DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured
@ 2020-09-16  5:52 SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
                   ` (5 more replies)
  0 siblings, 6 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-16  5:52 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

configure the correct default max packet size in dev_config ops.

SteveX Yang (5):
  net/e1000: fix max mtu size packets with vlan tag cannot be received
    by default
  net/igc: fix max mtu size packets with vlan tag cannot be received by
    default
  net/ice: fix max mtu size packets with vlan tag cannot be received by
    default
  net/iavf: fix max mtu size packets with vlan tag cannot be received by
    default
  net/i40e: fix max mtu size packets with vlan tag cannot be received by
    default

 drivers/net/e1000/em_ethdev.c     | 11 +++++++++++
 drivers/net/i40e/i40e_ethdev.c    | 10 ++++++++++
 drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++++++
 drivers/net/iavf/iavf_ethdev.c    | 13 +++++++++++--
 drivers/net/ice/ice_ethdev.c      | 14 ++++++++++++--
 drivers/net/igc/igc_ethdev.c      | 10 ++++++++++
 6 files changed, 65 insertions(+), 4 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v1 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
@ 2020-09-16  5:52 ` SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 2/5] net/igc: " SteveX Yang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-16  5:52 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

e1000 can support single vlan tags that need more 4 bytes for max packet
size, so, configures the correct max packet size in dev_config ops.

Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/em_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 902b1cdca..68ff892be 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -437,10 +437,21 @@ eth_em_configure(struct rte_eth_dev *dev)
 {
 	struct e1000_interrupt *intr =
 		E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 
 	PMD_INIT_FUNC_TRACE();
 	intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
 
+	/**
+	 * Considering vlan tag packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + E1000_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
+
 	PMD_INIT_FUNC_TRACE();
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v1 2/5] net/igc: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
@ 2020-09-16  5:52 ` " SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 3/5] net/ice: " SteveX Yang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-16  5:52 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

igc can support single vlan tag that need more 4 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/igc/igc_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 6ab3ee909..6113793a2 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -341,10 +341,20 @@ static int
 eth_igc_configure(struct rte_eth_dev *dev)
 {
 	struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
+	/* Considering vlan tag packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + IGC_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
+
 	ret  = igc_check_mq_mode(dev);
 	if (ret != 0)
 		return ret;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v1 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 2/5] net/igc: " SteveX Yang
@ 2020-09-16  5:52 ` " SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 4/5] net/iavf: " SteveX Yang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-16  5:52 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

ice can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 4170a5446..f5bf05bb8 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3129,6 +3129,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	struct ice_adapter *ad =
 		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 	int ret;
 
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the
@@ -3137,8 +3138,17 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	ad->rx_bulk_alloc_allowed = true;
 	ad->tx_simple_allowed = true;
 
-	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
-		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+	if (rxmode->mq_mode & ETH_MQ_RX_RSS_FLAG)
+		rxmode->offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + ICE_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
 
 	ret = ice_init_rss(pf);
 	if (ret) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v1 4/5] net/iavf: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
                   ` (2 preceding siblings ...)
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 3/5] net/ice: " SteveX Yang
@ 2020-09-16  5:52 ` " SteveX Yang
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 5/5] net/i40e: " SteveX Yang
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-16  5:52 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

iavf can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 8fe81409c..ca4c52a52 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -217,7 +217,7 @@ iavf_dev_configure(struct rte_eth_dev *dev)
 	struct iavf_adapter *ad =
 		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;
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 
 	ad->rx_bulk_alloc_allowed = true;
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the
@@ -229,9 +229,18 @@ 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;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + IAVF_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
+
 	/* Vlan stripping setting */
 	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) {
-		if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
+		if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
 			iavf_enable_vlan_strip(ad);
 		else
 			iavf_disable_vlan_strip(ad);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v1 5/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
                   ` (3 preceding siblings ...)
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 4/5] net/iavf: " SteveX Yang
@ 2020-09-16  5:52 ` " SteveX Yang
  2020-09-16 14:41   ` Ananyev, Konstantin
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
  5 siblings, 1 reply; 31+ messages in thread
From: SteveX Yang @ 2020-09-16  5:52 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side. But for i40e/i40evf,
they should support dual vlan tags that need more 8 bytes for max packet
size, so, configure the correct max packet size in dev_config ops.

Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    | 10 ++++++++++
 drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 841447228..787ff61c0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1917,6 +1917,7 @@ i40e_dev_configure(struct rte_eth_dev *dev)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode;
 	int i, ret;
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 
 	ret = i40e_dev_sync_phy_type(hw);
 	if (ret)
@@ -1930,6 +1931,15 @@ i40e_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 	ad->tx_vec_allowed = true;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + I40E_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
+
 	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index b755350cd..7410563db 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1669,6 +1669,7 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
 		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	uint16_t num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
 				dev->data->nb_tx_queues);
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
 	 * allocation or vector Rx preconditions we will reset it.
@@ -1681,6 +1682,16 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
 	dev->data->dev_conf.intr_conf.lsc =
 		!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC);
 
+
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + I40E_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
+
 	if (num_queue_pairs > vf->vsi_res->num_queue_pairs) {
 		struct i40e_hw *hw;
 		int ret;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [dpdk-dev] [PATCH v1 5/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 5/5] net/i40e: " SteveX Yang
@ 2020-09-16 14:41   ` Ananyev, Konstantin
       [not found]     ` <DM6PR11MB4362E5FF332551D12AA20017F93E0@DM6PR11MB4362.namprd11.prod.outlook.com>
  0 siblings, 1 reply; 31+ messages in thread
From: Ananyev, Konstantin @ 2020-09-16 14:41 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Zhao1, Wei, Guo, Jia, Yang,  Qiming, Zhang, Qi Z, Wu, Jingjing,
	Xing, Beilei, Yang, SteveX

> testpmd will initialize default max packet length to 1518 which does't
> include vlan tag size in ether overheader. Once, send the max mtu length
> packet with vlan tag, the max packet length will exceed 1518 that will
> cause packets dropped directly from NIC hw side. But for i40e/i40evf,
> they should support dual vlan tags that need more 8 bytes for max packet
> size, so, configure the correct max packet size in dev_config ops.
> 
> Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c    | 10 ++++++++++
>  drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 841447228..787ff61c0 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -1917,6 +1917,7 @@ i40e_dev_configure(struct rte_eth_dev *dev)
>  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode;
>  	int i, ret;
> +	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> 
>  	ret = i40e_dev_sync_phy_type(hw);
>  	if (ret)
> @@ -1930,6 +1931,15 @@ i40e_dev_configure(struct rte_eth_dev *dev)
>  	ad->tx_simple_allowed = true;
>  	ad->tx_vec_allowed = true;
> 
> +	/* Considering QinQ packet, max frame size should be MTU and
> +	 * corresponding ether overhead.
> +	 */
> +	if (dev->data->mtu == RTE_ETHER_MTU &&
> +		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {

Wonder why that particular max_rx_pkt_len and mtu values are important?
Shouldn't we always do here same calculations as we do in i40e_dev_mtu_set()?


> +		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + I40E_ETH_OVERHEAD;
> +		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> +	}
> +
>  	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
>  		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index b755350cd..7410563db 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1669,6 +1669,7 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
>  		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>  	uint16_t num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
>  				dev->data->nb_tx_queues);
> +	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> 
>  	/* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
>  	 * allocation or vector Rx preconditions we will reset it.
> @@ -1681,6 +1682,16 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
>  	dev->data->dev_conf.intr_conf.lsc =
>  		!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC);
> 
> +
> +	/* Considering QinQ packet, max frame size should be MTU and
> +	 * corresponding ether overhead.
> +	 */
> +	if (dev->data->mtu == RTE_ETHER_MTU &&
> +		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
> +		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + I40E_ETH_OVERHEAD;
> +		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> +	}
> +
>  	if (num_queue_pairs > vf->vsi_res->num_queue_pairs) {
>  		struct i40e_hw *hw;
>  		int ret;
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [dpdk-dev] [PATCH v1 5/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
       [not found]     ` <DM6PR11MB4362E5FF332551D12AA20017F93E0@DM6PR11MB4362.namprd11.prod.outlook.com>
@ 2020-09-17 12:18       ` Ananyev, Konstantin
  0 siblings, 0 replies; 31+ messages in thread
From: Ananyev, Konstantin @ 2020-09-17 12:18 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Zhao1, Wei, Guo, Jia, Yang,  Qiming, Zhang, Qi Z, Wu, Jingjing,
	Xing, Beilei


> > Subject: RE: [dpdk-dev] [PATCH v1 5/5] net/i40e: fix max mtu size packets
> > with vlan tag cannot be received by default
> >
> > > testpmd will initialize default max packet length to 1518 which does't
> > > include vlan tag size in ether overheader. Once, send the max mtu
> > > length packet with vlan tag, the max packet length will exceed 1518
> > > that will cause packets dropped directly from NIC hw side. But for
> > > i40e/i40evf, they should support dual vlan tags that need more 8 bytes
> > > for max packet size, so, configure the correct max packet size in dev_config
> > ops.
> > >
> > > Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU")
> > >
> > > Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> > > ---
> > >  drivers/net/i40e/i40e_ethdev.c    | 10 ++++++++++
> > >  drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++++++
> > >  2 files changed, 21 insertions(+)
> > >
> > > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > > b/drivers/net/i40e/i40e_ethdev.c index 841447228..787ff61c0 100644
> > > --- a/drivers/net/i40e/i40e_ethdev.c
> > > +++ b/drivers/net/i40e/i40e_ethdev.c
> > > @@ -1917,6 +1917,7 @@ i40e_dev_configure(struct rte_eth_dev *dev)
> > >  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
> > >dev_private);
> > >  	enum rte_eth_rx_mq_mode mq_mode = dev->data-
> > >dev_conf.rxmode.mq_mode;
> > >  	int i, ret;
> > > +	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> > >
> > >  	ret = i40e_dev_sync_phy_type(hw);
> > >  	if (ret)
> > > @@ -1930,6 +1931,15 @@ i40e_dev_configure(struct rte_eth_dev *dev)
> > >  	ad->tx_simple_allowed = true;
> > >  	ad->tx_vec_allowed = true;
> > >
> > > +	/* Considering QinQ packet, max frame size should be MTU and
> > > +	 * corresponding ether overhead.
> > > +	 */
> > > +	if (dev->data->mtu == RTE_ETHER_MTU &&
> > > +		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
> >
> > Wonder why that particular max_rx_pkt_len and mtu values are important?
> > Shouldn't we always do here same calculations as we do in
> > i40e_dev_mtu_set()?
> 
> The combination of RTE_ETHER_MTU (1500) & RTE_ETHER_MAX_LEN (1518) is
> the generical default value from test-pmd or other apps. the RTE_ETHER_MAX_LEN
> doesn't include VLAN tag(s) size, hence, only need adjust frame size to hold real mtu
> size packet for the particular condition.

Ok, but user can overwrite default values in dev_configure.
What would happen if user would set rxmode.max_rx_pkt_len to RTE_ETHER_MAX_LEN + 1
or RTE_ETHER_MAX_LEN - 1?

> 
> >
> >
> > > +		rxmode->max_rx_pkt_len = RTE_ETHER_MTU +
> > I40E_ETH_OVERHEAD;
> > > +		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> > > +	}
> > > +
> > >  	if (dev->data->dev_conf.rxmode.mq_mode &
> > ETH_MQ_RX_RSS_FLAG)
> > >  		dev->data->dev_conf.rxmode.offloads |=
> > DEV_RX_OFFLOAD_RSS_HASH;
> > >
> > > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> > > b/drivers/net/i40e/i40e_ethdev_vf.c
> > > index b755350cd..7410563db 100644
> > > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > > @@ -1669,6 +1669,7 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
> > >  		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > >  	uint16_t num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
> > >  				dev->data->nb_tx_queues);
> > > +	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> > >
> > >  	/* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
> > >  	 * allocation or vector Rx preconditions we will reset it.
> > > @@ -1681,6 +1682,16 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
> > >  	dev->data->dev_conf.intr_conf.lsc =
> > >  		!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC);
> > >
> > > +
> > > +	/* Considering QinQ packet, max frame size should be MTU and
> > > +	 * corresponding ether overhead.
> > > +	 */
> > > +	if (dev->data->mtu == RTE_ETHER_MTU &&
> > > +		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
> > > +		rxmode->max_rx_pkt_len = RTE_ETHER_MTU +
> > I40E_ETH_OVERHEAD;
> > > +		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> > > +	}
> > > +
> > >  	if (num_queue_pairs > vf->vsi_res->num_queue_pairs) {
> > >  		struct i40e_hw *hw;
> > >  		int ret;
> > > --
> > > 2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured
  2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
                   ` (4 preceding siblings ...)
  2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 5/5] net/i40e: " SteveX Yang
