aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/init.c
diff options
context:
space:
mode:
authorChenmin Sun <chenmin.sun@intel.com>2019-07-17 22:29:44 +0800
committerDamjan Marion <dmarion@me.com>2019-08-19 09:41:08 +0000
commitde5ed58fdb72536ed928e12990a08104e1f89f51 (patch)
treee3eca3ec5afb52b613896cb2f1c52a89417230e2 /src/plugins/dpdk/device/init.c
parent4d843b9940a8fbcd0b54c8a66916b9ba66e4f2c9 (diff)
dpdk: add TSO support in dpdk plugin.
Type: feature You can enable tso in starup.conf like this: dev 0000:86:00.0{ tso on } TSO is disabled by default. Change-Id: Ifdbaf5322f768c384aa54e532d7bf45e810ca01c Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
Diffstat (limited to 'src/plugins/dpdk/device/init.c')
-rw-r--r--src/plugins/dpdk/device/init.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 4b4bed4ee07..e5a796bdf9c 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -207,6 +207,7 @@ dpdk_lib_init (dpdk_main_t * dm)
int i;
clib_error_t *error;
vlib_main_t *vm = vlib_get_main ();
+ vnet_main_t *vnm = vnet_get_main ();
vlib_thread_main_t *tm = vlib_get_thread_main ();
vnet_device_main_t *vdm = &vnet_device_main;
vnet_sw_interface_t *sw;
@@ -739,6 +740,23 @@ dpdk_lib_init (dpdk_main_t * dm)
if (xd->flags & DPDK_DEVICE_FLAG_TX_OFFLOAD && hi != NULL)
hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+ if (devconf->tso == DPDK_DEVICE_TSO_ON)
+ {
+ if (xd->flags & DPDK_DEVICE_FLAG_TX_OFFLOAD && hi != NULL)
+ {
+ /*tcp_udp checksum must be enabled*/
+ if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD)
+ {
+ hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
+ vnm->interface_main.gso_interface_count++;
+ xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_TSO |
+ DEV_TX_OFFLOAD_UDP_TSO;
+ }
+ else
+ return clib_error_return (0, "TSO: TCP/UDP checksum offload must be enabled");
+ }
+ }
+
dpdk_device_setup (xd);
if (vec_len (xd->errors))
@@ -1024,6 +1042,7 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
devconf->pci_addr.as_u32 = pci_addr.as_u32;
devconf->hqos_enabled = 0;
+ devconf->tso = DPDK_DEVICE_TSO_DEFAULT;
#if 0
dpdk_device_config_hqos_default (&devconf->hqos);
#endif
@@ -1072,6 +1091,14 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
{
devconf->hqos_enabled = 1;
}
+ else if (unformat (input, "tso on"))
+ {
+ devconf->tso = DPDK_DEVICE_TSO_ON;
+ }
+ else if (unformat (input, "tso off"))
+ {
+ devconf->tso = DPDK_DEVICE_TSO_OFF;
+ }
else
{
error = clib_error_return (0, "unknown input `%U'",
@@ -1378,6 +1405,9 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
devconf->vlan_strip_offload =
conf->default_devconf.vlan_strip_offload;
+ /* copy tso config from default device */
+ _(tso)
+
/* add DPDK EAL whitelist/blacklist entry */
if (num_whitelisted > 0 && devconf->is_blacklisted == 0)
{