aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Kinsella <mdr@ashroe.eu>2021-05-04 10:07:26 +0100
committerDamjan Marion <dmarion@me.com>2021-05-04 13:57:48 +0000
commit78b0a6e3f6e8644ebd06273f53b2440748ba34f4 (patch)
tree7d8557f0030b94bf1eb9bf35d362570e4cee607e
parent7d64631e516ba6c3fd0be12deda00862c1edd69a (diff)
dpdk: allow configuration of max-simd-bitwidth
Enable configuration of DPDK's max-simd-bitwidth through the startup.conf Type: improvement Change-Id: I455148714ffc7caa257931526f310dbefd7ab01c Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
-rw-r--r--src/plugins/dpdk/device/dpdk.h5
-rw-r--r--src/plugins/dpdk/device/init.c31
-rw-r--r--src/vpp/conf/startup.conf3
3 files changed, 37 insertions, 2 deletions
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index 5d326983df1..d860a0cbeb8 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -303,6 +303,11 @@ typedef struct
u8 enable_tcp_udp_checksum;
u8 no_tx_checksum_offload;
u8 enable_telemetry;
+ u16 max_simd_bitwidth;
+
+#define DPDK_MAX_SIMD_BITWIDTH_DEFAULT 0
+#define DPDK_MAX_SIMD_BITWIDTH_256 256
+#define DPDK_MAX_SIMD_BITWIDTH_512 512
/* Required config parameters */
u8 coremask_set_manually;
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index cf32687289a..7f57c6ada84 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1136,6 +1136,25 @@ dpdk_bind_vmbus_devices_to_uio (dpdk_config_main_t * conf)
/* *INDENT-ON* */
}
+uword
+unformat_max_simd_bitwidth (unformat_input_t *input, va_list *va)
+{
+ uword *max_simd_bitwidth = va_arg (*va, uword *);
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (!unformat (input, "%u", max_simd_bitwidth))
+ goto error;
+
+ if (*max_simd_bitwidth != DPDK_MAX_SIMD_BITWIDTH_256 &&
+ *max_simd_bitwidth != DPDK_MAX_SIMD_BITWIDTH_512)
+ goto error;
+ }
+ return 1;
+error:
+ return 0;
+}
+
static clib_error_t *
dpdk_device_config (dpdk_config_main_t *conf, void *addr,
dpdk_device_addr_type_t addr_type, unformat_input_t *input,
@@ -1347,7 +1366,9 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
else if (unformat (input, "no-multi-seg"))
conf->no_multi_seg = 1;
-
+ else if (unformat (input, "max-simd-bitwidth %U",
+ unformat_max_simd_bitwidth, &conf->max_simd_bitwidth))
+ ;
else if (unformat (input, "dev default %U", unformat_vlib_cli_sub_input,
&sub_input))
{
@@ -1691,8 +1712,14 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
(char **) conf->eal_init_args);
/* enable the AVX-512 vPMDs in DPDK */
- if (clib_cpu_supports_avx512_bitalg ())
+ if (clib_cpu_supports_avx512_bitalg () &&
+ conf->max_simd_bitwidth == DPDK_MAX_SIMD_BITWIDTH_DEFAULT)
rte_vect_set_max_simd_bitwidth (RTE_VECT_SIMD_512);
+ else if (conf->max_simd_bitwidth != DPDK_MAX_SIMD_BITWIDTH_DEFAULT)
+ rte_vect_set_max_simd_bitwidth (conf->max_simd_bitwidth ==
+ DPDK_MAX_SIMD_BITWIDTH_256 ?
+ RTE_VECT_SIMD_256 :
+ RTE_VECT_SIMD_512);
/* lazy umount hugepages */
umount2 ((char *) huge_dir_path, MNT_DETACH);
diff --git a/src/vpp/conf/startup.conf b/src/vpp/conf/startup.conf
index 270160217a0..d96a4307231 100644
--- a/src/vpp/conf/startup.conf
+++ b/src/vpp/conf/startup.conf
@@ -179,6 +179,9 @@ cpu {
## Enable UDP / TCP TX checksum offload
## This is the reversed option of 'no-tx-checksum-offload'
# enable-tcp-udp-checksum
+
+ ## Enable/Disable AVX-512 vPMDs
+ # max-simd-bitwidth <256|512>
# }
## node variant defaults