summaryrefslogtreecommitdiffstats
path: root/src/plugins/dev_iavf
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-12-04 12:15:23 +0000
committerDamjan Marion <damarion@cisco.com>2023-12-04 12:27:19 +0000
commitc6ae4999d2ddd0b700248aa0a3ea8facded1d359 (patch)
tree7f35b6ef213440166ee773dcf2f62326ca7fd55b /src/plugins/dev_iavf
parent39e79fdf30c653ee814b79c914b46ebe9db40a8f (diff)
iavf: workaround for case when PF driver sends zero for max_mtu
Type: improvement Change-Id: Ie4b2b958a24cdde8c183b700d864fc6f5b0df08f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dev_iavf')
-rw-r--r--src/plugins/dev_iavf/iavf.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/dev_iavf/iavf.c b/src/plugins/dev_iavf/iavf.c
index 3bf11201a3e..5603f61f45f 100644
--- a/src/plugins/dev_iavf/iavf.c
+++ b/src/plugins/dev_iavf/iavf.c
@@ -121,6 +121,7 @@ iavf_init (vlib_main_t *vm, vnet_dev_t *dev)
virtchnl_version_info_t ver;
virtchnl_vf_resource_t res;
u32 n_threads = vlib_get_n_threads ();
+ u16 max_frame_sz;
vnet_dev_rv_t rv;
log_debug (dev, "init");
@@ -147,6 +148,17 @@ iavf_init (vlib_main_t *vm, vnet_dev_t *dev)
if (res.num_vsis != 1 || res.vsi_res[0].vsi_type != VIRTCHNL_VSI_SRIOV)
return VNET_DEV_ERR_UNSUPPORTED_DEVICE;
+ if (res.max_mtu == 0)
+ {
+ log_warn (dev, "PF driver is reporting invalid value of 0 for max_mtu, "
+ "consider upgrade");
+ max_frame_sz = ETHERNET_MAX_PACKET_BYTES;
+ }
+ else
+ /* reverse of PF driver MTU calculation */
+ max_frame_sz = res.max_mtu + 14 /* ethernet header */ + 4 /* FCS */ +
+ 2 * 4 /* two VLAN tags */;
+
iavf_port_t iavf_port = {
.vf_cap_flags = res.vf_cap_flags,
.rss_key_size = res.rss_key_size,
@@ -162,7 +174,7 @@ iavf_init (vlib_main_t *vm, vnet_dev_t *dev)
.type = VNET_DEV_PORT_TYPE_ETHERNET,
.max_rx_queues = clib_min (IAVF_MAX_QPAIRS, res.num_queue_pairs),
.max_tx_queues = clib_min (IAVF_MAX_QPAIRS, res.num_queue_pairs),
- .max_supported_rx_frame_size = res.max_mtu,
+ .max_supported_rx_frame_size = max_frame_sz,
.caps.change_max_rx_frame_size = 1,
},
.ops = {