@ 2020-09-22  1:23 ` SteveX Yang
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
                     ` (5 more replies)
  5 siblings, 6 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-22  1:23 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

configure the correct default max packet size in dev_config ops.

v2:
 * change the max_rx_pkt_len via mtu_set ops;

SteveX Yang (5):
  net/e1000: fix max mtu size packets with vlan tag cannot be received
    by default
  net/igc: fix max mtu size packets with vlan tag cannot be received by
    default
  net/ice: fix max mtu size packets with vlan tag cannot be received by
    default
  net/i40e: fix max mtu size packets with vlan tag cannot be received by
    default
  net/iavf: fix max mtu size packets with vlan tag cannot be received by
    default

 drivers/net/e1000/em_ethdev.c     |  6 ++++++
 drivers/net/i40e/i40e_ethdev.c    |  5 +++++
 drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++++++
 drivers/net/iavf/iavf_ethdev.c    |  5 +++++
 drivers/net/ice/ice_ethdev.c      |  5 +++++
 drivers/net/igc/igc_ethdev.c      |  7 ++++++-
 6 files changed, 38 insertions(+), 1 deletion(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v2 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
@ 2020-09-22  1:23   ` SteveX Yang
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 2/5] net/igc: " SteveX Yang
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-22  1:23 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

e1000 can support single vlan tags that need more 4 bytes for max packet
size, so, configures the correct max packet size in dev_config ops.

Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/em_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 1dc360713..485a30625 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -441,6 +441,12 @@ eth_em_configure(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 	intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
 
+	/**
+	 * Considering vlan tag packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	eth_em_mtu_set(dev, dev->data->mtu);
+
 	PMD_INIT_FUNC_TRACE();
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v2 2/5] net/igc: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
@ 2020-09-22  1:23   ` " SteveX Yang
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 3/5] net/ice: " SteveX Yang
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-22  1:23 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

