aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-12-04 19:58:12 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-12-05 18:17:07 +0000
commit3a699b28bbc6f33fd7e8e504ee1cff64c164881a (patch)
treedc457de9d091203c28ee982ae7813848890172f2
parentb96412d8f0904e2bd2dd39c27b3984b0354dab4e (diff)
dpdk:remove duplicate code
unify code from both branches Change-Id: Iae7325cff8c799c7827727ad7465bec089e39f50 Signed-off-by: Eyal Bari <ebari@cisco.com>
-rwxr-xr-xsrc/plugins/dpdk/device/init.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 314a2e9ba70..55904f018da 100755
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -522,34 +522,26 @@ dpdk_lib_init (dpdk_main_t * dm)
xd->per_interface_next_index = ~0;
/* assign interface to input thread */
- dpdk_device_and_queue_t *dq;
int q;
if (devconf->hqos_enabled)
{
xd->flags |= DPDK_DEVICE_FLAG_HQOS;
+ int cpu;
if (devconf->hqos.hqos_thread_valid)
{
- int cpu = dm->hqos_cpu_first_index + devconf->hqos.hqos_thread;
-
if (devconf->hqos.hqos_thread >= dm->hqos_cpu_count)
return clib_error_return (0, "invalid HQoS thread index");
- vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
- dq->device = xd->device_index;
- dq->queue_id = 0;
+ cpu = dm->hqos_cpu_first_index + devconf->hqos.hqos_thread;
}
else
{
- int cpu = dm->hqos_cpu_first_index + next_hqos_cpu;
-
if (dm->hqos_cpu_count == 0)
return clib_error_return (0, "no HQoS threads available");
- vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
- dq->device = xd->device_index;
- dq->queue_id = 0;
+ cpu = dm->hqos_cpu_first_index + next_hqos_cpu;
next_hqos_cpu++;
if (next_hqos_cpu == dm->hqos_cpu_count)
@@ -558,6 +550,11 @@ dpdk_lib_init (dpdk_main_t * dm)
devconf->hqos.hqos_thread_valid = 1;
devconf->hqos.hqos_thread = cpu;
}
+
+ dpdk_device_and_queue_t *dq;
+ vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
+ dq->device = xd->device_index;
+ dq->queue_id = 0;
}
vec_validate_aligned (xd->tx_vectors, tm->n_vlib_mains,