On 21/10/2019 03:44, Xiao Zhang wrote: > Vlan packets with ip length bigger then 1496 will not be received by > i40e/i40evf due to wrong packets size checking. This patch fixes the issue > by correcting the maximum frame size during checking. > > Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration") > Cc: sta...@dpdk.org > > Signed-off-by: Xiao Zhang <xiao.zh...@intel.com> > --- > v2 > add fix for i40evf and correct the checking when using the max_pkt_len. > --- > drivers/net/i40e/i40e_ethdev.c | 2 +- > drivers/net/i40e/i40e_ethdev_vf.c | 8 +++++--- > drivers/net/i40e/i40e_rxtx.c | 6 ++++-- > 3 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 2ca14da..156d67b 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -12103,7 +12103,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t > mtu) > return -EBUSY; > } > > - if (frame_size > RTE_ETHER_MAX_LEN) > + if (frame_size > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2) > dev_data->dev_conf.rxmode.offloads |= > DEV_RX_OFFLOAD_JUMBO_FRAME; > else > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index 5dba092..bc825e2 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -1782,12 +1782,14 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct > i40e_rx_queue *rxq) > }
Size check in jumbo on case needs to be updated also > } else { > if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || > - rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { > + rxq->max_pkt_len > RTE_ETHER_MAX_LEN + > + I40E_VLAN_TAG_SIZE * 2) { > PMD_DRV_LOG(ERR, "maximum packet length must be " > "larger than %u and smaller than %u, as jumbo " > "frame is disabled", > (uint32_t)RTE_ETHER_MIN_LEN, > - (uint32_t)RTE_ETHER_MAX_LEN); > + (uint32_t)RTE_ETHER_MAX_LEN + > + I40E_VLAN_TAG_SIZE * 2); > return I40E_ERR_CONFIG; > } > } > @@ -2747,7 +2749,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t > mtu) > return -EBUSY; > } > > - if (frame_size > RTE_ETHER_MAX_LEN) > + if (frame_size > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2) > dev_data->dev_conf.rxmode.offloads |= > DEV_RX_OFFLOAD_JUMBO_FRAME; > else > diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c > index ff6eb4a..0c178e3 100644 > --- a/drivers/net/i40e/i40e_rxtx.c > +++ b/drivers/net/i40e/i40e_rxtx.c > @@ -2634,12 +2634,14 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) > } Size check in jumbo on case needs to be updated also > } else { > if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || > - rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { > + rxq->max_pkt_len > RTE_ETHER_MAX_LEN + > + I40E_VLAN_TAG_SIZE * 2) { > PMD_DRV_LOG(ERR, "maximum packet length must be " > "larger than %u and smaller than %u, " > "as jumbo frame is disabled", > (uint32_t)RTE_ETHER_MIN_LEN, > - (uint32_t)RTE_ETHER_MAX_LEN); > + (uint32_t)RTE_ETHER_MAX_LEN + > + I40E_VLAN_TAG_SIZE * 2); > return I40E_ERR_CONFIG; > } > } > Doing quick search for RTE_ETHER_MAX_LEN, - in i40e_fdir_rx_queue_init(), is 'rx_ctx.rxmax = RTE_ETHER_MAX_LEN;' still correct now? - Looking at rte_eth_dev_configure() https://git.dpdk.org/dpdk/tree/lib/librte_ethdev/rte_ethdev.c#n1242 Does it mean an MTU not allowed without jumbo frames during configuration is allowed later with mtu_set? Request is to review related code and see if there are any impacts with this change. @Beilei Xing @Qi Zhang, this patch needs careful review by i40e maintainer. thanks, Kevin.