vmxnet3: add logging support to the control plane [VPP-1470]
[vpp.git] / src / plugins / vmxnet3 / output.c
index bcb0294..c80ad07 100644 (file)
@@ -143,15 +143,22 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm,
        }
       if (PREDICT_FALSE (space_left < space_needed))
        {
-         vlib_buffer_free_one (vm, bi0);
-         vlib_error_count (vm, node->node_index,
-                           VMXNET3_TX_ERROR_NO_FREE_SLOTS, 1);
-         buffers++;
-         n_left--;
-         /*
-          * Drop this packet. But we may have enough room for the next packet
-          */
-         continue;
+         vmxnet3_txq_release (vm, vd, txq);
+         space_left = vmxnet3_tx_ring_space_left (txq);
+
+         if (PREDICT_FALSE (space_left < space_needed))
+           {
+             vlib_buffer_free_one (vm, bi0);
+             vlib_error_count (vm, node->node_index,
+                               VMXNET3_TX_ERROR_NO_FREE_SLOTS, 1);
+             buffers++;
+             n_left--;
+             /*
+              * Drop this packet. But we may have enough room for the next
+              * packet
+              */
+             continue;
+           }
        }
 
       /*
@@ -171,9 +178,7 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm,
          txq->tx_ring.bufs[desc_idx] = bi0;
 
          txd = &txq->tx_desc[desc_idx];
-         txd->address =
-           vlib_get_buffer_data_physical_address (vm,
-                                                  bi0) + b0->current_data;
+         txd->address = vlib_buffer_get_current_pa (vm, b0);
 
          txd->flags[0] = generation | b0->current_length;
 
@@ -190,7 +195,8 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm,
        * Device can start reading the packet
        */
       txq->tx_desc[first_idx].flags[0] ^= VMXNET3_TXF_GEN;
-      vmxnet3_reg_write (vd, 0, VMXNET3_REG_TXPROD, txq->tx_ring.produce);
+      vmxnet3_reg_write_inline (vd, 0, VMXNET3_REG_TXPROD,
+                               txq->tx_ring.produce);
 
       buffers++;
       n_left--;