Numa-aware, growable physical memory allocator (pmalloc)
[vpp.git] / src / plugins / vmxnet3 / vmxnet3.h
index 1379940..befbe36 100644 (file)
@@ -18,6 +18,7 @@
 
 #define foreach_vmxnet3_tx_func_error         \
   _(ERROR_PACKETS, "error packets") \
+  _(LINK_DOWN, "link down") \
   _(NO_FREE_SLOTS, "no free tx slots")
 
 typedef enum
@@ -42,6 +43,20 @@ enum
 #undef _
 };
 
+#define foreach_vmxnet3_show_entry \
+  _(RX_COMP, "rx comp") \
+  _(RX_DESC0, "rx desc 0") \
+  _(RX_DESC1, "rx desc 1") \
+  _(TX_COMP, "tx comp") \
+  _(TX_DESC, "tx desc")
+
+enum
+{
+#define _(a, b) VMXNET3_SHOW_##a,
+  foreach_vmxnet3_show_entry
+#undef _
+};
+
 /* BAR 0 */
 #define VMXNET3_REG_IMR     0x0000     /* Interrupt Mask Register */
 #define VMXNET3_REG_TXPROD  0x0600     /* Tx Producer Index */
@@ -66,6 +81,8 @@ enum
 
 #define VMXNET3_RXF_BTYPE (1 << 14)    /* rx body buffer type */
 #define VMXNET3_RXF_GEN   (1 << 31)    /* rx generation */
+#define VMXNET3_RXCF_IP6  (1 << 20)    /* rx ip6 packet */
+#define VMXNET3_RXCF_IP4  (1 << 21)    /* rx ip4 packet */
 #define VMXNET3_RXCF_GEN  (1 << 31)    /* rx completion generation */
 #define VMXNET3_RXC_INDEX (0xFFF)      /* rx completion index mask */
 
@@ -393,8 +410,8 @@ typedef struct
 typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
-  u64 next;
   u32 gen;
+  u16 next;
 } vmxnet3_rx_comp_ring;
 
 typedef struct
@@ -420,8 +437,8 @@ typedef struct
 typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
-  u64 next;
   u32 gen;
+  u16 next;
 } vmxnet3_tx_comp_ring;
 
 typedef struct
@@ -470,13 +487,12 @@ typedef struct
 
   vmxnet3_dma *dma;
 
+  u32 link_speed;
 } vmxnet3_device_t;
 
 typedef struct
 {
   vmxnet3_device_t *devices;
-  vlib_physmem_region_index_t physmem_region;
-  u32 physmem_region_alloc;
   u16 msg_id_base;
 } vmxnet3_main_t;
 
@@ -528,10 +544,8 @@ vmxnet3_reg_read (vmxnet3_device_t * vd, u8 bar, u32 addr)
 static_always_inline uword
 vmxnet3_dma_addr (vlib_main_t * vm, vmxnet3_device_t * vd, void *p)
 {
-  vmxnet3_main_t *vmxm = &vmxnet3_main;
-
   return (vd->flags & VMXNET3_DEVICE_F_IOVA) ? pointer_to_uword (p) :
-    vlib_physmem_virtual_to_physical (vm, vmxm->physmem_region, p);
+    vlib_physmem_get_pa (vm, p);
 }
 
 static_always_inline void
@@ -572,9 +586,9 @@ vmxnet3_rxq_refill_ring0 (vlib_main_t * vm, vmxnet3_device_t * vd,
 
   while (n_alloc)
     {
+      vlib_buffer_t *b = vlib_get_buffer (vm, ring->bufs[ring->produce]);
       rxd = &rxq->rx_desc[0][ring->produce];
-      rxd->address =
-       vlib_get_buffer_data_physical_address (vm, ring->bufs[ring->produce]);
+      rxd->address = vlib_buffer_get_pa (vm, b);
       rxd->flags = ring->gen | VLIB_BUFFER_DATA_SIZE;
 
       vmxnet3_rx_ring_advance_produce (rxq, ring);
@@ -614,9 +628,9 @@ vmxnet3_rxq_refill_ring1 (vlib_main_t * vm, vmxnet3_device_t * vd,
 
   while (n_alloc)
     {
+      vlib_buffer_t *b = vlib_get_buffer (vm, ring->bufs[ring->produce]);
       rxd = &rxq->rx_desc[1][ring->produce];
-      rxd->address =
-       vlib_get_buffer_data_physical_address (vm, ring->bufs[ring->produce]);
+      rxd->address = vlib_buffer_get_pa (vm, b);
       rxd->flags = ring->gen | VLIB_BUFFER_DATA_SIZE | VMXNET3_RXF_BTYPE;
 
       vmxnet3_rx_ring_advance_produce (rxq, ring);