igc can support single vlan tag that need more 4 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/igc/igc_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 810568bc5..36ef325a4 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -341,7 +341,12 @@ eth_igc_configure(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	ret  = igc_check_mq_mode(dev);
+	/* Considering vlan tag packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	eth_igc_mtu_set(dev, dev->data->mtu);
+
+	ret = igc_check_mq_mode(dev);
 	if (ret != 0)
 		return ret;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v2 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 2/5] net/igc: " SteveX Yang
@ 2020-09-22  1:23   ` " SteveX Yang
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 4/5] net/i40e: " SteveX Yang
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-22  1:23 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

ice can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index cfd357b05..0ca6962b1 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3157,6 +3157,11 @@ ice_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;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	ice_mtu_set(dev, dev->data->mtu);
+
 	ret = ice_init_rss(pf);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v2 4/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
                     ` (2 preceding siblings ...)
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 3/5] net/ice: " SteveX Yang
@ 2020-09-22  1:23   ` " SteveX Yang
  2020-09-22 10:47     ` Ananyev, Konstantin
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 5/5] net/iavf: " SteveX Yang
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
  5 siblings, 1 reply; 31+ messages in thread
From: SteveX Yang @ 2020-09-22  1:23 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side. But for i40e/i40evf,
they should support dual vlan tags that need more 8 bytes for max packet
size, so, configure the correct max packet size in dev_config ops.

Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    |  5 +++++
 drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 563f21d9d..023c86d66 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1930,6 +1930,11 @@ i40e_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 	ad->tx_vec_allowed = true;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	i40e_dev_mtu_set(dev, dev->data->mtu);
+
 	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 8531cf6b1..b268b3d00 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1669,6 +1669,7 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
 		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	uint16_t num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
 				dev->data->nb_tx_queues);
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
 	 * allocation or vector Rx preconditions we will reset it.
@@ -1681,6 +1682,16 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
 	dev->data->dev_conf.intr_conf.lsc =
 		!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC);
 
+
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + I40E_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
+
 	if (num_queue_pairs > vf->vsi_res->num_queue_pairs) {
 		struct i40e_hw *hw;
 		int ret;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v2 5/5] net/iavf: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
                     ` (3 preceding siblings ...)
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 4/5] net/i40e: " SteveX Yang
@ 2020-09-22  1:23   ` " SteveX Yang
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-22  1:23 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

iavf can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 6bb915d81..47caaeda3 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -226,6 +226,11 @@ 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;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	iavf_dev_mtu_set(dev, dev->data->mtu);
+
 	/* 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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [dpdk-dev] [PATCH v2 4/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 4/5] net/i40e: " SteveX Yang
@ 2020-09-22 10:47     ` Ananyev, Konstantin
  0 siblings, 0 replies; 31+ messages in thread
From: Ananyev, Konstantin @ 2020-09-22 10:47 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Zhao1, Wei, Guo, Jia, Yang,  Qiming, Zhang, Qi Z, Wu, Jingjing,
	Xing, Beilei



> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Tuesday, September 22, 2020 2:24 AM
> To: dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v2 4/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
> 
> testpmd will initialize default max packet length to 1518 which doesn't
> include vlan tag size in ether overheader. Once, send the max mtu length
> packet with vlan tag, the max packet length will exceed 1518 that will
> cause packets dropped directly from NIC hw side. But for i40e/i40evf,
> they should support dual vlan tags that need more 8 bytes for max packet
> size, so, configure the correct max packet size in dev_config ops.
> 
> Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c    |  5 +++++
>  drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 563f21d9d..023c86d66 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -1930,6 +1930,11 @@ i40e_dev_configure(struct rte_eth_dev *dev)
>  	ad->tx_simple_allowed = true;
>  	ad->tx_vec_allowed = true;
> 
> +	/* Considering QinQ packet, max frame size should be MTU and
> +	 * corresponding ether overhead.
> +	 */
> +	i40e_dev_mtu_set(dev, dev->data->mtu);
> +
>  	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
>  		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index 8531cf6b1..b268b3d00 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1669,6 +1669,7 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
>  		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>  	uint16_t num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
>  				dev->data->nb_tx_queues);
> +	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> 
>  	/* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
>  	 * allocation or vector Rx preconditions we will reset it.
> @@ -1681,6 +1682,16 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
>  	dev->data->dev_conf.intr_conf.lsc =
>  		!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC);
> 
> +
> +	/* Considering QinQ packet, max frame size should be MTU and
> +	 * corresponding ether overhead.
> +	 */
> +	if (dev->data->mtu == RTE_ETHER_MTU &&
> +		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
> +		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + I40E_ETH_OVERHEAD;
> +		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> +	}

