dpdk: Decoupling the meaning of xd->device_index in dpdk_plugin
[vpp.git] / src / plugins / dpdk / hqos / hqos.c
index 123ecba..04455c5 100644 (file)
@@ -282,13 +282,13 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
       u32 swq_flags = RING_F_SP_ENQ | RING_F_SC_DEQ;
 
       snprintf (name, sizeof (name), "SWQ-worker%u-to-device%u", i,
-               xd->device_index);
+               xd->port_id);
       xd->hqos_ht->swq[i] =
        rte_ring_create (name, hqos->swq_size, xd->cpu_socket, swq_flags);
       if (xd->hqos_ht->swq[i] == NULL)
        return clib_error_return (0,
                                  "SWQ-worker%u-to-device%u: rte_ring_create err",
-                                 i, xd->device_index);
+                                 i, xd->port_id);
     }
 
   /*
@@ -296,19 +296,19 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
    */
 
   /* HQoS port */
-  snprintf (name, sizeof (name), "HQoS%u", xd->device_index);
+  snprintf (name, sizeof (name), "HQoS%u", xd->port_id);
   hqos->port.name = strdup (name);
   if (hqos->port.name == NULL)
-    return clib_error_return (0, "HQoS%u: strdup err", xd->device_index);
+    return clib_error_return (0, "HQoS%u: strdup err", xd->port_id);
 
-  hqos->port.socket = rte_eth_dev_socket_id (xd->device_index);
+  hqos->port.socket = rte_eth_dev_socket_id (xd->port_id);
   if (hqos->port.socket == SOCKET_ID_ANY)
     hqos->port.socket = 0;
 
   xd->hqos_ht->hqos = rte_sched_port_config (&hqos->port);
   if (xd->hqos_ht->hqos == NULL)
     return clib_error_return (0, "HQoS%u: rte_sched_port_config err",
-                             xd->device_index);
+                             xd->port_id);
 
   /* HQoS subport */
   for (subport_id = 0; subport_id < hqos->port.n_subports_per_port;
@@ -322,7 +322,7 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
       if (rv)
        return clib_error_return (0,
                                  "HQoS%u subport %u: rte_sched_subport_config err (%d)",
-                                 xd->device_index, subport_id, rv);
+                                 xd->port_id, subport_id, rv);
 
       /* HQoS pipe */
       for (pipe_id = 0; pipe_id < hqos->port.n_pipes_per_subport; pipe_id++)
@@ -336,8 +336,7 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
          if (rv)
            return clib_error_return (0,
                                      "HQoS%u subport %u pipe %u: rte_sched_pipe_config err (%d)",
-                                     xd->device_index, subport_id, pipe_id,
-                                     rv);
+                                     xd->port_id, subport_id, pipe_id, rv);
        }
     }
 
@@ -411,7 +410,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_index = xd->port_id;
       u16 queue_id = dq->queue_id;
 
       struct rte_mbuf **pkts_enq = hqos->pkts_enq;
@@ -498,7 +497,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_index = xd->port_id;
       u16 queue_id = dq->queue_id;
 
       struct rte_mbuf **pkts_enq = hqos->pkts_enq;