Hello all

I'm new to VPP so please bear with my ignorance in its
architecture/internals/development process :).

I'd like to ask for some change regarding DPDK plugin - to be specific
to differentiate between "device index" (in device table) and "device
id" (the DPDK port ID).  More information about the change is below and
the proposed patch is in the attachment (since I'm not aware yet of the
process to proposed them - if there is any).

The background for the change is as follows: I've developed a logical
PMD for DPDK that is meant to split different type of traffic (read some
"tag") to different "logical" ports while under the hood for actual
transmission a "physical" port is used.  The driver on the RX side takes
care of the finding the correct "logical" port for given tag, stripping
it and passing to the port and on TX side its job is to insert the tag
and pass it to the "physical" port for transmission.  It works with
test-pmd and l2fwd DPDK applications but our customer wishes to use it
also with VPP and here I needed to make some changes which I'd like to
upstream now.

>From the above description you can see that for N logical ports there
are N+1 (at least) actual DPDK ports used.  So the situation is a bit
like "reversed bonding driver" - in bonding PMD the are many "physical"
ports that are grouped to form one "logical" link, and in my case this
is reversed.

I've decided to make use of the new DPDK API "rte_eth_dev_owner_new/set"
(introduced by commit 5b7ba31148a8b and still marked as "experimental")
because this makes much easier for other applications (like VPP) to not
depend on the internals of given PMD - for example I did not have to
touch testpmd and l2fwd apps from DPDK to make them work since they were
already using/compatible with the new API.

This however requires some changes in VPP to make it work.  Previously
you simply assumed that DPDK port IDs start with 0 and assumed 1 to 1
correspondence between index in internal table with DPDK port id.  With
the use of some "internal/owned" DPDK ports this is no longer true so
what I am proposing is to add 'device_id' to 'dpdk_device_t' and make
use of it when passing to RTE functions and use 'RTE_ETH_FOREACH_DEV'
macro instead of plain 'for' loops starting with 0.

The patch in the attachment is what I have used for our customer.  Note
however that this was my first contact with VPP so there might be
something wrong with it or I might have missed some other places that
also need an update.  Also note that since the "ownership" API in DPDK
is still marked as experimental then you'll need to add
"-Wno-deprecated-declarations" to your compilation flags in platform
files (I'm using a separate one so don't have patch for you).

Let me know what you think.

Best regards
Andrzej
>From 0da5ba713a257f166ba4d8f111fa76ce757f4563 Mon Sep 17 00:00:00 2001
From: Andrzej Ostruszka <a...@semihalf.com>
Date: Fri, 6 Jul 2018 12:37:12 +0200
Subject: [PATCH] plugins: dpdk: do not use internal index for port id

Some DPDK ports can be used internally and not available to the user
application so one can not assume that index of internal structure is
DPDK port id.
---
 src/plugins/dpdk/device/cli.c       |  8 ++++----
 src/plugins/dpdk/device/common.c    | 30 +++++++++++++++---------------
 src/plugins/dpdk/device/device.c    | 16 ++++++++--------
 src/plugins/dpdk/device/dpdk.h      |  3 ++-
 src/plugins/dpdk/device/dpdk_priv.h |  6 +++---
 src/plugins/dpdk/device/format.c    | 22 +++++++++++-----------
 src/plugins/dpdk/device/init.c      | 22 +++++++++++-----------
 src/plugins/dpdk/device/node.c      |  2 +-
 src/plugins/dpdk/hqos/hqos.c        | 10 +++++-----
 10 files changed, 66 insertions(+), 65 deletions(-)