Wonder why vf code-path is different here?
Can't we also do mtu_set() here?

> +
>  	if (num_queue_pairs > vf->vsi_res->num_queue_pairs) {
>  		struct i40e_hw *hw;
>  		int ret;
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured
  2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
                     ` (4 preceding siblings ...)
  2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 5/5] net/iavf: " SteveX Yang
@ 2020-09-23  4:09   ` SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
                       ` (5 more replies)
  5 siblings, 6 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-23  4:09 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

configure the correct default max packet size in dev_config ops.

v3:
 * change the i40evf relative code;
v2:
 * change the max_rx_pkt_len via mtu_set ops;


SteveX Yang (5):
  net/e1000: fix max mtu size packets with vlan tag cannot be received
    by default
  net/igc: fix max mtu size packets with vlan tag cannot be received by
    default
  net/ice: fix max mtu size packets with vlan tag cannot be received by
    default
  net/i40e: fix max mtu size packets with vlan tag cannot be received by
    default
  net/iavf: fix max mtu size packets with vlan tag cannot be received by
    default

 drivers/net/e1000/em_ethdev.c     | 6 ++++++
 drivers/net/i40e/i40e_ethdev.c    | 5 +++++
 drivers/net/i40e/i40e_ethdev_vf.c | 5 +++++
 drivers/net/iavf/iavf_ethdev.c    | 5 +++++
 drivers/net/ice/ice_ethdev.c      | 5 +++++
 drivers/net/igc/igc_ethdev.c      | 7 ++++++-
 6 files changed, 32 insertions(+), 1 deletion(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v3 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
@ 2020-09-23  4:09     ` SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 2/5] net/igc: " SteveX Yang
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-23  4:09 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

