aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/hqos/hqos.c
diff options
context:
space:
mode:
authorRui Cai <rucai@microsoft.com>2018-05-11 22:55:33 +0000
committerDamjan Marion <dmarion@me.com>2018-05-31 22:01:15 +0000
commita059a000f81a7251ffed2821f69dd96cfd94c8c7 (patch)
treed3674736007fbd45b61dc79de030ce5c53cf49a1 /src/plugins/dpdk/hqos/hqos.c
parentcb91e603bc82083fc762206edfe4530f993a6c36 (diff)
dpdk: Decoupling the meaning of xd->device_index in dpdk_plugin
Prior to the change, dpdk plugin assumes xd->device_index is used both as index for internal dpdk_main->devices array and DPDK port index to call into DPDK APIs. However, when running on top of Failsafe PMDs, DPDK port index range may no longer be contiguous (as noted: http://dpdk.org/ml/archives/dev/2018-March/092375.html for related changes in DPDK). Because this, dpdk plugin can no longer iterate through all available DPDK ports with a for 0->rte_eth_dev_count() loop and the assumption of device_index no longer holds. This is part of initial effort to enable vpp running over dpdk on failsafe PMD in Microsoft Azure(3/4). Change-Id: I416fd80f2d40e12e139f8f3492814da98343eae7 Signed-off-by: Rui Cai <rucai@microsoft.com>
Diffstat (limited to 'src/plugins/dpdk/hqos/hqos.c')
-rw-r--r--src/plugins/dpdk/hqos/hqos.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/dpdk/hqos/hqos.c b/src/plugins/dpdk/hqos/hqos.c
index 123ecbab0d3..04455c5d534 100644
--- a/src/plugins/dpdk/hqos/hqos.c
+++ b/src/plugins/dpdk/hqos/hqos.c
@@ -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;