diff --git a/src/plugins/dpdk/device/cli.c b/src/plugins/dpdk/device/cli.c
index c9fcea5..0cdb344 100644
--- a/src/plugins/dpdk/device/cli.c
+++ b/src/plugins/dpdk/device/cli.c
@@ -60,7 +60,7 @@ get_hqos (u32 hw_if_index, u32 subport_id, dpdk_device_t ** xd,
   hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
   *xd = vec_elt_at_index (dm->devices, hw->dev_instance);
 
-  rte_eth_dev_info_get ((*xd)->device_index, &dev_info);
+  rte_eth_dev_info_get ((*xd)->device_id, &dev_info);
   if (dev_info.pci_dev)
     {				/* bonded interface has no pci info */
       vlib_pci_addr_t pci_addr;
@@ -1159,7 +1159,7 @@ set_dpdk_if_hqos_pktfield (vlib_main_t * vm, unformat_input_t * input,
   hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
   xd = vec_elt_at_index (dm->devices, hw->dev_instance);
 
-  rte_eth_dev_info_get (xd->device_index, &dev_info);
+  rte_eth_dev_info_get (xd->device_id, &dev_info);
   if (dev_info.pci_dev)
     {				/* bonded interface has no pci info */
       vlib_pci_addr_t pci_addr;
@@ -1350,7 +1350,7 @@ show_dpdk_if_hqos (vlib_main_t * vm, unformat_input_t * input,
   hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
   xd = vec_elt_at_index (dm->devices, hw->dev_instance);
 
-  rte_eth_dev_info_get (xd->device_index, &dev_info);
+  rte_eth_dev_info_get (xd->device_id, &dev_info);
   if (dev_info.pci_dev)
     {				/* bonded interface has no pci info */
       vlib_pci_addr_t pci_addr;
@@ -1760,7 +1760,7 @@ show_dpdk_hqos_queue_stats (vlib_main_t * vm, unformat_input_t * input,
   hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
   xd = vec_elt_at_index (dm->devices, hw->dev_instance);
 
-  rte_eth_dev_info_get (xd->device_index, &dev_info);
+  rte_eth_dev_info_get (xd->device_id, &dev_info);
   if (dev_info.pci_dev)
     {				/* bonded interface has no pci info */
       vlib_pci_addr_t pci_addr;
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index e8f33cf..82072e5 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -56,7 +56,7 @@ dpdk_device_setup (dpdk_device_t * xd)
       dpdk_device_stop (xd);
     }
 
-  rv = rte_eth_dev_configure (xd->device_index, xd->rx_q_used,
+  rv = rte_eth_dev_configure (xd->device_id, xd->rx_q_used,
 			      xd->tx_q_used, &xd->port_conf);
 
   if (rv < 0)
@@ -68,12 +68,12 @@ dpdk_device_setup (dpdk_device_t * xd)
   /* Set up one TX-queue per worker thread */
   for (j = 0; j < xd->tx_q_used; j++)
     {
-      rv = rte_eth_tx_queue_setup (xd->device_index, j, xd->nb_tx_desc,
+      rv = rte_eth_tx_queue_setup (xd->device_id, j, xd->nb_tx_desc,
 				   xd->cpu_socket, &xd->tx_conf);
 
       /* retry with any other CPU socket */
       if (rv < 0)
-	rv = rte_eth_tx_queue_setup (xd->device_index, j, xd->nb_tx_desc,
+	rv = rte_eth_tx_queue_setup (xd->device_id, j, xd->nb_tx_desc,
 				     SOCKET_ID_ANY, &xd->tx_conf);
       if (rv < 0)
 	dpdk_device_error (xd, "rte_eth_tx_queue_setup", rv);
@@ -89,13 +89,13 @@ dpdk_device_setup (dpdk_device_t * xd)
       unsigned lcore = vlib_worker_threads[tidx].lcore_id;
       u16 socket_id = rte_lcore_to_socket_id (lcore);
 
-      rv = rte_eth_rx_queue_setup (xd->device_index, j, xd->nb_rx_desc,
+      rv = rte_eth_rx_queue_setup (xd->device_id, j, xd->nb_rx_desc,
 				   xd->cpu_socket, 0,
 				   dm->pktmbuf_pools[socket_id]);
 
       /* retry with any other CPU socket */
       if (rv < 0)
-	rv = rte_eth_rx_queue_setup (xd->device_index, j, xd->nb_rx_desc,
+	rv = rte_eth_rx_queue_setup (xd->device_id, j, xd->nb_rx_desc,
 				     SOCKET_ID_ANY, 0,
 				     dm->pktmbuf_pools[socket_id]);
 
@@ -109,7 +109,7 @@ dpdk_device_setup (dpdk_device_t * xd)
   if (vec_len (xd->errors))
     goto error;
 
-  rte_eth_dev_set_mtu (xd->device_index, hi->max_packet_bytes);
+  rte_eth_dev_set_mtu (xd->device_id, hi->max_packet_bytes);
 
   if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
     dpdk_device_start (xd);
@@ -132,7 +132,7 @@ dpdk_device_start (dpdk_device_t * xd)
   if (xd->flags & DPDK_DEVICE_FLAG_PMD_INIT_FAIL)
     return;
 
-  rv = rte_eth_dev_start (xd->device_index);
+  rv = rte_eth_dev_start (xd->device_id);
 
   if (rv)
     {
@@ -142,7 +142,7 @@ dpdk_device_start (dpdk_device_t * xd)
 
   if (xd->default_mac_address)
     rv =
-      rte_eth_dev_default_mac_addr_set (xd->device_index,
+      rte_eth_dev_default_mac_addr_set (xd->device_id,
 					(struct ether_addr *)
 					xd->default_mac_address);
 
@@ -150,16 +150,16 @@ dpdk_device_start (dpdk_device_t * xd)
     dpdk_device_error (xd, "rte_eth_dev_default_mac_addr_set", rv);
 
   if (xd->flags & DPDK_DEVICE_FLAG_PROMISC)
-    rte_eth_promiscuous_enable (xd->device_index);
+    rte_eth_promiscuous_enable (xd->device_id);
   else
-    rte_eth_promiscuous_disable (xd->device_index);
+    rte_eth_promiscuous_disable (xd->device_id);
 
-  rte_eth_allmulticast_enable (xd->device_index);
+  rte_eth_allmulticast_enable (xd->device_id);
 
   if (xd->pmd == VNET_DPDK_PMD_BOND)
     {
       dpdk_portid_t slink[16];
-      int nlink = rte_eth_bond_slaves_get (xd->device_index, slink, 16);
+      int nlink = rte_eth_bond_slaves_get (xd->device_id, slink, 16);
       while (nlink >= 1)
 	{
 	  dpdk_portid_t dpdk_port = slink[--nlink];
@@ -174,14 +174,14 @@ dpdk_device_stop (dpdk_device_t * xd)
   if (xd->flags & DPDK_DEVICE_FLAG_PMD_INIT_FAIL)
     return;
 
-  rte_eth_allmulticast_disable (xd->device_index);
-  rte_eth_dev_stop (xd->device_index);
+  rte_eth_allmulticast_disable (xd->device_id);
+  rte_eth_dev_stop (xd->device_id);
 
   /* For bonded interface, stop slave links */
   if (xd->pmd == VNET_DPDK_PMD_BOND)
     {
       dpdk_portid_t slink[16];
-      int nlink = rte_eth_bond_slaves_get (xd->device_index, slink, 16);
+      int nlink = rte_eth_bond_slaves_get (xd->device_id, slink, 16);
       while (nlink >= 1)
 	{
 	  dpdk_portid_t dpdk_port = slink[--nlink];
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index c20a01b..f18c740 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -52,7 +52,7 @@ dpdk_set_mac_address (vnet_hw_interface_t * hi, char *address)
   dpdk_main_t *dm = &dpdk_main;
   dpdk_device_t *xd = vec_elt_at_index (dm->devices, hi->dev_instance);
 
-  error = rte_eth_dev_default_mac_addr_set (xd->device_index,
+  error = rte_eth_dev_default_mac_addr_set (xd->device_id,
 					    (struct ether_addr *) address);
 
   if (error)
@@ -262,7 +262,7 @@ static_always_inline
       else if (PREDICT_TRUE (xd->flags & DPDK_DEVICE_FLAG_PMD))
 	{
 	  /* no wrap, transmit in one burst */
-	  rv = rte_eth_tx_burst (xd->device_index,
+	  rv = rte_eth_tx_burst (xd->device_id,
 				 (uint16_t) queue_id,
 				 &tx_vector[tx_tail],
 				 (uint16_t) (tx_head - tx_tail));
@@ -287,7 +287,7 @@ static_always_inline
 					 xd->hw_if_index)->tx_node_index;
 
 	  vlib_error_count (vm, node_index, DPDK_TX_FUNC_ERROR_BAD_RETVAL, 1);
-	  clib_warning ("rte_eth_tx_burst[%d]: error %d", xd->device_index,
+	  clib_warning ("rte_eth_tx_burst[%d]: error %d", xd->device_id,
 			rv);
 	  return n_packets;	// untransmitted packets
 	}
@@ -748,25 +748,25 @@ dpdk_subif_add_del_function (vnet_main_t * vnm,
       goto done;
     }
 
-  vlan_offload = rte_eth_dev_get_vlan_offload (xd->device_index);
+  vlan_offload = rte_eth_dev_get_vlan_offload (xd->device_id);
   vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
 
-  if ((r = rte_eth_dev_set_vlan_offload (xd->device_index, vlan_offload)))
+  if ((r = rte_eth_dev_set_vlan_offload (xd->device_id, vlan_offload)))
     {
       xd->num_subifs = prev_subifs;
       err = clib_error_return (0, "rte_eth_dev_set_vlan_offload[%d]: err %d",
-			       xd->device_index, r);
+			       xd->device_id, r);
       goto done;
     }
 
 
   if ((r =
-       rte_eth_dev_vlan_filter (xd->device_index, t->sub.eth.outer_vlan_id,
+       rte_eth_dev_vlan_filter (xd->device_id, t->sub.eth.outer_vlan_id,
 				is_add)))
     {
       xd->num_subifs = prev_subifs;
       err = clib_error_return (0, "rte_eth_dev_vlan_filter[%d]: err %d",
-			       xd->device_index, r);
+			       xd->device_id, r);
       goto done;
     }
 
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index bf53c6c..321b1be 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -162,7 +162,8 @@ typedef struct
   volatile u32 **lockp;
 
   /* Instance ID */
-  dpdk_portid_t device_index;
+  u16           device_index;
+  dpdk_portid_t device_id;
 
   u32 hw_if_index;
   u32 vlib_sw_if_index;
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index 7c4091c..d60eab0 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -65,13 +65,13 @@ dpdk_get_xstats (dpdk_device_t * xd)
   if (!(xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP))
     return;
   int len;
-  if ((len = rte_eth_xstats_get (xd->device_index, NULL, 0)) > 0)
+  if ((len = rte_eth_xstats_get (xd->device_id, NULL, 0)) > 0)
     {
       vec_validate (xd->xstats, len - 1);
       vec_validate (xd->last_cleared_xstats, len - 1);
 
       len =
-	rte_eth_xstats_get (xd->device_index, xd->xstats,
+	rte_eth_xstats_get (xd->device_id, xd->xstats,
 			    vec_len (xd->xstats));
 
       ASSERT (vec_len (xd->xstats) == len);
@@ -98,7 +98,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
 
   xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
   clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
-  rte_eth_stats_get (xd->device_index, &xd->stats);
+  rte_eth_stats_get (xd->device_id, &xd->stats);
 
   /* maybe bump interface rx no buffer counter */
   if (PREDICT_FALSE (xd->stats.rx_nombuf != xd->last_stats.rx_nombuf))
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 62abe95..5c06b92 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -224,7 +224,7 @@ format_dpdk_device_name (u8 * s, va_list * args)
       break;
 
     case VNET_DPDK_PORT_TYPE_AF_PACKET:
-      rte_eth_dev_info_get (i, &dev_info);
+      rte_eth_dev_info_get (dm->devices[i].device_id, &dev_info);
       return format (s, "af_packet%d", dm->devices[i].port_id);
 
     case VNET_DPDK_PORT_TYPE_VIRTIO_USER:
@@ -241,7 +241,7 @@ format_dpdk_device_name (u8 * s, va_list * args)
       break;
     }
 
-  rte_eth_dev_info_get (i, &dev_info);
+  rte_eth_dev_info_get (dm->devices[i].device_id, &dev_info);
 
   if (dev_info.pci_dev)
     ret = format (s, devname_format, device_name, dev_info.pci_dev->addr.bus,
@@ -380,7 +380,7 @@ format_dpdk_link_status (u8 * s, va_list * args)
   s = format (s, "%s ", l->link_status ? "up" : "down");
   if (l->link_status)
     {
-      u32 promisc = rte_eth_promiscuous_get (xd->device_index);
+      u32 promisc = rte_eth_promiscuous_get (xd->device_id);
 
       s = format (s, "%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
 		  "full" : "half");
@@ -473,10 +473,10 @@ format_dpdk_device (u8 * s, va_list * args)
   dpdk_update_link_state (xd, now);
 
   s = format (s, "%U\n%Ucarrier %U",
-	      format_dpdk_device_type, xd->device_index,
+	      format_dpdk_device_type, dev_instance,
 	      format_white_space, indent + 2, format_dpdk_link_status, xd);
 
-  rte_eth_dev_info_get (xd->device_index, &di);
+  rte_eth_dev_info_get (xd->device_id, &di);
 
   if (verbose > 1 && xd->flags & DPDK_DEVICE_FLAG_PMD)
     {
@@ -486,7 +486,7 @@ format_dpdk_device (u8 * s, va_list * args)
       int retval;
 
       rss_conf.rss_key = 0;
-      retval = rte_eth_dev_rss_hash_conf_get (xd->device_index, &rss_conf);
+      retval = rte_eth_dev_rss_hash_conf_get (xd->device_id, &rss_conf);
       if (retval < 0)
 	clib_warning ("rte_eth_dev_rss_hash_conf_get returned %d", retval);
       pci = di.pci_dev;
@@ -510,9 +510,9 @@ format_dpdk_device (u8 * s, va_list * args)
       s =
 	format (s, "%Upromiscuous:       unicast %s all-multicast %s\n",
 		format_white_space, indent + 2,
-		rte_eth_promiscuous_get (xd->device_index) ? "on" : "off",
-		rte_eth_allmulticast_get (xd->device_index) ? "on" : "off");
-      vlan_off = rte_eth_dev_get_vlan_offload (xd->device_index);
+		rte_eth_promiscuous_get (xd->device_id) ? "on" : "off",
+		rte_eth_allmulticast_get (xd->device_id) ? "on" : "off");
+      vlan_off = rte_eth_dev_get_vlan_offload (xd->device_id);
       s = format (s, "%Uvlan offload:      strip %s filter %s qinq %s\n",
 		  format_white_space, indent + 2,
 		  vlan_off & ETH_VLAN_STRIP_OFFLOAD ? "on" : "off",
@@ -558,9 +558,9 @@ format_dpdk_device (u8 * s, va_list * args)
   u32 i = 0;
   struct rte_eth_xstat *xstat, *last_xstat;
   struct rte_eth_xstat_name *xstat_names = 0;
-  int len = rte_eth_xstats_get_names (xd->device_index, NULL, 0);
+  int len = rte_eth_xstats_get_names (xd->device_id, NULL, 0);
   vec_validate (xstat_names, len - 1);
-  rte_eth_xstats_get_names (xd->device_index, xstat_names, len);
+  rte_eth_xstats_get_names (xd->device_id, xstat_names, len);
 
   ASSERT (vec_len (xd->xstats) == vec_len (xd->last_cleared_xstats));
 
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 0bb8f8b..a578ec9 100755
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -104,9 +104,9 @@ dpdk_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags)
       if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
 	{
 	  if (xd->flags & DPDK_DEVICE_FLAG_PROMISC)
-	    rte_eth_promiscuous_enable (xd->device_index);
+	    rte_eth_promiscuous_enable (xd->device_id);
 	  else
-	    rte_eth_promiscuous_disable (xd->device_index);
+	    rte_eth_promiscuous_disable (xd->device_id);
 	}
     }
   else if (ETHERNET_INTERFACE_FLAG_CONFIG_MTU (flags))
@@ -273,7 +273,7 @@ dpdk_lib_init (dpdk_main_t * dm)
       vnet_buffer (bt)->sw_if_index[VLIB_TX] = (u32) ~ 0;
     }
 
-  for (i = 0; i < nports; i++)
+  RTE_ETH_FOREACH_DEV(i)
     {
       u8 addr[6];
       u8 vlan_strip = 0;
@@ -516,7 +516,7 @@ dpdk_lib_init (dpdk_main_t * dm)
 	dpdk_device_lock_init (xd);
 
       xd->device_index = xd - dm->devices;
-      ASSERT (i == xd->device_index);
+      xd->device_id = i;
       xd->per_interface_next_index = ~0;
 
       /* assign interface to input thread */
@@ -710,10 +710,10 @@ dpdk_lib_init (dpdk_main_t * dm)
       if (vlan_strip)
 	{
 	  int vlan_off;
-	  vlan_off = rte_eth_dev_get_vlan_offload (xd->device_index);
+	  vlan_off = rte_eth_dev_get_vlan_offload (xd->device_id);
 	  vlan_off |= ETH_VLAN_STRIP_OFFLOAD;
 	  xd->port_conf.rxmode.hw_vlan_strip = vlan_off;
-	  if (rte_eth_dev_set_vlan_offload (xd->device_index, vlan_off) == 0)
+	  if (rte_eth_dev_set_vlan_offload (xd->device_id, vlan_off) == 0)
 	    clib_warning ("VLAN strip enabled for interface\n");
 	  else
 	    clib_warning ("VLAN strip cannot be supported by interface\n");
@@ -722,7 +722,7 @@ dpdk_lib_init (dpdk_main_t * dm)
       hi->max_l3_packet_bytes[VLIB_RX] = hi->max_l3_packet_bytes[VLIB_TX] =
 	xd->port_conf.rxmode.max_rx_pkt_len - sizeof (ethernet_header_t);
 
-      rte_eth_dev_set_mtu (xd->device_index, mtu);
+      rte_eth_dev_set_mtu (xd->device_id, mtu);
     }
 
   if (nb_desc > dm->conf->num_mbufs)
@@ -1355,7 +1355,7 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
 
   xd->time_last_link_update = now ? now : xd->time_last_link_update;
   memset (&xd->link, 0, sizeof (xd->link));
-  rte_eth_link_get_nowait (xd->device_index, &xd->link);
+  rte_eth_link_get_nowait (xd->device_id, &xd->link);
 
   if (LINK_STATE_ELOGS)
     {
@@ -1521,7 +1521,7 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
 	      {
 		u8 addr[6];
 		dpdk_portid_t slink[16];
-		int nlink = rte_eth_bond_slaves_get (i, slink, 16);
+		int nlink = rte_eth_bond_slaves_get (xd->device_id, slink, 16);
 		if (nlink > 0)
 		  {
 		    vnet_hw_interface_t *bhi;
@@ -1534,9 +1534,9 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
 
 		    /* Set MAC of bounded interface to that of 1st slave link */
 		    clib_warning ("Set MAC for bond port %d BondEthernet%d",
-				  i, xd->port_id);
+				  xd->device_id, xd->port_id);
 		    rv = rte_eth_bond_mac_address_set
-		      (i, (struct ether_addr *) addr);
+		      (xd->device_id, (struct ether_addr *) addr);
 		    if (rv)
 		      clib_warning ("Set MAC addr failure rv=%d", rv);
 
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index 7edcc36..6fd97d3 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -100,7 +100,7 @@ dpdk_rx_burst (dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id)
     {
       while (n_left)
 	{
-	  n_this_chunk = rte_eth_rx_burst (xd->device_index, queue_id,
+	  n_this_chunk = rte_eth_rx_burst (xd->device_id, queue_id,
 					   xd->rx_vectors[queue_id] +
 					   n_buffers, n_left);
 	  n_buffers += n_this_chunk;
diff --git a/src/plugins/dpdk/hqos/hqos.c b/src/plugins/dpdk/hqos/hqos.c
index c9b8565..522417e 100644
--- a/src/plugins/dpdk/hqos/hqos.c
+++ b/src/plugins/dpdk/hqos/hqos.c
@@ -301,7 +301,7 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
   if (hqos->port.name == NULL)
     return clib_error_return (0, "HQoS%u: strdup err", xd->device_index);
 
-  hqos->port.socket = rte_eth_dev_socket_id (xd->device_index);
+  hqos->port.socket = rte_eth_dev_socket_id (xd->device_id);
   if (hqos->port.socket == SOCKET_ID_ANY)
     hqos->port.socket = 0;
 
@@ -411,7 +411,7 @@ dpdk_hqos_thread_internal_hqos_dbg_bypass (vlib_main_t * vm)
       dpdk_device_t *xd = vec_elt_at_index (dm->devices, dq->device);
 
       dpdk_device_hqos_per_hqos_thread_t *hqos = xd->hqos_ht;
-      u32 device_index = xd->device_index;
+      u32 device_id = xd->device_id;
       u16 queue_id = dq->queue_id;
 
       struct rte_mbuf **pkts_enq = hqos->pkts_enq;
@@ -440,7 +440,7 @@ dpdk_hqos_thread_internal_hqos_dbg_bypass (vlib_main_t * vm)
 	  /* HWQ TX enqueue when burst available */
 	  if (pkts_enq_len >= hqos->hqos_burst_enq)
 	    {
-	      u32 n_pkts = rte_eth_tx_burst (device_index,
+	      u32 n_pkts = rte_eth_tx_burst (device_id,
 					     (uint16_t) queue_id,
 					     pkts_enq,
 					     (uint16_t) pkts_enq_len);
@@ -498,7 +498,7 @@ dpdk_hqos_thread_internal (vlib_main_t * vm)
       dpdk_device_t *xd = vec_elt_at_index (dm->devices, dq->device);
 
       dpdk_device_hqos_per_hqos_thread_t *hqos = xd->hqos_ht;
-      u32 device_index = xd->device_index;
+      u32 device_id = xd->device_id;
       u16 queue_id = dq->queue_id;
 
       struct rte_mbuf **pkts_enq = hqos->pkts_enq;
@@ -563,7 +563,7 @@ dpdk_hqos_thread_internal (vlib_main_t * vm)
 					       hqos->hqos_burst_deq);
 
 	for (n_pkts = 0; n_pkts < pkts_deq_len;)
-	  n_pkts += rte_eth_tx_burst (device_index,
+	  n_pkts += rte_eth_tx_burst (device_id,
 				      (uint16_t) queue_id,
 				      &pkts_deq[n_pkts],
 				      (uint16_t) (pkts_deq_len - n_pkts));
-- 
2.7.4

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10193): https://lists.fd.io/g/vpp-dev/message/10193
Mute This Topic: https://lists.fd.io/mt/24610614/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to