e1000 can support single vlan tags that need more 4 bytes for max packet
size, so, configures the correct max packet size in dev_config ops.

Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/em_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 1dc360713..485a30625 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -441,6 +441,12 @@ eth_em_configure(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 	intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
 
+	/**
+	 * Considering vlan tag packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	eth_em_mtu_set(dev, dev->data->mtu);
+
 	PMD_INIT_FUNC_TRACE();
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v3 2/5] net/igc: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
@ 2020-09-23  4:09     ` " SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 3/5] net/ice: " SteveX Yang
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-23  4:09 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

igc can support single vlan tag that need more 4 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/igc/igc_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 810568bc5..36ef325a4 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -341,7 +341,12 @@ eth_igc_configure(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	ret  = igc_check_mq_mode(dev);
+	/* Considering vlan tag packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	eth_igc_mtu_set(dev, dev->data->mtu);
+
+	ret = igc_check_mq_mode(dev);
 	if (ret != 0)
 		return ret;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v3 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 2/5] net/igc: " SteveX Yang
@ 2020-09-23  4:09     ` " SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 4/5] net/i40e: " SteveX Yang
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-23  4:09 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

ice can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index cfd357b05..0ca6962b1 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3157,6 +3157,11 @@ ice_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;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	ice_mtu_set(dev, dev->data->mtu);
+
 	ret = ice_init_rss(pf);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v3 4/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
                       ` (2 preceding siblings ...)
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 3/5] net/ice: " SteveX Yang
@ 2020-09-23  4:09     ` " SteveX Yang
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 5/5] net/iavf: " SteveX Yang
  2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-23  4:09 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side. But for i40e/i40evf,
they should support dual vlan tags that need more 8 bytes for max packet
size, so, configure the correct max packet size in dev_config ops.

Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    | 5 +++++
 drivers/net/i40e/i40e_ethdev_vf.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6439baf2f..6b8acd07f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1930,6 +1930,11 @@ i40e_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 	ad->tx_vec_allowed = true;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	i40e_dev_mtu_set(dev, dev->data->mtu);
+
 	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 8531cf6b1..12e85ba26 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1681,6 +1681,11 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
 	dev->data->dev_conf.intr_conf.lsc =
 		!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC);
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	i40evf_dev_mtu_set(dev, dev->data->mtu);
+
 	if (num_queue_pairs > vf->vsi_res->num_queue_pairs) {
 		struct i40e_hw *hw;
 		int ret;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v3 5/5] net/iavf: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
                       ` (3 preceding siblings ...)
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 4/5] net/i40e: " SteveX Yang
@ 2020-09-23  4:09     ` " SteveX Yang
  2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
  5 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-23  4:09 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

iavf can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 440da7d76..20581994c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -226,6 +226,11 @@ 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;
 
+	/* Considering QinQ packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	iavf_dev_mtu_set(dev, dev->data->mtu);
+
 	/* 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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured
  2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
                       ` (4 preceding siblings ...)
  2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 5/5] net/iavf: " SteveX Yang
@ 2020-09-28  6:55     ` SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
                         ` (4 more replies)
  5 siblings, 5 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-28  6:55 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

configure the correct default max packet size in dev_config ops.

v4:
 * add the adjust condition for max_rx_pkt_len;
v3:
 * change the i40evf relative code;
v2:
 * change the max_rx_pkt_len via mtu_set ops;

SteveX Yang (5):
  net/e1000: fix max mtu size packets with vlan tag cannot be received
    by default
  net/igc: fix max mtu size packets with vlan tag cannot be received by
    default
  net/ice: fix max mtu size packets with vlan tag cannot be received by
    default
  net/i40e: fix max mtu size packets with vlan tag cannot be received by
    default
  net/iavf: fix max mtu size packets with vlan tag cannot be received by
    default

 drivers/net/e1000/em_ethdev.c     | 12 ++++++++++++
 drivers/net/i40e/i40e_ethdev.c    | 11 +++++++++++
 drivers/net/i40e/i40e_ethdev_vf.c | 13 ++++++++++++-
 drivers/net/iavf/iavf_ethdev.c    | 12 ++++++++++++
 drivers/net/ice/ice_ethdev.c      | 11 +++++++++++
 drivers/net/igc/igc_ethdev.c      | 13 ++++++++++++-
 6 files changed, 70 insertions(+), 2 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v4 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
@ 2020-09-28  6:55       ` SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 2/5] net/igc: " SteveX Yang
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-28  6:55 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

e1000 can support single vlan tags that need more 4 bytes for max packet
size, so, configures the correct max packet size in dev_config ops.

Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/em_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 1dc360713..96ff99951 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -437,10 +437,22 @@ eth_em_configure(struct rte_eth_dev *dev)
 {
 	struct e1000_interrupt *intr =
 		E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+	uint16_t frame_size = dev->data->mtu + E1000_ETH_OVERHEAD;
+	int rc = 0;
 
 	PMD_INIT_FUNC_TRACE();
 	intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
 
+	/**
+	 * Considering vlan tag packet, max frame size should be equal or
+	 * larger than total size of MTU and Ether overhead.
+	 */
+	if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+		rc = eth_em_mtu_set(dev, dev->data->mtu);
+		if (rc != 0)
+			return rc;
+	}
+
 	PMD_INIT_FUNC_TRACE();
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v4 2/5] net/igc: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
@ 2020-09-28  6:55       ` " SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 3/5] net/ice: " SteveX Yang
                         ` (2 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-28  6:55 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

igc can support single vlan tag that need more 4 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/igc/igc_ethdev.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 810568bc5..f47ea3e64 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -337,11 +337,22 @@ static int
 eth_igc_configure(struct rte_eth_dev *dev)
 {
 	struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
+	uint32_t frame_size = dev->data->mtu + IGC_ETH_OVERHEAD;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
-	ret  = igc_check_mq_mode(dev);
+	/**
+	 * Considering vlan tag packet, max frame size should be equal or
+	 * larger than total size of MTU and Ether overhead.
+	 */
+	if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+		ret = eth_igc_mtu_set(dev, dev->data->mtu);
+		if (ret != 0)
+			return ret;
+	}
+
+	ret = igc_check_mq_mode(dev);
 	if (ret != 0)
 		return ret;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 2/5] net/igc: " SteveX Yang
@ 2020-09-28  6:55       ` " SteveX Yang
  2020-09-29 11:59         ` Zhang, Qi Z
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 4/5] net/i40e: " SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 5/5] net/iavf: " SteveX Yang
  4 siblings, 1 reply; 31+ messages in thread
From: SteveX Yang @ 2020-09-28  6:55 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

ice can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index cfd357b05..6b7098444 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3146,6 +3146,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	struct ice_adapter *ad =
 		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
 	int ret;
 
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the
@@ -3157,6 +3158,16 @@ ice_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;
 
+	/**
+	 * Considering QinQ packet, max frame size should be equal or
+	 * larger than total size of MTU and Ether overhead.
+	 */
+	if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+		ret = ice_mtu_set(dev, dev->data->mtu);
+		if (ret != 0)
+			return ret;
+	}
+
 	ret = ice_init_rss(pf);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v4 4/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
                         ` (2 preceding siblings ...)
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 3/5] net/ice: " SteveX Yang
@ 2020-09-28  6:55       ` " SteveX Yang
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 5/5] net/iavf: " SteveX Yang
  4 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-28  6:55 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side. But for i40e/i40evf,
they should support dual vlan tags that need more 8 bytes for max packet
size, so, configure the correct max packet size in dev_config ops.

Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    | 11 +++++++++++
 drivers/net/i40e/i40e_ethdev_vf.c | 13 ++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6439baf2f..35ffe33ab 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1916,6 +1916,7 @@ i40e_dev_configure(struct rte_eth_dev *dev)
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode;
+	uint32_t frame_size = dev->data->mtu + I40E_ETH_OVERHEAD;
 	int i, ret;
 
 	ret = i40e_dev_sync_phy_type(hw);
