summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2019-08-29 12:47:57 -0700
committerDamjan Marion <dmarion@me.com>2019-08-30 13:19:20 +0000
commit2985e0af6b48c7a5b57e442ead21b3620686b052 (patch)
treecc6a89526fdce244d70ce976360d482fbab7abad /src
parent90b34ed67a516c4391ad353ba431f8419b582d50 (diff)
vmxnet3: per interface gso support
gso option for vmxnet3 is per VPP process currently. There is no reason why we cannot provide per interface gso support. Type: feature Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ife962b52221191050dedd18252b859880ccd7599
Diffstat (limited to 'src')
-rw-r--r--src/plugins/vmxnet3/cli.c30
-rw-r--r--src/plugins/vmxnet3/input.c2
-rw-r--r--src/plugins/vmxnet3/output.c2
-rw-r--r--src/plugins/vmxnet3/vmxnet3.api4
-rw-r--r--src/plugins/vmxnet3/vmxnet3.c13
-rw-r--r--src/plugins/vmxnet3/vmxnet3.h4
-rw-r--r--src/plugins/vmxnet3/vmxnet3_api.c3
-rw-r--r--src/plugins/vmxnet3/vmxnet3_test.c5
8 files changed, 26 insertions, 37 deletions
diff --git a/src/plugins/vmxnet3/cli.c b/src/plugins/vmxnet3/cli.c
index e1d74e8464b..fd97c36aee2 100644
--- a/src/plugins/vmxnet3/cli.c
+++ b/src/plugins/vmxnet3/cli.c
@@ -43,6 +43,8 @@ vmxnet3_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
{
if (unformat (line_input, "%U", unformat_vlib_pci_addr, &args.addr))
;
+ else if (unformat (line_input, "gso"))
+ args.enable_gso = 1;
else if (unformat (line_input, "elog"))
args.enable_elog = 1;
else if (unformat (line_input, "bind"))
@@ -71,8 +73,9 @@ vmxnet3_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
VLIB_CLI_COMMAND (vmxnet3_create_command, static) = {
.path = "create interface vmxnet3",
.short_help = "create interface vmxnet3 <pci-address>"
- "[rx-queue-size <size>] [tx-queue-size <size>]"
- "[num-tx-queues <number>] [num-rx-queues <number>] [bind]",
+ " [rx-queue-size <size>] [tx-queue-size <size>]"
+ " [num-tx-queues <number>] [num-rx-queues <number>] [bind]"
+ " [gso]",
.function = vmxnet3_create_command_fn,
};
/* *INDENT-ON* */
@@ -210,7 +213,6 @@ show_vmxnet3 (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr,
if (!hw_if_indices)
return;
- vlib_cli_output (vm, "LRO/TSO configured: %u", vmxm->lro_configured);
for (i = 0; i < vec_len (hw_if_indices); i++)
{
hi = vnet_get_hw_interface (vnm, hw_if_indices[i]);
@@ -219,7 +221,7 @@ show_vmxnet3 (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr,
format_vnet_hw_if_index_name, vnm, hw_if_indices[i],
hw_if_indices[i]);
vlib_cli_output (vm, " Version: %u", vd->version);
- vlib_cli_output (vm, " LRO/TSO enable: %u", vd->lro_enable);
+ vlib_cli_output (vm, " GSO enable: %u", vd->gso_enable);
vlib_cli_output (vm, " PCI Address: %U", format_vlib_pci_addr,
&vd->pci_addr);
vlib_cli_output (vm, " Mac Address: %U", format_ethernet_address,
@@ -587,26 +589,6 @@ vmxnet3_cli_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (vmxnet3_cli_init);
-static clib_error_t *
-vmxnet3_config (vlib_main_t * vm, unformat_input_t * input)
-{
- vmxnet3_main_t *vmxm = &vmxnet3_main;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "lro"))
- vmxm->lro_configured = 1;
- else
- return clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
- }
-
- return 0;
-}
-
-/* vmxnet3 { ... } configuration. */
-VLIB_CONFIG_FUNCTION (vmxnet3_config, "vmxnet3");
-
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c
index 6d30f19116a..b1f28346de8 100644
--- a/src/plugins/vmxnet3/input.c
+++ b/src/plugins/vmxnet3/input.c
@@ -290,7 +290,7 @@ vmxnet3_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{
ASSERT (!(rxd->flags & VMXNET3_RXF_BTYPE));
/* start segment */
- if ((vd->lro_enable) &&
+ if (vd->gso_enable &&
(rx_comp->flags & VMXNET3_RXCF_CT) == VMXNET3_RXCOMP_TYPE_LRO)
{
vmxnet3_rx_comp_ext *lro = (vmxnet3_rx_comp_ext *) rx_comp;
diff --git a/src/plugins/vmxnet3/output.c b/src/plugins/vmxnet3/output.c
index 5de41cdba07..81a1afb190c 100644
--- a/src/plugins/vmxnet3/output.c
+++ b/src/plugins/vmxnet3/output.c
@@ -191,7 +191,7 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm,
* We should not be getting GSO outbound traffic unless it is
* lro is enable
*/
- ASSERT (vd->lro_enable == 1);
+ ASSERT (vd->gso_enable == 1);
gso_size = vnet_buffer2 (b0)->gso_size;
hdr_len = vnet_buffer (b0)->l4_hdr_offset +
sizeof (ethernet_header_t);
diff --git a/src/plugins/vmxnet3/vmxnet3.api b/src/plugins/vmxnet3/vmxnet3.api
index 8c3597bd6a0..191c2ccbd02 100644
--- a/src/plugins/vmxnet3/vmxnet3.api
+++ b/src/plugins/vmxnet3/vmxnet3.api
@@ -15,7 +15,7 @@
*------------------------------------------------------------------
*/
-option version = "1.0.0";
+option version = "1.0.1";
/** \brief
@param client_index - opaque cookie to identify the sender
@@ -30,6 +30,7 @@ option version = "1.0.0";
@param txq_num - number of transmit queues (optional - default is 1)
@param bind - automatically bind PCI to vfio-pci module
(optional - default is 0)
+ @param enable_gso - enable gso (optional - default is 0)
*/
define vmxnet3_create
@@ -44,6 +45,7 @@ define vmxnet3_create
u16 txq_size;
u16 txq_num;
u8 bind;
+ u8 enable_gso;
};
/** \brief
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c
index de1002381b6..bddf8b49006 100644
--- a/src/plugins/vmxnet3/vmxnet3.c
+++ b/src/plugins/vmxnet3/vmxnet3.c
@@ -220,7 +220,7 @@ vmxnet3_provision_driver_shared (vlib_main_t * vm, vmxnet3_device_t * vd)
shared->misc.guest_info |= VMXNET3_GOS_TYPE_LINUX;
shared->misc.version_support = VMXNET3_VERSION_SELECT;
shared->misc.upt_features = VMXNET3_F_RXCSUM;
- if (vd->lro_enable)
+ if (vd->gso_enable)
shared->misc.upt_features |= VMXNET3_F_LRO;
if (vd->num_rx_queues > 1)
{
@@ -406,7 +406,6 @@ vmxnet3_device_init (vlib_main_t * vm, vmxnet3_device_t * vd,
vmxnet3_create_if_args_t * args)
{
vnet_main_t *vnm = vnet_get_main ();
- vmxnet3_main_t *vmxm = &vmxnet3_main;
clib_error_t *error = 0;
u32 ret, i, size;
vlib_thread_main_t *tm = vlib_get_thread_main ();
@@ -453,10 +452,10 @@ vmxnet3_device_init (vlib_main_t * vm, vmxnet3_device_t * vd,
return error;
}
- /* LRO is only supported for version >= 3 */
- if ((vmxm->lro_configured) && (vd->version >= 3))
+ /* GSO is only supported for version >= 3 */
+ if (args->enable_gso && (vd->version >= 3))
{
- vd->lro_enable = 1;
+ vd->gso_enable = 1;
vnm->interface_main.gso_interface_count++;
}
@@ -798,7 +797,7 @@ vmxnet3_create_if (vlib_main_t * vm, vmxnet3_create_if_args_t * args)
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vd->hw_if_index);
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
- if (vd->lro_enable)
+ if (vd->gso_enable)
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
vnet_hw_interface_set_input_node (vnm, vd->hw_if_index,
@@ -919,7 +918,7 @@ vmxnet3_delete_if (vlib_main_t * vm, vmxnet3_device_t * vd)
clib_memset (vd, 0, sizeof (*vd));
pool_put (vmxm->devices, vd);
- if (vd->lro_enable)
+ if (vd->gso_enable)
vnm->interface_main.gso_interface_count--;
}
diff --git a/src/plugins/vmxnet3/vmxnet3.h b/src/plugins/vmxnet3/vmxnet3.h
index 65aa929ddcd..8790e0f136e 100644
--- a/src/plugins/vmxnet3/vmxnet3.h
+++ b/src/plugins/vmxnet3/vmxnet3.h
@@ -582,7 +582,7 @@ typedef struct
void *queues;
vmxnet3_rss_shared *rss;
u32 link_speed;
- u8 lro_enable;
+ u8 gso_enable;
vmxnet3_tx_stats *tx_stats;
vmxnet3_rx_stats *rx_stats;
} vmxnet3_device_t;
@@ -592,7 +592,6 @@ typedef struct
vmxnet3_device_t *devices;
u16 msg_id_base;
vlib_log_class_t log_default;
- u8 lro_configured;
} vmxnet3_main_t;
extern vmxnet3_main_t vmxnet3_main;
@@ -606,6 +605,7 @@ typedef struct
u16 txq_size;
u16 txq_num;
u8 bind;
+ u8 enable_gso;
/* return */
i32 rv;
u32 sw_if_index;
diff --git a/src/plugins/vmxnet3/vmxnet3_api.c b/src/plugins/vmxnet3/vmxnet3_api.c
index 731a5d0b25f..c7f60ee723f 100644
--- a/src/plugins/vmxnet3/vmxnet3_api.c
+++ b/src/plugins/vmxnet3/vmxnet3_api.c
@@ -78,6 +78,7 @@ vl_api_vmxnet3_create_t_handler (vl_api_vmxnet3_create_t * mp)
args.txq_num = ntohs (mp->txq_num);
args.rxq_num = ntohs (mp->rxq_num);
args.bind = mp->bind;
+ args.enable_gso = mp->enable_gso;
vmxnet3_create_if (vm, &args);
rv = args.rv;
@@ -102,6 +103,8 @@ vl_api_vmxnet3_create_t_print (vl_api_vmxnet3_create_t * mp, void *handle)
s = format (s, "elog ");
if (mp->bind)
s = format (s, "bind ");
+ if (mp->enable_gso)
+ s = format (s, "gso ");
if (mp->rxq_size)
s = format (s, "rx-queue-size %u ", ntohs (mp->rxq_size));
if (mp->txq_size)
diff --git a/src/plugins/vmxnet3/vmxnet3_test.c b/src/plugins/vmxnet3/vmxnet3_test.c
index 7a70f619a55..987026e3878 100644
--- a/src/plugins/vmxnet3/vmxnet3_test.c
+++ b/src/plugins/vmxnet3/vmxnet3_test.c
@@ -114,6 +114,8 @@ api_vmxnet3_create (vat_main_t * vam)
args.enable_elog = 1;
else if (unformat (i, "bind"))
args.bind = 1;
+ else if (unformat (i, "gso"))
+ args.enable_gso = 1;
else if (unformat (i, "rx-queue-size %u", &size))
args.rxq_size = size;
else if (unformat (i, "tx-queue-size %u", &size))
@@ -138,6 +140,7 @@ api_vmxnet3_create (vat_main_t * vam)
mp->txq_num = clib_host_to_net_u16 (args.txq_num);
mp->rxq_num = clib_host_to_net_u16 (args.rxq_num);
mp->bind = args.bind;
+ mp->enable_gso = args.enable_gso;
S (mp);
W (ret);
@@ -291,7 +294,7 @@ vl_api_vmxnet3_details_t_handler (vl_api_vmxnet3_details_t * mp)
#define foreach_vpe_api_msg \
_(vmxnet3_create, "<pci-address> [rx-queue-size <size>] " \
"[tx-queue-size <size>] [num-tx-queues <num>]" \
- "[num-rx-queues <num>] [bind]") \
+ "[num-rx-queues <num>] [bind] [gso]") \
_(vmxnet3_delete, "sw_if_index <sw_if_index>") \
_(vmxnet3_dump, "")