[dpdk-dev] [PATCH v5 5/5] net/iavf: fix max mtu size packets with vlan tag cannot be received by default
SteveX Yang
stevex.yang at intel.com
Wed Oct 14 11:19:45 CEST 2020
when application presets the max rx packet length and expected mtu at
the same time, driver need identify if the preset max frame size can
hold mtu data and Ether overhead completely.
if not, adjust the max frame size via mtu_set ops within dev_configure.
Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings")
Signed-off-by: SteveX Yang <stevex.yang at intel.com>
---
drivers/net/iavf/iavf_ethdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 93e26c768..8b1cf8f1c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -291,6 +291,8 @@ iavf_dev_configure(struct rte_eth_dev *dev)
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+ uint32_t frame_size = dev->data->mtu + IAVF_ETH_OVERHEAD;
+ int ret;
ad->rx_bulk_alloc_allowed = true;
/* Initialize to TRUE. If any of Rx queues doesn't meet the
@@ -302,6 +304,16 @@ iavf_dev_configure(struct rte_eth_dev *dev)
if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+ /**
+ * Reset the max frame size via mtu_set ops if preset max frame
+ * cannot hold MTU data and Ether overhead.
+ */
+ if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+ ret = iavf_dev_mtu_set(dev, dev->data->mtu);
+ if (ret != 0)
+ return ret;
+ }
+
/* Vlan stripping setting */
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) {
if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
--
2.17.1
More information about the dev
mailing list