@@ -1930,6 +1931,16 @@ i40e_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 	ad->tx_vec_allowed = true;
 
+	/**
+	 * Considering QinQ packet, max frame size should be equal or
+	 * larger than total size of MTU and Ether overhead.
+	 */
+	if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+		ret = i40e_dev_mtu_set(dev, dev->data->mtu);
+		if (ret != 0)
+			return ret;
+	}
+
 	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 8531cf6b1..e3c809037 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1669,6 +1669,8 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
 		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	uint16_t num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
 				dev->data->nb_tx_queues);
+	uint32_t frame_size = dev->data->mtu + I40E_ETH_OVERHEAD;
+	int ret;
 
 	/* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
 	 * allocation or vector Rx preconditions we will reset it.
@@ -1681,9 +1683,18 @@ i40evf_dev_configure(struct rte_eth_dev *dev)
 	dev->data->dev_conf.intr_conf.lsc =
 		!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC);
 
+	/**
+	 * Considering QinQ packet, max frame size should be equal or
+	 * larger than total size of MTU and Ether overhead.
+	 */
+	if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+		ret = i40evf_dev_mtu_set(dev, dev->data->mtu);
+		if (ret != 0)
+			return ret;
+	}
+
 	if (num_queue_pairs > vf->vsi_res->num_queue_pairs) {
 		struct i40e_hw *hw;
-		int ret;
 
 		if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
 			PMD_DRV_LOG(ERR,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [dpdk-dev] [PATCH v4 5/5] net/iavf: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
                         ` (3 preceding siblings ...)
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 4/5] net/i40e: " SteveX Yang
@ 2020-09-28  6:55       ` " SteveX Yang
  4 siblings, 0 replies; 31+ messages in thread
From: SteveX Yang @ 2020-09-28  6:55 UTC (permalink / raw)
  To: dev
  Cc: wei.zhao1, jia.guo, qiming.yang, qi.z.zhang, jingjing.wu,
	beilei.xing, konstantin.ananyev, SteveX Yang

testpmd will initialize default max packet length to 1518 which doesn't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

iavf can support dual vlan tags that need more 8 bytes for max packet size,
so, configures the correct max packet size in dev_config ops.

Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings")

Signed-off-by: SteveX Yang <stevex.yang@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 a88d53ab0..635d781eb 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -258,6 +258,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
@@ -269,6 +271,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;
 
+	/**
+	 * Considering QinQ packet, max frame size should be equal or
+	 * larger than total size of MTU 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


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 3/5] net/ice: " SteveX Yang
@ 2020-09-29 11:59         ` Zhang, Qi Z
  2020-09-29 23:01           ` Ananyev, Konstantin
  0 siblings, 1 reply; 31+ messages in thread
From: Zhang, Qi Z @ 2020-09-29 11:59 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Zhao1, Wei, Guo, Jia, Yang,  Qiming, Wu, Jingjing, Xing, Beilei,
	Ananyev, Konstantin



> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Monday, September 28, 2020 2:56 PM
> To: dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>; Yang,
> Qiming <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu,
> Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag cannot
> be received by default
> 
> testpmd will initialize default max packet length to 1518 which doesn't include
> vlan tag size in ether overheader. Once, send the max mtu length packet with
> vlan tag, the max packet length will exceed 1518 that will cause packets
> dropped directly from NIC hw side.
> 
> ice can support dual vlan tags that need more 8 bytes for max packet size, so,
> configures the correct max packet size in dev_config ops.
> 
> Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/ice/ice_ethdev.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> cfd357b05..6b7098444 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -3146,6 +3146,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
>  	struct ice_adapter *ad =
>  		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>  	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> +	uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
>  	int ret;
> 
>  	/* Initialize to TRUE. If any of Rx queues doesn't meet the @@ -3157,6
> +3158,16 @@ ice_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;
> 
> +	/**
> +	 * Considering QinQ packet, max frame size should be equal or
> +	 * larger than total size of MTU and Ether overhead.
> +	 */

> +	if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {


Why we need this check?
Can we just call ice_mtu_set directly 
And please remove above comment, since ether overhead is already considered in ice_mtu_set.


> +		ret = ice_mtu_set(dev, dev->data->mtu);
> +		if (ret != 0)
> +			return ret;
> +	}
> +
>  	ret = ice_init_rss(pf);
>  	if (ret) {
>  		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-29 11:59         ` Zhang, Qi Z
@ 2020-09-29 23:01           ` Ananyev, Konstantin
  2020-09-30  0:34             ` Zhang, Qi Z
  0 siblings, 1 reply; 31+ messages in thread
From: Ananyev, Konstantin @ 2020-09-29 23:01 UTC (permalink / raw)
  To: Zhang, Qi Z, Yang, SteveX, dev
  Cc: Zhao1, Wei, Guo, Jia, Yang,  Qiming, Wu, Jingjing, Xing, Beilei

> 
> > -----Original Message-----
> > From: Yang, SteveX <stevex.yang@intel.com>
> > Sent: Monday, September 28, 2020 2:56 PM
> > To: dev@dpdk.org
> > Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>; Yang,
> > Qiming <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu,
> > Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> > Ananyev, Konstantin <konstantin.ananyev@intel.com>; Yang, SteveX
> > <stevex.yang@intel.com>
> > Subject: [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag cannot
> > be received by default
> >
> > testpmd will initialize default max packet length to 1518 which doesn't include
> > vlan tag size in ether overheader. Once, send the max mtu length packet with
> > vlan tag, the max packet length will exceed 1518 that will cause packets
> > dropped directly from NIC hw side.
> >
> > ice can support dual vlan tags that need more 8 bytes for max packet size, so,
> > configures the correct max packet size in dev_config ops.
> >
> > Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")
> >
> > Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> > ---
> >  drivers/net/ice/ice_ethdev.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> > cfd357b05..6b7098444 100644
> > --- a/drivers/net/ice/ice_ethdev.c
> > +++ b/drivers/net/ice/ice_ethdev.c
> > @@ -3146,6 +3146,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
> >  struct ice_adapter *ad =
> >  ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> >  struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> > +uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
> >  int ret;
> >
> >  /* Initialize to TRUE. If any of Rx queues doesn't meet the @@ -3157,6
> > +3158,16 @@ ice_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;
> >
> > +/**
> > + * Considering QinQ packet, max frame size should be equal or
> > + * larger than total size of MTU and Ether overhead.
> > + */
> 
> > +if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
> 
> 
> Why we need this check?
> Can we just call ice_mtu_set directly

I think that without that check we can silently overwrite
provided by user dev_conf.rxmode.max_rx_pkt_len value. 

> And please remove above comment, since ether overhead is already considered in ice_mtu_set.
> 
> 
> > +ret = ice_mtu_set(dev, dev->data->mtu);
> > +if (ret != 0)
> > +return ret;
> > +}
> > +
> >  ret = ice_init_rss(pf);
> >  if (ret) {
> >  PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
> > --
> > 2.17.1
> 


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
  2020-09-29 23:01           ` Ananyev, Konstantin
@ 2020-09-30  0:34             ` Zhang, Qi Z
       [not found]               ` <DM6PR11MB4362515283D00E27A793E6B0F9330@DM6PR11MB4362.namprd11.prod.outlook.com>
  0 siblings, 1 reply; 31+ messages in thread
From: Zhang, Qi Z @ 2020-09-30  0:34 UTC (permalink / raw)
  To: Ananyev, Konstantin, Yang, SteveX, dev
  Cc: Zhao1, Wei, Guo, Jia, Yang,  Qiming, Wu, Jingjing, Xing, Beilei



> -----Original Message-----
> From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Sent: Wednesday, September 30, 2020 7:02 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>; dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>; Yang,
> Qiming <qiming.yang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>
> Subject: RE: [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag
> cannot be received by default
> 
> >
> > > -----Original Message-----
> > > From: Yang, SteveX <stevex.yang@intel.com>
> > > Sent: Monday, September 28, 2020 2:56 PM
> > > To: dev@dpdk.org
> > > Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>;
> > > Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > > <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> > > Beilei <beilei.xing@intel.com>; Ananyev, Konstantin
> > > <konstantin.ananyev@intel.com>; Yang, SteveX <stevex.yang@intel.com>
> > > Subject: [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan
> > > tag cannot be received by default
> > >
> > > testpmd will initialize default max packet length to 1518 which
> > > doesn't include vlan tag size in ether overheader. Once, send the
> > > max mtu length packet with vlan tag, the max packet length will
> > > exceed 1518 that will cause packets dropped directly from NIC hw side.
> > >
> > > ice can support dual vlan tags that need more 8 bytes for max packet
> > > size, so, configures the correct max packet size in dev_config ops.
> > >
> > > Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")
> > >
> > > Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> > > ---
> > >  drivers/net/ice/ice_ethdev.c | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > >
> > > diff --git a/drivers/net/ice/ice_ethdev.c
> > > b/drivers/net/ice/ice_ethdev.c index
> > > cfd357b05..6b7098444 100644
> > > --- a/drivers/net/ice/ice_ethdev.c
> > > +++ b/drivers/net/ice/ice_ethdev.c
> > > @@ -3146,6 +3146,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
> > > struct ice_adapter *ad =
> > > ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > >  struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> > > +uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
> > >  int ret;
> > >
> > >  /* Initialize to TRUE. If any of Rx queues doesn't meet the @@
> > > -3157,6
> > > +3158,16 @@ ice_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;
> > >
> > > +/**
> > > + * Considering QinQ packet, max frame size should be equal or
> > > + * larger than total size of MTU and Ether overhead.
> > > + */
> >
> > > +if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
> >
> >
> > Why we need this check?
> > Can we just call ice_mtu_set directly
> 
> I think that without that check we can silently overwrite provided by user
> dev_conf.rxmode.max_rx_pkt_len value.

OK, I see

But still have one question
dev->data->mtu is initialized to 1518 as default , but if application set dev_conf.rxmode.max_rx_pkt_len = 1000 in dev_configure.
does that mean we will still will set mtu to 1518, is this expected?

Should we just call ice_mtu_set(dev, dev_conf.rxmode.max_rx_pkt_len) here?



> 
> > And please remove above comment, since ether overhead is already
> considered in ice_mtu_set.
> >
> >
> > > +ret = ice_mtu_set(dev, dev->data->mtu); if (ret != 0) return ret; }
> > > +
> > >  ret = ice_init_rss(pf);
> > >  if (ret) {
> > >  PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
> > > --
> > > 2.17.1
> >
> 


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
       [not found]               ` <DM6PR11MB4362515283D00E27A793E6B0F9330@DM6PR11MB4362.namprd11.prod.outlook.com>
@ 2020-09-30  2:32                 ` Zhang, Qi Z
  0 siblings, 0 replies; 31+ messages in thread
From: Zhang, Qi Z @ 2020-09-30  2:32 UTC (permalink / raw)
  To: Yang, SteveX, Ananyev, Konstantin, dev
  Cc: Zhao1, Wei, Guo, Jia, Yang,  Qiming, Wu, Jingjing, Xing, Beilei



> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Wednesday, September 30, 2020 9:32 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>; Yang,
> Qiming <qiming.yang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>
> Subject: RE: [PATCH v4 3/5] net/ice: fix max mtu size packets with vlan tag
> cannot be received by default
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Wednesday, September 30, 2020 8:35 AM
> > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Yang, SteveX
> > <stevex.yang@intel.com>; dev@dpdk.org
> > Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>;
> > Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > Subject: RE: [PATCH v4 3/5] net/ice: fix max mtu size packets with
> > vlan tag cannot be received by default
> >
> >
> >
> > > -----Original Message-----
> > > From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> > > Sent: Wednesday, September 30, 2020 7:02 AM
> > > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, SteveX
> > > <stevex.yang@intel.com>; dev@dpdk.org
> > > Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>;
> > > Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> > > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > > Subject: RE: [PATCH v4 3/5] net/ice: fix max mtu size packets with
> > > vlan tag cannot be received by default
> > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Yang, SteveX <stevex.yang@intel.com>
> > > > > Sent: Monday, September 28, 2020 2:56 PM
> > > > > To: dev@dpdk.org
> > > > > Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia
> > > > > <jia.guo@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
> > > > > Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> > > > > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> > > > > Ananyev, Konstantin <konstantin.ananyev@intel.com>; Yang, SteveX
> > > > > <stevex.yang@intel.com>
> > > > > Subject: [PATCH v4 3/5] net/ice: fix max mtu size packets with
> > > > > vlan tag cannot be received by default
> > > > >
> > > > > testpmd will initialize default max packet length to 1518 which
> > > > > doesn't include vlan tag size in ether overheader. Once, send
> > > > > the max mtu length packet with vlan tag, the max packet length
> > > > > will exceed 1518 that will cause packets dropped directly from NIC hw
> side.
> > > > >
> > > > > ice can support dual vlan tags that need more 8 bytes for max
> > > > > packet size, so, configures the correct max packet size in
> > > > > dev_config
> > ops.
> > > > >
> > > > > Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")
> > > > >
> > > > > Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> > > > > ---
> > > > >  drivers/net/ice/ice_ethdev.c | 11 +++++++++++
> > > > >  1 file changed, 11 insertions(+)
> > > > >
> > > > > diff --git a/drivers/net/ice/ice_ethdev.c
> > > > > b/drivers/net/ice/ice_ethdev.c index
> > > > > cfd357b05..6b7098444 100644
> > > > > --- a/drivers/net/ice/ice_ethdev.c
> > > > > +++ b/drivers/net/ice/ice_ethdev.c
> > > > > @@ -3146,6 +3146,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
> > > > > struct ice_adapter *ad =
> > > > > ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > > > >  struct ice_pf *pf =
> > > > > ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> > > > > +uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
> > > > >  int ret;
> > > > >
> > > > >  /* Initialize to TRUE. If any of Rx queues doesn't meet the @@
> > > > > -3157,6
> > > > > +3158,16 @@ ice_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;
> > > > >
> > > > > +/**
> > > > > + * Considering QinQ packet, max frame size should be equal or
> > > > > + * larger than total size of MTU and Ether overhead.
> > > > > + */
> > > >
> > > > > +if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
> > > >
> > > >
> > > > Why we need this check?
> > > > Can we just call ice_mtu_set directly
> > >
> > > I think that without that check we can silently overwrite provided
> > > by user dev_conf.rxmode.max_rx_pkt_len value.
> >
> > OK, I see
> >
> > But still have one question
> > dev->data->mtu is initialized to 1518 as default , but if application
> > dev->data->set
> > dev_conf.rxmode.max_rx_pkt_len = 1000 in dev_configure.
> > does that mean we will still will set mtu to 1518, is this expected?
> >
> 
> max_rx_pkt_len should be larger than mtu at least, so we should raise the
> max_rx_pkt_len (e.g.:1518) to hold expected mtu value (e.g.: 1500).

Ok, this describe the problem more general and better to replace exist code comment and commit log for easy understanding.
Please send a new version for reword


> Generally, the mtu value can be adjustable from user (e.g.: ip link set ens801f0
> mtu 1400), hence, we just adjust the max_rx_pkt_len to satisfy mtu
> requirement.
> 
> > Should we just call ice_mtu_set(dev, dev_conf.rxmode.max_rx_pkt_len)
> > here?
> ice_mtu_set(dev, mtu) will append ether overhead to
> frame_size/max_rx_pkt_len, so we need pass the mtu value as the 2nd
> parameter, or not the max_rx_pkt_len.
> 
> >
> >
> > >
> > > > And please remove above comment, since ether overhead is already
> > > considered in ice_mtu_set.
> Ether overhead is already considered in ice_mtu_set, but it also should be
> considered as the adjustment condition that if ice_mtu_set need be invoked.
> So, it perhaps should remain this comment before this if() condition.
> 
> > > >
> > > >
> > > > > +ret = ice_mtu_set(dev, dev->data->mtu); if (ret != 0) return
> > > > > +ret; }
> > > > > +
> > > > >  ret = ice_init_rss(pf);
> > > > >  if (ret) {
> > > > >  PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
> > > > > --
> > > > > 2.17.1
> > > >
> > >
> >
> 


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, back to index

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 2/5] net/igc: " SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 3/5] net/ice: " SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 4/5] net/iavf: " SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 5/5] net/i40e: " SteveX Yang
2020-09-16 14:41   ` Ananyev, Konstantin
     [not found]     ` <DM6PR11MB4362E5FF332551D12AA20017F93E0@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-09-17 12:18       ` Ananyev, Konstantin
2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 2/5] net/igc: " SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 3/5] net/ice: " SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 4/5] net/i40e: " SteveX Yang
2020-09-22 10:47     ` Ananyev, Konstantin
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 5/5] net/iavf: " SteveX Yang
2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 2/5] net/igc: " SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 3/5] net/ice: " SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 4/5] net/i40e: " SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 5/5] net/iavf: " SteveX Yang
2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 2/5] net/igc: " SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 3/5] net/ice: " SteveX Yang
2020-09-29 11:59         ` Zhang, Qi Z
2020-09-29 23:01           ` Ananyev, Konstantin
2020-09-30  0:34             ` Zhang, Qi Z
     [not found]               ` <DM6PR11MB4362515283D00E27A793E6B0F9330@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-09-30  2:32                 ` Zhang, Qi Z
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 4/5] net/i40e: " SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 5/5] net/iavf: " SteveX Yang

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox