X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fdpdk%2Fhqos%2Fhqos.c;h=1a8dd6d98fe93bffab7ce4983cc34b54bf13cf84;hb=b7b929931a07fbb27b43d5cd105f366c3e29807e;hp=2f2504d6e1dc90486b02fa9af31beadd9c1ab6d8;hpb=6a5be214b95f3ec9f30eab46aa1a21a62a7bbc85;p=vpp.git diff --git a/src/plugins/dpdk/hqos/hqos.c b/src/plugins/dpdk/hqos/hqos.c index 2f2504d6e1d..1a8dd6d98fe 100644 --- a/src/plugins/dpdk/hqos/hqos.c +++ b/src/plugins/dpdk/hqos/hqos.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include /* enumerate all vlib messages */ @@ -169,8 +168,8 @@ int dpdk_hqos_validate_mask (u64 mask, u32 n) { int count = __builtin_popcountll (mask); - int pos_lead = sizeof (u64) * 8 - __builtin_clzll (mask); - int pos_trail = __builtin_ctzll (mask); + int pos_lead = sizeof (u64) * 8 - count_leading_zeros (mask); + int pos_trail = count_trailing_zeros (mask); int count_expected = __builtin_popcount (n - 1); /* Handle the exceptions */ @@ -269,10 +268,10 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos) /* Allocate the per-thread device data array */ vec_validate_aligned (xd->hqos_wt, tm->n_vlib_mains - 1, CLIB_CACHE_LINE_BYTES); - memset (xd->hqos_wt, 0, tm->n_vlib_mains * sizeof (xd->hqos_wt[0])); + clib_memset (xd->hqos_wt, 0, tm->n_vlib_mains * sizeof (xd->hqos_wt[0])); vec_validate_aligned (xd->hqos_ht, 0, CLIB_CACHE_LINE_BYTES); - memset (xd->hqos_ht, 0, sizeof (xd->hqos_ht[0])); + clib_memset (xd->hqos_ht, 0, sizeof (xd->hqos_ht[0])); /* Allocate space for one SWQ per worker thread in the I/O TX thread data structure */ vec_validate (xd->hqos_ht->swq, worker_thread_count); @@ -283,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); } /* @@ -297,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; @@ -323,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++) @@ -337,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); } } @@ -364,15 +362,15 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos) xd->hqos_wt[tid].hqos_field0_slabpos = hqos->pktfield0_slabpos; xd->hqos_wt[tid].hqos_field0_slabmask = hqos->pktfield0_slabmask; xd->hqos_wt[tid].hqos_field0_slabshr = - __builtin_ctzll (hqos->pktfield0_slabmask); + count_trailing_zeros (hqos->pktfield0_slabmask); xd->hqos_wt[tid].hqos_field1_slabpos = hqos->pktfield1_slabpos; xd->hqos_wt[tid].hqos_field1_slabmask = hqos->pktfield1_slabmask; xd->hqos_wt[tid].hqos_field1_slabshr = - __builtin_ctzll (hqos->pktfield1_slabmask); + count_trailing_zeros (hqos->pktfield1_slabmask); xd->hqos_wt[tid].hqos_field2_slabpos = hqos->pktfield2_slabpos; xd->hqos_wt[tid].hqos_field2_slabmask = hqos->pktfield2_slabmask; xd->hqos_wt[tid].hqos_field2_slabshr = - __builtin_ctzll (hqos->pktfield2_slabmask); + count_trailing_zeros (hqos->pktfield2_slabmask); memcpy (xd->hqos_wt[tid].hqos_tc_table, hqos->tc_table, sizeof (hqos->tc_table)); } @@ -412,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; @@ -430,11 +428,7 @@ dpdk_hqos_thread_internal_hqos_dbg_bypass (vlib_main_t * vm) pkts_enq_len += rte_ring_sc_dequeue_burst (swq, (void **) &pkts_enq[pkts_enq_len], -#if RTE_VERSION >= RTE_VERSION_NUM(17, 5, 0, 0) hqos->hqos_burst_enq, 0); -#else - hqos->hqos_burst_enq); -#endif /* Get next SWQ for this device */ swq_pos++; @@ -503,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; @@ -525,11 +519,7 @@ dpdk_hqos_thread_internal (vlib_main_t * vm) pkts_enq_len += rte_ring_sc_dequeue_burst (swq, (void **) &pkts_enq[pkts_enq_len], -#if RTE_VERSION >= RTE_VERSION_NUM(17, 5, 0, 0) hqos->hqos_burst_enq, 0); -#else - hqos->hqos_burst_enq); -#endif /* Get next SWQ for this device */ swq_pos++;