DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue
@ 2020-12-09  3:16 Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 01/12] net/dpaa2: fix the jumbo frame flag condition for mtu set Steve Yang
                   ` (14 more replies)
  0 siblings, 15 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition, this
fix will change the boundary condition with 'RTE_ETHER_MTU'.

When the MTU(1500) set, the frame type of rx packet will be different
if used different overhead, it will cause the consistency issue, and the
normal packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
can avoid this issue.

Following scopes will be changed:
- 'rte_ethdev'
- 'app', e.g.: 'test-pmd';
- net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;

Steve Yang (12):
  net/dpaa2: fix the jumbo frame flag condition for mtu set
  net/e1000: fix the jumbo frame flag condition for mtu set
  net/hns3: fix the jumbo frame flag condition for mtu set
  net/i40e: fix the jumbo frame flag condition
  net/iavf: fix the jumbo frame flag condition
  net/ice: fix the jumbo frame flag condition
  net/ipn3ke: fix the jumbo frame flag condition for mtu set
  net/octeontx: fix the jumbo frame flag condition for mtu set
  net/octeontx2: fix the jumbo frame flag condition for mtu
  net/qede: fix the jumbo frame flag condition for mtu set
  net/sfc: fix the jumbo frame flag condition for mtu set
  net/thunderx: fix the jumbo frame flag condition for mtu set

 drivers/net/dpaa2/dpaa2_ethdev.c        |  2 +-
 drivers/net/e1000/em_ethdev.c           |  2 +-
 drivers/net/e1000/igb_ethdev.c          |  2 +-
 drivers/net/hns3/hns3_ethdev.c          |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  2 +-
 drivers/net/i40e/i40e_ethdev.c          |  2 +-
 drivers/net/i40e/i40e_ethdev.h          |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c       | 10 +++++-----
 drivers/net/i40e/i40e_fdir.c            |  2 +-
 drivers/net/i40e/i40e_rxtx.c            |  8 ++++----
 drivers/net/iavf/iavf.h                 |  1 +
 drivers/net/iavf/iavf_ethdev.c          | 10 +++++-----
 drivers/net/ice/ice_dcf_ethdev.c        |  8 ++++----
 drivers/net/ice/ice_ethdev.c            |  2 +-
 drivers/net/ice/ice_ethdev.h            |  1 +
 drivers/net/ice/ice_rxtx.c              | 10 +++++-----
 drivers/net/ipn3ke/ipn3ke_representor.c |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c  |  2 +-
 drivers/net/octeontx2/otx2_ethdev_ops.c |  2 +-
 drivers/net/qede/qede_ethdev.c          |  2 +-
 drivers/net/sfc/sfc_ethdev.c            |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c     |  2 +-
 22 files changed, 40 insertions(+), 37 deletions(-)

-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 01/12] net/dpaa2: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 02/12] net/e1000: " Steve Yang
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports VLAN tag. That
will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: e16408499412 ("net/dpaa2: configure jumbo frames")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index ab6863300e..b92f4c1a7f 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1420,7 +1420,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > DPAA2_MAX_RX_PKT_LEN)
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 02/12] net/e1000: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 01/12] net/dpaa2: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 03/12] net/hns3: " Steve Yang
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports VLAN tag. That
will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: ef990fb56e55 ("net/e1000: convert to new Rx offloads API")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/em_ethdev.c  | 2 +-
 drivers/net/e1000/igb_ethdev.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 8ee9422bf4..044858f567 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1816,7 +1816,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (mtu > RTE_ETHER_MTU) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 647aa8d995..d31964558d 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -4369,7 +4369,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (mtu > RTE_ETHER_MTU) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 03/12] net/hns3: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 01/12] net/dpaa2: fix the jumbo frame flag condition for mtu set Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 02/12] net/e1000: " Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 04/12] net/i40e: fix the jumbo frame flag condition Steve Yang
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
Fixes: a5475d61fa34 ("net/hns3: support VF")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 2011378879..1a5cfd3e1f 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2458,7 +2458,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	rte_spinlock_lock(&hw->lock);
-	is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
+	is_jumbo_frame = mtu > RTE_ETHER_MTU ? true : false;
 	frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
 
 	/*
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 0366b9d4dc..d47af417bf 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -928,7 +928,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		rte_spinlock_unlock(&hw->lock);
 		return ret;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 04/12] net/i40e: fix the jumbo frame flag condition
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (2 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 03/12] net/hns3: " Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 05/12] net/iavf: " Steve Yang
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: c1715402df8f ("i40evf: fix jumbo frame support")
Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: c3ac7c5b0b8a ("net/i40e: convert to new Rx offloads API")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    |  2 +-
 drivers/net/i40e/i40e_ethdev.h    |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  8 ++++----
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f54769c29d..0b5e4abb41 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11753,7 +11753,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 696c5aaf7e..1f31a532a1 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -281,6 +281,7 @@ struct rte_flow {
  */
 #define I40E_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
+#define I40E_ETH_MAX_LEN (RTE_ETHER_MTU + I40E_ETH_OVERHEAD)
 
 #define I40E_RXTX_BYTES_H_16_BIT(bytes) ((bytes) & ~I40E_48_BIT_MASK)
 #define I40E_RXTX_BYTES_L_48_BIT(bytes) ((bytes) & I40E_48_BIT_MASK)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036b85..c2577d598c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1889,22 +1889,22 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 	 * Check if the jumbo frame and maximum packet length are set correctly
 	 */
 	if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				"larger than %u and smaller than %u, as jumbo "
-				"frame is enabled", (uint32_t)RTE_ETHER_MAX_LEN,
+				"frame is enabled", (uint32_t)I40E_ETH_MAX_LEN,
 					(uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
@@ -2825,7 +2825,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 50c0eee9f2..449b67b2a9 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -116,7 +116,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
 #endif
 	rx_ctx.dtype = i40e_header_split_none;
 	rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = I40E_ETH_MAX_LEN;
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
 	rx_ctx.tphdata_ena = 1;
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 5df9a9df56..b8859bbff2 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2797,23 +2797,23 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
 			rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len);
 	if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 			rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)I40E_ETH_MAX_LEN,
 				    (uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-			rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+			rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 05/12] net/iavf: fix the jumbo frame flag condition
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (3 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 04/12] net/i40e: fix the jumbo frame flag condition Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 06/12] net/ice: " Steve Yang
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf.h        |  1 +
 drivers/net/iavf/iavf_ethdev.c | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 6d5912d8c1..3328bd9327 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -66,6 +66,7 @@
 #define IAVF_VLAN_TAG_SIZE               4
 #define IAVF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2)
+#define IAVF_ETH_MAX_LEN (RTE_ETHER_MTU + IAVF_ETH_OVERHEAD)
 
 #define IAVF_32_BIT_WIDTH (CHAR_BIT * 4)
 #define IAVF_48_BIT_WIDTH (CHAR_BIT * 6)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 7e3c26a94e..b24d801065 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -418,23 +418,23 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= IAVF_ETH_MAX_LEN ||
 		    max_pkt_len > IAVF_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)IAVF_ETH_MAX_LEN,
 				    (uint32_t)IAVF_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > IAVF_ETH_MAX_LEN) {
 			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)IAVF_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -1167,7 +1167,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |=
 				DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 06/12] net/ice: fix the jumbo frame flag condition
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (4 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 05/12] net/iavf: " Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 07/12] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine")
Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF")
Fixes: ae2bdd0219cb ("net/ice: support MTU setting")
Fixes: 50370662b727 ("net/ice: support device and queue ops")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_dcf_ethdev.c |  8 ++++----
 drivers/net/ice/ice_ethdev.c     |  2 +-
 drivers/net/ice/ice_ethdev.h     |  1 +
 drivers/net/ice/ice_rxtx.c       | 10 +++++-----
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index b0b2ecb0d6..e5c877805f 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -60,23 +60,23 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9a5d6a559f..fc99f4bad0 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3904,7 +3904,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 899f446cde..2b03c59671 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -135,6 +135,7 @@
  */
 #define ICE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)
+#define ICE_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_ETH_OVERHEAD)
 
 #define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK)
 #define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK)
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 5fbd68eafc..0d9ad75782 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -246,23 +246,23 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
 				   dev->data->dev_conf.rxmode.max_rx_pkt_len);
 
 	if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -701,7 +701,7 @@ ice_fdir_program_hw_rx_queue(struct ice_rx_queue *rxq)
 	rx_ctx.hbuf = rxq->rx_hdr_len >> ICE_RLAN_CTX_HBUF_S;
 	rx_ctx.dtype = 0; /* No Header Split mode */
 	rx_ctx.dsize = 1; /* 32B descriptors */
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = ICE_ETH_MAX_LEN;
 	/* TPH: Transaction Layer Packet (TLP) processing hints */
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 07/12] net/ipn3ke: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (5 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 06/12] net/ice: " Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 08/12] net/octeontx: " Steve Yang
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ipn3ke/ipn3ke_representor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 8a53602576..c8ca58cc4b 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2801,7 +2801,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev_data->dev_conf.rxmode.offloads |=
 			(uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME);
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 08/12] net/octeontx: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (6 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 07/12] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 3151e6a687a3 ("net/octeontx: support MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3ee7b043fd..0b79360885 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -552,7 +552,7 @@ octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtu
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (7 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 08/12] net/octeontx: " Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-21  7:16   ` [dpdk-dev] [EXT] " Sunil Kumar Kori
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 10/12] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
                   ` (5 subsequent siblings)
  14 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index b36d37b9f7..170b8fbd91 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -58,7 +58,7 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 10/12] net/qede: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (8 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 11/12] net/sfc: " Steve Yang
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 200645ac7909 ("net/qede: set MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/qede/qede_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 549013557c..d6f0f0a493 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2367,7 +2367,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 			fp->rxq->rx_buf_size = rc;
 		}
 	}
-	if (max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 11/12] net/sfc: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (9 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 10/12] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 12/12] net/thunderx: " Steve Yang
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports VLAN tag. That
will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: ff6a1197c3b1 ("net/sfc: convert to new Rx offload API")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/sfc/sfc_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 93fc7baa0d..f2f5336435 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1017,7 +1017,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	 * The driver does not use it, but other PMDs update jumbo frame
 	 * flag and max_rx_pkt_len when MTU is set.
 	 */
-	if (mtu > RTE_ETHER_MAX_LEN) {
+	if (mtu > RTE_ETHER_MTU) {
 		struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v1 12/12] net/thunderx: fix the jumbo frame flag condition for mtu set
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (10 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 11/12] net/sfc: " Steve Yang
@ 2020-12-09  3:16 ` Steve Yang
  2020-12-11  4:31 ` [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Guo, Jia
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-09  3:16 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, ferruh.yigit,
	chenhao164, helin.zhang, konstantin.ananyev, yanglong.wu,
	xiaolong.ye, ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	skori, vattunuru, sony.chacko, bruce.richardson, ivan.malov,
	zyta.szpak, slawomir.rosek, rad, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: 65d9804edc05 ("net/thunderx: support MTU configuration")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/thunderx/nicvf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index b6bb05e500..a13ee960ec 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -176,7 +176,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		(frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS))
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (11 preceding siblings ...)
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 12/12] net/thunderx: " Steve Yang
@ 2020-12-11  4:31 ` Guo, Jia
  2020-12-14 17:44 ` Ferruh Yigit
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
  14 siblings, 0 replies; 115+ messages in thread
From: Guo, Jia @ 2020-12-11  4:31 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: hemant.agrawal, sachin.saxena, Wang, Haiyue, xavier.huwei,
	humin29, yisen.zhuang, oulijun, Xing, Beilei, Wu, Jingjing, Yang,
	Qiming, Zhang, Qi Z, Xu, Rosen, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, wei.dai,
	fengchunsong, lihuisong, Yigit, Ferruh, chenhao164, Zhang, Helin,
	Ananyev, Konstantin, yanglong.wu, xiaolong.ye, Xu, Ting, Li,
	Xiaoyun, Lu, Wenzhuo, Pei, Andy, Wei, Dan, skori, vattunuru,
	sony.chacko, Richardson, Bruce, ivan.malov, zyta.szpak,
	slawomir.rosek, rad, Yang, SteveX

Hi, steve

What I saw is that you replace of frame size checking to mtu checking, but you still use
"18" as overhead number to configure max_rx_pkt_len?
 
uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;

dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;

> -----Original Message-----
> From: Steve Yang <stevex.yang@intel.com>
> Sent: Wednesday, December 9, 2020 11:16 AM
> To: dev@dpdk.org
> Cc: hemant.agrawal@nxp.com; sachin.saxena@oss.nxp.com; Guo, Jia
> <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>;
> xavier.huwei@huawei.com; humin29@huawei.com;
> yisen.zhuang@huawei.com; oulijun@huawei.com; Xing, Beilei
> <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Xu, Rosen
> <rosen.xu@intel.com>; hkalra@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; kirankumark@marvell.com;
> rmody@marvell.com; shshaikh@marvell.com;
> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com; wei.dai@intel.com;
> fengchunsong@huawei.com; lihuisong@huawei.com; Yigit, Ferruh
> <ferruh.yigit@intel.com>; chenhao164@huawei.com; Zhang, Helin
> <helin.zhang@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; yanglong.wu@intel.com;
> xiaolong.ye@intel.com; Xu, Ting <ting.xu@intel.com>; Li, Xiaoyun
> <xiaoyun.li@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Pei, Andy
> <andy.pei@intel.com>; Wei, Dan <dan.wei@intel.com>; skori@marvell.com;
> vattunuru@marvell.com; sony.chacko@qlogic.com; Richardson, Bruce
> <bruce.richardson@intel.com>; ivan.malov@oktetlabs.ru;
> zyta.szpak@semihalf.com; slawomir.rosek@semihalf.com;
> rad@semihalf.com; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v1 00/12] fix rx packets dropped issue
> 
> The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition,
> this fix will change the boundary condition with 'RTE_ETHER_MTU'.
> 
> When the MTU(1500) set, the frame type of rx packet will be different if
> used different overhead, it will cause the consistency issue, and the normal
> packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
> can avoid this issue.
> 
> Following scopes will be changed:
> - 'rte_ethdev'
> - 'app', e.g.: 'test-pmd';
> - net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;
> 
> Steve Yang (12):
>   net/dpaa2: fix the jumbo frame flag condition for mtu set
>   net/e1000: fix the jumbo frame flag condition for mtu set
>   net/hns3: fix the jumbo frame flag condition for mtu set
>   net/i40e: fix the jumbo frame flag condition
>   net/iavf: fix the jumbo frame flag condition
>   net/ice: fix the jumbo frame flag condition
>   net/ipn3ke: fix the jumbo frame flag condition for mtu set
>   net/octeontx: fix the jumbo frame flag condition for mtu set
>   net/octeontx2: fix the jumbo frame flag condition for mtu
>   net/qede: fix the jumbo frame flag condition for mtu set
>   net/sfc: fix the jumbo frame flag condition for mtu set
>   net/thunderx: fix the jumbo frame flag condition for mtu set
> 
>  drivers/net/dpaa2/dpaa2_ethdev.c        |  2 +-
>  drivers/net/e1000/em_ethdev.c           |  2 +-
>  drivers/net/e1000/igb_ethdev.c          |  2 +-
>  drivers/net/hns3/hns3_ethdev.c          |  2 +-
>  drivers/net/hns3/hns3_ethdev_vf.c       |  2 +-
>  drivers/net/i40e/i40e_ethdev.c          |  2 +-
>  drivers/net/i40e/i40e_ethdev.h          |  1 +
>  drivers/net/i40e/i40e_ethdev_vf.c       | 10 +++++-----
>  drivers/net/i40e/i40e_fdir.c            |  2 +-
>  drivers/net/i40e/i40e_rxtx.c            |  8 ++++----
>  drivers/net/iavf/iavf.h                 |  1 +
>  drivers/net/iavf/iavf_ethdev.c          | 10 +++++-----
>  drivers/net/ice/ice_dcf_ethdev.c        |  8 ++++----
>  drivers/net/ice/ice_ethdev.c            |  2 +-
>  drivers/net/ice/ice_ethdev.h            |  1 +
>  drivers/net/ice/ice_rxtx.c              | 10 +++++-----
>  drivers/net/ipn3ke/ipn3ke_representor.c |  2 +-
> drivers/net/octeontx/octeontx_ethdev.c  |  2 +-
> drivers/net/octeontx2/otx2_ethdev_ops.c |  2 +-
>  drivers/net/qede/qede_ethdev.c          |  2 +-
>  drivers/net/sfc/sfc_ethdev.c            |  2 +-
>  drivers/net/thunderx/nicvf_ethdev.c     |  2 +-
>  22 files changed, 40 insertions(+), 37 deletions(-)
> 
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (12 preceding siblings ...)
  2020-12-11  4:31 ` [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Guo, Jia
@ 2020-12-14 17:44 ` Ferruh Yigit
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
  14 siblings, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2020-12-14 17:44 UTC (permalink / raw)
  To: Steve Yang, dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra, jerinj,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	mczekaj, wei.dai, fengchunsong, lihuisong, chenhao164,
	helin.zhang, konstantin.ananyev, yanglong.wu, xiaolong.ye,
	ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei, skori,
	vattunuru, sony.chacko, bruce.richardson, ivan.malov, zyta.szpak,
	slawomir.rosek, rad, Jeff Guo, Haiyue Wang, Rahul Lakkireddy,
	Somalapuram Amaranath, Gagandeep Singh, Sachin Saxena,
	Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou, Hemant Agrawal,
	Sachin Saxena, Heinrich Kuhn, Shijith Thotton,
	Srisivasubramanian Srinivasan

On 12/9/2020 3:16 AM, Steve Yang wrote:
> The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition, this
> fix will change the boundary condition with 'RTE_ETHER_MTU'.
> 
> When the MTU(1500) set, the frame type of rx packet will be different
> if used different overhead, it will cause the consistency issue, and the
> normal packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
> can avoid this issue.
> 
> Following scopes will be changed:
> - 'rte_ethdev'
> - 'app', e.g.: 'test-pmd';
> - net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;
> 
> Steve Yang (12):
>    net/dpaa2: fix the jumbo frame flag condition for mtu set
>    net/e1000: fix the jumbo frame flag condition for mtu set
>    net/hns3: fix the jumbo frame flag condition for mtu set
>    net/i40e: fix the jumbo frame flag condition
>    net/iavf: fix the jumbo frame flag condition
>    net/ice: fix the jumbo frame flag condition
>    net/ipn3ke: fix the jumbo frame flag condition for mtu set
>    net/octeontx: fix the jumbo frame flag condition for mtu set
>    net/octeontx2: fix the jumbo frame flag condition for mtu
>    net/qede: fix the jumbo frame flag condition for mtu set
>    net/sfc: fix the jumbo frame flag condition for mtu set
>    net/thunderx: fix the jumbo frame flag condition for mtu set
> 

Overall looks good to me, there is no review from the individual drivers, but if 
there is no objection I am for merging it soon. A few things below:

1) I see following usage not updated, can you please include them in next version:
ixgbe_set_vf_lpe
ixgbe_dev_mtu_set
cxgbe_dev_mtu_set
cxgbe_dev_rx_queue_setup
axgb_mtu_set
enetc_mtu_set
hinic_dev_set_mtu
dpaa_mtu_set
nfp_net_dev_mtu_set
lio_dev_mtu_set


2) I guess 'eth_dev' update will come as separate patch, can you please send it 
without waiting this set to be merged, since both are related having them both 
can help discussions.

Thanks,
ferruh


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

* [dpdk-dev] [PATCH v2 00/22] fix rx packets dropped issue
  2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
                   ` (13 preceding siblings ...)
  2020-12-14 17:44 ` Ferruh Yigit
@ 2020-12-17  9:22 ` Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
                     ` (45 more replies)
  14 siblings, 46 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition, this
fix will change the boundary condition with 'RTE_ETHER_MTU' and overhead.

When the MTU(1500) set, the frame type of rx packet will be different
if used different overhead, it will cause the consistency issue, and the
normal packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
can avoid this issue.

Following scopes will be changed:
- 'rte_ethdev'
- 'app', e.g.: 'test-pmd';
- net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;

---
v2:
 - defined the 'RTE_ETHER_MTU + overhead' to 'driver_ETH_MAX_LEN';
 - changed the 'mtu > RTE_ETHER_MTU' to 'frame_size > driver_ETH_MAX_LEN';
---

Steve Yang (22):
  ethdev: fix MTU size exceeds max rx packet length
  app/testpmd: fix max rx packet length for VLAN packets
  net/dpaa: fix the jumbo frame flag condition for mtu set
  net/dpaa2: fix the jumbo frame flag condition for mtu set
  net/e1000: fix the jumbo frame flag condition for mtu set
  net/hns3: fix the jumbo frame flag condition for mtu set
  net/i40e: fix the jumbo frame flag condition
  net/iavf: fix the jumbo frame flag condition
  net/ice: fix the jumbo frame flag condition
  net/ipn3ke: fix the jumbo frame flag condition for mtu set
  net/octeontx: fix the jumbo frame flag condition for mtu set
  net/octeontx2: fix the jumbo frame flag condition for mtu
  net/qede: fix the jumbo frame flag condition for mtu set
  net/sfc: fix the jumbo frame flag condition for mtu set
  net/thunderx: fix the jumbo frame flag condition for mtu set
  net/ixgbe: fix the jumbo frame flag condition
  net/cxgbe: fix the jumbo frame flag condition
  net/axgbe: fix the jumbo frame flag condition for mtu set
  net/enetc: fix the jumbo frame flag condition for mtu set
  net/hinic: fix the jumbo frame flag condition for mtu set
  net/nfp: fix the jumbo frame flag condition for mtu set
  net/liquidio: fix the jumbo frame flag condition for mtu set

 app/test-pmd/cmdline.c                    |  6 ------
 app/test-pmd/config.c                     |  2 +-
 app/test-pmd/parameters.c                 |  7 ++-----
 app/test-pmd/testpmd.c                    | 20 ++++++++++++++++++++
 drivers/net/axgbe/axgbe_ethdev.c          |  2 +-
 drivers/net/axgbe/axgbe_ethdev.h          |  6 ++++++
 drivers/net/cxgbe/cxgbe.h                 |  4 ++++
 drivers/net/cxgbe/cxgbe_ethdev.c          |  4 ++--
 drivers/net/dpaa/dpaa_ethdev.c            |  2 +-
 drivers/net/dpaa/dpaa_ethdev.h            |  4 ++++
 drivers/net/dpaa2/dpaa2_ethdev.c          |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  4 ++++
 drivers/net/e1000/e1000_ethdev.h          |  2 +-
 drivers/net/e1000/em_ethdev.c             |  5 ++---
 drivers/net/e1000/igb_ethdev.c            |  2 +-
 drivers/net/enetc/enetc.h                 |  4 ++++
 drivers/net/enetc/enetc_ethdev.c          |  2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c      |  5 ++++-
 drivers/net/hns3/hns3_ethdev.c            |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c         |  2 +-
 drivers/net/i40e/i40e_ethdev.c            |  2 +-
 drivers/net/i40e/i40e_ethdev.h            |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c         | 10 +++++-----
 drivers/net/i40e/i40e_fdir.c              |  2 +-
 drivers/net/i40e/i40e_rxtx.c              |  8 ++++----
 drivers/net/iavf/iavf.h                   |  1 +
 drivers/net/iavf/iavf_ethdev.c            | 10 +++++-----
 drivers/net/ice/ice_dcf_ethdev.c          |  8 ++++----
 drivers/net/ice/ice_ethdev.c              |  2 +-
 drivers/net/ice/ice_ethdev.h              |  1 +
 drivers/net/ice/ice_rxtx.c                | 10 +++++-----
 drivers/net/ipn3ke/ipn3ke_ethdev.h        |  1 +
 drivers/net/ipn3ke/ipn3ke_representor.c   |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c          |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h          |  3 +++
 drivers/net/ixgbe/ixgbe_pf.c              |  2 +-
 drivers/net/liquidio/lio_ethdev.c         |  2 +-
 drivers/net/liquidio/lio_ethdev.h         |  3 +++
 drivers/net/nfp/nfp_net.c                 |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c    |  2 +-
 drivers/net/octeontx/octeontx_ethdev.h    |  1 +
 drivers/net/octeontx2/otx2_ethdev.h       |  2 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c   |  2 +-
 drivers/net/qede/qede_ethdev.c            |  2 +-
 drivers/net/qede/qede_rxtx.h              |  1 +
 drivers/net/sfc/sfc_ethdev.c              |  2 +-
 drivers/net/thunderx/base/nicvf_hw_defs.h |  1 +
 drivers/net/thunderx/nicvf_ethdev.c       |  2 +-
 lib/librte_ethdev/rte_ethdev.c            | 21 ++++++++++++++++++---
 49 files changed, 130 insertions(+), 65 deletions(-)

-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-28 14:51     ` Andrew Rybchenko
  2020-12-30 10:19     ` oulijun
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
                     ` (44 subsequent siblings)
  45 siblings, 2 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

If max rx packet length is smaller then MTU + Ether overhead, that will
drop all MTU size packets.

Update the MTU size according to the max rx packet and Ether overhead.

Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 17ddacc78d..ff6a1e675f 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1292,6 +1292,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_conf orig_conf;
+	uint16_t overhead_len;
 	int diag;
 	int ret;
 
@@ -1323,6 +1324,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	if (ret != 0)
 		goto rollback;
 
+	/* Get the real Ethernet overhead length */
+	if (dev_info.max_mtu &&
+	    dev_info.max_mtu != UINT16_MAX &&
+	    dev_info.max_rx_pktlen &&
+	    dev_info.max_rx_pktlen > dev_info.max_mtu)
+		overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
+	else
+		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
 	/* If number of queues specified by application for both Rx and Tx is
 	 * zero, use driver preferred values. This cannot be done individually
 	 * as it is valid for either Tx or Rx (but not both) to be zero.
@@ -1410,13 +1420,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 			goto rollback;
 		}
 	} else {
-		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
+		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
+			pktlen > RTE_ETHER_MTU + overhead_len)
 			/* Use default value */
 			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+						RTE_ETHER_MTU + overhead_len;
 	}
 
+	/* Scale the MTU size to adapt max_rx_pkt_len */
+	dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
+				overhead_len;
+
 	/*
 	 * If LRO is enabled, check that the maximum aggregated packet
 	 * size is supported by the configured device.
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 02/22] app/testpmd: fix max rx packet length for VLAN packets
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2021-01-13 11:26     ` Ferruh Yigit
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (43 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

When the max rx packet length is smaller than the sum of mtu size and
ether overhead size, it should be enlarged, otherwise the VLAN packets
will be dropped.

Removed the rx_offloads assignment for jumbo frame during command line
parsing, and set the correct jumbo frame flag if MTU size is larger than
the default value 'RTE_ETHER_MTU' within 'init_config()'.

Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 app/test-pmd/cmdline.c    |  6 ------
 app/test-pmd/config.c     |  2 +-
 app/test-pmd/parameters.c |  7 ++-----
 app/test-pmd/testpmd.c    | 20 ++++++++++++++++++++
 4 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2ccbaa039e..65042fcff5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1886,7 +1886,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 
 	RTE_ETH_FOREACH_DEV(pid) {
 		struct rte_port *port = &ports[pid];
-		uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
 
 		if (!strcmp(res->name, "max-pkt-len")) {
 			if (res->value < RTE_ETHER_MIN_LEN) {
@@ -1898,11 +1897,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 				return;
 
 			port->dev_conf.rxmode.max_rx_pkt_len = res->value;
-			if (res->value > RTE_ETHER_MAX_LEN)
-				rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
-			else
-				rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-			port->dev_conf.rxmode.offloads = rx_offloads;
 		} else {
 			printf("Unknown parameter\n");
 			return;
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3f6c8642b1..1195f054f3 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1434,7 +1434,7 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
 		 * device supports jumbo frame.
 		 */
 		eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu;
-		if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) {
+		if (mtu > RTE_ETHER_MTU) {
 			rte_port->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 			rte_port->dev_conf.rxmode.max_rx_pkt_len =
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 414a0068fb..df5eb10d84 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -834,12 +834,9 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
 				n = atoi(optarg);
-				if (n >= RTE_ETHER_MIN_LEN) {
+				if (n >= RTE_ETHER_MIN_LEN)
 					rx_mode.max_rx_pkt_len = (uint32_t) n;
-					if (n > RTE_ETHER_MAX_LEN)
-						rx_offloads |=
-							DEV_RX_OFFLOAD_JUMBO_FRAME;
-				} else
+				else
 					rte_exit(EXIT_FAILURE,
 						 "Invalid max-pkt-len=%d - should be > %d\n",
 						 n, RTE_ETHER_MIN_LEN);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 33a060dffd..fdb5c3c38b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1410,6 +1410,7 @@ init_config(void)
 	struct rte_gro_param gro_param;
 	uint32_t gso_types;
 	uint16_t data_size;
+	uint16_t eth_overhead;
 	bool warning = 0;
 	int k;
 	int ret;
@@ -1446,6 +1447,25 @@ init_config(void)
 			rte_exit(EXIT_FAILURE,
 				 "rte_eth_dev_info_get() failed\n");
 
+		/* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
+		if (port->dev_info.max_mtu &&
+		    port->dev_info.max_mtu != UINT16_MAX &&
+		    port->dev_info.max_rx_pktlen &&
+		    port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
+			eth_overhead = port->dev_info.max_rx_pktlen -
+				port->dev_info.max_mtu;
+		else
+			eth_overhead =
+				RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
+		if (port->dev_conf.rxmode.max_rx_pkt_len <=
+			(uint32_t)(RTE_ETHER_MTU + eth_overhead))
+			port->dev_conf.rxmode.max_rx_pkt_len =
+					RTE_ETHER_MTU + eth_overhead;
+		else
+			port->dev_conf.rxmode.offloads |=
+					DEV_RX_OFFLOAD_JUMBO_FRAME;
+
 		if (!(port->dev_info.tx_offload_capa &
 		      DEV_TX_OFFLOAD_MBUF_FAST_FREE))
 			port->dev_conf.txmode.offloads &=
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 04/22] net/dpaa2: " Steve Yang
                     ` (42 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports VLAN tag. That
will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 25f854197abc ("net/dpaa: support jumbo frames")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 2 +-
 drivers/net/dpaa/dpaa_ethdev.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index f00279e004..0c87c136d7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -184,7 +184,7 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > DPAA_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 659bceb467..a858b1372c 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -51,6 +51,10 @@
 #define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
 #endif
 
+#define DPAA_ETH_MAX_LEN (RTE_ETHER_MTU + \
+			  RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
+			  VLAN_TAG_SIZE)
+
 /* PCD frame queues */
 #define DPAA_DEFAULT_NUM_PCD_QUEUES	1
 #define DPAA_VSP_PROFILE_MAX_NUM	8
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 04/22] net/dpaa2: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (2 preceding siblings ...)
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 05/22] net/e1000: " Steve Yang
                     ` (41 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports VLAN tag. That
will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: e16408499412 ("net/dpaa2: configure jumbo frames")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 2 +-
 drivers/net/dpaa2/dpaa2_ethdev.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index ab6863300e..6f38da3cce 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1420,7 +1420,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > DPAA2_MAX_RX_PKT_LEN)
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > DPAA2_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 8d82f74684..cacb11bd3e 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -26,6 +26,10 @@
 
 #define DPAA2_RX_DEFAULT_NBDESC 512
 
+#define DPAA2_ETH_MAX_LEN (RTE_ETHER_MTU + \
+			   RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
+			   VLAN_TAG_SIZE)
+
 /*default tc to be used for ,congestion, distribution etc configuration. */
 #define DPAA2_DEF_TC		0
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 05/22] net/e1000: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (3 preceding siblings ...)
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 04/22] net/dpaa2: " Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-18  2:42     ` Guo, Jia
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 06/22] net/hns3: " Steve Yang
                     ` (40 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports VLAN tag. That
will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: ef990fb56e55 ("net/e1000: convert to new Rx offloads API")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/e1000_ethdev.h | 2 +-
 drivers/net/e1000/em_ethdev.c    | 5 ++---
 drivers/net/e1000/igb_ethdev.c   | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 4755a5f333..3b4d9c3ee6 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -97,7 +97,7 @@
  */
 #define E1000_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
 				VLAN_TAG_SIZE)
-
+#define E1000_ETH_MAX_LEN (RTE_ETHER_MTU + E1000_ETH_OVERHEAD)
 /*
  * Maximum number of Ring Descriptors.
  *
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 8ee9422bf4..2036c6e917 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1799,8 +1799,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (ret != 0)
 		return ret;
 
-	frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
-		VLAN_TAG_SIZE;
+	frame_size = mtu + E1000_ETH_OVERHEAD;
 
 	/* check that mtu is within the allowed range */
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen)
@@ -1816,7 +1815,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > E1000_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 647aa8d995..dfe87508c2 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -4369,7 +4369,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > E1000_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 06/22] net/hns3: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (4 preceding siblings ...)
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 05/22] net/e1000: " Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
                     ` (39 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN'.

Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
Fixes: a5475d61fa34 ("net/hns3: support VF")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 7c34e382fb..10e0c0de46 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2467,7 +2467,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	rte_spinlock_lock(&hw->lock);
-	is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
+	is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false;
 	frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
 
 	/*
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index f09cabcd82..ef03fb1c4e 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -928,7 +928,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		rte_spinlock_unlock(&hw->lock);
 		return ret;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (5 preceding siblings ...)
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 06/22] net/hns3: " Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-18  2:44     ` Guo, Jia
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 08/22] net/iavf: " Steve Yang
                     ` (38 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: c1715402df8f ("i40evf: fix jumbo frame support")
Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: c3ac7c5b0b8a ("net/i40e: convert to new Rx offloads API")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    |  2 +-
 drivers/net/i40e/i40e_ethdev.h    |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  8 ++++----
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2cb18ecc03..d4fcc6c853 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11770,7 +11770,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 > I40E_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 696c5aaf7e..1f31a532a1 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -281,6 +281,7 @@ struct rte_flow {
  */
 #define I40E_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
+#define I40E_ETH_MAX_LEN (RTE_ETHER_MTU + I40E_ETH_OVERHEAD)
 
 #define I40E_RXTX_BYTES_H_16_BIT(bytes) ((bytes) & ~I40E_48_BIT_MASK)
 #define I40E_RXTX_BYTES_L_48_BIT(bytes) ((bytes) & I40E_48_BIT_MASK)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036b85..85c65c09ee 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1889,22 +1889,22 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 	 * Check if the jumbo frame and maximum packet length are set correctly
 	 */
 	if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				"larger than %u and smaller than %u, as jumbo "
-				"frame is enabled", (uint32_t)RTE_ETHER_MAX_LEN,
+				"frame is enabled", (uint32_t)I40E_ETH_MAX_LEN,
 					(uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
@@ -2825,7 +2825,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 > I40E_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 50c0eee9f2..449b67b2a9 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -116,7 +116,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
 #endif
 	rx_ctx.dtype = i40e_header_split_none;
 	rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = I40E_ETH_MAX_LEN;
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
 	rx_ctx.tphdata_ena = 1;
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 5df9a9df56..b8859bbff2 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2797,23 +2797,23 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
 			rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len);
 	if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 			rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)I40E_ETH_MAX_LEN,
 				    (uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-			rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+			rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 08/22] net/iavf: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (6 preceding siblings ...)
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 09/22] net/ice: " Steve Yang
                     ` (37 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf.h        |  1 +
 drivers/net/iavf/iavf_ethdev.c | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 6d5912d8c1..3328bd9327 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -66,6 +66,7 @@
 #define IAVF_VLAN_TAG_SIZE               4
 #define IAVF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2)
+#define IAVF_ETH_MAX_LEN (RTE_ETHER_MTU + IAVF_ETH_OVERHEAD)
 
 #define IAVF_32_BIT_WIDTH (CHAR_BIT * 4)
 #define IAVF_48_BIT_WIDTH (CHAR_BIT * 6)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 7e3c26a94e..658f28d353 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -418,23 +418,23 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= IAVF_ETH_MAX_LEN ||
 		    max_pkt_len > IAVF_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)IAVF_ETH_MAX_LEN,
 				    (uint32_t)IAVF_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > IAVF_ETH_MAX_LEN) {
 			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)IAVF_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -1167,7 +1167,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > IAVF_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 				DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 09/22] net/ice: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (7 preceding siblings ...)
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 08/22] net/iavf: " Steve Yang
@ 2020-12-17  9:22   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (36 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:22 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine")
Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF")
Fixes: ae2bdd0219cb ("net/ice: support MTU setting")
Fixes: 50370662b727 ("net/ice: support device and queue ops")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_dcf_ethdev.c |  8 ++++----
 drivers/net/ice/ice_ethdev.c     |  2 +-
 drivers/net/ice/ice_ethdev.h     |  1 +
 drivers/net/ice/ice_rxtx.c       | 10 +++++-----
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index b0b2ecb0d6..e5c877805f 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -60,23 +60,23 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9a5d6a559f..d25aed54b3 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3904,7 +3904,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > ICE_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 899f446cde..2b03c59671 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -135,6 +135,7 @@
  */
 #define ICE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)
+#define ICE_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_ETH_OVERHEAD)
 
 #define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK)
 #define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK)
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index d052bd0f1b..c98328ce0b 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -246,23 +246,23 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
 				   dev->data->dev_conf.rxmode.max_rx_pkt_len);
 
 	if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -701,7 +701,7 @@ ice_fdir_program_hw_rx_queue(struct ice_rx_queue *rxq)
 	rx_ctx.hbuf = rxq->rx_hdr_len >> ICE_RLAN_CTX_HBUF_S;
 	rx_ctx.dtype = 0; /* No Header Split mode */
 	rx_ctx.dsize = 1; /* 32B descriptors */
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = ICE_ETH_MAX_LEN;
 	/* TPH: Transaction Layer Packet (TLP) processing hints */
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (8 preceding siblings ...)
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 09/22] net/ice: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-19  0:54     ` Xu, Rosen
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 11/22] net/octeontx: " Steve Yang
                     ` (35 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ipn3ke/ipn3ke_ethdev.h      | 1 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 9b0cf309c8..a6815a9cca 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -640,6 +640,7 @@ ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
  */
 #define IPN3KE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IPN3KE_VLAN_TAG_SIZE * 2)
+#define IPN3KE_ETH_MAX_LEN (RTE_ETHER_MTU + IPN3KE_ETH_OVERHEAD)
 
 #define IPN3KE_MAC_FRAME_SIZE_MAX    9728
 #define IPN3KE_MAC_RX_FRAME_MAXLENGTH    0x00AE
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 8a53602576..9e15cce34f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2801,7 +2801,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > IPN3KE_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			(uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME);
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 11/22] net/octeontx: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (9 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-21 15:04     ` [dpdk-dev] [EXT] " Harman Kalra
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
                     ` (34 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 3151e6a687a3 ("net/octeontx: support MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 2 +-
 drivers/net/octeontx/octeontx_ethdev.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3ee7b043fd..81779885d5 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -552,7 +552,7 @@ octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > OCCTX_L2_MAX_LEN)
 		nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index 7246fb6d1d..780a094ffa 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -44,6 +44,7 @@
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
 #define OCCTX_L2_OVERHEAD	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
 				 OCCTX_MAX_VTAG_ACT_SIZE)
+#define OCCTX_L2_MAX_LEN	(RTE_ETHER_MTU + OCCTX_L2_OVERHEAD)
 
 /* Since HW FRS includes NPC VTAG insertion space, user has reduced FRS */
 #define OCCTX_MAX_FRS	\
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (10 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 11/22] net/octeontx: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-18 10:15     ` Nithin Dabilpuram
  2020-12-21  7:19     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (33 subsequent siblings)
  45 siblings, 2 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx2/otx2_ethdev.h     | 2 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 3b9871f4dc..99f0469d89 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -51,6 +51,8 @@
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
 #define NIX_L2_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
+#define NIX_L2_MAX_LEN \
+	(RTE_ETHER_MTU + NIX_L2_OVERHEAD)
 
 /* HW config of frame size doesn't include FCS */
 #define NIX_MAX_HW_FRS			9212
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index b36d37b9f7..963cc285ed 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -58,7 +58,7 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > NIX_L2_MAX_LEN)
 		dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 13/22] net/qede: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (11 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 14/22] net/sfc: " Steve Yang
                     ` (32 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 200645ac7909 ("net/qede: set MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/qede/qede_ethdev.c | 2 +-
 drivers/net/qede/qede_rxtx.h   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 549013557c..6919378b8e 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2367,7 +2367,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 			fp->rxq->rx_buf_size = rc;
 		}
 	}
-	if (max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+	if (frame_size > QEDE_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h
index d7ff870b20..fcb564a1bb 100644
--- a/drivers/net/qede/qede_rxtx.h
+++ b/drivers/net/qede/qede_rxtx.h
@@ -71,6 +71,7 @@
 				 + (QEDE_LLC_SNAP_HDR_LEN) + 2)
 
 #define QEDE_MAX_ETHER_HDR_LEN	(RTE_ETHER_HDR_LEN + QEDE_ETH_OVERHEAD)
+#define QEDE_ETH_MAX_LEN	(RTE_ETHER_MTU + QEDE_MAX_ETHER_HDR_LEN)
 
 #define QEDE_RSS_OFFLOAD_ALL    (ETH_RSS_IPV4			|\
 				 ETH_RSS_NONFRAG_IPV4_TCP	|\
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 14/22] net/sfc: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (12 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 15/22] net/thunderx: " Steve Yang
                     ` (31 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports VLAN tag. That
will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: ff6a1197c3b1 ("net/sfc: convert to new Rx offload API")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/sfc/sfc_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 93fc7baa0d..f2f5336435 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1017,7 +1017,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	 * The driver does not use it, but other PMDs update jumbo frame
 	 * flag and max_rx_pkt_len when MTU is set.
 	 */
-	if (mtu > RTE_ETHER_MAX_LEN) {
+	if (mtu > RTE_ETHER_MTU) {
 		struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 15/22] net/thunderx: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (13 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 14/22] net/sfc: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
                     ` (30 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead.

Fixes: 65d9804edc05 ("net/thunderx: support MTU configuration")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/thunderx/base/nicvf_hw_defs.h | 1 +
 drivers/net/thunderx/nicvf_ethdev.c       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/thunderx/base/nicvf_hw_defs.h b/drivers/net/thunderx/base/nicvf_hw_defs.h
index b12c8ec50a..adc8ec943d 100644
--- a/drivers/net/thunderx/base/nicvf_hw_defs.h
+++ b/drivers/net/thunderx/base/nicvf_hw_defs.h
@@ -176,6 +176,7 @@
 #define NIC_HW_MAX_MTU                  (9190)
 #define NIC_HW_MAX_FRS                  (NIC_HW_MAX_MTU + NIC_HW_L2_OVERHEAD)
 #define NIC_HW_MAX_SEGS                 (12)
+#define NIC_HW_L2_MAX_LEN		(RTE_ETHER_MTU + NIC_HW_L2_OVERHEAD)
 
 /* Descriptor alignments */
 #define NICVF_RBDR_BASE_ALIGN_BYTES     (128) /* 7 bits */
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index b6bb05e500..c2e7c334d4 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -176,7 +176,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		(frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS))
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > NIC_HW_L2_MAX_LEN)
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (14 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 15/22] net/thunderx: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-18  2:43     ` Guo, Jia
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 17/22] net/cxgbe: " Steve Yang
                     ` (29 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
Fixes: 95a27b3ba5f5 ("net/ixgbe: enable jumbo frame for VF")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++
 drivers/net/ixgbe/ixgbe_pf.c     | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d7a1806ab8..fa0f5afd03 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5173,7 +5173,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > IXGBE_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 3d35ea791b..a0ce18ca24 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -104,6 +104,9 @@
 /* The overhead from MTU to max frame size. */
 #define IXGBE_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
 
+/* The max frame size with default MTU */
+#define IXGBE_ETH_MAX_LEN  (RTE_ETHER_MTU + IXGBE_ETH_OVERHEAD)
+
 /* bit of VXLAN tunnel type | 7 bits of zeros  | 8 bits of zeros*/
 #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE    0x8000
 /* bit of NVGRE tunnel type | 7 bits of zeros  | 8 bits of zeros*/
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 833863af5a..89698e8470 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -575,7 +575,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
 		   IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
 	if (max_frs < new_mtu) {
 		hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-		if (new_mtu > RTE_ETHER_MAX_LEN) {
+		if (new_mtu > IXGBE_ETH_MAX_LEN) {
 			dev->data->dev_conf.rxmode.offloads |=
 				DEV_RX_OFFLOAD_JUMBO_FRAME;
 			hlreg0 |= IXGBE_HLREG0_JUMBOEN;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 17/22] net/cxgbe: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (15 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (28 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 4b2eff452d2e ("cxgbe: enable jumbo frames")
Fixes: 0ec33be4c857 ("cxgbe: allow to change mtu")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/cxgbe/cxgbe.h        | 4 ++++
 drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h
index ef62af1c3f..7c89a028bf 100644
--- a/drivers/net/cxgbe/cxgbe.h
+++ b/drivers/net/cxgbe/cxgbe.h
@@ -19,6 +19,10 @@
 #define CXGBE_MAX_RX_PKTLEN (9000 + RTE_ETHER_HDR_LEN + \
 				RTE_ETHER_CRC_LEN) /* max pkt */
 
+/* The max frame size with default MTU */
+#define CXGBE_ETH_MAX_LEN (RTE_ETHER_MTU + \
+		RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 /* Max poll time is 100 * 100msec = 10 sec */
 #define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */
 #define CXGBE_LINK_STATUS_POLL_CNT 100 /* Max number of times to poll */
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 98d0362fa3..480d6f58a8 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -300,7 +300,7 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 		return -EINVAL;
 
 	/* set to jumbo mode if needed */
-	if (new_mtu > RTE_ETHER_MAX_LEN)
+	if (new_mtu > CXGBE_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
@@ -669,7 +669,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		rxq->fl.size = temp_nb_desc;
 
 	/* Set to jumbo mode if necessary */
-	if (pkt_len > RTE_ETHER_MAX_LEN)
+	if (pkt_len > CXGBE_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (16 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 17/22] net/cxgbe: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 19/22] net/enetc: " Steve Yang
                     ` (27 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: b58d8781fa1f ("net/axgbe: support setting MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/axgbe/axgbe_ethdev.c | 2 +-
 drivers/net/axgbe/axgbe_ethdev.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index f524a3be96..599ae19940 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -1489,7 +1489,7 @@ static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 				dev->data->port_id);
 		return -EBUSY;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > AXGBE_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		val = 1;
diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
index 1481fd9ff3..a6226729fe 100644
--- a/drivers/net/axgbe/axgbe_ethdev.h
+++ b/drivers/net/axgbe/axgbe_ethdev.h
@@ -125,6 +125,12 @@
 /* MDIO port types */
 #define AXGMAC_MAX_C22_PORT		3
 
+/* The max frame size with default MTU */
+#define AXGBE_ETH_MAX_LEN ( \
+	RTE_ETHER_MTU + \
+	RTE_ETHER_HDR_LEN + \
+	RTE_ETHER_CRC_LEN)
+
 /* Helper macro for descriptor handling
  *  Always use AXGBE_GET_DESC_DATA to access the descriptor data
  *  since the index is free-running and needs to be and-ed
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 19/22] net/enetc: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (17 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 20/22] net/hinic: " Steve Yang
                     ` (26 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 5d5589b0c858 ("net/enetc: support MTU update and jumbo frames")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/enetc/enetc.h        | 4 ++++
 drivers/net/enetc/enetc_ethdev.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enetc/enetc.h b/drivers/net/enetc/enetc.h
index 14ef3bc18b..7163633bce 100644
--- a/drivers/net/enetc/enetc.h
+++ b/drivers/net/enetc/enetc.h
@@ -29,6 +29,10 @@
 /* maximum frame size supported */
 #define ENETC_MAC_MAXFRM_SIZE	9600
 
+/* The max frame size with default MTU */
+#define ENETC_ETH_MAX_LEN (RTE_ETHER_MTU + \
+		RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 /*
  * upper_32_bits - return bits 32-63 of a number
  * @n: the number we're accessing
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 6ff3022874..4d2c9c0474 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -677,7 +677,7 @@ enetc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > ENETC_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads &=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 20/22] net/hinic: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (18 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 19/22] net/enetc: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 21/22] net/nfp: " Steve Yang
                     ` (25 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 254bd849b132 ("net/hinic: set jumbo frame offload flag")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 62642354cf..5a2c171099 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -75,6 +75,9 @@
 #define HINIC_PKTLEN_TO_MTU(pktlen)	\
 	((pktlen) - (ETH_HLEN + ETH_CRC_LEN))
 
+/* The max frame size with default MTU */
+#define HINIC_ETH_MAX_LEN (RTE_ETHER_MTU + ETH_HLEN + ETH_CRC_LEN)
+
 /* lro numer limit for one packet */
 #define HINIC_LRO_WQE_NUM_DEFAULT	8
 
@@ -1556,7 +1559,7 @@ static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 
 	/* update max frame size */
 	frame_size = HINIC_MTU_TO_PKTLEN(mtu);
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > HINIC_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 21/22] net/nfp: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (19 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 20/22] net/hinic: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 22/22] net/liquidio: " Steve Yang
                     ` (24 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU'.

Fixes: d4a27a3b092a ("nfp: add basic features")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/nfp/nfp_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 1608bf5ea1..9ea24e5bda 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1508,7 +1508,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	/* switch to jumbo mode if needed */
-	if ((uint32_t)mtu > RTE_ETHER_MAX_LEN)
+	if ((uint32_t)mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 22/22] net/liquidio: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (20 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 21/22] net/nfp: " Steve Yang
@ 2020-12-17  9:23   ` Steve Yang
  2021-01-13 11:32   ` [dpdk-dev] [PATCH v2 00/22] fix rx packets dropped issue Ferruh Yigit
                     ` (23 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2020-12-17  9:23 UTC (permalink / raw)
  To: dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ferruh.yigit, ivan.boule, konstantin.ananyev, samuel.gauthier,
	david.marchand, shahafs, stephen, maxime.coquelin, olivier.matz,
	lihuisong, shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero,
	Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 9f1c00266d82 ("net/liquidio: add API to set MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/liquidio/lio_ethdev.c | 2 +-
 drivers/net/liquidio/lio_ethdev.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index d4dd3768cd..eb0fdab45a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -481,7 +481,7 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 		return -1;
 	}
 
-	if (frame_len > RTE_ETHER_MAX_LEN)
+	if (frame_len > LIO_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/liquidio/lio_ethdev.h b/drivers/net/liquidio/lio_ethdev.h
index 74cd2fb6c6..d33be1c44d 100644
--- a/drivers/net/liquidio/lio_ethdev.h
+++ b/drivers/net/liquidio/lio_ethdev.h
@@ -13,6 +13,9 @@
 #define LIO_LSC_TIMEOUT		100000 /* 100000us (100ms) */
 #define LIO_MAX_CMD_TIMEOUT     10000 /* 10000ms (10s) */
 
+/* The max frame size with default MTU */
+#define LIO_ETH_MAX_LEN (RTE_ETHER_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 #define LIO_DEV(_eth_dev)		((_eth_dev)->data->dev_private)
 
 /* LIO Response condition variable */
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v2 05/22] net/e1000: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 05/22] net/e1000: " Steve Yang
@ 2020-12-18  2:42     ` Guo, Jia
  0 siblings, 0 replies; 115+ messages in thread
From: Guo, Jia @ 2020-12-18  2:42 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Lu, Wenzhuo, Xing, Beilei, Iremonger, Bernard, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, Wang, Haiyue,
	g.singh, xuanziyang2, cloud.wangxiaoyun, zhouguoyang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, Wu, Jingjing, Yang,
	Qiming, Zhang, Qi Z, Xu, Rosen, sthotton, srinivasan,
	heinrich.kuhn, hkalra, jerinj, ndabilpuram, kirankumark, rmody,
	shshaikh, andrew.rybchenko, mczekaj, thomas, Yigit, Ferruh,
	ivan.boule, Ananyev, Konstantin, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, Zhang, Helin, yanglong.wu, xiaolong.ye, Xu, Ting,
	Li, Xiaoyun, Wei, Dan, Pei, Andy, vattunuru, skori, sony.chacko,
	Richardson, Bruce, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, Zhao1, Wei, Jiang, JunyuX, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero, Yang,
	SteveX

Acked-by: Jeff Guo <jia.guo@intel.com>

> -----Original Message-----
> From: Steve Yang <stevex.yang@intel.com>
> Sent: Thursday, December 17, 2020 5:23 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; asomalap@amd.com;
> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
> sachin.saxena@oss.nxp.com; Guo, Jia <jia.guo@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; g.singh@nxp.com; xuanziyang2@huawei.com;
> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
> xavier.huwei@huawei.com; humin29@huawei.com;
> yisen.zhuang@huawei.com; oulijun@huawei.com; Wu, Jingjing
> <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi
> Z <qi.z.zhang@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> sthotton@marvell.com; srinivasan@marvell.com;
> heinrich.kuhn@netronome.com; hkalra@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; kirankumark@marvell.com;
> rmody@marvell.com; shshaikh@marvell.com;
> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com;
> thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
> ivan.boule@6wind.com; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; samuel.gauthier@6wind.com;
> david.marchand@6wind.com; shahafs@mellanox.com;
> stephen@networkplumber.org; maxime.coquelin@redhat.com;
> olivier.matz@6wind.com; lihuisong@huawei.com; shreyansh.jain@nxp.com;
> wei.dai@intel.com; fengchunsong@huawei.com; chenhao164@huawei.com;
> tangchengchang@hisilicon.com; Zhang, Helin <helin.zhang@intel.com>;
> yanglong.wu@intel.com; xiaolong.ye@intel.com; Xu, Ting
> <ting.xu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wei, Dan
> <dan.wei@intel.com>; Pei, Andy <andy.pei@intel.com>;
> vattunuru@marvell.com; skori@marvell.com; sony.chacko@qlogic.com;
> Richardson, Bruce <bruce.richardson@intel.com>; ivan.malov@oktetlabs.ru;
> rad@semihalf.com; slawomir.rosek@semihalf.com;
> kamil.rytarowski@caviumnetworks.com; Zhao1, Wei <wei.zhao1@intel.com>;
> Jiang, JunyuX <junyux.jiang@intel.com>; kumaras@chelsio.com;
> girish.nandibasappa@amd.com; rolf.neugebauer@netronome.com;
> alejandro.lucero@netronome.com; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v2 05/22] net/e1000: fix the jumbo frame flag condition for
> mtu set
> 
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
> but the Ether overhead is larger than 18 when it supports VLAN tag. That will
> cause the jumbo flag rx offload is wrong when MTU size is 'RTE_ETHER_MTU'.
> 
> This fix will change the boundary condition with 'RTE_ETHER_MTU' and
> overhead.
> 
> Fixes: ef990fb56e55 ("net/e1000: convert to new Rx offloads API")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  drivers/net/e1000/e1000_ethdev.h | 2 +-
>  drivers/net/e1000/em_ethdev.c    | 5 ++---
>  drivers/net/e1000/igb_ethdev.c   | 2 +-
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/e1000/e1000_ethdev.h
> b/drivers/net/e1000/e1000_ethdev.h
> index 4755a5f333..3b4d9c3ee6 100644
> --- a/drivers/net/e1000/e1000_ethdev.h
> +++ b/drivers/net/e1000/e1000_ethdev.h
> @@ -97,7 +97,7 @@
>   */
>  #define E1000_ETH_OVERHEAD (RTE_ETHER_HDR_LEN +
> RTE_ETHER_CRC_LEN + \
>  				VLAN_TAG_SIZE)
> -
> +#define E1000_ETH_MAX_LEN (RTE_ETHER_MTU + E1000_ETH_OVERHEAD)
>  /*
>   * Maximum number of Ring Descriptors.
>   *
> diff --git a/drivers/net/e1000/em_ethdev.c
> b/drivers/net/e1000/em_ethdev.c index 8ee9422bf4..2036c6e917 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -1799,8 +1799,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
>  	if (ret != 0)
>  		return ret;
> 
> -	frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
> -		VLAN_TAG_SIZE;
> +	frame_size = mtu + E1000_ETH_OVERHEAD;
> 
>  	/* check that mtu is within the allowed range */
>  	if (mtu < RTE_ETHER_MIN_MTU || frame_size >
> dev_info.max_rx_pktlen) @@ -1816,7 +1815,7 @@ eth_em_mtu_set(struct
> rte_eth_dev *dev, uint16_t mtu)
>  	rctl = E1000_READ_REG(hw, E1000_RCTL);
> 
>  	/* switch to jumbo mode if needed */
> -	if (frame_size > RTE_ETHER_MAX_LEN) {
> +	if (frame_size > E1000_ETH_MAX_LEN) {
>  		dev->data->dev_conf.rxmode.offloads |=
>  			DEV_RX_OFFLOAD_JUMBO_FRAME;
>  		rctl |= E1000_RCTL_LPE;
> diff --git a/drivers/net/e1000/igb_ethdev.c
> b/drivers/net/e1000/igb_ethdev.c index 647aa8d995..dfe87508c2 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -4369,7 +4369,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
>  	rctl = E1000_READ_REG(hw, E1000_RCTL);
> 
>  	/* switch to jumbo mode if needed */
> -	if (frame_size > RTE_ETHER_MAX_LEN) {
> +	if (frame_size > E1000_ETH_MAX_LEN) {
>  		dev->data->dev_conf.rxmode.offloads |=
>  			DEV_RX_OFFLOAD_JUMBO_FRAME;
>  		rctl |= E1000_RCTL_LPE;
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
@ 2020-12-18  2:43     ` Guo, Jia
  0 siblings, 0 replies; 115+ messages in thread
From: Guo, Jia @ 2020-12-18  2:43 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Lu, Wenzhuo, Xing, Beilei, Iremonger, Bernard, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, Wang, Haiyue,
	g.singh, xuanziyang2, cloud.wangxiaoyun, zhouguoyang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, Wu, Jingjing, Yang,
	Qiming, Zhang, Qi Z, Xu, Rosen, sthotton, srinivasan,
	heinrich.kuhn, hkalra, jerinj, ndabilpuram, kirankumark, rmody,
	shshaikh, andrew.rybchenko, mczekaj, thomas, Yigit, Ferruh,
	ivan.boule, Ananyev, Konstantin, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, Zhang, Helin, yanglong.wu, xiaolong.ye, Xu, Ting,
	Li, Xiaoyun, Wei, Dan, Pei, Andy, vattunuru, skori, sony.chacko,
	Richardson, Bruce, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, Zhao1, Wei, Jiang, JunyuX, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero, Yang,
	SteveX

Acked-by: Jeff Guo <jia.guo@intel.com>

> -----Original Message-----
> From: Steve Yang <stevex.yang@intel.com>
> Sent: Thursday, December 17, 2020 5:23 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; asomalap@amd.com;
> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
> sachin.saxena@oss.nxp.com; Guo, Jia <jia.guo@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; g.singh@nxp.com; xuanziyang2@huawei.com;
> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
> xavier.huwei@huawei.com; humin29@huawei.com;
> yisen.zhuang@huawei.com; oulijun@huawei.com; Wu, Jingjing
> <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi
> Z <qi.z.zhang@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> sthotton@marvell.com; srinivasan@marvell.com;
> heinrich.kuhn@netronome.com; hkalra@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; kirankumark@marvell.com;
> rmody@marvell.com; shshaikh@marvell.com;
> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com;
> thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
> ivan.boule@6wind.com; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; samuel.gauthier@6wind.com;
> david.marchand@6wind.com; shahafs@mellanox.com;
> stephen@networkplumber.org; maxime.coquelin@redhat.com;
> olivier.matz@6wind.com; lihuisong@huawei.com; shreyansh.jain@nxp.com;
> wei.dai@intel.com; fengchunsong@huawei.com; chenhao164@huawei.com;
> tangchengchang@hisilicon.com; Zhang, Helin <helin.zhang@intel.com>;
> yanglong.wu@intel.com; xiaolong.ye@intel.com; Xu, Ting
> <ting.xu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wei, Dan
> <dan.wei@intel.com>; Pei, Andy <andy.pei@intel.com>;
> vattunuru@marvell.com; skori@marvell.com; sony.chacko@qlogic.com;
> Richardson, Bruce <bruce.richardson@intel.com>; ivan.malov@oktetlabs.ru;
> rad@semihalf.com; slawomir.rosek@semihalf.com;
> kamil.rytarowski@caviumnetworks.com; Zhao1, Wei <wei.zhao1@intel.com>;
> Jiang, JunyuX <junyux.jiang@intel.com>; kumaras@chelsio.com;
> girish.nandibasappa@amd.com; rolf.neugebauer@netronome.com;
> alejandro.lucero@netronome.com; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition
> 
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
> If the Ether overhead is larger than 18 when it supports VLAN tag, that will
> cause the jumbo flag rx offload is wrong when MTU size is 'RTE_ETHER_MTU'.
> 
> This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
> and overhead even though current overhead is 18.
> 
> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
> Fixes: 95a27b3ba5f5 ("net/ixgbe: enable jumbo frame for VF")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-  drivers/net/ixgbe/ixgbe_ethdev.h
> | 3 +++
>  drivers/net/ixgbe/ixgbe_pf.c     | 2 +-
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index d7a1806ab8..fa0f5afd03 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -5173,7 +5173,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
>  	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
> 
>  	/* switch to jumbo mode if needed */
> -	if (frame_size > RTE_ETHER_MAX_LEN) {
> +	if (frame_size > IXGBE_ETH_MAX_LEN) {
>  		dev->data->dev_conf.rxmode.offloads |=
>  			DEV_RX_OFFLOAD_JUMBO_FRAME;
>  		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> b/drivers/net/ixgbe/ixgbe_ethdev.h
> index 3d35ea791b..a0ce18ca24 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -104,6 +104,9 @@
>  /* The overhead from MTU to max frame size. */  #define
> IXGBE_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
> 
> +/* The max frame size with default MTU */ #define IXGBE_ETH_MAX_LEN
> +(RTE_ETHER_MTU + IXGBE_ETH_OVERHEAD)
> +
>  /* bit of VXLAN tunnel type | 7 bits of zeros  | 8 bits of zeros*/
>  #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE    0x8000
>  /* bit of NVGRE tunnel type | 7 bits of zeros  | 8 bits of zeros*/ diff --git
> a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index
> 833863af5a..89698e8470 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -575,7 +575,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev,
> __rte_unused uint32_t vf, uint32_t *ms
>  		   IXGBE_MHADD_MFS_MASK) >>
> IXGBE_MHADD_MFS_SHIFT;
>  	if (max_frs < new_mtu) {
>  		hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
> -		if (new_mtu > RTE_ETHER_MAX_LEN) {
> +		if (new_mtu > IXGBE_ETH_MAX_LEN) {
>  			dev->data->dev_conf.rxmode.offloads |=
>  				DEV_RX_OFFLOAD_JUMBO_FRAME;
>  			hlreg0 |= IXGBE_HLREG0_JUMBOEN;
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
@ 2020-12-18  2:44     ` Guo, Jia
  0 siblings, 0 replies; 115+ messages in thread
From: Guo, Jia @ 2020-12-18  2:44 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Lu, Wenzhuo, Xing, Beilei, Iremonger, Bernard, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, Wang, Haiyue,
	g.singh, xuanziyang2, cloud.wangxiaoyun, zhouguoyang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, Wu, Jingjing, Yang,
	Qiming, Zhang, Qi Z, Xu, Rosen, sthotton, srinivasan,
	heinrich.kuhn, hkalra, jerinj, ndabilpuram, kirankumark, rmody,
	shshaikh, andrew.rybchenko, mczekaj, thomas, Yigit, Ferruh,
	ivan.boule, Ananyev, Konstantin, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, Zhang, Helin, yanglong.wu, xiaolong.ye, Xu, Ting,
	Li, Xiaoyun, Wei, Dan, Pei, Andy, vattunuru, skori, sony.chacko,
	Richardson, Bruce, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, Zhao1, Wei, Jiang, JunyuX, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero, Yang,
	SteveX

Acked-by: Jeff Guo <jia.guo@intel.com>

> -----Original Message-----
> From: Steve Yang <stevex.yang@intel.com>
> Sent: Thursday, December 17, 2020 5:23 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; asomalap@amd.com;
> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
> sachin.saxena@oss.nxp.com; Guo, Jia <jia.guo@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; g.singh@nxp.com; xuanziyang2@huawei.com;
> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
> xavier.huwei@huawei.com; humin29@huawei.com;
> yisen.zhuang@huawei.com; oulijun@huawei.com; Wu, Jingjing
> <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi
> Z <qi.z.zhang@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> sthotton@marvell.com; srinivasan@marvell.com;
> heinrich.kuhn@netronome.com; hkalra@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; kirankumark@marvell.com;
> rmody@marvell.com; shshaikh@marvell.com;
> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com;
> thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
> ivan.boule@6wind.com; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; samuel.gauthier@6wind.com;
> david.marchand@6wind.com; shahafs@mellanox.com;
> stephen@networkplumber.org; maxime.coquelin@redhat.com;
> olivier.matz@6wind.com; lihuisong@huawei.com; shreyansh.jain@nxp.com;
> wei.dai@intel.com; fengchunsong@huawei.com; chenhao164@huawei.com;
> tangchengchang@hisilicon.com; Zhang, Helin <helin.zhang@intel.com>;
> yanglong.wu@intel.com; xiaolong.ye@intel.com; Xu, Ting
> <ting.xu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wei, Dan
> <dan.wei@intel.com>; Pei, Andy <andy.pei@intel.com>;
> vattunuru@marvell.com; skori@marvell.com; sony.chacko@qlogic.com;
> Richardson, Bruce <bruce.richardson@intel.com>; ivan.malov@oktetlabs.ru;
> rad@semihalf.com; slawomir.rosek@semihalf.com;
> kamil.rytarowski@caviumnetworks.com; Zhao1, Wei <wei.zhao1@intel.com>;
> Jiang, JunyuX <junyux.jiang@intel.com>; kumaras@chelsio.com;
> girish.nandibasappa@amd.com; rolf.neugebauer@netronome.com;
> alejandro.lucero@netronome.com; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition
> 
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
> but the Ether overhead is larger than 18 when it supports dual VLAN tags.
> That will cause the jumbo flag rx offload is wrong when MTU size is
> 'RTE_ETHER_MTU'.
> 
> This fix will change the boundary condition with 'RTE_ETHER_MTU' and
> overhead.
> 
> Fixes: c1715402df8f ("i40evf: fix jumbo frame support")
> Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration")
> Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
> Fixes: c3ac7c5b0b8a ("net/i40e: convert to new Rx offloads API")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c    |  2 +-
>  drivers/net/i40e/i40e_ethdev.h    |  1 +
>  drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
>  drivers/net/i40e/i40e_fdir.c      |  2 +-
>  drivers/net/i40e/i40e_rxtx.c      |  8 ++++----
>  5 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 2cb18ecc03..d4fcc6c853 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -11770,7 +11770,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 > I40E_ETH_MAX_LEN)
>  		dev_data->dev_conf.rxmode.offloads |=
>  			DEV_RX_OFFLOAD_JUMBO_FRAME;
>  	else
> diff --git a/drivers/net/i40e/i40e_ethdev.h
> b/drivers/net/i40e/i40e_ethdev.h index 696c5aaf7e..1f31a532a1 100644
> --- a/drivers/net/i40e/i40e_ethdev.h
> +++ b/drivers/net/i40e/i40e_ethdev.h
> @@ -281,6 +281,7 @@ struct rte_flow {
>   */
>  #define I40E_ETH_OVERHEAD \
>  	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
> I40E_VLAN_TAG_SIZE * 2)
> +#define I40E_ETH_MAX_LEN (RTE_ETHER_MTU + I40E_ETH_OVERHEAD)
> 
>  #define I40E_RXTX_BYTES_H_16_BIT(bytes) ((bytes) & ~I40E_48_BIT_MASK)
> #define I40E_RXTX_BYTES_L_48_BIT(bytes) ((bytes) & I40E_48_BIT_MASK)
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index c26b036b85..85c65c09ee 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1889,22 +1889,22 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct
> i40e_rx_queue *rxq)
>  	 * Check if the jumbo frame and maximum packet length are set
> correctly
>  	 */
>  	if (dev_data->dev_conf.rxmode.offloads &
> DEV_RX_OFFLOAD_JUMBO_FRAME) {
> -		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
> +		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
>  		    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
>  			PMD_DRV_LOG(ERR, "maximum packet length must
> be "
>  				"larger than %u and smaller than %u, as
> jumbo "
> -				"frame is enabled",
> (uint32_t)RTE_ETHER_MAX_LEN,
> +				"frame is enabled",
> (uint32_t)I40E_ETH_MAX_LEN,
>  					(uint32_t)I40E_FRAME_SIZE_MAX);
>  			return I40E_ERR_CONFIG;
>  		}
>  	} else {
>  		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
> -		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
> +		    rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
>  			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)I40E_ETH_MAX_LEN);
>  			return I40E_ERR_CONFIG;
>  		}
>  	}
> @@ -2825,7 +2825,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 > I40E_ETH_MAX_LEN)
>  		dev_data->dev_conf.rxmode.offloads |=
>  			DEV_RX_OFFLOAD_JUMBO_FRAME;
>  	else
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index
> 50c0eee9f2..449b67b2a9 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -116,7 +116,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
> #endif
>  	rx_ctx.dtype = i40e_header_split_none;
>  	rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
> -	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
> +	rx_ctx.rxmax = I40E_ETH_MAX_LEN;
>  	rx_ctx.tphrdesc_ena = 1;
>  	rx_ctx.tphwdesc_ena = 1;
>  	rx_ctx.tphdata_ena = 1;
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index
> 5df9a9df56..b8859bbff2 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -2797,23 +2797,23 @@ i40e_rx_queue_config(struct i40e_rx_queue
> *rxq)
>  		RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
>  			rxq->rx_buf_len), data-
> >dev_conf.rxmode.max_rx_pkt_len);
>  	if (data->dev_conf.rxmode.offloads &
> DEV_RX_OFFLOAD_JUMBO_FRAME) {
> -		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
> +		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
>  			rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
>  			PMD_DRV_LOG(ERR, "maximum packet length must
> "
>  				    "be larger than %u and smaller than %u,"
>  				    "as jumbo frame is enabled",
> -				    (uint32_t)RTE_ETHER_MAX_LEN,
> +				    (uint32_t)I40E_ETH_MAX_LEN,
>  				    (uint32_t)I40E_FRAME_SIZE_MAX);
>  			return I40E_ERR_CONFIG;
>  		}
>  	} else {
>  		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
> -			rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
> +			rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
>  			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)I40E_ETH_MAX_LEN);
>  			return I40E_ERR_CONFIG;
>  		}
>  	}
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
@ 2020-12-18 10:15     ` Nithin Dabilpuram
  2020-12-21  7:19     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
  1 sibling, 0 replies; 115+ messages in thread
From: Nithin Dabilpuram @ 2020-12-18 10:15 UTC (permalink / raw)
  To: Steve Yang
  Cc: dev, wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, kirankumark, rmody,
	shshaikh, andrew.rybchenko, mczekaj, thomas, ferruh.yigit,
	ivan.boule, konstantin.ananyev, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On Thu, Dec 17, 2020 at 09:23:02AM +0000, Steve Yang wrote:
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
> the Ether overhead is larger than 18 when it supports dual VLAN tags.
> That will cause the jumbo flag rx offload is wrong when MTU size is
> 'RTE_ETHER_MTU'.
> 
> This fix will change the boundary condition with 'RTE_ETHER_MTU' and
> overhead.
> 
> Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  drivers/net/octeontx2/otx2_ethdev.h     | 2 ++
>  drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
> index 3b9871f4dc..99f0469d89 100644
> --- a/drivers/net/octeontx2/otx2_ethdev.h
> +++ b/drivers/net/octeontx2/otx2_ethdev.h
> @@ -51,6 +51,8 @@
>  /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
>  #define NIX_L2_OVERHEAD \
>  	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
> +#define NIX_L2_MAX_LEN \
> +	(RTE_ETHER_MTU + NIX_L2_OVERHEAD)
>  
>  /* HW config of frame size doesn't include FCS */
>  #define NIX_MAX_HW_FRS			9212
> diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
> index b36d37b9f7..963cc285ed 100644
> --- a/drivers/net/octeontx2/otx2_ethdev_ops.c
> +++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
> @@ -58,7 +58,7 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
>  	if (rc)
>  		return rc;
>  
> -	if (frame_size > RTE_ETHER_MAX_LEN)
> +	if (frame_size > NIX_L2_MAX_LEN)
>  		dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
>  	else
>  		dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -- 
> 2.17.1
> 

Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>

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

* Re: [dpdk-dev] [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2020-12-19  0:54     ` Xu, Rosen
  0 siblings, 0 replies; 115+ messages in thread
From: Xu, Rosen @ 2020-12-19  0:54 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Lu, Wenzhuo, Xing, Beilei, Iremonger, Bernard, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, Guo, Jia, Wang,
	Haiyue, g.singh, xuanziyang2, cloud.wangxiaoyun, zhouguoyang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, Wu, Jingjing, Yang,
	Qiming, Zhang, Qi Z, sthotton, srinivasan, heinrich.kuhn, hkalra,
	jerinj, ndabilpuram, kirankumark, rmody, shshaikh,
	andrew.rybchenko, mczekaj, thomas, Yigit, Ferruh, ivan.boule,
	Ananyev, Konstantin, samuel.gauthier, david.marchand, shahafs,
	stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, Zhang, Helin, yanglong.wu, xiaolong.ye, Xu, Ting,
	Li, Xiaoyun, Wei, Dan, Pei, Andy, vattunuru, skori, sony.chacko,
	Richardson, Bruce, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, Zhao1, Wei, Jiang, JunyuX, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero, Yang,
	SteveX

Hi,

> -----Original Message-----
> From: Steve Yang <stevex.yang@intel.com>
> Sent: Thursday, December 17, 2020 17:23
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; asomalap@amd.com;
> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
> sachin.saxena@oss.nxp.com; Guo, Jia <jia.guo@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; g.singh@nxp.com; xuanziyang2@huawei.com;
> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
> xavier.huwei@huawei.com; humin29@huawei.com;
> yisen.zhuang@huawei.com; oulijun@huawei.com; Wu, Jingjing
> <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi
> Z <qi.z.zhang@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> sthotton@marvell.com; srinivasan@marvell.com;
> heinrich.kuhn@netronome.com; hkalra@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; kirankumark@marvell.com;
> rmody@marvell.com; shshaikh@marvell.com;
> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com;
> thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
> ivan.boule@6wind.com; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; samuel.gauthier@6wind.com;
> david.marchand@6wind.com; shahafs@mellanox.com;
> stephen@networkplumber.org; maxime.coquelin@redhat.com;
> olivier.matz@6wind.com; lihuisong@huawei.com; shreyansh.jain@nxp.com;
> wei.dai@intel.com; fengchunsong@huawei.com; chenhao164@huawei.com;
> tangchengchang@hisilicon.com; Zhang, Helin <helin.zhang@intel.com>;
> yanglong.wu@intel.com; xiaolong.ye@intel.com; Xu, Ting
> <ting.xu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wei, Dan
> <dan.wei@intel.com>; Pei, Andy <andy.pei@intel.com>;
> vattunuru@marvell.com; skori@marvell.com; sony.chacko@qlogic.com;
> Richardson, Bruce <bruce.richardson@intel.com>; ivan.malov@oktetlabs.ru;
> rad@semihalf.com; slawomir.rosek@semihalf.com;
> kamil.rytarowski@caviumnetworks.com; Zhao1, Wei <wei.zhao1@intel.com>;
> Jiang, JunyuX <junyux.jiang@intel.com>; kumaras@chelsio.com;
> girish.nandibasappa@amd.com; rolf.neugebauer@netronome.com;
> alejandro.lucero@netronome.com; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for
> mtu set
> 
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
> but the Ether overhead is larger than 18 when it supports dual VLAN tags.
> That will cause the jumbo flag rx offload is wrong when MTU size is
> 'RTE_ETHER_MTU'.
> 
> This fix will change the boundary condition with 'RTE_ETHER_MTU' and
> overhead.
> 
> Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  drivers/net/ipn3ke/ipn3ke_ethdev.h      | 1 +
>  drivers/net/ipn3ke/ipn3ke_representor.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h
> b/drivers/net/ipn3ke/ipn3ke_ethdev.h
> index 9b0cf309c8..a6815a9cca 100644
> --- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
> +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
> @@ -640,6 +640,7 @@ ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
>   */
>  #define IPN3KE_ETH_OVERHEAD \
>  	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
> IPN3KE_VLAN_TAG_SIZE * 2)
> +#define IPN3KE_ETH_MAX_LEN (RTE_ETHER_MTU +
> IPN3KE_ETH_OVERHEAD)
> 
>  #define IPN3KE_MAC_FRAME_SIZE_MAX    9728
>  #define IPN3KE_MAC_RX_FRAME_MAXLENGTH    0x00AE
> diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c
> b/drivers/net/ipn3ke/ipn3ke_representor.c
> index 8a53602576..9e15cce34f 100644
> --- a/drivers/net/ipn3ke/ipn3ke_representor.c
> +++ b/drivers/net/ipn3ke/ipn3ke_representor.c
> @@ -2801,7 +2801,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev,
> uint16_t mtu)
>  		return -EBUSY;
>  	}
> 
> -	if (frame_size > RTE_ETHER_MAX_LEN)
> +	if (frame_size > IPN3KE_ETH_MAX_LEN)
>  		dev_data->dev_conf.rxmode.offloads |=
>  			(uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME);
>  	else
> --
> 2.17.1

Reviewed-by: Rosen Xu <rosen.xu@intel.com>

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

* Re: [dpdk-dev] [EXT] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtu
  2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
@ 2020-12-21  7:16   ` Sunil Kumar Kori
  0 siblings, 0 replies; 115+ messages in thread
From: Sunil Kumar Kori @ 2020-12-21  7:16 UTC (permalink / raw)
  To: Steve Yang, dev
  Cc: hemant.agrawal, sachin.saxena, jia.guo, haiyue.wang,
	xavier.huwei, humin29, yisen.zhuang, oulijun, beilei.xing,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, Harman Kalra,
	Jerin Jacob Kollanukkaran, Nithin Kumar Dabilpuram,
	Kiran Kumar Kokkilagadda, Rasesh Mody, Shahed Shaikh,
	andrew.rybchenko, Maciej Czekaj [C],
	wei.dai, fengchunsong, lihuisong, ferruh.yigit, chenhao164,
	helin.zhang, konstantin.ananyev, yanglong.wu, xiaolong.ye,
	ting.xu, xiaoyun.li, wenzhuo.lu, andy.pei, dan.wei,
	Vamsi Krishna Attunuru, sony.chacko, bruce.richardson,
	ivan.malov, zyta.szpak, slawomir.rosek, rad

>-----Original Message-----
>From: Steve Yang <stevex.yang@intel.com>
>Sent: Wednesday, December 9, 2020 8:46 AM
>To: dev@dpdk.org
>Cc: hemant.agrawal@nxp.com; sachin.saxena@oss.nxp.com;
>jia.guo@intel.com; haiyue.wang@intel.com; xavier.huwei@huawei.com;
>humin29@huawei.com; yisen.zhuang@huawei.com; oulijun@huawei.com;
>beilei.xing@intel.com; jingjing.wu@intel.com; qiming.yang@intel.com;
>qi.z.zhang@intel.com; rosen.xu@intel.com; Harman Kalra
><hkalra@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
>Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
>Kokkilagadda <kirankumark@marvell.com>; Rasesh Mody
><rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>;
>andrew.rybchenko@oktetlabs.ru; Maciej Czekaj [C] <mczekaj@marvell.com>;
>wei.dai@intel.com; fengchunsong@huawei.com; lihuisong@huawei.com;
>ferruh.yigit@intel.com; chenhao164@huawei.com; helin.zhang@intel.com;
>konstantin.ananyev@intel.com; yanglong.wu@intel.com;
>xiaolong.ye@intel.com; ting.xu@intel.com; xiaoyun.li@intel.com;
>wenzhuo.lu@intel.com; andy.pei@intel.com; dan.wei@intel.com; Sunil
>Kumar Kori <skori@marvell.com>; Vamsi Krishna Attunuru
><vattunuru@marvell.com>; sony.chacko@qlogic.com;
>bruce.richardson@intel.com; ivan.malov@oktetlabs.ru;
>zyta.szpak@semihalf.com; slawomir.rosek@semihalf.com;
>rad@semihalf.com; Steve Yang <stevex.yang@intel.com>
>Subject: [EXT] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag
>condition for mtu
>
>External Email
>
>----------------------------------------------------------------------
>The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
>the Ether overhead is larger than 18 when it supports dual VLAN tags.
>That will cause the jumbo flag rx offload is wrong when MTU size is
>'RTE_ETHER_MTU'.
>
>This fix will change the boundary condition with 'RTE_ETHER_MTU'.
>
>Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation")
>
>Signed-off-by: Steve Yang <stevex.yang@intel.com>
>---
> drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c
>b/drivers/net/octeontx2/otx2_ethdev_ops.c
>index b36d37b9f7..170b8fbd91 100644
>--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
>+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
>@@ -58,7 +58,7 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t
>mtu)
> 	if (rc)
> 		return rc;
>
>-	if (frame_size > RTE_ETHER_MAX_LEN)
>+	if (mtu > RTE_ETHER_MTU)
> 		dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> 	else
> 		dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
>--
>2.17.1

Acked-by: Sunil Kumar Kori <skori@mavell.com>


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

* Re: [dpdk-dev] [EXT] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
  2020-12-18 10:15     ` Nithin Dabilpuram
@ 2020-12-21  7:19     ` Sunil Kumar Kori
  1 sibling, 0 replies; 115+ messages in thread
From: Sunil Kumar Kori @ 2020-12-21  7:19 UTC (permalink / raw)
  To: Steve Yang, dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, Shijith Thotton,
	Srisivasubramanian Srinivasan, heinrich.kuhn, Harman Kalra,
	Jerin Jacob Kollanukkaran, Nithin Kumar Dabilpuram,
	Kiran Kumar Kokkilagadda, Rasesh Mody, Shahed Shaikh,
	andrew.rybchenko, Maciej Czekaj [C],
	thomas, ferruh.yigit, ivan.boule, konstantin.ananyev,
	samuel.gauthier, david.marchand, shahafs, stephen,
	maxime.coquelin, olivier.matz, lihuisong, shreyansh.jain,
	wei.dai, fengchunsong, chenhao164, tangchengchang, helin.zhang,
	yanglong.wu, xiaolong.ye, ting.xu, xiaoyun.li, dan.wei, andy.pei,
	Vamsi Krishna Attunuru, sony.chacko, bruce.richardson,
	ivan.malov, rad, slawomir.rosek, kamil.rytarowski, wei.zhao1,
	junyux.jiang, kumaras, girish.nandibasappa, rolf.neugebauer,
	alejandro.lucero

>-----Original Message-----
>From: Steve Yang <stevex.yang@intel.com>
>Sent: Thursday, December 17, 2020 2:53 PM
>To: dev@dpdk.org
>Cc: wenzhuo.lu@intel.com; beilei.xing@intel.com;
>bernard.iremonger@intel.com; asomalap@amd.com;
>rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
>sachin.saxena@oss.nxp.com; jia.guo@intel.com; haiyue.wang@intel.com;
>g.singh@nxp.com; xuanziyang2@huawei.com;
>cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
>xavier.huwei@huawei.com; humin29@huawei.com;
>yisen.zhuang@huawei.com; oulijun@huawei.com; jingjing.wu@intel.com;
>qiming.yang@intel.com; qi.z.zhang@intel.com; rosen.xu@intel.com; Shijith
>Thotton <sthotton@marvell.com>; Srisivasubramanian Srinivasan
><srinivasan@marvell.com>; heinrich.kuhn@netronome.com; Harman Kalra
><hkalra@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
>Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
>Kokkilagadda <kirankumark@marvell.com>; Rasesh Mody
><rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>;
>andrew.rybchenko@oktetlabs.ru; Maciej Czekaj [C] <mczekaj@marvell.com>;
>thomas@monjalon.net; ferruh.yigit@intel.com; ivan.boule@6wind.com;
>konstantin.ananyev@intel.com; samuel.gauthier@6wind.com;
>david.marchand@6wind.com; shahafs@mellanox.com;
>stephen@networkplumber.org; maxime.coquelin@redhat.com;
>olivier.matz@6wind.com; lihuisong@huawei.com; shreyansh.jain@nxp.com;
>wei.dai@intel.com; fengchunsong@huawei.com; chenhao164@huawei.com;
>tangchengchang@hisilicon.com; helin.zhang@intel.com;
>yanglong.wu@intel.com; xiaolong.ye@intel.com; ting.xu@intel.com;
>xiaoyun.li@intel.com; dan.wei@intel.com; andy.pei@intel.com; Vamsi
>Krishna Attunuru <vattunuru@marvell.com>; Sunil Kumar Kori
><skori@marvell.com>; sony.chacko@qlogic.com;
>bruce.richardson@intel.com; ivan.malov@oktetlabs.ru; rad@semihalf.com;
>slawomir.rosek@semihalf.com; kamil.rytarowski@caviumnetworks.com;
>wei.zhao1@intel.com; junyux.jiang@intel.com; kumaras@chelsio.com;
>girish.nandibasappa@amd.com; rolf.neugebauer@netronome.com;
>alejandro.lucero@netronome.com; Steve Yang <stevex.yang@intel.com>
>Subject: [EXT] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag
>condition for mtu
>
>External Email
>
>----------------------------------------------------------------------
>The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
>the Ether overhead is larger than 18 when it supports dual VLAN tags.
>That will cause the jumbo flag rx offload is wrong when MTU size is
>'RTE_ETHER_MTU'.
>
>This fix will change the boundary condition with 'RTE_ETHER_MTU' and
>overhead.
>
>Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation")
>
>Signed-off-by: Steve Yang <stevex.yang@intel.com>
>---
> drivers/net/octeontx2/otx2_ethdev.h     | 2 ++
> drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/octeontx2/otx2_ethdev.h
>b/drivers/net/octeontx2/otx2_ethdev.h
>index 3b9871f4dc..99f0469d89 100644
>--- a/drivers/net/octeontx2/otx2_ethdev.h
>+++ b/drivers/net/octeontx2/otx2_ethdev.h
>@@ -51,6 +51,8 @@
> /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
> #define NIX_L2_OVERHEAD \
> 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
>+#define NIX_L2_MAX_LEN \
>+	(RTE_ETHER_MTU + NIX_L2_OVERHEAD)
>
> /* HW config of frame size doesn't include FCS */
> #define NIX_MAX_HW_FRS			9212
>diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c
>b/drivers/net/octeontx2/otx2_ethdev_ops.c
>index b36d37b9f7..963cc285ed 100644
>--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
>+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
>@@ -58,7 +58,7 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t
>mtu)
> 	if (rc)
> 		return rc;
>
>-	if (frame_size > RTE_ETHER_MAX_LEN)
>+	if (frame_size > NIX_L2_MAX_LEN)
> 		dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> 	else
> 		dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
>--
>2.17.1

Acked-by: Sunil Kumar Kori <skori@mavell.com>

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

* Re: [dpdk-dev] [EXT] [PATCH v2 11/22] net/octeontx: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 11/22] net/octeontx: " Steve Yang
@ 2020-12-21 15:04     ` Harman Kalra
  0 siblings, 0 replies; 115+ messages in thread
From: Harman Kalra @ 2020-12-21 15:04 UTC (permalink / raw)
  To: Steve Yang
  Cc: dev, wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, jerinj, ndabilpuram, kirankumark,
	rmody, shshaikh, andrew.rybchenko, mczekaj, thomas, ferruh.yigit,
	ivan.boule, konstantin.ananyev, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On Thu, Dec 17, 2020 at 09:23:01AM +0000, Steve Yang wrote:
> External Email
> 
> ----------------------------------------------------------------------
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, but
> the Ether overhead is larger than 18 when it supports dual VLAN tags.
> That will cause the jumbo flag rx offload is wrong when MTU size is
> 'RTE_ETHER_MTU'.
> 
> This fix will change the boundary condition with 'RTE_ETHER_MTU' and
> overhead.
> 
> Fixes: 3151e6a687a3 ("net/octeontx: support MTU")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>


Acked-by: Harman Kalra <hkalra@marvell.com>

> ---
>  drivers/net/octeontx/octeontx_ethdev.c | 2 +-
>  drivers/net/octeontx/octeontx_ethdev.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
> index 3ee7b043fd..81779885d5 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -552,7 +552,7 @@ octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
>  	if (rc)
>  		return rc;
>  
> -	if (frame_size > RTE_ETHER_MAX_LEN)
> +	if (frame_size > OCCTX_L2_MAX_LEN)
>  		nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
>  	else
>  		nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
> index 7246fb6d1d..780a094ffa 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.h
> +++ b/drivers/net/octeontx/octeontx_ethdev.h
> @@ -44,6 +44,7 @@
>  /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
>  #define OCCTX_L2_OVERHEAD	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
>  				 OCCTX_MAX_VTAG_ACT_SIZE)
> +#define OCCTX_L2_MAX_LEN	(RTE_ETHER_MTU + OCCTX_L2_OVERHEAD)
>  
>  /* Since HW FRS includes NPC VTAG insertion space, user has reduced FRS */
>  #define OCCTX_MAX_FRS	\
> -- 
> 2.17.1
> 

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

* Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
@ 2020-12-28 14:51     ` Andrew Rybchenko
  2021-01-13 10:32       ` Ferruh Yigit
  2020-12-30 10:19     ` oulijun
  1 sibling, 1 reply; 115+ messages in thread
From: Andrew Rybchenko @ 2020-12-28 14:51 UTC (permalink / raw)
  To: Steve Yang, dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, mczekaj, thomas, ferruh.yigit,
	ivan.boule, konstantin.ananyev, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On 12/17/20 12:22 PM, Steve Yang wrote:
> If max rx packet length is smaller then MTU + Ether overhead, that will
> drop all MTU size packets.
> 
> Update the MTU size according to the max rx packet and Ether overhead.
> 
> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 17ddacc78d..ff6a1e675f 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -1292,6 +1292,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>  	struct rte_eth_dev *dev;
>  	struct rte_eth_dev_info dev_info;
>  	struct rte_eth_conf orig_conf;
> +	uint16_t overhead_len;
>  	int diag;
>  	int ret;
>  
> @@ -1323,6 +1324,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>  	if (ret != 0)
>  		goto rollback;
>  
> +	/* Get the real Ethernet overhead length */
> +	if (dev_info.max_mtu &&

First of all I'm not sure that we need to handle 0 value
separately. Or it should be checked separately and trigger
an error since it is a driver mis-behaviour.

If kept, it should be compared vs 0 explicitly in accordance
with DPDK coding style.

> +	    dev_info.max_mtu != UINT16_MAX &&
> +	    dev_info.max_rx_pktlen &&

It should be compared vs 0 explicitly in accordance
with DPDK coding style.

> +	    dev_info.max_rx_pktlen > dev_info.max_mtu)
> +		overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
> +	else
> +		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> +
>  	/* If number of queues specified by application for both Rx and Tx is
>  	 * zero, use driver preferred values. This cannot be done individually
>  	 * as it is valid for either Tx or Rx (but not both) to be zero.
> @@ -1410,13 +1420,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>  			goto rollback;
>  		}
>  	} else {
> -		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
> -			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
> +		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
> +		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
> +			pktlen > RTE_ETHER_MTU + overhead_len)

Alignment looks misleading. Either two tabs or just 4 spaces.

>  			/* Use default value */
>  			dev->data->dev_conf.rxmode.max_rx_pkt_len =
> -							RTE_ETHER_MAX_LEN;
> +						RTE_ETHER_MTU + overhead_len;
>  	}
>  
> +	/* Scale the MTU size to adapt max_rx_pkt_len */
> +	dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
> +				overhead_len;
> +

Is it expected side effect that re-configure always resets
previously set MTU. I.e.:
   configure -> set_mtu -> start -> stop -> re-configure
and set MTU is lost.

>  	/*
>  	 * If LRO is enabled, check that the maximum aggregated packet
>  	 * size is supported by the configured device.
> 


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

* Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
  2020-12-28 14:51     ` Andrew Rybchenko
@ 2020-12-30 10:19     ` oulijun
       [not found]       ` <DM6PR11MB43627F10DDAFC9801816FF5BF9D00@DM6PR11MB4362.namprd11.prod.outlook.com>
  1 sibling, 1 reply; 115+ messages in thread
From: oulijun @ 2020-12-30 10:19 UTC (permalink / raw)
  To: Steve Yang, dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, jingjing.wu,
	qiming.yang, qi.z.zhang, rosen.xu, sthotton, srinivasan,
	heinrich.kuhn, hkalra, jerinj, ndabilpuram, kirankumark, rmody,
	shshaikh, andrew.rybchenko, mczekaj, thomas, ferruh.yigit,
	ivan.boule, konstantin.ananyev, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero



在 2020/12/17 17:22, Steve Yang 写道:
> If max rx packet length is smaller then MTU + Ether overhead, that will
> drop all MTU size packets.
> 
> Update the MTU size according to the max rx packet and Ether overhead.
> 
> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>   lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 17ddacc78d..ff6a1e675f 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -1292,6 +1292,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   	struct rte_eth_dev *dev;
>   	struct rte_eth_dev_info dev_info;
>   	struct rte_eth_conf orig_conf;
> +	uint16_t overhead_len;
>   	int diag;
>   	int ret;
>   
> @@ -1323,6 +1324,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   	if (ret != 0)
>   		goto rollback;
>   
> +	/* Get the real Ethernet overhead length */
> +	if (dev_info.max_mtu &&
> +	    dev_info.max_mtu != UINT16_MAX &&
> +	    dev_info.max_rx_pktlen &&
> +	    dev_info.max_rx_pktlen > dev_info.max_mtu)
> +		overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
> +	else
> +		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> +
>   	/* If number of queues specified by application for both Rx and Tx is
>   	 * zero, use driver preferred values. This cannot be done individually
>   	 * as it is valid for either Tx or Rx (but not both) to be zero.
> @@ -1410,13 +1420,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   			goto rollback;
>   		}
>   	} else {
> -		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
> -			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
> +		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
> +		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
> +			pktlen > RTE_ETHER_MTU + overhead_len)
>   			/* Use default value */
>   			dev->data->dev_conf.rxmode.max_rx_pkt_len =
> -							RTE_ETHER_MAX_LEN;
> +						RTE_ETHER_MTU + overhead_len;
>   	}
>   
> +	/* Scale the MTU size to adapt max_rx_pkt_len */
> +	dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
> +				overhead_len;
> +
Hi
   I think the dev->data->mtu should be updated after configured 
success. So the update in this position seems unreasonable. 
'max_rx_pkt_len' is only used when jumbo_frame enabled, as follows:
struct rte_eth_rxmode {
	.....
	uint32_t max_rx_pkt_len;  /**< Only used if JUMBO_FRAME enabled. */
	/** Maximum allowed size of LRO aggregated packet. */
	....};

So If DEV_RX_OFFLOAD_JUMBO_FRAME is set to rxmode.offload, driver should 
configure mtu to hardware according to 'max_rx_pkt_len' and update 
dev->data->mtu. This seems more reasonable. And some PMD drivers are 
already doing this.

In addition, validity check for 'max_rx_pkt_len' in 
rte_eth_dev_configure API may be error. It should be greater than 
'RTE_ETHER_MTU + overhead_len'.
Because driver must enable DEV_RX_OFFLOAD_JUMBO_FRAME when user set mtu 
with greater than 1500 by 'rte_eth_dev_set_mtu' API.

What do you think?

Thanks
Lijun Ou

>   	/*
>   	 * If LRO is enabled, check that the maximum aggregated packet
>   	 * size is supported by the configured device.
> 

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

* Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
       [not found]       ` <DM6PR11MB43627F10DDAFC9801816FF5BF9D00@DM6PR11MB4362.namprd11.prod.outlook.com>
@ 2021-01-13 10:25         ` Ferruh Yigit
  2021-01-13 11:04         ` Ferruh Yigit
  1 sibling, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-13 10:25 UTC (permalink / raw)
  To: Yang, SteveX, oulijun, dev
  Cc: Lu, Wenzhuo, Xing, Beilei, Iremonger, Bernard, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, Guo, Jia, Wang,
	Haiyue, g.singh, xuanziyang2, cloud.wangxiaoyun, zhouguoyang,
	xavier.huwei, humin29, yisen.zhuang, Wu, Jingjing, Yang, Qiming,
	Zhang, Qi Z, Xu, Rosen, sthotton, srinivasan, heinrich.kuhn,
	hkalra, jerinj, ndabilpuram, kirankumark, rmody, shshaikh,
	andrew.rybchenko, mczekaj, thomas, ivan.boule, Ananyev,
	Konstantin, samuel.gauthier, david.marchand, shahafs, stephen,
	maxime.coquelin, olivier.matz, lihuisong, shreyansh.jain,
	wei.dai, fengchunsong, chenhao164, tangchengchang, Zhang, Helin,
	yanglong.wu, xiaolong.ye, Xu, Ting, Li, Xiaoyun, Wei, Dan, Pei,
	Andy, vattunuru, skori, sony.chacko, Richardson, Bruce,
	ivan.malov, rad, slawomir.rosek, kamil.rytarowski, Jiang, JunyuX,
	kumaras, girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On 1/6/2021 3:36 AM, Yang, SteveX wrote:
> Hi Lijun,
> 
> Thanks for your review. Please check my comments inline.
> Regards,
> Steve Yang.
> 
>> -----Original Message-----
>> From: oulijun <oulijun@huawei.com>
>> Sent: Wednesday, December 30, 2020 6:20 PM
>> To: Yang, SteveX <stevex.yang@intel.com>; dev@dpdk.org
>> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
>> <beilei.xing@intel.com>; Iremonger, Bernard
>> <bernard.iremonger@intel.com>; asomalap@amd.com;
>> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
>> sachin.saxena@oss.nxp.com; Guo, Jia <jia.guo@intel.com>; Wang, Haiyue
>> <haiyue.wang@intel.com>; g.singh@nxp.com; xuanziyang2@huawei.com;
>> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
>> xavier.huwei@huawei.com; humin29@huawei.com;
>> yisen.zhuang@huawei.com; Wu, Jingjing <jingjing.wu@intel.com>; Yang,
>> Qiming <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Xu,
>> Rosen <rosen.xu@intel.com>; sthotton@marvell.com;
>> srinivasan@marvell.com; heinrich.kuhn@netronome.com;
>> hkalra@marvell.com; jerinj@marvell.com; ndabilpuram@marvell.com;
>> kirankumark@marvell.com; rmody@marvell.com; shshaikh@marvell.com;
>> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com;
>> thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
>> ivan.boule@6wind.com; Ananyev, Konstantin
>> <konstantin.ananyev@intel.com>; samuel.gauthier@6wind.com;
>> david.marchand@6wind.com; shahafs@mellanox.com;
>> stephen@networkplumber.org; maxime.coquelin@redhat.com;
>> olivier.matz@6wind.com; lihuisong@huawei.com; shreyansh.jain@nxp.com;
>> wei.dai@intel.com; fengchunsong@huawei.com; chenhao164@huawei.com;
>> tangchengchang@hisilicon.com; Zhang, Helin <helin.zhang@intel.com>;
>> yanglong.wu@intel.com; xiaolong.ye@intel.com; Xu, Ting
>> <ting.xu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wei, Dan
>> <dan.wei@intel.com>; Pei, Andy <andy.pei@intel.com>;
>> vattunuru@marvell.com; skori@marvell.com; sony.chacko@qlogic.com;
>> Richardson, Bruce <bruce.richardson@intel.com>; ivan.malov@oktetlabs.ru;
>> rad@semihalf.com; slawomir.rosek@semihalf.com;
>> kamil.rytarowski@caviumnetworks.com; Zhao1, Wei <wei.zhao1@intel.com>;
>> Jiang, JunyuX <junyux.jiang@intel.com>; kumaras@chelsio.com;
>> girish.nandibasappa@amd.com; rolf.neugebauer@netronome.com;
>> alejandro.lucero@netronome.com
>> Subject: Re: [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet
>> length
>>
>>
>>
>> 在 2020/12/17 17:22, Steve Yang 写道:
>>> If max rx packet length is smaller then MTU + Ether overhead, that
>>> will drop all MTU size packets.
>>>
>>> Update the MTU size according to the max rx packet and Ether overhead.
>>>
>>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>>
>>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>>> ---
>>>    lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++---
>>>    1 file changed, 18 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/lib/librte_ethdev/rte_ethdev.c
>>> b/lib/librte_ethdev/rte_ethdev.c index 17ddacc78d..ff6a1e675f 100644
>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>> @@ -1292,6 +1292,7 @@ rte_eth_dev_configure(uint16_t port_id,
>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>    struct rte_eth_dev *dev;
>>>    struct rte_eth_dev_info dev_info;
>>>    struct rte_eth_conf orig_conf;
>>> +uint16_t overhead_len;
>>>    int diag;
>>>    int ret;
>>>
>>> @@ -1323,6 +1324,15 @@ rte_eth_dev_configure(uint16_t port_id,
>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>    if (ret != 0)
>>>    goto rollback;
>>>
>>> +/* Get the real Ethernet overhead length */
>>> +if (dev_info.max_mtu &&
>>> +    dev_info.max_mtu != UINT16_MAX &&
>>> +    dev_info.max_rx_pktlen &&
>>> +    dev_info.max_rx_pktlen > dev_info.max_mtu)
>>> +overhead_len = dev_info.max_rx_pktlen -
>> dev_info.max_mtu;
>>> +else
>>> +overhead_len = RTE_ETHER_HDR_LEN +
>> RTE_ETHER_CRC_LEN;
>>> +
>>>    /* If number of queues specified by application for both Rx and Tx is
>>>     * zero, use driver preferred values. This cannot be done individually
>>>     * as it is valid for either Tx or Rx (but not both) to be zero.
>>> @@ -1410,13 +1420,18 @@ rte_eth_dev_configure(uint16_t port_id,
>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>    goto rollback;
>>>    }
>>>    } else {
>>> -if (dev_conf->rxmode.max_rx_pkt_len <
>> RTE_ETHER_MIN_LEN ||
>>> -dev_conf->rxmode.max_rx_pkt_len >
>> RTE_ETHER_MAX_LEN)
>>> +uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>>> +if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>>> +pktlen > RTE_ETHER_MTU + overhead_len)
>>>    /* Use default value */
>>>    dev->data->dev_conf.rxmode.max_rx_pkt_len =
>>> -
>> RTE_ETHER_MAX_LEN;
>>> +RTE_ETHER_MTU +
>> overhead_len;
>>>    }
>>>
>>> +/* Scale the MTU size to adapt max_rx_pkt_len */
>>> +dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>>> +overhead_len;
>>> +
>> Hi
>>     I think the dev->data->mtu should be updated after configured success. So
>> the update in this position seems unreasonable.
> 
> Good suggestion, I've checked some PMDs, and the corresponding assignments are existed within their 'dev_configure_ops'.
> For example: [bnxt_ethdev.c # 1100]
> ```
> if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
> eth_dev->data->mtu =
> eth_dev->data->dev_conf.rxmode.max_rx_pkt_len -
> RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN - VLAN_TAG_SIZE *
> BNXT_NUM_VLANS;
> bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
> }
> ```
> Hence, I will move this 'mtu' assignment to line after '(*dev->dev_ops->dev_configure)(dev)'.

There is a 'rollback' already for the similar reason.

What do you think to store the old MTU and restore it in the rollback if needed? 
So you don't need to change where MTU set.

> Actually, it doesn't matter if it is the JUMBO frame, the 'mtu' must keep pace with 'max_rx_pkt_len' anytime.
> E.g.: if 'mtu' is 1500, and 'max_rx_pkt_len' is set to 1510 by command line, that 'mtu' must be reduced to '1510 - 18 = 1492' in 'dev_configure' phase, even though it is not a Jumbo frame.
> 

According to the API definition:
  max_rx_pkt_len;  /**< Only used if JUMBO_FRAME enabled. */

The concern was removing this check from the ethdev may break some PMDs that 
does not follow the API and use the 'max_rx_pkt_len' even if JUMBO frame offload 
set.

For this release, we can afford to break the PMDs implementing wrong and fix 
them after testing.

>> 'max_rx_pkt_len' is only used when jumbo_frame enabled, as follows:
>> struct rte_eth_rxmode {
>> .....
>> uint32_t max_rx_pkt_len;  /**< Only used if JUMBO_FRAME
>> enabled. */
>> /** Maximum allowed size of LRO aggregated packet. */
>> ....};
>>
>> So If DEV_RX_OFFLOAD_JUMBO_FRAME is set to rxmode.offload, driver
>> should configure mtu to hardware according to 'max_rx_pkt_len' and update
>> dev->data->mtu. This seems more reasonable. And some PMD drivers are
>> already doing this.
> 
>>
>> In addition, validity check for 'max_rx_pkt_len' in
>> rte_eth_dev_configure API may be error. It should be greater than
>> 'RTE_ETHER_MTU + overhead_len'.
>> Because driver must enable DEV_RX_OFFLOAD_JUMBO_FRAME when user
>> set mtu
>> with greater than 1500 by 'rte_eth_dev_set_mtu' API.
>>
> 
> I'm not sure if it is following validity check you mentioned.
>>> +if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>>> +pktlen > RTE_ETHER_MTU + overhead_len)
> If yes, no issue here, because the 'rte_eth_dev_configure' is only used for initializing device,
> and just gives out an initial 'max_rx_pkt_len' value by default. Once user tries to change mtu via 'set mtu',
> the 'max_rx_pkt_len' will be updated to expected value in the 'mtu_set' ops.
> Another aspect, that is the 'disable DEV_RX_OFFLOAD_JUMBO' branch, 'max_rx_pkt_len' must be limited to
> effective max value for non-Jumbo frame.
> 

In the 'disable DEV_RX_OFFLOAD_JUMBO' branch, 'max_rx_pkt_len' should be invalid 
according API doc as mentioned above, I guess Lijun refers to this.

Overall what about updating as following, in 'rte_eth_dev_configure()':

if (offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
   // max_rx_pkt_len checks
   old_mtu = mtu
   mtu = max_rx_pkt_len - overhead_len
}

...

rollback:
  mtu = old_mtu;


>> What do you think?
>>
>> Thanks
>> Lijun Ou
>>
>>>    /*
>>>     * If LRO is enabled, check that the maximum aggregated packet
>>>     * size is supported by the configured device.
>>>


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

* Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
  2020-12-28 14:51     ` Andrew Rybchenko
@ 2021-01-13 10:32       ` Ferruh Yigit
  0 siblings, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-13 10:32 UTC (permalink / raw)
  To: Andrew Rybchenko, Steve Yang, dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, mczekaj, thomas, ivan.boule,
	konstantin.ananyev, samuel.gauthier, david.marchand, shahafs,
	stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On 12/28/2020 2:51 PM, Andrew Rybchenko wrote:
> On 12/17/20 12:22 PM, Steve Yang wrote:
>> If max rx packet length is smaller then MTU + Ether overhead, that will
>> drop all MTU size packets.
>>
>> Update the MTU size according to the max rx packet and Ether overhead.
>>
>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>
>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>> ---
>>   lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++---
>>   1 file changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
>> index 17ddacc78d..ff6a1e675f 100644
>> --- a/lib/librte_ethdev/rte_ethdev.c
>> +++ b/lib/librte_ethdev/rte_ethdev.c
>> @@ -1292,6 +1292,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>>   	struct rte_eth_dev *dev;
>>   	struct rte_eth_dev_info dev_info;
>>   	struct rte_eth_conf orig_conf;
>> +	uint16_t overhead_len;
>>   	int diag;
>>   	int ret;
>>   
>> @@ -1323,6 +1324,15 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>>   	if (ret != 0)
>>   		goto rollback;
>>   
>> +	/* Get the real Ethernet overhead length */
>> +	if (dev_info.max_mtu &&
> 
> First of all I'm not sure that we need to handle 0 value
> separately. Or it should be checked separately and trigger
> an error since it is a driver mis-behaviour.
> 

Agree. Most probably we can drop it, "dev_info.max_mtu != UINT16_MAX" covers the 
case driver doesn't provide any value.

> If kept, it should be compared vs 0 explicitly in accordance
> with DPDK coding style.
> 
>> +	    dev_info.max_mtu != UINT16_MAX &&
>> +	    dev_info.max_rx_pktlen &&
> 
> It should be compared vs 0 explicitly in accordance
> with DPDK coding style.
> 
>> +	    dev_info.max_rx_pktlen > dev_info.max_mtu)
>> +		overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
>> +	else
>> +		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
>> +
>>   	/* If number of queues specified by application for both Rx and Tx is
>>   	 * zero, use driver preferred values. This cannot be done individually
>>   	 * as it is valid for either Tx or Rx (but not both) to be zero.
>> @@ -1410,13 +1420,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>>   			goto rollback;
>>   		}
>>   	} else {
>> -		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>> -			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>> +		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>> +		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>> +			pktlen > RTE_ETHER_MTU + overhead_len)
> 
> Alignment looks misleading. Either two tabs or just 4 spaces.
> 
>>   			/* Use default value */
>>   			dev->data->dev_conf.rxmode.max_rx_pkt_len =
>> -							RTE_ETHER_MAX_LEN;
>> +						RTE_ETHER_MTU + overhead_len;
>>   	}
>>   
>> +	/* Scale the MTU size to adapt max_rx_pkt_len */
>> +	dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>> +				overhead_len;
>> +
> 
> Is it expected side effect that re-configure always resets
> previously set MTU. I.e.:
>     configure -> set_mtu -> start -> stop -> re-configure
> and set MTU is lost.
> 

This is the problem of two APIs updating same/related values, when device 
re-configure with a given 'max_rx_pkt_len', can we know if the intentions is 
update to the value to new provided 'max_rx_pkt_len' or not?

For this case if user want to keep the MTU value, can read the MTU from device 
first and set 'max_rx_pkt_len' according it.

And we can reduce to updating the MTU in the configure() only when JUMBO frame 
offload is requested, that should be when the 'max_rx_pkt_len' is valid only.

>>   	/*
>>   	 * If LRO is enabled, check that the maximum aggregated packet
>>   	 * size is supported by the configured device.
>>
> 


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

* Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
       [not found]       ` <DM6PR11MB43627F10DDAFC9801816FF5BF9D00@DM6PR11MB4362.namprd11.prod.outlook.com>
  2021-01-13 10:25         ` Ferruh Yigit
@ 2021-01-13 11:04         ` Ferruh Yigit
  1 sibling, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-13 11:04 UTC (permalink / raw)
  To: Yang, SteveX, oulijun, dev
  Cc: Lu, Wenzhuo, Xing, Beilei, Iremonger, Bernard, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, Guo, Jia, Wang,
	Haiyue, g.singh, xuanziyang2, cloud.wangxiaoyun, zhouguoyang,
	xavier.huwei, humin29, yisen.zhuang, Wu, Jingjing, Yang, Qiming,
	Zhang, Qi Z, Xu, Rosen, sthotton, srinivasan, heinrich.kuhn,
	hkalra, jerinj, ndabilpuram, kirankumark, rmody, shshaikh,
	andrew.rybchenko, mczekaj, thomas, ivan.boule, Ananyev,
	Konstantin, samuel.gauthier, david.marchand, shahafs, stephen,
	maxime.coquelin, olivier.matz, lihuisong, shreyansh.jain,
	wei.dai, fengchunsong, chenhao164, tangchengchang, Zhang, Helin,
	yanglong.wu, xiaolong.ye, Xu, Ting, Li, Xiaoyun, Wei, Dan, Pei,
	Andy, vattunuru, skori, sony.chacko, Richardson, Bruce,
	ivan.malov, rad, slawomir.rosek, kamil.rytarowski, Jiang, JunyuX,
	kumaras, girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On 1/6/2021 3:36 AM, Yang, SteveX wrote:

<...>

>>> If max rx packet length is smaller then MTU + Ether overhead, that
>>> will drop all MTU size packets.
>>>
>>> Update the MTU size according to the max rx packet and Ether overhead.
>>>

Can you please elaborate the explanation a little more, it is hard to understand 
the problem with above description.

Problem is:
"
Ethdev is using default Ethernet overhead to decide if provided 'max_rx_pkt_len' 
value is bigger than max (non jumbo) MTU value, and limits it to MAX if it is.

Since the application/driver used Ethernet overhead is different than the ethdev 
one, check result is wrong.

If the driver is using Ethernet overhead bigger than the default one, the 
provided 'max_rx_pkt_len' is trimmed down, and in the driver when correct 
Ethernet overhead is used to convert back, the resulting MTU is less than the 
intended one, causing some packets to be dropped.

Like,
app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
driver  -> MTU = 1518 - 22 = 1496
Packets with size 1497-1500 are dropped although intention is to be able to 
send/receive them.

The fix is to make ethdev use the correct Ethernet overhead for port, instead of 
default one.
"

Addition to above, the code reviews suggest slight difference, like dropping the 
ethdev check completely for non-jumbo packets, please reflect them to the commit 
log if changes are implemented.

>>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>>
>>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>>> ---

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

* Re: [dpdk-dev] [PATCH v2 02/22] app/testpmd: fix max rx packet length for VLAN packets
  2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
@ 2021-01-13 11:26     ` Ferruh Yigit
  0 siblings, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-13 11:26 UTC (permalink / raw)
  To: Steve Yang, dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ivan.boule, konstantin.ananyev, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On 12/17/2020 9:22 AM, Steve Yang wrote:
> When the max rx packet length is smaller than the sum of mtu size and
> ether overhead size, it should be enlarged, otherwise the VLAN packets
> will be dropped.
> 
> Removed the rx_offloads assignment for jumbo frame during command line
> parsing, and set the correct jumbo frame flag if MTU size is larger than
> the default value 'RTE_ETHER_MTU' within 'init_config()'.
> 
> Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
> Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
> Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
> Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>

<...>

> @@ -1446,6 +1447,25 @@ init_config(void)
>   			rte_exit(EXIT_FAILURE,
>   				 "rte_eth_dev_info_get() failed\n");
>   
> +		/* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
> +		if (port->dev_info.max_mtu &&

Similar to the ethdev comment, above check can be dropped.

> +		    port->dev_info.max_mtu != UINT16_MAX &&
> +		    port->dev_info.max_rx_pktlen &&
> +		    port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
> +			eth_overhead = port->dev_info.max_rx_pktlen -
> +				port->dev_info.max_mtu;
> +		else
> +			eth_overhead =
> +				RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> +
> +		if (port->dev_conf.rxmode.max_rx_pkt_len <=
> +			(uint32_t)(RTE_ETHER_MTU + eth_overhead))
> +			port->dev_conf.rxmode.max_rx_pkt_len =
> +					RTE_ETHER_MTU + eth_overhead;
> +		else
> +			port->dev_conf.rxmode.offloads |=
> +					DEV_RX_OFFLOAD_JUMBO_FRAME;
> +
>   		if (!(port->dev_info.tx_offload_capa &
>   		      DEV_TX_OFFLOAD_MBUF_FAST_FREE))
>   			port->dev_conf.txmode.offloads &=
> 


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

* Re: [dpdk-dev] [PATCH v2 00/22] fix rx packets dropped issue
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (21 preceding siblings ...)
  2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 22/22] net/liquidio: " Steve Yang
@ 2021-01-13 11:32   ` Ferruh Yigit
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 " Steve Yang
                     ` (22 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-13 11:32 UTC (permalink / raw)
  To: Steve Yang, dev
  Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, asomalap,
	rahul.lakkireddy, hemant.agrawal, sachin.saxena, jia.guo,
	haiyue.wang, g.singh, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, sthotton,
	srinivasan, heinrich.kuhn, hkalra, jerinj, ndabilpuram,
	kirankumark, rmody, shshaikh, andrew.rybchenko, mczekaj, thomas,
	ivan.boule, konstantin.ananyev, samuel.gauthier, david.marchand,
	shahafs, stephen, maxime.coquelin, olivier.matz, lihuisong,
	shreyansh.jain, wei.dai, fengchunsong, chenhao164,
	tangchengchang, helin.zhang, yanglong.wu, xiaolong.ye, ting.xu,
	xiaoyun.li, dan.wei, andy.pei, vattunuru, skori, sony.chacko,
	bruce.richardson, ivan.malov, rad, slawomir.rosek,
	kamil.rytarowski, wei.zhao1, junyux.jiang, kumaras,
	girish.nandibasappa, rolf.neugebauer, alejandro.lucero

On 12/17/2020 9:22 AM, Steve Yang wrote:
> The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition, this
> fix will change the boundary condition with 'RTE_ETHER_MTU' and overhead.
> 
> When the MTU(1500) set, the frame type of rx packet will be different
> if used different overhead, it will cause the consistency issue, and the
> normal packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
> can avoid this issue.
> 
> Following scopes will be changed:
> - 'rte_ethdev'
> - 'app', e.g.: 'test-pmd';
> - net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;
> 
> ---
> v2:
>   - defined the 'RTE_ETHER_MTU + overhead' to 'driver_ETH_MAX_LEN';
>   - changed the 'mtu > RTE_ETHER_MTU' to 'frame_size > driver_ETH_MAX_LEN';
> ---
> 
> Steve Yang (22):
>    ethdev: fix MTU size exceeds max rx packet length
>    app/testpmd: fix max rx packet length for VLAN packets
>    net/dpaa: fix the jumbo frame flag condition for mtu set
>    net/dpaa2: fix the jumbo frame flag condition for mtu set
>    net/e1000: fix the jumbo frame flag condition for mtu set
>    net/hns3: fix the jumbo frame flag condition for mtu set
>    net/i40e: fix the jumbo frame flag condition
>    net/iavf: fix the jumbo frame flag condition
>    net/ice: fix the jumbo frame flag condition
>    net/ipn3ke: fix the jumbo frame flag condition for mtu set
>    net/octeontx: fix the jumbo frame flag condition for mtu set
>    net/octeontx2: fix the jumbo frame flag condition for mtu
>    net/qede: fix the jumbo frame flag condition for mtu set
>    net/sfc: fix the jumbo frame flag condition for mtu set
>    net/thunderx: fix the jumbo frame flag condition for mtu set
>    net/ixgbe: fix the jumbo frame flag condition
>    net/cxgbe: fix the jumbo frame flag condition
>    net/axgbe: fix the jumbo frame flag condition for mtu set
>    net/enetc: fix the jumbo frame flag condition for mtu set
>    net/hinic: fix the jumbo frame flag condition for mtu set
>    net/nfp: fix the jumbo frame flag condition for mtu set
>    net/liquidio: fix the jumbo frame flag condition for mtu set

Driver maintainers please be aware that this set is planned to be merged for 
-rc1, last a few days to review changes to your driver.

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

* [dpdk-dev] [PATCH v3 00/22] fix rx packets dropped issue
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (22 preceding siblings ...)
  2021-01-13 11:32   ` [dpdk-dev] [PATCH v2 00/22] fix rx packets dropped issue Ferruh Yigit
@ 2021-01-14  9:45   ` Steve Yang
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
                     ` (21 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:45 UTC (permalink / raw)
  To: dev
  Cc: thomas, ferruh.yigit, wenzhuo.lu, beilei.xing, bernard.iremonger,
	hemant.agrawal, xavier.huwei, humin29, yisen.zhuang, oulijun,
	jingjing.wu, qiming.yang, qi.z.zhang, rosen.xu, hkalra,
	ndabilpuram, kirankumark, rmody, shshaikh, andrew.rybchenko,
	jerinj, mczekaj, jia.guo, haiyue.wang, rahul.lakkireddy,
	asomalap, g.singh, sachin.saxena, xuanziyang2, cloud.wangxiaoyun,
	zhouguoyang, heinrich.kuhn, sthotton, srinivasan, Steve Yang

The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition, this
fix will change the boundary condition with 'RTE_ETHER_MTU' and overhead.

When the MTU(1500) set, the frame type of rx packet will be different
if used different overhead, it will cause the consistency issue, and the
normal packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
can avoid this issue.

Like,
app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
driver  -> MTU = 1518 - 22 = 1496
Packets with size 1497-1500 are dropped although intention is to be able
to send/receive them.

Following scopes will be changed:
- 'rte_ethdev'
- 'app', e.g.: 'test-pmd';
- net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;

Following scopes perhaps will be impacted:
- the cases of jumbo frame related;
- the logic of 'max_rx_pkt_len' and 'mtu' related;
- the using place of 'RTE_ETHER_MAX_LEN';

---
v3:
 - removed redundant if-conditions in rte_ethdev and testpmd;
 - adjusted the alignment style;
 - added offload check before updating mtu;
v2:
 - defined the 'RTE_ETHER_MTU + overhead' to 'driver_ETH_MAX_LEN';
 - changed the 'mtu > RTE_ETHER_MTU' to 'frame_size > driver_ETH_MAX_LEN';
---

Steve Yang (22):
  ethdev: fix MTU size exceeds max rx packet length
  app/testpmd: fix max rx packet length for VLAN packets
  net/dpaa: fix the jumbo frame flag condition for mtu set
  net/dpaa2: fix the jumbo frame flag condition for mtu set
  net/e1000: fix the jumbo frame flag condition for mtu set
  net/hns3: fix the jumbo frame flag condition for mtu set
  net/i40e: fix the jumbo frame flag condition
  net/iavf: fix the jumbo frame flag condition
  net/ice: fix the jumbo frame flag condition
  net/ipn3ke: fix the jumbo frame flag condition for mtu set
  net/octeontx: fix the jumbo frame flag condition for mtu set
  net/octeontx2: fix the jumbo frame flag condition for mtu
  net/qede: fix the jumbo frame flag condition for mtu set
  net/sfc: fix the jumbo frame flag condition for mtu set
  net/thunderx: fix the jumbo frame flag condition for mtu set
  net/ixgbe: fix the jumbo frame flag condition
  net/cxgbe: fix the jumbo frame flag condition
  net/axgbe: fix the jumbo frame flag condition for mtu set
  net/enetc: fix the jumbo frame flag condition for mtu set
  net/hinic: fix the jumbo frame flag condition for mtu set
  net/nfp: fix the jumbo frame flag condition for mtu set
  net/liquidio: fix the jumbo frame flag condition for mtu set

 app/test-pmd/cmdline.c                    |  6 -----
 app/test-pmd/config.c                     |  2 +-
 app/test-pmd/parameters.c                 |  7 ++----
 app/test-pmd/testpmd.c                    | 18 +++++++++++++++
 drivers/net/axgbe/axgbe_ethdev.c          |  2 +-
 drivers/net/axgbe/axgbe_ethdev.h          |  6 +++++
 drivers/net/cxgbe/cxgbe.h                 |  4 ++++
 drivers/net/cxgbe/cxgbe_ethdev.c          |  4 ++--
 drivers/net/dpaa/dpaa_ethdev.c            |  2 +-
 drivers/net/dpaa/dpaa_ethdev.h            |  4 ++++
 drivers/net/dpaa2/dpaa2_ethdev.c          |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  4 ++++
 drivers/net/e1000/e1000_ethdev.h          |  2 +-
 drivers/net/e1000/em_ethdev.c             |  5 ++---
 drivers/net/e1000/igb_ethdev.c            |  2 +-
 drivers/net/enetc/enetc.h                 |  4 ++++
 drivers/net/enetc/enetc_ethdev.c          |  2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c      |  5 ++++-
 drivers/net/hns3/hns3_ethdev.c            |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c         |  2 +-
 drivers/net/i40e/i40e_ethdev.c            |  2 +-
 drivers/net/i40e/i40e_ethdev.h            |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c         | 10 ++++-----
 drivers/net/i40e/i40e_fdir.c              |  2 +-
 drivers/net/i40e/i40e_rxtx.c              |  8 +++----
 drivers/net/iavf/iavf.h                   |  1 +
 drivers/net/iavf/iavf_ethdev.c            | 10 ++++-----
 drivers/net/ice/ice_dcf_ethdev.c          |  8 +++----
 drivers/net/ice/ice_ethdev.c              |  2 +-
 drivers/net/ice/ice_ethdev.h              |  1 +
 drivers/net/ice/ice_rxtx.c                | 10 ++++-----
 drivers/net/ipn3ke/ipn3ke_ethdev.h        |  1 +
 drivers/net/ipn3ke/ipn3ke_representor.c   |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c          |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h          |  3 +++
 drivers/net/ixgbe/ixgbe_pf.c              |  2 +-
 drivers/net/liquidio/lio_ethdev.c         |  2 +-
 drivers/net/liquidio/lio_ethdev.h         |  3 +++
 drivers/net/nfp/nfp_net.c                 |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c    |  2 +-
 drivers/net/octeontx/octeontx_ethdev.h    |  1 +
 drivers/net/octeontx2/otx2_ethdev.h       |  2 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c   |  2 +-
 drivers/net/qede/qede_ethdev.c            |  2 +-
 drivers/net/qede/qede_rxtx.h              |  1 +
 drivers/net/sfc/sfc_ethdev.c              |  2 +-
 drivers/net/thunderx/base/nicvf_hw_defs.h |  1 +
 drivers/net/thunderx/nicvf_ethdev.c       |  2 +-
 lib/librte_ethdev/rte_ethdev.c            | 27 ++++++++++++++++++++---
 49 files changed, 134 insertions(+), 65 deletions(-)

-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (23 preceding siblings ...)
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 " Steve Yang
@ 2021-01-14  9:45   ` Steve Yang
  2021-01-14 16:36     ` Ferruh Yigit
                       ` (2 more replies)
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
                     ` (20 subsequent siblings)
  45 siblings, 3 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:45 UTC (permalink / raw)
  To: dev; +Cc: thomas, ferruh.yigit, andrew.rybchenko, oulijun, Steve Yang

Ethdev is using default Ethernet overhead to decide if provided
'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
and limits it to MAX if it is.

Since the application/driver used Ethernet overhead is different than
the ethdev one, check result is wrong.

If the driver is using Ethernet overhead bigger than the default one,
the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
correct Ethernet overhead is used to convert back, the resulting MTU is
less than the intended one, causing some packets to be dropped.

Like,
app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
driver  -> MTU = 1518 - 22 = 1496
Packets with size 1497-1500 are dropped although intention is to be able
to send/receive them.

The fix is to make ethdev use the correct Ethernet overhead for port,
instead of default one.

Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 17ddacc78d..19ca4c4512 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_conf orig_conf;
+	uint16_t overhead_len;
 	int diag;
 	int ret;
+	uint16_t old_mtu;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
@@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		memcpy(&dev->data->dev_conf, dev_conf,
 		       sizeof(dev->data->dev_conf));
 
+	/* Backup mtu for rollback */
+	old_mtu = dev->data->mtu;
+
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
 		goto rollback;
 
+	/* Get the real Ethernet overhead length */
+	if (dev_info.max_mtu != UINT16_MAX &&
+	    dev_info.max_rx_pktlen > dev_info.max_mtu)
+		overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
+	else
+		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
 	/* If number of queues specified by application for both Rx and Tx is
 	 * zero, use driver preferred values. This cannot be done individually
 	 * as it is valid for either Tx or Rx (but not both) to be zero.
@@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 			goto rollback;
 		}
 	} else {
-		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
+		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
+		    pktlen > RTE_ETHER_MTU + overhead_len)
 			/* Use default value */
 			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+						RTE_ETHER_MTU + overhead_len;
+	}
+
+	/* Scale the MTU size to adapt max_rx_pkt_len */
+	if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
+		dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
+				overhead_len;
 	}
 
 	/*
@@ -1549,6 +1568,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	eth_dev_tx_queue_config(dev, 0);
 rollback:
 	memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf));
+	if (old_mtu != dev->data->mtu)
+		dev->data->mtu = old_mtu;
 
 	rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret);
 	return ret;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 02/22] app/testpmd: fix max rx packet length for VLAN packets
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (24 preceding siblings ...)
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
@ 2021-01-14  9:45   ` Steve Yang
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (19 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:45 UTC (permalink / raw)
  To: dev; +Cc: wenzhuo.lu, beilei.xing, bernard.iremonger, ferruh.yigit, Steve Yang

When the max rx packet length is smaller than the sum of mtu size and
ether overhead size, it should be enlarged, otherwise the VLAN packets
will be dropped.

Removed the rx_offloads assignment for jumbo frame during command line
parsing, and set the correct jumbo frame flag if MTU size is larger than
the default value 'RTE_ETHER_MTU' within 'init_config()'.

Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 app/test-pmd/cmdline.c    |  6 ------
 app/test-pmd/config.c     |  2 +-
 app/test-pmd/parameters.c |  7 ++-----
 app/test-pmd/testpmd.c    | 18 ++++++++++++++++++
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2ccbaa039e..65042fcff5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1886,7 +1886,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 
 	RTE_ETH_FOREACH_DEV(pid) {
 		struct rte_port *port = &ports[pid];
-		uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
 
 		if (!strcmp(res->name, "max-pkt-len")) {
 			if (res->value < RTE_ETHER_MIN_LEN) {
@@ -1898,11 +1897,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 				return;
 
 			port->dev_conf.rxmode.max_rx_pkt_len = res->value;
-			if (res->value > RTE_ETHER_MAX_LEN)
-				rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
-			else
-				rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-			port->dev_conf.rxmode.offloads = rx_offloads;
 		} else {
 			printf("Unknown parameter\n");
 			return;
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3f6c8642b1..1195f054f3 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1434,7 +1434,7 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
 		 * device supports jumbo frame.
 		 */
 		eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu;
-		if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) {
+		if (mtu > RTE_ETHER_MTU) {
 			rte_port->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 			rte_port->dev_conf.rxmode.max_rx_pkt_len =
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 414a0068fb..df5eb10d84 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -834,12 +834,9 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
 				n = atoi(optarg);
-				if (n >= RTE_ETHER_MIN_LEN) {
+				if (n >= RTE_ETHER_MIN_LEN)
 					rx_mode.max_rx_pkt_len = (uint32_t) n;
-					if (n > RTE_ETHER_MAX_LEN)
-						rx_offloads |=
-							DEV_RX_OFFLOAD_JUMBO_FRAME;
-				} else
+				else
 					rte_exit(EXIT_FAILURE,
 						 "Invalid max-pkt-len=%d - should be > %d\n",
 						 n, RTE_ETHER_MIN_LEN);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 2b60f6c5d3..c256e719ae 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1410,6 +1410,7 @@ init_config(void)
 	struct rte_gro_param gro_param;
 	uint32_t gso_types;
 	uint16_t data_size;
+	uint16_t eth_overhead;
 	bool warning = 0;
 	int k;
 	int ret;
@@ -1446,6 +1447,23 @@ init_config(void)
 			rte_exit(EXIT_FAILURE,
 				 "rte_eth_dev_info_get() failed\n");
 
+		/* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
+		if (port->dev_info.max_mtu != UINT16_MAX &&
+		    port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
+			eth_overhead = port->dev_info.max_rx_pktlen -
+				port->dev_info.max_mtu;
+		else
+			eth_overhead =
+				RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
+		if (port->dev_conf.rxmode.max_rx_pkt_len <=
+			(uint32_t)(RTE_ETHER_MTU + eth_overhead))
+			port->dev_conf.rxmode.max_rx_pkt_len =
+					RTE_ETHER_MTU + eth_overhead;
+		else
+			port->dev_conf.rxmode.offloads |=
+					DEV_RX_OFFLOAD_JUMBO_FRAME;
+
 		if (!(port->dev_info.tx_offload_capa &
 		      DEV_TX_OFFLOAD_MBUF_FAST_FREE))
 			port->dev_conf.txmode.offloads &=
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (25 preceding siblings ...)
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
@ 2021-01-14  9:45   ` Steve Yang
  2021-01-14 10:26     ` Hemant Agrawal
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 04/22] net/dpaa2: " Steve Yang
                     ` (18 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:45 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, sachin.saxena, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 25f854197abc ("net/dpaa: support jumbo frames")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 2 +-
 drivers/net/dpaa/dpaa_ethdev.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index f00279e004..0c87c136d7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -184,7 +184,7 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > DPAA_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 659bceb467..a858b1372c 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -51,6 +51,10 @@
 #define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
 #endif
 
+#define DPAA_ETH_MAX_LEN (RTE_ETHER_MTU + \
+			  RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
+			  VLAN_TAG_SIZE)
+
 /* PCD frame queues */
 #define DPAA_DEFAULT_NUM_PCD_QUEUES	1
 #define DPAA_VSP_PROFILE_MAX_NUM	8
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 04/22] net/dpaa2: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (26 preceding siblings ...)
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14 10:27     ` Hemant Agrawal
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 05/22] net/e1000: " Steve Yang
                     ` (17 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, sachin.saxena, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: e16408499412 ("net/dpaa2: configure jumbo frames")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 2 +-
 drivers/net/dpaa2/dpaa2_ethdev.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index ab6863300e..6f38da3cce 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1420,7 +1420,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > DPAA2_MAX_RX_PKT_LEN)
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > DPAA2_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 8d82f74684..cacb11bd3e 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -26,6 +26,10 @@
 
 #define DPAA2_RX_DEFAULT_NBDESC 512
 
+#define DPAA2_ETH_MAX_LEN (RTE_ETHER_MTU + \
+			   RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
+			   VLAN_TAG_SIZE)
+
 /*default tc to be used for ,congestion, distribution etc configuration. */
 #define DPAA2_DEF_TC		0
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 05/22] net/e1000: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (27 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 04/22] net/dpaa2: " Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 06/22] net/hns3: " Steve Yang
                     ` (16 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: jia.guo, haiyue.wang, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: ef990fb56e55 ("net/e1000: convert to new Rx offloads API")

Acked-by: Jeff Guo <jia.guo@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/e1000_ethdev.h | 2 +-
 drivers/net/e1000/em_ethdev.c    | 5 ++---
 drivers/net/e1000/igb_ethdev.c   | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 4755a5f333..3b4d9c3ee6 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -97,7 +97,7 @@
  */
 #define E1000_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
 				VLAN_TAG_SIZE)
-
+#define E1000_ETH_MAX_LEN (RTE_ETHER_MTU + E1000_ETH_OVERHEAD)
 /*
  * Maximum number of Ring Descriptors.
  *
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 8ee9422bf4..2036c6e917 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1799,8 +1799,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (ret != 0)
 		return ret;
 
-	frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
-		VLAN_TAG_SIZE;
+	frame_size = mtu + E1000_ETH_OVERHEAD;
 
 	/* check that mtu is within the allowed range */
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen)
@@ -1816,7 +1815,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > E1000_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 647aa8d995..dfe87508c2 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -4369,7 +4369,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > E1000_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 06/22] net/hns3: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (28 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 05/22] net/e1000: " Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-18  1:30     ` oulijun
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
                     ` (15 subsequent siblings)
  45 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei, humin29, yisen.zhuang, oulijun, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN',
that perhaps impacts the cases of the jumbo frame related.

Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
Fixes: a5475d61fa34 ("net/hns3: support VF")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 7c34e382fb..10e0c0de46 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2467,7 +2467,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	rte_spinlock_lock(&hw->lock);
-	is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
+	is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false;
 	frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
 
 	/*
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index f09cabcd82..ef03fb1c4e 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -928,7 +928,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		rte_spinlock_unlock(&hw->lock);
 		return ret;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 07/22] net/i40e: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (29 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 06/22] net/hns3: " Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 08/22] net/iavf: " Steve Yang
                     ` (14 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, jia.guo, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: c1715402df8f ("i40evf: fix jumbo frame support")
Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: c3ac7c5b0b8a ("net/i40e: convert to new Rx offloads API")

Acked-by: Jeff Guo <jia.guo@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    |  2 +-
 drivers/net/i40e/i40e_ethdev.h    |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  8 ++++----
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 14622484a0..6074d3d928 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11745,7 +11745,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 > I40E_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 0617fe5e65..c1c429a075 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -283,6 +283,7 @@ struct rte_flow {
  */
 #define I40E_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
+#define I40E_ETH_MAX_LEN (RTE_ETHER_MTU + I40E_ETH_OVERHEAD)
 
 #define I40E_RXTX_BYTES_H_16_BIT(bytes) ((bytes) & ~I40E_48_BIT_MASK)
 #define I40E_RXTX_BYTES_L_48_BIT(bytes) ((bytes) & I40E_48_BIT_MASK)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index dc076ae552..bca8cb80e4 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1899,22 +1899,22 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 	 * Check if the jumbo frame and maximum packet length are set correctly
 	 */
 	if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				"larger than %u and smaller than %u, as jumbo "
-				"frame is enabled", (uint32_t)RTE_ETHER_MAX_LEN,
+				"frame is enabled", (uint32_t)I40E_ETH_MAX_LEN,
 					(uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
@@ -2836,7 +2836,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 > I40E_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 0343e8b09a..f5defcf585 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -116,7 +116,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
 #endif
 	rx_ctx.dtype = i40e_header_split_none;
 	rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = I40E_ETH_MAX_LEN;
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
 	rx_ctx.tphdata_ena = 1;
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 5df9a9df56..b8859bbff2 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2797,23 +2797,23 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
 			rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len);
 	if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 			rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)I40E_ETH_MAX_LEN,
 				    (uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-			rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+			rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 08/22] net/iavf: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (30 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 09/22] net/ice: " Steve Yang
                     ` (13 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, beilei.xing, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf.h        |  1 +
 drivers/net/iavf/iavf_ethdev.c | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index af11268fe3..c934d2e614 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -73,6 +73,7 @@
 #define IAVF_VLAN_TAG_SIZE               4
 #define IAVF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2)
+#define IAVF_ETH_MAX_LEN (RTE_ETHER_MTU + IAVF_ETH_OVERHEAD)
 
 #define IAVF_32_BIT_WIDTH (CHAR_BIT * 4)
 #define IAVF_48_BIT_WIDTH (CHAR_BIT * 6)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index e22c62ed00..250ef6fc9a 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -460,23 +460,23 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= IAVF_ETH_MAX_LEN ||
 		    max_pkt_len > IAVF_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)IAVF_ETH_MAX_LEN,
 				    (uint32_t)IAVF_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > IAVF_ETH_MAX_LEN) {
 			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)IAVF_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -1303,7 +1303,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > IAVF_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 				DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 09/22] net/ice: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (31 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 08/22] net/iavf: " Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (12 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, qi.z.zhang, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine")
Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF")
Fixes: ae2bdd0219cb ("net/ice: support MTU setting")
Fixes: 50370662b727 ("net/ice: support device and queue ops")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_dcf_ethdev.c |  8 ++++----
 drivers/net/ice/ice_ethdev.c     |  2 +-
 drivers/net/ice/ice_ethdev.h     |  1 +
 drivers/net/ice/ice_rxtx.c       | 10 +++++-----
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index a9e78064d4..d46734a57b 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -60,23 +60,23 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index e2799a8eb2..ba533a78ee 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3912,7 +3912,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > ICE_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 899f446cde..2b03c59671 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -135,6 +135,7 @@
  */
 #define ICE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)
+#define ICE_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_ETH_OVERHEAD)
 
 #define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK)
 #define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK)
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index d052bd0f1b..c98328ce0b 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -246,23 +246,23 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
 				   dev->data->dev_conf.rxmode.max_rx_pkt_len);
 
 	if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -701,7 +701,7 @@ ice_fdir_program_hw_rx_queue(struct ice_rx_queue *rxq)
 	rx_ctx.hbuf = rxq->rx_hdr_len >> ICE_RLAN_CTX_HBUF_S;
 	rx_ctx.dtype = 0; /* No Header Split mode */
 	rx_ctx.dsize = 1; /* 32B descriptors */
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = ICE_ETH_MAX_LEN;
 	/* TPH: Transaction Layer Packet (TLP) processing hints */
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (32 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 09/22] net/ice: " Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 11/22] net/octeontx: " Steve Yang
                     ` (11 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: rosen.xu, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")

Reviewed-by: Rosen Xu <rosen.xu@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ipn3ke/ipn3ke_ethdev.h      | 1 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 9b0cf309c8..a6815a9cca 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -640,6 +640,7 @@ ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
  */
 #define IPN3KE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IPN3KE_VLAN_TAG_SIZE * 2)
+#define IPN3KE_ETH_MAX_LEN (RTE_ETHER_MTU + IPN3KE_ETH_OVERHEAD)
 
 #define IPN3KE_MAC_FRAME_SIZE_MAX    9728
 #define IPN3KE_MAC_RX_FRAME_MAXLENGTH    0x00AE
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 8a53602576..9e15cce34f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2801,7 +2801,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > IPN3KE_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			(uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME);
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 11/22] net/octeontx: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (33 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
                     ` (10 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: hkalra, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 3151e6a687a3 ("net/octeontx: support MTU")

Acked-by: Harman Kalra <hkalra@marvell.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 2 +-
 drivers/net/octeontx/octeontx_ethdev.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3ee7b043fd..81779885d5 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -552,7 +552,7 @@ octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > OCCTX_L2_MAX_LEN)
 		nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index 7246fb6d1d..780a094ffa 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -44,6 +44,7 @@
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
 #define OCCTX_L2_OVERHEAD	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
 				 OCCTX_MAX_VTAG_ACT_SIZE)
+#define OCCTX_L2_MAX_LEN	(RTE_ETHER_MTU + OCCTX_L2_OVERHEAD)
 
 /* Since HW FRS includes NPC VTAG insertion space, user has reduced FRS */
 #define OCCTX_MAX_FRS	\
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (34 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 11/22] net/octeontx: " Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (9 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: jerinj, ndabilpuram, kirankumark, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation")

Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx2/otx2_ethdev.h     | 2 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 3b9871f4dc..99f0469d89 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -51,6 +51,8 @@
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
 #define NIX_L2_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
+#define NIX_L2_MAX_LEN \
+	(RTE_ETHER_MTU + NIX_L2_OVERHEAD)
 
 /* HW config of frame size doesn't include FCS */
 #define NIX_MAX_HW_FRS			9212
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index b36d37b9f7..963cc285ed 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -58,7 +58,7 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > NIX_L2_MAX_LEN)
 		dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 13/22] net/qede: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (35 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
@ 2021-01-14  9:46   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 14/22] net/sfc: " Steve Yang
                     ` (8 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:46 UTC (permalink / raw)
  To: dev; +Cc: rmody, shshaikh, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 200645ac7909 ("net/qede: set MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/qede/qede_ethdev.c | 2 +-
 drivers/net/qede/qede_rxtx.h   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 549013557c..6919378b8e 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2367,7 +2367,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 			fp->rxq->rx_buf_size = rc;
 		}
 	}
-	if (max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+	if (frame_size > QEDE_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h
index d7ff870b20..fcb564a1bb 100644
--- a/drivers/net/qede/qede_rxtx.h
+++ b/drivers/net/qede/qede_rxtx.h
@@ -71,6 +71,7 @@
 				 + (QEDE_LLC_SNAP_HDR_LEN) + 2)
 
 #define QEDE_MAX_ETHER_HDR_LEN	(RTE_ETHER_HDR_LEN + QEDE_ETH_OVERHEAD)
+#define QEDE_ETH_MAX_LEN	(RTE_ETHER_MTU + QEDE_MAX_ETHER_HDR_LEN)
 
 #define QEDE_RSS_OFFLOAD_ALL    (ETH_RSS_IPV4			|\
 				 ETH_RSS_NONFRAG_IPV4_TCP	|\
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 14/22] net/sfc: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (36 preceding siblings ...)
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 15/22] net/thunderx: " Steve Yang
                     ` (7 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: andrew.rybchenko, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU',
that perhaps impacts the cases of the jumbo frame related.

Fixes: ff6a1197c3b1 ("net/sfc: convert to new Rx offload API")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/sfc/sfc_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 93fc7baa0d..f2f5336435 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1017,7 +1017,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	 * The driver does not use it, but other PMDs update jumbo frame
 	 * flag and max_rx_pkt_len when MTU is set.
 	 */
-	if (mtu > RTE_ETHER_MAX_LEN) {
+	if (mtu > RTE_ETHER_MTU) {
 		struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 15/22] net/thunderx: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (37 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 14/22] net/sfc: " Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
                     ` (6 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: jerinj, mczekaj, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 65d9804edc05 ("net/thunderx: support MTU configuration")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/thunderx/base/nicvf_hw_defs.h | 1 +
 drivers/net/thunderx/nicvf_ethdev.c       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/thunderx/base/nicvf_hw_defs.h b/drivers/net/thunderx/base/nicvf_hw_defs.h
index b12c8ec50a..adc8ec943d 100644
--- a/drivers/net/thunderx/base/nicvf_hw_defs.h
+++ b/drivers/net/thunderx/base/nicvf_hw_defs.h
@@ -176,6 +176,7 @@
 #define NIC_HW_MAX_MTU                  (9190)
 #define NIC_HW_MAX_FRS                  (NIC_HW_MAX_MTU + NIC_HW_L2_OVERHEAD)
 #define NIC_HW_MAX_SEGS                 (12)
+#define NIC_HW_L2_MAX_LEN		(RTE_ETHER_MTU + NIC_HW_L2_OVERHEAD)
 
 /* Descriptor alignments */
 #define NICVF_RBDR_BASE_ALIGN_BYTES     (128) /* 7 bits */
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index b6bb05e500..c2e7c334d4 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -176,7 +176,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		(frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS))
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > NIC_HW_L2_MAX_LEN)
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 16/22] net/ixgbe: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (38 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 15/22] net/thunderx: " Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 17/22] net/cxgbe: " Steve Yang
                     ` (5 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: jia.guo, haiyue.wang, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
Fixes: 95a27b3ba5f5 ("net/ixgbe: enable jumbo frame for VF")

Acked-by: Jeff Guo <jia.guo@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++
 drivers/net/ixgbe/ixgbe_pf.c     | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d7a1806ab8..fa0f5afd03 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5173,7 +5173,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > IXGBE_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 3d35ea791b..a0ce18ca24 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -104,6 +104,9 @@
 /* The overhead from MTU to max frame size. */
 #define IXGBE_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
 
+/* The max frame size with default MTU */
+#define IXGBE_ETH_MAX_LEN  (RTE_ETHER_MTU + IXGBE_ETH_OVERHEAD)
+
 /* bit of VXLAN tunnel type | 7 bits of zeros  | 8 bits of zeros*/
 #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE    0x8000
 /* bit of NVGRE tunnel type | 7 bits of zeros  | 8 bits of zeros*/
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 833863af5a..89698e8470 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -575,7 +575,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
 		   IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
 	if (max_frs < new_mtu) {
 		hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-		if (new_mtu > RTE_ETHER_MAX_LEN) {
+		if (new_mtu > IXGBE_ETH_MAX_LEN) {
 			dev->data->dev_conf.rxmode.offloads |=
 				DEV_RX_OFFLOAD_JUMBO_FRAME;
 			hlreg0 |= IXGBE_HLREG0_JUMBOEN;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 17/22] net/cxgbe: fix the jumbo frame flag condition
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (39 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
                     ` (4 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: rahul.lakkireddy, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 4b2eff452d2e ("cxgbe: enable jumbo frames")
Fixes: 0ec33be4c857 ("cxgbe: allow to change mtu")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/cxgbe/cxgbe.h        | 4 ++++
 drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h
index ef62af1c3f..7c89a028bf 100644
--- a/drivers/net/cxgbe/cxgbe.h
+++ b/drivers/net/cxgbe/cxgbe.h
@@ -19,6 +19,10 @@
 #define CXGBE_MAX_RX_PKTLEN (9000 + RTE_ETHER_HDR_LEN + \
 				RTE_ETHER_CRC_LEN) /* max pkt */
 
+/* The max frame size with default MTU */
+#define CXGBE_ETH_MAX_LEN (RTE_ETHER_MTU + \
+		RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 /* Max poll time is 100 * 100msec = 10 sec */
 #define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */
 #define CXGBE_LINK_STATUS_POLL_CNT 100 /* Max number of times to poll */
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 98d0362fa3..480d6f58a8 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -300,7 +300,7 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 		return -EINVAL;
 
 	/* set to jumbo mode if needed */
-	if (new_mtu > RTE_ETHER_MAX_LEN)
+	if (new_mtu > CXGBE_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
@@ -669,7 +669,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		rxq->fl.size = temp_nb_desc;
 
 	/* Set to jumbo mode if necessary */
-	if (pkt_len > RTE_ETHER_MAX_LEN)
+	if (pkt_len > CXGBE_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (40 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 17/22] net/cxgbe: " Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 19/22] net/enetc: " Steve Yang
                     ` (3 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: asomalap, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: b58d8781fa1f ("net/axgbe: support setting MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/axgbe/axgbe_ethdev.c | 2 +-
 drivers/net/axgbe/axgbe_ethdev.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index ddd903680d..ebe9a2876d 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -1490,7 +1490,7 @@ static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 				dev->data->port_id);
 		return -EBUSY;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > AXGBE_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		val = 1;
diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
index 1481fd9ff3..a6226729fe 100644
--- a/drivers/net/axgbe/axgbe_ethdev.h
+++ b/drivers/net/axgbe/axgbe_ethdev.h
@@ -125,6 +125,12 @@
 /* MDIO port types */
 #define AXGMAC_MAX_C22_PORT		3
 
+/* The max frame size with default MTU */
+#define AXGBE_ETH_MAX_LEN ( \
+	RTE_ETHER_MTU + \
+	RTE_ETHER_HDR_LEN + \
+	RTE_ETHER_CRC_LEN)
+
 /* Helper macro for descriptor handling
  *  Always use AXGBE_GET_DESC_DATA to access the descriptor data
  *  since the index is free-running and needs to be and-ed
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 19/22] net/enetc: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (41 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 20/22] net/hinic: " Steve Yang
                     ` (2 subsequent siblings)
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: g.singh, sachin.saxena, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 5d5589b0c858 ("net/enetc: support MTU update and jumbo frames")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/enetc/enetc.h        | 4 ++++
 drivers/net/enetc/enetc_ethdev.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enetc/enetc.h b/drivers/net/enetc/enetc.h
index 14ef3bc18b..7163633bce 100644
--- a/drivers/net/enetc/enetc.h
+++ b/drivers/net/enetc/enetc.h
@@ -29,6 +29,10 @@
 /* maximum frame size supported */
 #define ENETC_MAC_MAXFRM_SIZE	9600
 
+/* The max frame size with default MTU */
+#define ENETC_ETH_MAX_LEN (RTE_ETHER_MTU + \
+		RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 /*
  * upper_32_bits - return bits 32-63 of a number
  * @n: the number we're accessing
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 6ff3022874..4d2c9c0474 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -677,7 +677,7 @@ enetc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > ENETC_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads &=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 20/22] net/hinic: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (42 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 19/22] net/enetc: " Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 21/22] net/nfp: " Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 22/22] net/liquidio: " Steve Yang
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: xuanziyang2, cloud.wangxiaoyun, zhouguoyang, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 254bd849b132 ("net/hinic: set jumbo frame offload flag")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 62642354cf..5a2c171099 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -75,6 +75,9 @@
 #define HINIC_PKTLEN_TO_MTU(pktlen)	\
 	((pktlen) - (ETH_HLEN + ETH_CRC_LEN))
 
+/* The max frame size with default MTU */
+#define HINIC_ETH_MAX_LEN (RTE_ETHER_MTU + ETH_HLEN + ETH_CRC_LEN)
+
 /* lro numer limit for one packet */
 #define HINIC_LRO_WQE_NUM_DEFAULT	8
 
@@ -1556,7 +1559,7 @@ static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 
 	/* update max frame size */
 	frame_size = HINIC_MTU_TO_PKTLEN(mtu);
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > HINIC_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 21/22] net/nfp: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (43 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 20/22] net/hinic: " Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 22/22] net/liquidio: " Steve Yang
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: heinrich.kuhn, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU',
that perhaps impacts the cases of the jumbo frame related.

Fixes: d4a27a3b092a ("nfp: add basic features")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/nfp/nfp_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 1608bf5ea1..9ea24e5bda 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1508,7 +1508,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	/* switch to jumbo mode if needed */
-	if ((uint32_t)mtu > RTE_ETHER_MAX_LEN)
+	if ((uint32_t)mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 22/22] net/liquidio: fix the jumbo frame flag condition for mtu set
  2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
                     ` (44 preceding siblings ...)
  2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 21/22] net/nfp: " Steve Yang
@ 2021-01-14  9:47   ` Steve Yang
  45 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-14  9:47 UTC (permalink / raw)
  To: dev; +Cc: sthotton, srinivasan, Steve Yang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 9f1c00266d82 ("net/liquidio: add API to set MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/liquidio/lio_ethdev.c | 2 +-
 drivers/net/liquidio/lio_ethdev.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index d4dd3768cd..eb0fdab45a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -481,7 +481,7 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 		return -1;
 	}
 
-	if (frame_len > RTE_ETHER_MAX_LEN)
+	if (frame_len > LIO_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/liquidio/lio_ethdev.h b/drivers/net/liquidio/lio_ethdev.h
index 74cd2fb6c6..d33be1c44d 100644
--- a/drivers/net/liquidio/lio_ethdev.h
+++ b/drivers/net/liquidio/lio_ethdev.h
@@ -13,6 +13,9 @@
 #define LIO_LSC_TIMEOUT		100000 /* 100000us (100ms) */
 #define LIO_MAX_CMD_TIMEOUT     10000 /* 10000ms (10s) */
 
+/* The max frame size with default MTU */
+#define LIO_ETH_MAX_LEN (RTE_ETHER_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 #define LIO_DEV(_eth_dev)		((_eth_dev)->data->dev_private)
 
 /* LIO Response condition variable */
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v3 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-14 10:26     ` Hemant Agrawal
  0 siblings, 0 replies; 115+ messages in thread
From: Hemant Agrawal @ 2021-01-14 10:26 UTC (permalink / raw)
  To: Steve Yang, dev; +Cc: Sachin Saxena (OSS)

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

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

* Re: [dpdk-dev] [PATCH v3 04/22] net/dpaa2: fix the jumbo frame flag condition for mtu set
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 04/22] net/dpaa2: " Steve Yang
@ 2021-01-14 10:27     ` Hemant Agrawal
  0 siblings, 0 replies; 115+ messages in thread
From: Hemant Agrawal @ 2021-01-14 10:27 UTC (permalink / raw)
  To: Steve Yang, dev; +Cc: Sachin Saxena (OSS)

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
@ 2021-01-14 16:36     ` Ferruh Yigit
  2021-01-14 17:13       ` Ferruh Yigit
  2021-01-15 10:44     ` oulijun
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
  2 siblings, 1 reply; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-14 16:36 UTC (permalink / raw)
  To: Steve Yang, dev; +Cc: thomas, andrew.rybchenko, oulijun

On 1/14/2021 9:45 AM, Steve Yang wrote:
> Ethdev is using default Ethernet overhead to decide if provided
> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
> and limits it to MAX if it is.
> 
> Since the application/driver used Ethernet overhead is different than
> the ethdev one, check result is wrong.
> 
> If the driver is using Ethernet overhead bigger than the default one,
> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
> correct Ethernet overhead is used to convert back, the resulting MTU is
> less than the intended one, causing some packets to be dropped.
> 
> Like,
> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
> driver  -> MTU = 1518 - 22 = 1496
> Packets with size 1497-1500 are dropped although intention is to be able
> to send/receive them.
> 
> The fix is to make ethdev use the correct Ethernet overhead for port,
> instead of default one.
> 
> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>

<...>

> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   			goto rollback;
>   		}
>   	} else {
> -		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
> -			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
> +		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
> +		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
> +		    pktlen > RTE_ETHER_MTU + overhead_len)
>   			/* Use default value */
>   			dev->data->dev_conf.rxmode.max_rx_pkt_len =
> -							RTE_ETHER_MAX_LEN;
> +						RTE_ETHER_MTU + overhead_len;

What do you think removing the above check, the else block, completely?
Since the 'max_rx_pkt_len' should not be used when jumbo frame is not set.

> +	}
> +
> +	/* Scale the MTU size to adapt max_rx_pkt_len */
> +	if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
> +		dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
> +				overhead_len;
>   	}

Above if block has exact same check, why not move it above block?

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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-14 16:36     ` Ferruh Yigit
@ 2021-01-14 17:13       ` Ferruh Yigit
  2021-01-14 17:29         ` Andrew Boyer
  0 siblings, 1 reply; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-14 17:13 UTC (permalink / raw)
  To: Steve Yang, dev; +Cc: thomas, andrew.rybchenko, oulijun

On 1/14/2021 4:36 PM, Ferruh Yigit wrote:
> On 1/14/2021 9:45 AM, Steve Yang wrote:
>> Ethdev is using default Ethernet overhead to decide if provided
>> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
>> and limits it to MAX if it is.
>>
>> Since the application/driver used Ethernet overhead is different than
>> the ethdev one, check result is wrong.
>>
>> If the driver is using Ethernet overhead bigger than the default one,
>> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
>> correct Ethernet overhead is used to convert back, the resulting MTU is
>> less than the intended one, causing some packets to be dropped.
>>
>> Like,
>> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
>> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
>> driver  -> MTU = 1518 - 22 = 1496
>> Packets with size 1497-1500 are dropped although intention is to be able
>> to send/receive them.
>>
>> The fix is to make ethdev use the correct Ethernet overhead for port,
>> instead of default one.
>>
>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>
>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> 
> <...>
> 
>> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>> nb_rx_q, uint16_t nb_tx_q,
>>               goto rollback;
>>           }
>>       } else {
>> -        if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>> -            dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>> +        uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>> +        if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>> +            pktlen > RTE_ETHER_MTU + overhead_len)
>>               /* Use default value */
>>               dev->data->dev_conf.rxmode.max_rx_pkt_len =
>> -                            RTE_ETHER_MAX_LEN;
>> +                        RTE_ETHER_MTU + overhead_len;
> 
> What do you think removing the above check, the else block, completely?
> Since the 'max_rx_pkt_len' should not be used when jumbo frame is not set.
> 

As I tested removing this check is causing problem because some PMDs are using 
the 'max_rx_pkt_len' even jumbo frame is not set.

Perhaps better to keep it, and make a separate patch later to remove this check, 
after PMDs fixed.

>> +    }
>> +
>> +    /* Scale the MTU size to adapt max_rx_pkt_len */
>> +    if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>> +        dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>> +                overhead_len;
>>       }
> 
> Above if block has exact same check, why not move it above block?

Can you still send a new version for above change please?

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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-14 17:13       ` Ferruh Yigit
@ 2021-01-14 17:29         ` Andrew Boyer
  2021-01-14 20:44           ` Ferruh Yigit
  0 siblings, 1 reply; 115+ messages in thread
From: Andrew Boyer @ 2021-01-14 17:29 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Steve Yang, dev, thomas, andrew.rybchenko, oulijun



> On Jan 14, 2021, at 12:13 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
> On 1/14/2021 4:36 PM, Ferruh Yigit wrote:
>> On 1/14/2021 9:45 AM, Steve Yang wrote:
>>> Ethdev is using default Ethernet overhead to decide if provided
>>> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
>>> and limits it to MAX if it is.
>>> 
>>> Since the application/driver used Ethernet overhead is different than
>>> the ethdev one, check result is wrong.
>>> 
>>> If the driver is using Ethernet overhead bigger than the default one,
>>> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
>>> correct Ethernet overhead is used to convert back, the resulting MTU is
>>> less than the intended one, causing some packets to be dropped.
>>> 
>>> Like,
>>> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
>>> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
>>> driver  -> MTU = 1518 - 22 = 1496
>>> Packets with size 1497-1500 are dropped although intention is to be able
>>> to send/receive them.
>>> 
>>> The fix is to make ethdev use the correct Ethernet overhead for port,
>>> instead of default one.
>>> 
>>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>> 
>>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>> <...>
>>> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>               goto rollback;
>>>           }
>>>       } else {
>>> -        if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>>> -            dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>>> +        uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>>> +        if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>>> +            pktlen > RTE_ETHER_MTU + overhead_len)
>>>               /* Use default value */
>>>               dev->data->dev_conf.rxmode.max_rx_pkt_len =
>>> -                            RTE_ETHER_MAX_LEN;
>>> +                        RTE_ETHER_MTU + overhead_len;
>> What do you think removing the above check, the else block, completely?
>> Since the 'max_rx_pkt_len' should not be used when jumbo frame is not set.
> 
> As I tested removing this check is causing problem because some PMDs are using the 'max_rx_pkt_len' even jumbo frame is not set.
> 
> Perhaps better to keep it, and make a separate patch later to remove this check, after PMDs fixed.

Hello Ferruh -
Working on fixing our PMD here. Do you want PMDs to update the JUMBO_FRAME flag based on the mtu value in dev_set_mtu(), or do you want the application to be solely responsible for it?

Thanks,
Andrew

>>> +    }
>>> +
>>> +    /* Scale the MTU size to adapt max_rx_pkt_len */
>>> +    if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>> +        dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>>> +                overhead_len;
>>>       }
>> Above if block has exact same check, why not move it above block?
> 
> Can you still send a new version for above change please?


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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-14 17:29         ` Andrew Boyer
@ 2021-01-14 20:44           ` Ferruh Yigit
  0 siblings, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-14 20:44 UTC (permalink / raw)
  To: Andrew Boyer
  Cc: Steve Yang, dev, thomas, andrew.rybchenko, oulijun, Konstantin Ananyev

On 1/14/2021 5:29 PM, Andrew Boyer wrote:
> 
> 
>> On Jan 14, 2021, at 12:13 PM, Ferruh Yigit <ferruh.yigit@intel.com 
>> <mailto:ferruh.yigit@intel.com>> wrote:
>>
>> On 1/14/2021 4:36 PM, Ferruh Yigit wrote:
>>> On 1/14/2021 9:45 AM, Steve Yang wrote:
>>>> Ethdev is using default Ethernet overhead to decide if provided
>>>> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
>>>> and limits it to MAX if it is.
>>>>
>>>> Since the application/driver used Ethernet overhead is different than
>>>> the ethdev one, check result is wrong.
>>>>
>>>> If the driver is using Ethernet overhead bigger than the default one,
>>>> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
>>>> correct Ethernet overhead is used to convert back, the resulting MTU is
>>>> less than the intended one, causing some packets to be dropped.
>>>>
>>>> Like,
>>>> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
>>>> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
>>>> driver  -> MTU = 1518 - 22 = 1496
>>>> Packets with size 1497-1500 are dropped although intention is to be able
>>>> to send/receive them.
>>>>
>>>> The fix is to make ethdev use the correct Ethernet overhead for port,
>>>> instead of default one.
>>>>
>>>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>>>
>>>> Signed-off-by: Steve Yang <stevex.yang@intel.com <mailto:stevex.yang@intel.com>>
>>> <...>
>>>> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>>>> nb_rx_q, uint16_t nb_tx_q,
>>>> goto rollback;
>>>> }
>>>> } else {
>>>> -        if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>>>> -            dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>>>> +        uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>>>> +        if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>>>> +            pktlen > RTE_ETHER_MTU + overhead_len)
>>>> /* Use default value */
>>>> dev->data->dev_conf.rxmode.max_rx_pkt_len =
>>>> -                            RTE_ETHER_MAX_LEN;
>>>> +                        RTE_ETHER_MTU + overhead_len;
>>> What do you think removing the above check, the else block, completely?
>>> Since the 'max_rx_pkt_len' should not be used when jumbo frame is not set.
>>
>> As I tested removing this check is causing problem because some PMDs are using 
>> the 'max_rx_pkt_len' even jumbo frame is not set.
>>
>> Perhaps better to keep it, and make a separate patch later to remove this 
>> check, after PMDs fixed.
> 
> Hello Ferruh -
> Working on fixing our PMD here. Do you want PMDs to update the JUMBO_FRAME flag 
> based on the mtu value in dev_set_mtu(), or do you want the application to be 
> solely responsible for it?
> 

Hi Andrew,

Technically JUMBO_FRAME flag is an user config and application should set it. It 
is application's responsibility to check the capability and set the flag when 
necessary.

But, after above said, many PMDs set it based on provided MTU value, if the 
explicitly requested MTU is bigger than the RTE_ETHER_MTU, this means user 
implied the JUMBO_FRAME support, for this case PMDs set the flag implicitly 
instead of failing.

In another thread Andrew R. & Konstantin suggested to remove the JUMBO_FRAME 
flag, since it is redundant and causing this kind of confusion, instead driver 
can decide based on requested MTU value, and driver reported 'max_mtu' value can 
be used by application to detect the capability. We will probably do this 
change, but it can be done only in the ABI break release, v21.11.

For now, PMD can set the flag itself if requested MTU > RTE_ETHER_MTU and driver 
supports jumbo frames.

> Thanks,
> Andrew
> 
>>>> +    }
>>>> +
>>>> +    /* Scale the MTU size to adapt max_rx_pkt_len */
>>>> +    if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>>> +        dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>>>> +                overhead_len;
>>>> }
>>> Above if block has exact same check, why not move it above block?
>>
>> Can you still send a new version for above change please?
> 


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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
  2021-01-14 16:36     ` Ferruh Yigit
@ 2021-01-15 10:44     ` oulijun
  2021-01-18 10:42       ` Ferruh Yigit
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
  2 siblings, 1 reply; 115+ messages in thread
From: oulijun @ 2021-01-15 10:44 UTC (permalink / raw)
  To: Steve Yang, dev; +Cc: thomas, ferruh.yigit, andrew.rybchenko, linuxarm

Hi Steve
This is a very good job! But I have some question and suggestions.
Please check it.

在 2021/1/14 17:45, Steve Yang 写道:
> Ethdev is using default Ethernet overhead to decide if provided
> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
> and limits it to MAX if it is.
> 
> Since the application/driver used Ethernet overhead is different than
> the ethdev one, check result is wrong.
> 
> If the driver is using Ethernet overhead bigger than the default one,
> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
> correct Ethernet overhead is used to convert back, the resulting MTU is
> less than the intended one, causing some packets to be dropped.
> 
> Like,
> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
> driver  -> MTU = 1518 - 22 = 1496
> Packets with size 1497-1500 are dropped although intention is to be able
> to send/receive them.
> 
> The fix is to make ethdev use the correct Ethernet overhead for port,
> instead of default one.
> 
> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>   lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++---
>   1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 17ddacc78d..19ca4c4512 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   	struct rte_eth_dev *dev;
>   	struct rte_eth_dev_info dev_info;
>   	struct rte_eth_conf orig_conf;
> +	uint16_t overhead_len;
>   	int diag;
>   	int ret;
> +	uint16_t old_mtu;
>   
>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>   
> @@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   		memcpy(&dev->data->dev_conf, dev_conf,
>   		       sizeof(dev->data->dev_conf));
>   
> +	/* Backup mtu for rollback */
> +	old_mtu = dev->data->mtu;
> +
>   	ret = rte_eth_dev_info_get(port_id, &dev_info);
>   	if (ret != 0)
>   		goto rollback;
>   
> +	/* Get the real Ethernet overhead length */
> +	if (dev_info.max_mtu != UINT16_MAX &&
> +	    dev_info.max_rx_pktlen > dev_info.max_mtu)
> +		overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
> +	else
> +		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> +
The Ethernet frame header length supported by each NIC may be different, 
which cause the difference of allowed packets size and drop you say.
The diference of Ethernet frame header length have an impact for the 
maximum Ethernet frame length, which is a boundary value
of enabling jumbo frame through the ' max_rx_pkt_len '.
However, we need to do the same thing you do above to get the 
overhead_len every time, which will
cause a lot of duplicate code in the framework and app. For examples, 
parsing and processing for '--max-pkt-len=xxx' parameter,
  and " cmd_config_max_pkt_len_parsed " in testpmd, and here modifying 
here dev_configure API.
It's a little redundant and troublesome.

Maybe, it is necessary for driver to directly report the supported 
maximum Ethernet frame length by rte_dev_info_get API.
As following:
struct rte_eth_dev_info {
	xxxx
	/**
	 * The maximum Ethernet frame length supported by each
	 * driver varies with the Ethernet header length.
	 */
	uint16_t eth_max_len;
	xxxx
}

int
rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
{
     xxx
	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
	dev_info->max_mtu = UINT16_MAX;
	dev_info->eth_max_len = RTE_ETHER_MAX_LEN;
     xxx
}

And then:
xxx_devv_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info 
*info)
{
	xxx
	info->eth_max_len = xxx_ETHER_MAX _LEN;
	xxx
}
What do you think?
>   	/* If number of queues specified by application for both Rx and Tx is
>   	 * zero, use driver preferred values. This cannot be done individually
>   	 * as it is valid for either Tx or Rx (but not both) to be zero.
> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   			goto rollback;
>   		}
>   	} else {
> -		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
> -			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
> +		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
> +		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
> +		    pktlen > RTE_ETHER_MTU + overhead_len)
>   			/* Use default value */
>   			dev->data->dev_conf.rxmode.max_rx_pkt_len =
> -							RTE_ETHER_MAX_LEN;
> +						RTE_ETHER_MTU + overhead_len;
> +	}
> +
> +	/* Scale the MTU size to adapt max_rx_pkt_len */
> +	if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
> +		dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
> +				overhead_len;
>   	}
Now that we update mtu here when jumbo frame enabled. It is necessary to 
check validity of max_rx_pkt_len.
As following:
if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
	if (dev_conf->rxmode.max_rx_pkt_len > dev_info.max_rx_pktlen ||
		dev_conf->rxmode.max_rx_pkt_len <=  RTE_ETHER_MTU + overhead_len) {
			xxxx
		}
} else {
		xxx
}

If it does not thing above, which will cause an unreasonable case.
Like,
dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME == 1
dev_conf->rxmode.max_rx_pkt_len = 1500
overhead_len = 26
dev->data->mtu = dev_conf->rxmode.max_rx_pkt_len - overhead_len = 1500 - 
26 = 1474

In fact, DEV_RX_OFFLOAD_JUMBO_FRAME is set to rxmode.offloads when mtu > 
1500.
>   
>   	/*
> @@ -1549,6 +1568,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>   	eth_dev_tx_queue_config(dev, 0);
>   rollback:
>   	memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf));
> +	if (old_mtu != dev->data->mtu)
> +		dev->data->mtu = old_mtu;
>   
>   	rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret);
>   	return ret;
> 

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

* Re: [dpdk-dev] [PATCH v3 06/22] net/hns3: fix the jumbo frame flag condition for mtu set
  2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 06/22] net/hns3: " Steve Yang
@ 2021-01-18  1:30     ` oulijun
  0 siblings, 0 replies; 115+ messages in thread
From: oulijun @ 2021-01-18  1:30 UTC (permalink / raw)
  To: Steve Yang, dev; +Cc: xavier.huwei, humin29, yisen.zhuang

Acked-by: Lijun Ou <oulijun@huawei.com>

在 2021/1/14 17:46, Steve Yang 写道:
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
> but the Ether overhead is larger than 18 when it supports dual VLAN tags.
> That will cause the jumbo flag rx offload is wrong when MTU size is
> 'RTE_ETHER_MTU'.
> 
> This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN',
> that perhaps impacts the cases of the jumbo frame related.
> 
> Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
> Fixes: a5475d61fa34 ("net/hns3: support VF")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>   drivers/net/hns3/hns3_ethdev.c    | 2 +-
>   drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
> index 7c34e382fb..10e0c0de46 100644
> --- a/drivers/net/hns3/hns3_ethdev.c
> +++ b/drivers/net/hns3/hns3_ethdev.c
> @@ -2467,7 +2467,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
>   	}
>   
>   	rte_spinlock_lock(&hw->lock);
> -	is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
> +	is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false;
>   	frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
>   
>   	/*
> diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
> index f09cabcd82..ef03fb1c4e 100644
> --- a/drivers/net/hns3/hns3_ethdev_vf.c
> +++ b/drivers/net/hns3/hns3_ethdev_vf.c
> @@ -928,7 +928,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
>   		rte_spinlock_unlock(&hw->lock);
>   		return ret;
>   	}
> -	if (frame_size > RTE_ETHER_MAX_LEN)
> +	if (mtu > RTE_ETHER_MTU)
>   		dev->data->dev_conf.rxmode.offloads |=
>   						DEV_RX_OFFLOAD_JUMBO_FRAME;
>   	else
> 

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

* [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue
  2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
  2021-01-14 16:36     ` Ferruh Yigit
  2021-01-15 10:44     ` oulijun
@ 2021-01-18  7:04     ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
                         ` (22 more replies)
  2 siblings, 23 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang

The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition, this
fix will change the boundary condition with 'RTE_ETHER_MTU' and overhead.

When the MTU(1500) set, the frame type of rx packet will be different
if used different overhead, it will cause the consistency issue, and the
normal packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
can avoid this issue.

Like,
app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
driver  -> MTU = 1518 - 22 = 1496
Packets with size 1497-1500 are dropped although intention is to be able
to send/receive them.

Following scopes will be changed:
- 'rte_ethdev'
- 'app', e.g.: 'test-pmd';
- net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;

Following scopes perhaps will be impacted:
- the cases of jumbo frame related;
- the logic of 'max_rx_pkt_len' and 'mtu' related;
- the using place of 'RTE_ETHER_MAX_LEN';

---
v4:
 - moved mtu assignment to the same if-true-block of jumbo frame;
v3:
 - removed redundant if-conditions in rte_ethdev and testpmd;
 - adjusted the alignment style;
 - added offload check before updating mtu;
v2:
 - defined the 'RTE_ETHER_MTU + overhead' to 'driver_ETH_MAX_LEN';
 - changed the 'mtu > RTE_ETHER_MTU' to 'frame_size > driver_ETH_MAX_LEN';
---

Steve Yang (22):
  ethdev: fix MTU size exceeds max rx packet length
  app/testpmd: fix max rx packet length for VLAN packets
  net/dpaa: fix the jumbo frame flag condition for mtu set
  net/dpaa2: fix the jumbo frame flag condition for mtu set
  net/e1000: fix the jumbo frame flag condition for mtu set
  net/hns3: fix the jumbo frame flag condition for mtu set
  net/i40e: fix the jumbo frame flag condition
  net/iavf: fix the jumbo frame flag condition
  net/ice: fix the jumbo frame flag condition
  net/ipn3ke: fix the jumbo frame flag condition for mtu set
  net/octeontx: fix the jumbo frame flag condition for mtu set
  net/octeontx2: fix the jumbo frame flag condition for mtu
  net/qede: fix the jumbo frame flag condition for mtu set
  net/sfc: fix the jumbo frame flag condition for mtu set
  net/thunderx: fix the jumbo frame flag condition for mtu set
  net/ixgbe: fix the jumbo frame flag condition
  net/cxgbe: fix the jumbo frame flag condition
  net/axgbe: fix the jumbo frame flag condition for mtu set
  net/enetc: fix the jumbo frame flag condition for mtu set
  net/hinic: fix the jumbo frame flag condition for mtu set
  net/nfp: fix the jumbo frame flag condition for mtu set
  net/liquidio: fix the jumbo frame flag condition for mtu set

 app/test-pmd/cmdline.c                    |  6 ------
 app/test-pmd/config.c                     |  2 +-
 app/test-pmd/parameters.c                 |  7 ++-----
 app/test-pmd/testpmd.c                    | 18 ++++++++++++++++
 drivers/net/axgbe/axgbe_ethdev.c          |  2 +-
 drivers/net/axgbe/axgbe_ethdev.h          |  6 ++++++
 drivers/net/cxgbe/cxgbe.h                 |  4 ++++
 drivers/net/cxgbe/cxgbe_ethdev.c          |  4 ++--
 drivers/net/dpaa/dpaa_ethdev.c            |  2 +-
 drivers/net/dpaa/dpaa_ethdev.h            |  4 ++++
 drivers/net/dpaa2/dpaa2_ethdev.c          |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.h          |  4 ++++
 drivers/net/e1000/e1000_ethdev.h          |  2 +-
 drivers/net/e1000/em_ethdev.c             |  5 ++---
 drivers/net/e1000/igb_ethdev.c            |  2 +-
 drivers/net/enetc/enetc.h                 |  4 ++++
 drivers/net/enetc/enetc_ethdev.c          |  2 +-
 drivers/net/hinic/hinic_pmd_ethdev.c      |  5 ++++-
 drivers/net/hns3/hns3_ethdev.c            |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c         |  2 +-
 drivers/net/i40e/i40e_ethdev.c            |  2 +-
 drivers/net/i40e/i40e_ethdev.h            |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c         | 10 ++++-----
 drivers/net/i40e/i40e_fdir.c              |  2 +-
 drivers/net/i40e/i40e_rxtx.c              |  8 ++++----
 drivers/net/iavf/iavf.h                   |  1 +
 drivers/net/iavf/iavf_ethdev.c            | 10 ++++-----
 drivers/net/ice/ice_dcf_ethdev.c          |  8 ++++----
 drivers/net/ice/ice_ethdev.c              |  2 +-
 drivers/net/ice/ice_ethdev.h              |  1 +
 drivers/net/ice/ice_rxtx.c                | 10 ++++-----
 drivers/net/ipn3ke/ipn3ke_ethdev.h        |  1 +
 drivers/net/ipn3ke/ipn3ke_representor.c   |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c          |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h          |  3 +++
 drivers/net/ixgbe/ixgbe_pf.c              |  2 +-
 drivers/net/liquidio/lio_ethdev.c         |  2 +-
 drivers/net/liquidio/lio_ethdev.h         |  3 +++
 drivers/net/nfp/nfp_net.c                 |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c    |  2 +-
 drivers/net/octeontx/octeontx_ethdev.h    |  1 +
 drivers/net/octeontx2/otx2_ethdev.h       |  2 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c   |  2 +-
 drivers/net/qede/qede_ethdev.c            |  2 +-
 drivers/net/qede/qede_rxtx.h              |  1 +
 drivers/net/sfc/sfc_ethdev.c              |  2 +-
 drivers/net/thunderx/base/nicvf_hw_defs.h |  1 +
 drivers/net/thunderx/nicvf_ethdev.c       |  2 +-
 lib/librte_ethdev/rte_ethdev.c            | 25 ++++++++++++++++++++---
 49 files changed, 132 insertions(+), 65 deletions(-)

-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
                         ` (21 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko

Ethdev is using default Ethernet overhead to decide if provided
'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
and limits it to MAX if it is.

Since the application/driver used Ethernet overhead is different than
the ethdev one, check result is wrong.

If the driver is using Ethernet overhead bigger than the default one,
the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
correct Ethernet overhead is used to convert back, the resulting MTU is
less than the intended one, causing some packets to be dropped.

Like,
app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
driver  -> MTU = 1518 - 22 = 1496
Packets with size 1497-1500 are dropped although intention is to be able
to send/receive them.

The fix is to make ethdev use the correct Ethernet overhead for port,
instead of default one.

Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")

Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 lib/librte_ethdev/rte_ethdev.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 17ddacc78d..71e1e9a6db 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_conf orig_conf;
+	uint16_t overhead_len;
 	int diag;
 	int ret;
+	uint16_t old_mtu;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
@@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		memcpy(&dev->data->dev_conf, dev_conf,
 		       sizeof(dev->data->dev_conf));
 
+	/* Backup mtu for rollback */
+	old_mtu = dev->data->mtu;
+
 	ret = rte_eth_dev_info_get(port_id, &dev_info);
 	if (ret != 0)
 		goto rollback;
 
+	/* Get the real Ethernet overhead length */
+	if (dev_info.max_mtu != UINT16_MAX &&
+	    dev_info.max_rx_pktlen > dev_info.max_mtu)
+		overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
+	else
+		overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
 	/* If number of queues specified by application for both Rx and Tx is
 	 * zero, use driver preferred values. This cannot be done individually
 	 * as it is valid for either Tx or Rx (but not both) to be zero.
@@ -1409,12 +1421,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 			ret = -EINVAL;
 			goto rollback;
 		}
+
+		/* Scale the MTU size to adapt max_rx_pkt_len */
+		dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
+				overhead_len;
 	} else {
-		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+		uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
+		if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
+		    pktlen > RTE_ETHER_MTU + overhead_len)
 			/* Use default value */
 			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+						RTE_ETHER_MTU + overhead_len;
 	}
 
 	/*
@@ -1549,6 +1566,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	eth_dev_tx_queue_config(dev, 0);
 rollback:
 	memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf));
+	if (old_mtu != dev->data->mtu)
+		dev->data->mtu = old_mtu;
 
 	rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret);
 	return ret;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-21 15:27         ` Lance Richardson
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
                         ` (20 subsequent siblings)
  22 siblings, 1 reply; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Wenzhuo Lu, Beilei Xing, Bernard Iremonger

When the max rx packet length is smaller than the sum of mtu size and
ether overhead size, it should be enlarged, otherwise the VLAN packets
will be dropped.

Removed the rx_offloads assignment for jumbo frame during command line
parsing, and set the correct jumbo frame flag if MTU size is larger than
the default value 'RTE_ETHER_MTU' within 'init_config()'.

Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")

Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
Cc: Beilei Xing <beilei.xing@intel.com>
Cc: Bernard Iremonger <bernard.iremonger@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 app/test-pmd/cmdline.c    |  6 ------
 app/test-pmd/config.c     |  2 +-
 app/test-pmd/parameters.c |  7 ++-----
 app/test-pmd/testpmd.c    | 18 ++++++++++++++++++
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2ccbaa039e..65042fcff5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1886,7 +1886,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 
 	RTE_ETH_FOREACH_DEV(pid) {
 		struct rte_port *port = &ports[pid];
-		uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
 
 		if (!strcmp(res->name, "max-pkt-len")) {
 			if (res->value < RTE_ETHER_MIN_LEN) {
@@ -1898,11 +1897,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 				return;
 
 			port->dev_conf.rxmode.max_rx_pkt_len = res->value;
-			if (res->value > RTE_ETHER_MAX_LEN)
-				rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
-			else
-				rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-			port->dev_conf.rxmode.offloads = rx_offloads;
 		} else {
 			printf("Unknown parameter\n");
 			return;
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3f6c8642b1..1195f054f3 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1434,7 +1434,7 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
 		 * device supports jumbo frame.
 		 */
 		eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu;
-		if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) {
+		if (mtu > RTE_ETHER_MTU) {
 			rte_port->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 			rte_port->dev_conf.rxmode.max_rx_pkt_len =
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 414a0068fb..df5eb10d84 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -834,12 +834,9 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
 				n = atoi(optarg);
-				if (n >= RTE_ETHER_MIN_LEN) {
+				if (n >= RTE_ETHER_MIN_LEN)
 					rx_mode.max_rx_pkt_len = (uint32_t) n;
-					if (n > RTE_ETHER_MAX_LEN)
-						rx_offloads |=
-							DEV_RX_OFFLOAD_JUMBO_FRAME;
-				} else
+				else
 					rte_exit(EXIT_FAILURE,
 						 "Invalid max-pkt-len=%d - should be > %d\n",
 						 n, RTE_ETHER_MIN_LEN);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 2b60f6c5d3..c256e719ae 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1410,6 +1410,7 @@ init_config(void)
 	struct rte_gro_param gro_param;
 	uint32_t gso_types;
 	uint16_t data_size;
+	uint16_t eth_overhead;
 	bool warning = 0;
 	int k;
 	int ret;
@@ -1446,6 +1447,23 @@ init_config(void)
 			rte_exit(EXIT_FAILURE,
 				 "rte_eth_dev_info_get() failed\n");
 
+		/* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
+		if (port->dev_info.max_mtu != UINT16_MAX &&
+		    port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
+			eth_overhead = port->dev_info.max_rx_pktlen -
+				port->dev_info.max_mtu;
+		else
+			eth_overhead =
+				RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
+		if (port->dev_conf.rxmode.max_rx_pkt_len <=
+			(uint32_t)(RTE_ETHER_MTU + eth_overhead))
+			port->dev_conf.rxmode.max_rx_pkt_len =
+					RTE_ETHER_MTU + eth_overhead;
+		else
+			port->dev_conf.rxmode.offloads |=
+					DEV_RX_OFFLOAD_JUMBO_FRAME;
+
 		if (!(port->dev_info.tx_offload_capa &
 		      DEV_TX_OFFLOAD_MBUF_FAST_FREE))
 			port->dev_conf.txmode.offloads &=
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 04/22] net/dpaa2: " Steve Yang
                         ` (19 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Hemant Agrawal, Sachin Saxena

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 25f854197abc ("net/dpaa: support jumbo frames")

Cc: Hemant Agrawal <hemant.agrawal@nxp.com>
Cc: Sachin Saxena <sachin.saxena@oss.nxp.com>

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 2 +-
 drivers/net/dpaa/dpaa_ethdev.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index f00279e004..0c87c136d7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -184,7 +184,7 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > DPAA_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 659bceb467..a858b1372c 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -51,6 +51,10 @@
 #define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
 #endif
 
+#define DPAA_ETH_MAX_LEN (RTE_ETHER_MTU + \
+			  RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
+			  VLAN_TAG_SIZE)
+
 /* PCD frame queues */
 #define DPAA_DEFAULT_NUM_PCD_QUEUES	1
 #define DPAA_VSP_PROFILE_MAX_NUM	8
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 04/22] net/dpaa2: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (2 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 05/22] net/e1000: " Steve Yang
                         ` (18 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Hemant Agrawal, Sachin Saxena

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: e16408499412 ("net/dpaa2: configure jumbo frames")

Cc: Hemant Agrawal <hemant.agrawal@nxp.com>
Cc: Sachin Saxena <sachin.saxena@oss.nxp.com>

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 2 +-
 drivers/net/dpaa2/dpaa2_ethdev.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index ab6863300e..6f38da3cce 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1420,7 +1420,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > DPAA2_MAX_RX_PKT_LEN)
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > DPAA2_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 8d82f74684..cacb11bd3e 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -26,6 +26,10 @@
 
 #define DPAA2_RX_DEFAULT_NBDESC 512
 
+#define DPAA2_ETH_MAX_LEN (RTE_ETHER_MTU + \
+			   RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
+			   VLAN_TAG_SIZE)
+
 /*default tc to be used for ,congestion, distribution etc configuration. */
 #define DPAA2_DEF_TC		0
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 05/22] net/e1000: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (3 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 04/22] net/dpaa2: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 06/22] net/hns3: " Steve Yang
                         ` (17 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Jeff Guo, Haiyue Wang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: ef990fb56e55 ("net/e1000: convert to new Rx offloads API")

Cc: Jeff Guo <jia.guo@intel.com>
Cc: Haiyue Wang <haiyue.wang@intel.com>

Acked-by: Jeff Guo <jia.guo@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/e1000/e1000_ethdev.h | 2 +-
 drivers/net/e1000/em_ethdev.c    | 5 ++---
 drivers/net/e1000/igb_ethdev.c   | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 4755a5f333..3b4d9c3ee6 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -97,7 +97,7 @@
  */
 #define E1000_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
 				VLAN_TAG_SIZE)
-
+#define E1000_ETH_MAX_LEN (RTE_ETHER_MTU + E1000_ETH_OVERHEAD)
 /*
  * Maximum number of Ring Descriptors.
  *
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 8ee9422bf4..2036c6e917 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1799,8 +1799,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (ret != 0)
 		return ret;
 
-	frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
-		VLAN_TAG_SIZE;
+	frame_size = mtu + E1000_ETH_OVERHEAD;
 
 	/* check that mtu is within the allowed range */
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen)
@@ -1816,7 +1815,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > E1000_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 647aa8d995..dfe87508c2 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -4369,7 +4369,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > E1000_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		rctl |= E1000_RCTL_LPE;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 06/22] net/hns3: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (4 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 05/22] net/e1000: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
                         ` (16 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Min Hu (Connor), Yisen Zhuang, Lijun Ou

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN',
that perhaps impacts the cases of the jumbo frame related.

Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
Fixes: a5475d61fa34 ("net/hns3: support VF")

Cc: "Min Hu (Connor)" <humin29@huawei.com>
Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
Cc: Lijun Ou <oulijun@huawei.com>

Acked-by: Lijun Ou <oulijun@huawei.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 7c34e382fb..10e0c0de46 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2467,7 +2467,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	rte_spinlock_lock(&hw->lock);
-	is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
+	is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false;
 	frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
 
 	/*
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index f09cabcd82..ef03fb1c4e 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -928,7 +928,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		rte_spinlock_unlock(&hw->lock);
 		return ret;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 07/22] net/i40e: fix the jumbo frame flag condition
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (5 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 06/22] net/hns3: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 08/22] net/iavf: " Steve Yang
                         ` (15 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Jeff Guo, Beilei Xing

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: c1715402df8f ("i40evf: fix jumbo frame support")
Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: c3ac7c5b0b8a ("net/i40e: convert to new Rx offloads API")

Cc: Jeff Guo <jia.guo@intel.com>
Cc: Beilei Xing <beilei.xing@intel.com>

Acked-by: Jeff Guo <jia.guo@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    |  2 +-
 drivers/net/i40e/i40e_ethdev.h    |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  8 ++++----
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 14622484a0..6074d3d928 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11745,7 +11745,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 > I40E_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 0617fe5e65..c1c429a075 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -283,6 +283,7 @@ struct rte_flow {
  */
 #define I40E_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
+#define I40E_ETH_MAX_LEN (RTE_ETHER_MTU + I40E_ETH_OVERHEAD)
 
 #define I40E_RXTX_BYTES_H_16_BIT(bytes) ((bytes) & ~I40E_48_BIT_MASK)
 #define I40E_RXTX_BYTES_L_48_BIT(bytes) ((bytes) & I40E_48_BIT_MASK)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index dc076ae552..bca8cb80e4 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1899,22 +1899,22 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 	 * Check if the jumbo frame and maximum packet length are set correctly
 	 */
 	if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				"larger than %u and smaller than %u, as jumbo "
-				"frame is enabled", (uint32_t)RTE_ETHER_MAX_LEN,
+				"frame is enabled", (uint32_t)I40E_ETH_MAX_LEN,
 					(uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
@@ -2836,7 +2836,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 > I40E_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 0343e8b09a..f5defcf585 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -116,7 +116,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
 #endif
 	rx_ctx.dtype = i40e_header_split_none;
 	rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = I40E_ETH_MAX_LEN;
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
 	rx_ctx.tphdata_ena = 1;
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 5df9a9df56..b8859bbff2 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2797,23 +2797,23 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
 			rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len);
 	if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
 			rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)I40E_ETH_MAX_LEN,
 				    (uint32_t)I40E_FRAME_SIZE_MAX);
 			return I40E_ERR_CONFIG;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-			rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+			rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
 			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)I40E_ETH_MAX_LEN);
 			return I40E_ERR_CONFIG;
 		}
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 08/22] net/iavf: fix the jumbo frame flag condition
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (6 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 09/22] net/ice: " Steve Yang
                         ` (14 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Beilei Xing, Jingjing Wu

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Cc: Beilei Xing <beilei.xing@intel.com>
Cc: Jingjing Wu <jingjing.wu@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf.h        |  1 +
 drivers/net/iavf/iavf_ethdev.c | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index af11268fe3..c934d2e614 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -73,6 +73,7 @@
 #define IAVF_VLAN_TAG_SIZE               4
 #define IAVF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2)
+#define IAVF_ETH_MAX_LEN (RTE_ETHER_MTU + IAVF_ETH_OVERHEAD)
 
 #define IAVF_32_BIT_WIDTH (CHAR_BIT * 4)
 #define IAVF_48_BIT_WIDTH (CHAR_BIT * 6)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index e22c62ed00..250ef6fc9a 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -460,23 +460,23 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= IAVF_ETH_MAX_LEN ||
 		    max_pkt_len > IAVF_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)IAVF_ETH_MAX_LEN,
 				    (uint32_t)IAVF_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > IAVF_ETH_MAX_LEN) {
 			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)IAVF_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -1303,7 +1303,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > IAVF_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 				DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 09/22] net/ice: fix the jumbo frame flag condition
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (7 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 08/22] net/iavf: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
                         ` (13 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Qiming Yang, Qi Zhang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine")
Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF")
Fixes: ae2bdd0219cb ("net/ice: support MTU setting")
Fixes: 50370662b727 ("net/ice: support device and queue ops")

Cc: Qiming Yang <qiming.yang@intel.com>
Cc: Qi Zhang <qi.z.zhang@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ice/ice_dcf_ethdev.c |  8 ++++----
 drivers/net/ice/ice_ethdev.c     |  2 +-
 drivers/net/ice/ice_ethdev.h     |  1 +
 drivers/net/ice/ice_rxtx.c       | 10 +++++-----
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index a9e78064d4..d46734a57b 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -60,23 +60,23 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq)
 	 * correctly.
 	 */
 	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index e2799a8eb2..ba533a78ee 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3912,7 +3912,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > ICE_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 899f446cde..2b03c59671 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -135,6 +135,7 @@
  */
 #define ICE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)
+#define ICE_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_ETH_OVERHEAD)
 
 #define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK)
 #define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK)
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index d052bd0f1b..c98328ce0b 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -246,23 +246,23 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
 				   dev->data->dev_conf.rxmode.max_rx_pkt_len);
 
 	if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= ICE_ETH_MAX_LEN ||
 		    rxq->max_pkt_len > ICE_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
 				    "as jumbo frame is enabled",
-				    (uint32_t)RTE_ETHER_MAX_LEN,
+				    (uint32_t)ICE_ETH_MAX_LEN,
 				    (uint32_t)ICE_FRAME_SIZE_MAX);
 			return -EINVAL;
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > ICE_ETH_MAX_LEN) {
 			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)ICE_ETH_MAX_LEN);
 			return -EINVAL;
 		}
 	}
@@ -701,7 +701,7 @@ ice_fdir_program_hw_rx_queue(struct ice_rx_queue *rxq)
 	rx_ctx.hbuf = rxq->rx_hdr_len >> ICE_RLAN_CTX_HBUF_S;
 	rx_ctx.dtype = 0; /* No Header Split mode */
 	rx_ctx.dsize = 1; /* 32B descriptors */
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = ICE_ETH_MAX_LEN;
 	/* TPH: Transaction Layer Packet (TLP) processing hints */
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (8 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 09/22] net/ice: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 11/22] net/octeontx: " Steve Yang
                         ` (12 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Rosen Xu

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")

Cc: Rosen Xu <rosen.xu@intel.com>

Reviewed-by: Rosen Xu <rosen.xu@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ipn3ke/ipn3ke_ethdev.h      | 1 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 9b0cf309c8..a6815a9cca 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -640,6 +640,7 @@ ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
  */
 #define IPN3KE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IPN3KE_VLAN_TAG_SIZE * 2)
+#define IPN3KE_ETH_MAX_LEN (RTE_ETHER_MTU + IPN3KE_ETH_OVERHEAD)
 
 #define IPN3KE_MAC_FRAME_SIZE_MAX    9728
 #define IPN3KE_MAC_RX_FRAME_MAXLENGTH    0x00AE
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 8a53602576..9e15cce34f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2801,7 +2801,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > IPN3KE_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			(uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME);
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 11/22] net/octeontx: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (9 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
                         ` (11 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Harman Kalra

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 3151e6a687a3 ("net/octeontx: support MTU")

Cc: Harman Kalra <hkalra@marvell.com>

Acked-by: Harman Kalra <hkalra@marvell.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 2 +-
 drivers/net/octeontx/octeontx_ethdev.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3ee7b043fd..81779885d5 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -552,7 +552,7 @@ octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > OCCTX_L2_MAX_LEN)
 		nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index 7246fb6d1d..780a094ffa 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -44,6 +44,7 @@
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
 #define OCCTX_L2_OVERHEAD	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
 				 OCCTX_MAX_VTAG_ACT_SIZE)
+#define OCCTX_L2_MAX_LEN	(RTE_ETHER_MTU + OCCTX_L2_OVERHEAD)
 
 /* Since HW FRS includes NPC VTAG insertion space, user has reduced FRS */
 #define OCCTX_MAX_FRS	\
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (10 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 11/22] net/octeontx: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
                         ` (10 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 0e2efd02db58 ("net/octeontx2: add MTU set operation")

Cc: Jerin Jacob <jerinj@marvell.com>
Cc: Nithin Dabilpuram <ndabilpuram@marvell.com>
Cc: Kiran Kumar K <kirankumark@marvell.com>

Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx2/otx2_ethdev.h     | 2 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 3b9871f4dc..99f0469d89 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -51,6 +51,8 @@
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
 #define NIX_L2_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
+#define NIX_L2_MAX_LEN \
+	(RTE_ETHER_MTU + NIX_L2_OVERHEAD)
 
 /* HW config of frame size doesn't include FCS */
 #define NIX_MAX_HW_FRS			9212
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index b36d37b9f7..963cc285ed 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -58,7 +58,7 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > NIX_L2_MAX_LEN)
 		dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 13/22] net/qede: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (11 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 14/22] net/sfc: " Steve Yang
                         ` (9 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Rasesh Mody, Shahed Shaikh

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 200645ac7909 ("net/qede: set MTU")

Cc: Rasesh Mody <rmody@marvell.com>
Cc: Shahed Shaikh <shshaikh@marvell.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/qede/qede_ethdev.c | 2 +-
 drivers/net/qede/qede_rxtx.h   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 549013557c..6919378b8e 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2367,7 +2367,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 			fp->rxq->rx_buf_size = rc;
 		}
 	}
-	if (max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+	if (frame_size > QEDE_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h
index d7ff870b20..fcb564a1bb 100644
--- a/drivers/net/qede/qede_rxtx.h
+++ b/drivers/net/qede/qede_rxtx.h
@@ -71,6 +71,7 @@
 				 + (QEDE_LLC_SNAP_HDR_LEN) + 2)
 
 #define QEDE_MAX_ETHER_HDR_LEN	(RTE_ETHER_HDR_LEN + QEDE_ETH_OVERHEAD)
+#define QEDE_ETH_MAX_LEN	(RTE_ETHER_MTU + QEDE_MAX_ETHER_HDR_LEN)
 
 #define QEDE_RSS_OFFLOAD_ALL    (ETH_RSS_IPV4			|\
 				 ETH_RSS_NONFRAG_IPV4_TCP	|\
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 14/22] net/sfc: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (12 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 15/22] net/thunderx: " Steve Yang
                         ` (8 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Andrew Rybchenko

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports VLAN tag.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU',
that perhaps impacts the cases of the jumbo frame related.

Fixes: ff6a1197c3b1 ("net/sfc: convert to new Rx offload API")

Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/sfc/sfc_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 93fc7baa0d..f2f5336435 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1017,7 +1017,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	 * The driver does not use it, but other PMDs update jumbo frame
 	 * flag and max_rx_pkt_len when MTU is set.
 	 */
-	if (mtu > RTE_ETHER_MAX_LEN) {
+	if (mtu > RTE_ETHER_MTU) {
 		struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	}
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 15/22] net/thunderx: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (13 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 14/22] net/sfc: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
                         ` (7 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Jerin Jacob, Maciej Czekaj

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: 65d9804edc05 ("net/thunderx: support MTU configuration")

Cc: Jerin Jacob <jerinj@marvell.com>
Cc: Maciej Czekaj <mczekaj@marvell.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/thunderx/base/nicvf_hw_defs.h | 1 +
 drivers/net/thunderx/nicvf_ethdev.c       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/thunderx/base/nicvf_hw_defs.h b/drivers/net/thunderx/base/nicvf_hw_defs.h
index b12c8ec50a..adc8ec943d 100644
--- a/drivers/net/thunderx/base/nicvf_hw_defs.h
+++ b/drivers/net/thunderx/base/nicvf_hw_defs.h
@@ -176,6 +176,7 @@
 #define NIC_HW_MAX_MTU                  (9190)
 #define NIC_HW_MAX_FRS                  (NIC_HW_MAX_MTU + NIC_HW_L2_OVERHEAD)
 #define NIC_HW_MAX_SEGS                 (12)
+#define NIC_HW_L2_MAX_LEN		(RTE_ETHER_MTU + NIC_HW_L2_OVERHEAD)
 
 /* Descriptor alignments */
 #define NICVF_RBDR_BASE_ALIGN_BYTES     (128) /* 7 bits */
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index b6bb05e500..c2e7c334d4 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -176,7 +176,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		(frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS))
 		return -EINVAL;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > NIC_HW_L2_MAX_LEN)
 		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 16/22] net/ixgbe: fix the jumbo frame flag condition
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (14 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 15/22] net/thunderx: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 17/22] net/cxgbe: " Steve Yang
                         ` (6 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Jeff Guo, Haiyue Wang

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
Fixes: 95a27b3ba5f5 ("net/ixgbe: enable jumbo frame for VF")

Cc: Jeff Guo <jia.guo@intel.com>
Cc: Haiyue Wang <haiyue.wang@intel.com>

Acked-by: Jeff Guo <jia.guo@intel.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++
 drivers/net/ixgbe/ixgbe_pf.c     | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d7a1806ab8..fa0f5afd03 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5173,7 +5173,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
 
 	/* switch to jumbo mode if needed */
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > IXGBE_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 3d35ea791b..a0ce18ca24 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -104,6 +104,9 @@
 /* The overhead from MTU to max frame size. */
 #define IXGBE_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
 
+/* The max frame size with default MTU */
+#define IXGBE_ETH_MAX_LEN  (RTE_ETHER_MTU + IXGBE_ETH_OVERHEAD)
+
 /* bit of VXLAN tunnel type | 7 bits of zeros  | 8 bits of zeros*/
 #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE    0x8000
 /* bit of NVGRE tunnel type | 7 bits of zeros  | 8 bits of zeros*/
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 833863af5a..89698e8470 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -575,7 +575,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
 		   IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
 	if (max_frs < new_mtu) {
 		hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-		if (new_mtu > RTE_ETHER_MAX_LEN) {
+		if (new_mtu > IXGBE_ETH_MAX_LEN) {
 			dev->data->dev_conf.rxmode.offloads |=
 				DEV_RX_OFFLOAD_JUMBO_FRAME;
 			hlreg0 |= IXGBE_HLREG0_JUMBOEN;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 17/22] net/cxgbe: fix the jumbo frame flag condition
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (15 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
                         ` (5 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Rahul Lakkireddy

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 4b2eff452d2e ("cxgbe: enable jumbo frames")
Fixes: 0ec33be4c857 ("cxgbe: allow to change mtu")

Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/cxgbe/cxgbe.h        | 4 ++++
 drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h
index ef62af1c3f..7c89a028bf 100644
--- a/drivers/net/cxgbe/cxgbe.h
+++ b/drivers/net/cxgbe/cxgbe.h
@@ -19,6 +19,10 @@
 #define CXGBE_MAX_RX_PKTLEN (9000 + RTE_ETHER_HDR_LEN + \
 				RTE_ETHER_CRC_LEN) /* max pkt */
 
+/* The max frame size with default MTU */
+#define CXGBE_ETH_MAX_LEN (RTE_ETHER_MTU + \
+		RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 /* Max poll time is 100 * 100msec = 10 sec */
 #define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */
 #define CXGBE_LINK_STATUS_POLL_CNT 100 /* Max number of times to poll */
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 98d0362fa3..480d6f58a8 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -300,7 +300,7 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 		return -EINVAL;
 
 	/* set to jumbo mode if needed */
-	if (new_mtu > RTE_ETHER_MAX_LEN)
+	if (new_mtu > CXGBE_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
@@ -669,7 +669,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		rxq->fl.size = temp_nb_desc;
 
 	/* Set to jumbo mode if necessary */
-	if (pkt_len > RTE_ETHER_MAX_LEN)
+	if (pkt_len > CXGBE_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (16 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 17/22] net/cxgbe: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 19/22] net/enetc: " Steve Yang
                         ` (4 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Somalapuram Amaranath

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: b58d8781fa1f ("net/axgbe: support setting MTU")

Cc: Somalapuram Amaranath <asomalap@amd.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/axgbe/axgbe_ethdev.c | 2 +-
 drivers/net/axgbe/axgbe_ethdev.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index ddd903680d..ebe9a2876d 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -1490,7 +1490,7 @@ static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 				dev->data->port_id);
 		return -EBUSY;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN) {
+	if (frame_size > AXGBE_ETH_MAX_LEN) {
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		val = 1;
diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
index 1481fd9ff3..a6226729fe 100644
--- a/drivers/net/axgbe/axgbe_ethdev.h
+++ b/drivers/net/axgbe/axgbe_ethdev.h
@@ -125,6 +125,12 @@
 /* MDIO port types */
 #define AXGMAC_MAX_C22_PORT		3
 
+/* The max frame size with default MTU */
+#define AXGBE_ETH_MAX_LEN ( \
+	RTE_ETHER_MTU + \
+	RTE_ETHER_HDR_LEN + \
+	RTE_ETHER_CRC_LEN)
+
 /* Helper macro for descriptor handling
  *  Always use AXGBE_GET_DESC_DATA to access the descriptor data
  *  since the index is free-running and needs to be and-ed
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 19/22] net/enetc: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (17 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 20/22] net/hinic: " Steve Yang
                         ` (3 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Gagandeep Singh, Sachin Saxena

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 5d5589b0c858 ("net/enetc: support MTU update and jumbo frames")

Cc: Gagandeep Singh <g.singh@nxp.com>
Cc: Sachin Saxena <sachin.saxena@oss.nxp.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/enetc/enetc.h        | 4 ++++
 drivers/net/enetc/enetc_ethdev.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enetc/enetc.h b/drivers/net/enetc/enetc.h
index 14ef3bc18b..7163633bce 100644
--- a/drivers/net/enetc/enetc.h
+++ b/drivers/net/enetc/enetc.h
@@ -29,6 +29,10 @@
 /* maximum frame size supported */
 #define ENETC_MAC_MAXFRM_SIZE	9600
 
+/* The max frame size with default MTU */
+#define ENETC_ETH_MAX_LEN (RTE_ETHER_MTU + \
+		RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 /*
  * upper_32_bits - return bits 32-63 of a number
  * @n: the number we're accessing
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 6ff3022874..4d2c9c0474 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -677,7 +677,7 @@ enetc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > ENETC_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads &=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 20/22] net/hinic: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (18 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 19/22] net/enetc: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 21/22] net/nfp: " Steve Yang
                         ` (2 subsequent siblings)
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 254bd849b132 ("net/hinic: set jumbo frame offload flag")

Cc: Ziyang Xuan <xuanziyang2@huawei.com>
Cc: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
Cc: Guoyang Zhou <zhouguoyang@huawei.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 62642354cf..5a2c171099 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -75,6 +75,9 @@
 #define HINIC_PKTLEN_TO_MTU(pktlen)	\
 	((pktlen) - (ETH_HLEN + ETH_CRC_LEN))
 
+/* The max frame size with default MTU */
+#define HINIC_ETH_MAX_LEN (RTE_ETHER_MTU + ETH_HLEN + ETH_CRC_LEN)
+
 /* lro numer limit for one packet */
 #define HINIC_LRO_WQE_NUM_DEFAULT	8
 
@@ -1556,7 +1559,7 @@ static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 
 	/* update max frame size */
 	frame_size = HINIC_MTU_TO_PKTLEN(mtu);
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > HINIC_ETH_MAX_LEN)
 		dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 21/22] net/nfp: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (19 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 20/22] net/hinic: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 22/22] net/liquidio: " Steve Yang
  2021-01-18 11:54       ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Ferruh Yigit
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Heinrich Kuhn

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU',
that perhaps impacts the cases of the jumbo frame related.

Fixes: d4a27a3b092a ("nfp: add basic features")

Cc: Heinrich Kuhn <heinrich.kuhn@netronome.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/nfp/nfp_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 1608bf5ea1..9ea24e5bda 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1508,7 +1508,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	/* switch to jumbo mode if needed */
-	if ((uint32_t)mtu > RTE_ETHER_MAX_LEN)
+	if ((uint32_t)mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v4 22/22] net/liquidio: fix the jumbo frame flag condition for mtu set
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (20 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 21/22] net/nfp: " Steve Yang
@ 2021-01-18  7:04       ` Steve Yang
  2021-01-18 11:54       ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Ferruh Yigit
  22 siblings, 0 replies; 115+ messages in thread
From: Steve Yang @ 2021-01-18  7:04 UTC (permalink / raw)
  To: dev; +Cc: Steve Yang, Shijith Thotton, Srisivasubramanian Srinivasan

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 9f1c00266d82 ("net/liquidio: add API to set MTU")

Cc: Shijith Thotton <sthotton@marvell.com>
Cc: Srisivasubramanian Srinivasan <srinivasan@marvell.com>

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/liquidio/lio_ethdev.c | 2 +-
 drivers/net/liquidio/lio_ethdev.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index d4dd3768cd..eb0fdab45a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -481,7 +481,7 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 		return -1;
 	}
 
-	if (frame_len > RTE_ETHER_MAX_LEN)
+	if (frame_len > LIO_ETH_MAX_LEN)
 		eth_dev->data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/liquidio/lio_ethdev.h b/drivers/net/liquidio/lio_ethdev.h
index 74cd2fb6c6..d33be1c44d 100644
--- a/drivers/net/liquidio/lio_ethdev.h
+++ b/drivers/net/liquidio/lio_ethdev.h
@@ -13,6 +13,9 @@
 #define LIO_LSC_TIMEOUT		100000 /* 100000us (100ms) */
 #define LIO_MAX_CMD_TIMEOUT     10000 /* 10000ms (10s) */
 
+/* The max frame size with default MTU */
+#define LIO_ETH_MAX_LEN (RTE_ETHER_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 #define LIO_DEV(_eth_dev)		((_eth_dev)->data->dev_private)
 
 /* LIO Response condition variable */
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-15 10:44     ` oulijun
@ 2021-01-18 10:42       ` Ferruh Yigit
  2021-01-19  8:46         ` oulijun
  0 siblings, 1 reply; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-18 10:42 UTC (permalink / raw)
  To: oulijun, Steve Yang, dev; +Cc: thomas, andrew.rybchenko, linuxarm

On 1/15/2021 10:44 AM, oulijun wrote:
> Hi Steve
> This is a very good job! But I have some question and suggestions.
> Please check it.
> 
> 在 2021/1/14 17:45, Steve Yang 写道:
>> Ethdev is using default Ethernet overhead to decide if provided
>> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
>> and limits it to MAX if it is.
>>
>> Since the application/driver used Ethernet overhead is different than
>> the ethdev one, check result is wrong.
>>
>> If the driver is using Ethernet overhead bigger than the default one,
>> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
>> correct Ethernet overhead is used to convert back, the resulting MTU is
>> less than the intended one, causing some packets to be dropped.
>>
>> Like,
>> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
>> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
>> driver  -> MTU = 1518 - 22 = 1496
>> Packets with size 1497-1500 are dropped although intention is to be able
>> to send/receive them.
>>
>> The fix is to make ethdev use the correct Ethernet overhead for port,
>> instead of default one.
>>
>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>
>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>> ---
>>   lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++---
>>   1 file changed, 24 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
>> index 17ddacc78d..19ca4c4512 100644
>> --- a/lib/librte_ethdev/rte_ethdev.c
>> +++ b/lib/librte_ethdev/rte_ethdev.c
>> @@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>> nb_rx_q, uint16_t nb_tx_q,
>>       struct rte_eth_dev *dev;
>>       struct rte_eth_dev_info dev_info;
>>       struct rte_eth_conf orig_conf;
>> +    uint16_t overhead_len;
>>       int diag;
>>       int ret;
>> +    uint16_t old_mtu;
>>       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>> @@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>> nb_rx_q, uint16_t nb_tx_q,
>>           memcpy(&dev->data->dev_conf, dev_conf,
>>                  sizeof(dev->data->dev_conf));
>> +    /* Backup mtu for rollback */
>> +    old_mtu = dev->data->mtu;
>> +
>>       ret = rte_eth_dev_info_get(port_id, &dev_info);
>>       if (ret != 0)
>>           goto rollback;
>> +    /* Get the real Ethernet overhead length */
>> +    if (dev_info.max_mtu != UINT16_MAX &&
>> +        dev_info.max_rx_pktlen > dev_info.max_mtu)
>> +        overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
>> +    else
>> +        overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
>> +
> The Ethernet frame header length supported by each NIC may be different, which 
> cause the difference of allowed packets size and drop you say.
> The diference of Ethernet frame header length have an impact for the maximum 
> Ethernet frame length, which is a boundary value
> of enabling jumbo frame through the ' max_rx_pkt_len '.
> However, we need to do the same thing you do above to get the overhead_len every 
> time, which will
> cause a lot of duplicate code in the framework and app. For examples, parsing 
> and processing for '--max-pkt-len=xxx' parameter,
>   and " cmd_config_max_pkt_len_parsed " in testpmd, and here modifying here 
> dev_configure API.
> It's a little redundant and troublesome.
> 
> Maybe, it is necessary for driver to directly report the supported maximum 
> Ethernet frame length by rte_dev_info_get API.
> As following:
> struct rte_eth_dev_info {
>      xxxx
>      /**
>       * The maximum Ethernet frame length supported by each
>       * driver varies with the Ethernet header length.
>       */
>      uint16_t eth_max_len;
>      xxxx
> }
> 
> int
> rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
> {
>      xxx
>      dev_info->min_mtu = RTE_ETHER_MIN_MTU;
>      dev_info->max_mtu = UINT16_MAX;
>      dev_info->eth_max_len = RTE_ETHER_MAX_LEN;
>      xxx
> }
> 
> And then:
> xxx_devv_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
> {
>      xxx
>      info->eth_max_len = xxx_ETHER_MAX _LEN;
>      xxx
> }
> What do you think?

Hi Lijun,

The 'max_mtu' has been added in the past to solve exact same problem, perhaps it 
would be better to add something like 'eth_max_len' at that time.

But as Steve mentioned we are planning to switch to more MTU based 
configuration, which should remove the need of the field you mentioned.

>>       /* If number of queues specified by application for both Rx and Tx is
>>        * zero, use driver preferred values. This cannot be done individually
>>        * as it is valid for either Tx or Rx (but not both) to be zero.
>> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>> nb_rx_q, uint16_t nb_tx_q,
>>               goto rollback;
>>           }
>>       } else {
>> -        if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>> -            dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>> +        uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>> +        if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>> +            pktlen > RTE_ETHER_MTU + overhead_len)
>>               /* Use default value */
>>               dev->data->dev_conf.rxmode.max_rx_pkt_len =
>> -                            RTE_ETHER_MAX_LEN;
>> +                        RTE_ETHER_MTU + overhead_len;
>> +    }
>> +
>> +    /* Scale the MTU size to adapt max_rx_pkt_len */
>> +    if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>> +        dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>> +                overhead_len;
>>       }
> Now that we update mtu here when jumbo frame enabled. It is necessary to check 
> validity of max_rx_pkt_len.
> As following:
> if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>      if (dev_conf->rxmode.max_rx_pkt_len > dev_info.max_rx_pktlen ||
>          dev_conf->rxmode.max_rx_pkt_len <=  RTE_ETHER_MTU + overhead_len) {

It is not clear from API that if "max_rx_pkt_len <=  RTE_ETHER_MTU + 
overhead_len" is a valid value or not, the API says:
"max_rx_pkt_len;  /**< Only used if JUMBO_FRAME enabled. */"

But it doesn't say that when 'DEV_RX_OFFLOAD_JUMBO_FRAME' is set, 
'max_rx_pkt_len' should be less then 'RTE_ETHER_MTU'

>              xxxx
>          }
> } else {
>          xxx
> }
> 
> If it does not thing above, which will cause an unreasonable case.
> Like,
> dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME == 1
> dev_conf->rxmode.max_rx_pkt_len = 1500
> overhead_len = 26
> dev->data->mtu = dev_conf->rxmode.max_rx_pkt_len - overhead_len = 1500 - 26 = 1474
> 

This looks correct, if the applicatin is requesting 'max_rx_pkt_len = 1500', the 
requeted MTU is 1474,
if application wants an MTU as 1500, it should set the 'max_rx_pkt_len' as "1500 
+ overhead".

> In fact, DEV_RX_OFFLOAD_JUMBO_FRAME is set to rxmode.offloads when mtu > 1500.

Overall the 'max_rx_pkt_len' setting is a little messy, it has been tried to fix 
in last release but we reverted them because of unexpected side affects.

Current long term plan is,
- Switch both 'rte_eth_dev_configure()' & 'rte_eth_dev_set_mtu()' to work on MTU 
values. (instead one working on frame lenght and other on MTU)
- Remove the 'DEV_RX_OFFLOAD_JUMBO_FRAME' and decide jumbo frame request by 
requested MTU value check
- App decide the jumbo frame capability from the 'max_mtu' check
- App calculate Ethernet overhead using 'max_mtu' and 'max_rx_pktlen'

>>       /*
>> @@ -1549,6 +1568,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>> nb_rx_q, uint16_t nb_tx_q,
>>       eth_dev_tx_queue_config(dev, 0);
>>   rollback:
>>       memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf));
>> +    if (old_mtu != dev->data->mtu)
>> +        dev->data->mtu = old_mtu;
>>       rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret);
>>       return ret;
>>


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

* Re: [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue
  2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
                         ` (21 preceding siblings ...)
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 22/22] net/liquidio: " Steve Yang
@ 2021-01-18 11:54       ` Ferruh Yigit
  22 siblings, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-18 11:54 UTC (permalink / raw)
  To: Steve Yang, dev

On 1/18/2021 7:04 AM, Steve Yang wrote:
> The jumbo frame used the 'RTE_ETHER_MAX_LEN' as boundary condition, this
> fix will change the boundary condition with 'RTE_ETHER_MTU' and overhead.
> 
> When the MTU(1500) set, the frame type of rx packet will be different
> if used different overhead, it will cause the consistency issue, and the
> normal packet will be dropped. Hence, using fixed value 'RTE_ETHER_MTU'
> can avoid this issue.
> 
> Like,
> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
> driver  -> MTU = 1518 - 22 = 1496
> Packets with size 1497-1500 are dropped although intention is to be able
> to send/receive them.
> 
> Following scopes will be changed:
> - 'rte_ethdev'
> - 'app', e.g.: 'test-pmd';
> - net PMDs which support VLAN tag(s) within overhead, e.g.: i40e;
> 
> Following scopes perhaps will be impacted:
> - the cases of jumbo frame related;
> - the logic of 'max_rx_pkt_len' and 'mtu' related;
> - the using place of 'RTE_ETHER_MAX_LEN';
> 
> ---
> v4:
>   - moved mtu assignment to the same if-true-block of jumbo frame;
> v3:
>   - removed redundant if-conditions in rte_ethdev and testpmd;
>   - adjusted the alignment style;
>   - added offload check before updating mtu;
> v2:
>   - defined the 'RTE_ETHER_MTU + overhead' to 'driver_ETH_MAX_LEN';
>   - changed the 'mtu > RTE_ETHER_MTU' to 'frame_size > driver_ETH_MAX_LEN';
> ---
> 
> Steve Yang (22):
>    ethdev: fix MTU size exceeds max rx packet length
>    app/testpmd: fix max rx packet length for VLAN packets
>    net/dpaa: fix the jumbo frame flag condition for mtu set
>    net/dpaa2: fix the jumbo frame flag condition for mtu set
>    net/e1000: fix the jumbo frame flag condition for mtu set
>    net/hns3: fix the jumbo frame flag condition for mtu set
>    net/i40e: fix the jumbo frame flag condition
>    net/iavf: fix the jumbo frame flag condition
>    net/ice: fix the jumbo frame flag condition
>    net/ipn3ke: fix the jumbo frame flag condition for mtu set
>    net/octeontx: fix the jumbo frame flag condition for mtu set
>    net/octeontx2: fix the jumbo frame flag condition for mtu
>    net/qede: fix the jumbo frame flag condition for mtu set
>    net/sfc: fix the jumbo frame flag condition for mtu set
>    net/thunderx: fix the jumbo frame flag condition for mtu set
>    net/ixgbe: fix the jumbo frame flag condition
>    net/cxgbe: fix the jumbo frame flag condition
>    net/axgbe: fix the jumbo frame flag condition for mtu set
>    net/enetc: fix the jumbo frame flag condition for mtu set
>    net/hinic: fix the jumbo frame flag condition for mtu set
>    net/nfp: fix the jumbo frame flag condition for mtu set
>    net/liquidio: fix the jumbo frame flag condition for mtu set

For series,
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Series applied to dpdk-next-net/main, thanks.


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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-18 10:42       ` Ferruh Yigit
@ 2021-01-19  8:46         ` oulijun
  2021-01-23  9:05           ` oulijun
  2021-01-25 12:22           ` Ferruh Yigit
  0 siblings, 2 replies; 115+ messages in thread
From: oulijun @ 2021-01-19  8:46 UTC (permalink / raw)
  To: Ferruh Yigit, Steve Yang, dev; +Cc: thomas, andrew.rybchenko



在 2021/1/18 18:42, Ferruh Yigit 写道:
> On 1/15/2021 10:44 AM, oulijun wrote:
>> Hi Steve
>> This is a very good job! But I have some question and suggestions.
>> Please check it.
>>
>> 在 2021/1/14 17:45, Steve Yang 写道:
>>> Ethdev is using default Ethernet overhead to decide if provided
>>> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
>>> and limits it to MAX if it is.
>>>
>>> Since the application/driver used Ethernet overhead is different than
>>> the ethdev one, check result is wrong.
>>>
>>> If the driver is using Ethernet overhead bigger than the default one,
>>> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
>>> correct Ethernet overhead is used to convert back, the resulting MTU is
>>> less than the intended one, causing some packets to be dropped.
>>>
>>> Like,
>>> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
>>> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
>>> driver  -> MTU = 1518 - 22 = 1496
>>> Packets with size 1497-1500 are dropped although intention is to be able
>>> to send/receive them.
>>>
>>> The fix is to make ethdev use the correct Ethernet overhead for port,
>>> instead of default one.
>>>
>>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>>
>>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>>> ---
>>>   lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++---
>>>   1 file changed, 24 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/lib/librte_ethdev/rte_ethdev.c 
>>> b/lib/librte_ethdev/rte_ethdev.c
>>> index 17ddacc78d..19ca4c4512 100644
>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>> @@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, 
>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>       struct rte_eth_dev *dev;
>>>       struct rte_eth_dev_info dev_info;
>>>       struct rte_eth_conf orig_conf;
>>> +    uint16_t overhead_len;
>>>       int diag;
>>>       int ret;
>>> +    uint16_t old_mtu;
>>>       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>> @@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, 
>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>           memcpy(&dev->data->dev_conf, dev_conf,
>>>                  sizeof(dev->data->dev_conf));
>>> +    /* Backup mtu for rollback */
>>> +    old_mtu = dev->data->mtu;
>>> +
>>>       ret = rte_eth_dev_info_get(port_id, &dev_info);
>>>       if (ret != 0)
>>>           goto rollback;
>>> +    /* Get the real Ethernet overhead length */
>>> +    if (dev_info.max_mtu != UINT16_MAX &&
>>> +        dev_info.max_rx_pktlen > dev_info.max_mtu)
>>> +        overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
>>> +    else
>>> +        overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
>>> +
>> The Ethernet frame header length supported by each NIC may be 
>> different, which cause the difference of allowed packets size and drop 
>> you say.
>> The diference of Ethernet frame header length have an impact for the 
>> maximum Ethernet frame length, which is a boundary value
>> of enabling jumbo frame through the ' max_rx_pkt_len '.
>> However, we need to do the same thing you do above to get the 
>> overhead_len every time, which will
>> cause a lot of duplicate code in the framework and app. For examples, 
>> parsing and processing for '--max-pkt-len=xxx' parameter,
>>   and " cmd_config_max_pkt_len_parsed " in testpmd, and here modifying 
>> here dev_configure API.
>> It's a little redundant and troublesome.
>>
>> Maybe, it is necessary for driver to directly report the supported 
>> maximum Ethernet frame length by rte_dev_info_get API.
>> As following:
>> struct rte_eth_dev_info {
>>      xxxx
>>      /**
>>       * The maximum Ethernet frame length supported by each
>>       * driver varies with the Ethernet header length.
>>       */
>>      uint16_t eth_max_len;
>>      xxxx
>> }
>>
>> int
>> rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
>> {
>>      xxx
>>      dev_info->min_mtu = RTE_ETHER_MIN_MTU;
>>      dev_info->max_mtu = UINT16_MAX;
>>      dev_info->eth_max_len = RTE_ETHER_MAX_LEN;
>>      xxx
>> }
>>
>> And then:
>> xxx_devv_infos_get(struct rte_eth_dev *eth_dev, struct 
>> rte_eth_dev_info *info)
>> {
>>      xxx
>>      info->eth_max_len = xxx_ETHER_MAX _LEN;
>>      xxx
>> }
>> What do you think?
> 
> Hi Lijun,
> 
> The 'max_mtu' has been added in the past to solve exact same problem, 
> perhaps it would be better to add something like 'eth_max_len' at that 
> time.
> 
> But as Steve mentioned we are planning to switch to more MTU based 
> configuration, which should remove the need of the field you mentioned.
> 
>>>       /* If number of queues specified by application for both Rx and 
>>> Tx is
>>>        * zero, use driver preferred values. This cannot be done 
>>> individually
>>>        * as it is valid for either Tx or Rx (but not both) to be zero.
>>> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, 
>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>               goto rollback;
>>>           }
>>>       } else {
>>> -        if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>>> -            dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>>> +        uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>>> +        if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>>> +            pktlen > RTE_ETHER_MTU + overhead_len)
>>>               /* Use default value */
>>>               dev->data->dev_conf.rxmode.max_rx_pkt_len =
>>> -                            RTE_ETHER_MAX_LEN;
>>> +                        RTE_ETHER_MTU + overhead_len;
>>> +    }
>>> +
>>> +    /* Scale the MTU size to adapt max_rx_pkt_len */
>>> +    if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>> +        dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>>> +                overhead_len;
>>>       }
>> Now that we update mtu here when jumbo frame enabled. It is necessary 
>> to check validity of max_rx_pkt_len.
>> As following:
>> if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>      if (dev_conf->rxmode.max_rx_pkt_len > dev_info.max_rx_pktlen ||
>>          dev_conf->rxmode.max_rx_pkt_len <=  RTE_ETHER_MTU + 
>> overhead_len) {
> 
> It is not clear from API that if "max_rx_pkt_len <=  RTE_ETHER_MTU + 
> overhead_len" is a valid value or not, the API says:
> "max_rx_pkt_len;  /**< Only used if JUMBO_FRAME enabled. */"
> 
> But it doesn't say that when 'DEV_RX_OFFLOAD_JUMBO_FRAME' is set, 
> 'max_rx_pkt_len' should be less then 'RTE_ETHER_MTU'
> 
The MTU setting entry does need to be adjusted. I agree! But I think 
this place should be modified, and it's probably more reasonable.

Generally speaking, max_rx_pkt_len will be also updated with 'mtu + 
overhead_len' also when application sets mtu > 1500, which means 
JUMBO_FRAME is enabled.
Namely, JUMBO_FRAME is enabled based on mtu > 1500 or max_rx_pkt_len > 
1500 + overhead_len.
Besides, having following check for "rxmode.offloads & 
DEV_RX_OFFLOAD_JUMBO_FRAME == 0":
@@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
               goto rollback;
           }
       } else {
         uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
         if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
             pktlen > RTE_ETHER_MTU + overhead_len)
               /* Use default value */
               dev->data->dev_conf.rxmode.max_rx_pkt_len =
                         RTE_ETHER_MTU + overhead_len;
}
One of check condition for the branch is "pktlen > RTE_ETHER_MTU + 
overhead_len ".

In view of the above two aspects, when application set 
DEV_RX_OFFLOAD_JUMBO_FRAME in offload, the max_rx_pkt_len must be 
greater than " RTE_ETHER_MTU + overhead_len "

Since DEV_RX_OFFLOAD_JUMBO_FRAME is not removed, so the check is necessary.

>>              xxxx
>>          }
>> } else {
>>          xxx
>> }
>>
>> If it does not thing above, which will cause an unreasonable case.
>> Like,
>> dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME == 1
>> dev_conf->rxmode.max_rx_pkt_len = 1500
>> overhead_len = 26
>> dev->data->mtu = dev_conf->rxmode.max_rx_pkt_len - overhead_len = 1500 
>> - 26 = 1474
>>
> 
> This looks correct, if the applicatin is requesting 'max_rx_pkt_len = 
> 1500', the requeted MTU is 1474,
> if application wants an MTU as 1500, it should set the 'max_rx_pkt_len' 
> as "1500 + overhead".
> 
>> In fact, DEV_RX_OFFLOAD_JUMBO_FRAME is set to rxmode.offloads when mtu 
>> > 1500.
> 
> Overall the 'max_rx_pkt_len' setting is a little messy, it has been 
> tried to fix in last release but we reverted them because of unexpected 
> side affects.
> 
> Current long term plan is,
> - Switch both 'rte_eth_dev_configure()' & 'rte_eth_dev_set_mtu()' to 
> work on MTU values. (instead one working on frame lenght and other on MTU)
> - Remove the 'DEV_RX_OFFLOAD_JUMBO_FRAME' and decide jumbo frame request 
> by requested MTU value check
> - App decide the jumbo frame capability from the 'max_mtu' check
> - App calculate Ethernet overhead using 'max_mtu' and 'max_rx_pktlen'
> 
>>>       /*
>>> @@ -1549,6 +1568,8 @@ rte_eth_dev_configure(uint16_t port_id, 
>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>       eth_dev_tx_queue_config(dev, 0);
>>>   rollback:
>>>       memcpy(&dev->data->dev_conf, &orig_conf, 
>>> sizeof(dev->data->dev_conf));
>>> +    if (old_mtu != dev->data->mtu)
>>> +        dev->data->mtu = old_mtu;
>>>       rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, 
>>> ret);
>>>       return ret;
>>>
> 
> .
> 

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

* Re: [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets
  2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
@ 2021-01-21 15:27         ` Lance Richardson
  2021-01-22 14:26           ` Lance Richardson
  2021-01-25 12:14           ` Ferruh Yigit
  0 siblings, 2 replies; 115+ messages in thread
From: Lance Richardson @ 2021-01-21 15:27 UTC (permalink / raw)
  To: Steve Yang; +Cc: dev, Wenzhuo Lu, Beilei Xing, Bernard Iremonger

[-- Attachment #1: Type: text/plain, Size: 6403 bytes --]

On Mon, Jan 18, 2021 at 2:08 AM Steve Yang <stevex.yang@intel.com> wrote:
>
> When the max rx packet length is smaller than the sum of mtu size and
> ether overhead size, it should be enlarged, otherwise the VLAN packets
> will be dropped.
>
> Removed the rx_offloads assignment for jumbo frame during command line
> parsing, and set the correct jumbo frame flag if MTU size is larger than
> the default value 'RTE_ETHER_MTU' within 'init_config()'.
>
> Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
> Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
> Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
> Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")
>
> Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
> Cc: Beilei Xing <beilei.xing@intel.com>
> Cc: Bernard Iremonger <bernard.iremonger@intel.com>
>
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  app/test-pmd/cmdline.c    |  6 ------
>  app/test-pmd/config.c     |  2 +-
>  app/test-pmd/parameters.c |  7 ++-----
>  app/test-pmd/testpmd.c    | 18 ++++++++++++++++++
>  4 files changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 2ccbaa039e..65042fcff5 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -1886,7 +1886,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
>
>         RTE_ETH_FOREACH_DEV(pid) {
>                 struct rte_port *port = &ports[pid];
> -               uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
>
>                 if (!strcmp(res->name, "max-pkt-len")) {
>                         if (res->value < RTE_ETHER_MIN_LEN) {
> @@ -1898,11 +1897,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
>                                 return;
>
>                         port->dev_conf.rxmode.max_rx_pkt_len = res->value;
> -                       if (res->value > RTE_ETHER_MAX_LEN)
> -                               rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> -                       else
> -                               rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -                       port->dev_conf.rxmode.offloads = rx_offloads;
>                 } else {
>                         printf("Unknown parameter\n");
>                         return;
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 3f6c8642b1..1195f054f3 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1434,7 +1434,7 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
>                  * device supports jumbo frame.
>                  */
>                 eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu;
> -               if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) {
> +               if (mtu > RTE_ETHER_MTU) {
>                         rte_port->dev_conf.rxmode.offloads |=
>                                                 DEV_RX_OFFLOAD_JUMBO_FRAME;
>                         rte_port->dev_conf.rxmode.max_rx_pkt_len =
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> index 414a0068fb..df5eb10d84 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -834,12 +834,9 @@ launch_args_parse(int argc, char** argv)
>                         }
>                         if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
>                                 n = atoi(optarg);
> -                               if (n >= RTE_ETHER_MIN_LEN) {
> +                               if (n >= RTE_ETHER_MIN_LEN)
>                                         rx_mode.max_rx_pkt_len = (uint32_t) n;
> -                                       if (n > RTE_ETHER_MAX_LEN)
> -                                               rx_offloads |=
> -                                                       DEV_RX_OFFLOAD_JUMBO_FRAME;
> -                               } else
> +                               else
>                                         rte_exit(EXIT_FAILURE,
>                                                  "Invalid max-pkt-len=%d - should be > %d\n",
>                                                  n, RTE_ETHER_MIN_LEN);
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 2b60f6c5d3..c256e719ae 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1410,6 +1410,7 @@ init_config(void)
>         struct rte_gro_param gro_param;
>         uint32_t gso_types;
>         uint16_t data_size;
> +       uint16_t eth_overhead;
>         bool warning = 0;
>         int k;
>         int ret;
> @@ -1446,6 +1447,23 @@ init_config(void)
>                         rte_exit(EXIT_FAILURE,
>                                  "rte_eth_dev_info_get() failed\n");
>
> +               /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
> +               if (port->dev_info.max_mtu != UINT16_MAX &&
> +                   port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
> +                       eth_overhead = port->dev_info.max_rx_pktlen -
> +                               port->dev_info.max_mtu;
> +               else
> +                       eth_overhead =
> +                               RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> +
> +               if (port->dev_conf.rxmode.max_rx_pkt_len <=
> +                       (uint32_t)(RTE_ETHER_MTU + eth_overhead))
> +                       port->dev_conf.rxmode.max_rx_pkt_len =
> +                                       RTE_ETHER_MTU + eth_overhead;
> +               else
> +                       port->dev_conf.rxmode.offloads |=
> +                                       DEV_RX_OFFLOAD_JUMBO_FRAME;
> +
>                 if (!(port->dev_info.tx_offload_capa &
>                       DEV_TX_OFFLOAD_MBUF_FAST_FREE))
>                         port->dev_conf.txmode.offloads &=
> --
> 2.17.1
>

Moving the setting of DEV_RX_OFFLOAD_JUMBO_FRAME from
cmd_config_max_pkt_len_parsed() to init_config() doesn't seem to
be correct for the case where max_rx_pkt_len is changed from the
command line via "port config all max-pkt-len".

The init_config() function is only called when testpmd is started,
but the DEV_RX_OFFLOAD_JUMBO_FRAME setting needs to
be recomputed whenever max_rx_pkt_len changes.

(Of course this won't matter when DEV_RX_OFFLOAD_JUMBO_FRAME
is removed, which seems like a great idea, but for now this is impacting
some test automation with 21.02-rc1.)

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

* Re: [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets
  2021-01-21 15:27         ` Lance Richardson
@ 2021-01-22 14:26           ` Lance Richardson
  2021-01-25 12:14           ` Ferruh Yigit
  1 sibling, 0 replies; 115+ messages in thread
From: Lance Richardson @ 2021-01-22 14:26 UTC (permalink / raw)
  To: Steve Yang, Ferruh Yigit; +Cc: dev, Wenzhuo Lu, Beilei Xing, Bernard Iremonger

[-- Attachment #1: Type: text/plain, Size: 6818 bytes --]

On Thu, Jan 21, 2021 at 10:27 AM Lance Richardson
<lance.richardson@broadcom.com> wrote:
>
> On Mon, Jan 18, 2021 at 2:08 AM Steve Yang <stevex.yang@intel.com> wrote:
> >
> > When the max rx packet length is smaller than the sum of mtu size and
> > ether overhead size, it should be enlarged, otherwise the VLAN packets
> > will be dropped.
> >
> > Removed the rx_offloads assignment for jumbo frame during command line
> > parsing, and set the correct jumbo frame flag if MTU size is larger than
> > the default value 'RTE_ETHER_MTU' within 'init_config()'.
> >
> > Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
> > Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
> > Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
> > Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")
> >
> > Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > Cc: Beilei Xing <beilei.xing@intel.com>
> > Cc: Bernard Iremonger <bernard.iremonger@intel.com>
> >
> > Signed-off-by: Steve Yang <stevex.yang@intel.com>
> > ---
> >  app/test-pmd/cmdline.c    |  6 ------
> >  app/test-pmd/config.c     |  2 +-
> >  app/test-pmd/parameters.c |  7 ++-----
> >  app/test-pmd/testpmd.c    | 18 ++++++++++++++++++
> >  4 files changed, 21 insertions(+), 12 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> > index 2ccbaa039e..65042fcff5 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -1886,7 +1886,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
> >
> >         RTE_ETH_FOREACH_DEV(pid) {
> >                 struct rte_port *port = &ports[pid];
> > -               uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
> >
> >                 if (!strcmp(res->name, "max-pkt-len")) {
> >                         if (res->value < RTE_ETHER_MIN_LEN) {
> > @@ -1898,11 +1897,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
> >                                 return;
> >
> >                         port->dev_conf.rxmode.max_rx_pkt_len = res->value;
> > -                       if (res->value > RTE_ETHER_MAX_LEN)
> > -                               rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> > -                       else
> > -                               rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> > -                       port->dev_conf.rxmode.offloads = rx_offloads;
> >                 } else {
> >                         printf("Unknown parameter\n");
> >                         return;
> > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> > index 3f6c8642b1..1195f054f3 100644
> > --- a/app/test-pmd/config.c
> > +++ b/app/test-pmd/config.c
> > @@ -1434,7 +1434,7 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
> >                  * device supports jumbo frame.
> >                  */
> >                 eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu;
> > -               if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) {
> > +               if (mtu > RTE_ETHER_MTU) {
> >                         rte_port->dev_conf.rxmode.offloads |=
> >                                                 DEV_RX_OFFLOAD_JUMBO_FRAME;
> >                         rte_port->dev_conf.rxmode.max_rx_pkt_len =
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > index 414a0068fb..df5eb10d84 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -834,12 +834,9 @@ launch_args_parse(int argc, char** argv)
> >                         }
> >                         if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
> >                                 n = atoi(optarg);
> > -                               if (n >= RTE_ETHER_MIN_LEN) {
> > +                               if (n >= RTE_ETHER_MIN_LEN)
> >                                         rx_mode.max_rx_pkt_len = (uint32_t) n;
> > -                                       if (n > RTE_ETHER_MAX_LEN)
> > -                                               rx_offloads |=
> > -                                                       DEV_RX_OFFLOAD_JUMBO_FRAME;
> > -                               } else
> > +                               else
> >                                         rte_exit(EXIT_FAILURE,
> >                                                  "Invalid max-pkt-len=%d - should be > %d\n",
> >                                                  n, RTE_ETHER_MIN_LEN);
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> > index 2b60f6c5d3..c256e719ae 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -1410,6 +1410,7 @@ init_config(void)
> >         struct rte_gro_param gro_param;
> >         uint32_t gso_types;
> >         uint16_t data_size;
> > +       uint16_t eth_overhead;
> >         bool warning = 0;
> >         int k;
> >         int ret;
> > @@ -1446,6 +1447,23 @@ init_config(void)
> >                         rte_exit(EXIT_FAILURE,
> >                                  "rte_eth_dev_info_get() failed\n");
> >
> > +               /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
> > +               if (port->dev_info.max_mtu != UINT16_MAX &&
> > +                   port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
> > +                       eth_overhead = port->dev_info.max_rx_pktlen -
> > +                               port->dev_info.max_mtu;
> > +               else
> > +                       eth_overhead =
> > +                               RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> > +
> > +               if (port->dev_conf.rxmode.max_rx_pkt_len <=
> > +                       (uint32_t)(RTE_ETHER_MTU + eth_overhead))
> > +                       port->dev_conf.rxmode.max_rx_pkt_len =
> > +                                       RTE_ETHER_MTU + eth_overhead;
> > +               else
> > +                       port->dev_conf.rxmode.offloads |=
> > +                                       DEV_RX_OFFLOAD_JUMBO_FRAME;
> > +
> >                 if (!(port->dev_info.tx_offload_capa &
> >                       DEV_TX_OFFLOAD_MBUF_FAST_FREE))
> >                         port->dev_conf.txmode.offloads &=
> > --
> > 2.17.1
> >
>
> Moving the setting of DEV_RX_OFFLOAD_JUMBO_FRAME from
> cmd_config_max_pkt_len_parsed() to init_config() doesn't seem to
> be correct for the case where max_rx_pkt_len is changed from the
> command line via "port config all max-pkt-len".
>
> The init_config() function is only called when testpmd is started,
> but the DEV_RX_OFFLOAD_JUMBO_FRAME setting needs to
> be recomputed whenever max_rx_pkt_len changes.
>
> (Of course this won't matter when DEV_RX_OFFLOAD_JUMBO_FRAME
> is removed, which seems like a great idea, but for now this is impacting
> some test automation with 21.02-rc1.)

+Ferruh (sorry, thought he was already on this thread.)

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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-19  8:46         ` oulijun
@ 2021-01-23  9:05           ` oulijun
  2021-01-25 12:22           ` Ferruh Yigit
  1 sibling, 0 replies; 115+ messages in thread
From: oulijun @ 2021-01-23  9:05 UTC (permalink / raw)
  To: dev



在 2021/1/19 16:46, oulijun 写道:
> 
> 
> 在 2021/1/18 18:42, Ferruh Yigit 写道:
>> On 1/15/2021 10:44 AM, oulijun wrote:
>>> Hi Steve
>>> This is a very good job! But I have some question and suggestions.
>>> Please check it.
>>>
>>> 在 2021/1/14 17:45, Steve Yang 写道:
>>>> Ethdev is using default Ethernet overhead to decide if provided
>>>> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
>>>> and limits it to MAX if it is.
>>>>
>>>> Since the application/driver used Ethernet overhead is different than
>>>> the ethdev one, check result is wrong.
>>>>
>>>> If the driver is using Ethernet overhead bigger than the default one,
>>>> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
>>>> correct Ethernet overhead is used to convert back, the resulting MTU is
>>>> less than the intended one, causing some packets to be dropped.
>>>>
>>>> Like,
>>>> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
>>>> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
>>>> driver  -> MTU = 1518 - 22 = 1496
>>>> Packets with size 1497-1500 are dropped although intention is to be 
>>>> able
>>>> to send/receive them.
>>>>
>>>> The fix is to make ethdev use the correct Ethernet overhead for port,
>>>> instead of default one.
>>>>
>>>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>>>
>>>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>>>> ---
>>>>   lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++---
>>>>   1 file changed, 24 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/lib/librte_ethdev/rte_ethdev.c 
>>>> b/lib/librte_ethdev/rte_ethdev.c
>>>> index 17ddacc78d..19ca4c4512 100644
>>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>>> @@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, 
>>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>>       struct rte_eth_dev *dev;
>>>>       struct rte_eth_dev_info dev_info;
>>>>       struct rte_eth_conf orig_conf;
>>>> +    uint16_t overhead_len;
>>>>       int diag;
>>>>       int ret;
>>>> +    uint16_t old_mtu;
>>>>       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>>> @@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, 
>>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>>           memcpy(&dev->data->dev_conf, dev_conf,
>>>>                  sizeof(dev->data->dev_conf));
>>>> +    /* Backup mtu for rollback */
>>>> +    old_mtu = dev->data->mtu;
>>>> +
>>>>       ret = rte_eth_dev_info_get(port_id, &dev_info);
>>>>       if (ret != 0)
>>>>           goto rollback;
>>>> +    /* Get the real Ethernet overhead length */
>>>> +    if (dev_info.max_mtu != UINT16_MAX &&
>>>> +        dev_info.max_rx_pktlen > dev_info.max_mtu)
>>>> +        overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
>>>> +    else
>>>> +        overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
>>>> +
>>> The Ethernet frame header length supported by each NIC may be 
>>> different, which cause the difference of allowed packets size and 
>>> drop you say.
>>> The diference of Ethernet frame header length have an impact for the 
>>> maximum Ethernet frame length, which is a boundary value
>>> of enabling jumbo frame through the ' max_rx_pkt_len '.
>>> However, we need to do the same thing you do above to get the 
>>> overhead_len every time, which will
>>> cause a lot of duplicate code in the framework and app. For examples, 
>>> parsing and processing for '--max-pkt-len=xxx' parameter,
>>>   and " cmd_config_max_pkt_len_parsed " in testpmd, and here 
>>> modifying here dev_configure API.
>>> It's a little redundant and troublesome.
>>>
>>> Maybe, it is necessary for driver to directly report the supported 
>>> maximum Ethernet frame length by rte_dev_info_get API.
>>> As following:
>>> struct rte_eth_dev_info {
>>>      xxxx
>>>      /**
>>>       * The maximum Ethernet frame length supported by each
>>>       * driver varies with the Ethernet header length.
>>>       */
>>>      uint16_t eth_max_len;
>>>      xxxx
>>> }
>>>
>>> int
>>> rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info 
>>> *dev_info)
>>> {
>>>      xxx
>>>      dev_info->min_mtu = RTE_ETHER_MIN_MTU;
>>>      dev_info->max_mtu = UINT16_MAX;
>>>      dev_info->eth_max_len = RTE_ETHER_MAX_LEN;
>>>      xxx
>>> }
>>>
>>> And then:
>>> xxx_devv_infos_get(struct rte_eth_dev *eth_dev, struct 
>>> rte_eth_dev_info *info)
>>> {
>>>      xxx
>>>      info->eth_max_len = xxx_ETHER_MAX _LEN;
>>>      xxx
>>> }
>>> What do you think?
>>
>> Hi Lijun,
>>
>> The 'max_mtu' has been added in the past to solve exact same problem, 
>> perhaps it would be better to add something like 'eth_max_len' at that 
>> time.
>>
>> But as Steve mentioned we are planning to switch to more MTU based 
>> configuration, which should remove the need of the field you mentioned.
>>
>>>>       /* If number of queues specified by application for both Rx 
>>>> and Tx is
>>>>        * zero, use driver preferred values. This cannot be done 
>>>> individually
>>>>        * as it is valid for either Tx or Rx (but not both) to be zero.
>>>> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, 
>>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>>               goto rollback;
>>>>           }
>>>>       } else {
>>>> -        if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>>>> -            dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>>>> +        uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>>>> +        if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>>>> +            pktlen > RTE_ETHER_MTU + overhead_len)
>>>>               /* Use default value */
>>>>               dev->data->dev_conf.rxmode.max_rx_pkt_len =
>>>> -                            RTE_ETHER_MAX_LEN;
>>>> +                        RTE_ETHER_MTU + overhead_len;
>>>> +    }
>>>> +
>>>> +    /* Scale the MTU size to adapt max_rx_pkt_len */
>>>> +    if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>>> +        dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>>>> +                overhead_len;
>>>>       }
>>> Now that we update mtu here when jumbo frame enabled. It is necessary 
>>> to check validity of max_rx_pkt_len.
>>> As following:
>>> if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>>      if (dev_conf->rxmode.max_rx_pkt_len > dev_info.max_rx_pktlen ||
>>>          dev_conf->rxmode.max_rx_pkt_len <=  RTE_ETHER_MTU + 
>>> overhead_len) {
>>
>> It is not clear from API that if "max_rx_pkt_len <=  RTE_ETHER_MTU + 
>> overhead_len" is a valid value or not, the API says:
>> "max_rx_pkt_len;  /**< Only used if JUMBO_FRAME enabled. */"
>>
>> But it doesn't say that when 'DEV_RX_OFFLOAD_JUMBO_FRAME' is set, 
>> 'max_rx_pkt_len' should be less then 'RTE_ETHER_MTU'
>>
> The MTU setting entry does need to be adjusted. I agree! But I think 
> this place should be modified, and it's probably more reasonable.
> 
> Generally speaking, max_rx_pkt_len will be also updated with 'mtu + 
> overhead_len' also when application sets mtu > 1500, which means 
> JUMBO_FRAME is enabled.
> Namely, JUMBO_FRAME is enabled based on mtu > 1500 or max_rx_pkt_len > 
> 1500 + overhead_len.
> Besides, having following check for "rxmode.offloads & 
> DEV_RX_OFFLOAD_JUMBO_FRAME == 0":
> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
> nb_rx_q, uint16_t nb_tx_q,
>                goto rollback;
>            }
>        } else {
>          uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>          if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>              pktlen > RTE_ETHER_MTU + overhead_len)
>                /* Use default value */
>                dev->data->dev_conf.rxmode.max_rx_pkt_len =
>                          RTE_ETHER_MTU + overhead_len;
> }
> One of check condition for the branch is "pktlen > RTE_ETHER_MTU + 
> overhead_len ".
> 
> In view of the above two aspects, when application set 
> DEV_RX_OFFLOAD_JUMBO_FRAME in offload, the max_rx_pkt_len must be 
> greater than " RTE_ETHER_MTU + overhead_len "
> 
> Since DEV_RX_OFFLOAD_JUMBO_FRAME is not removed, so the check is necessary.
> 
>>>              xxxx
>>>          }
>>> } else {
>>>          xxx
>>> }
>>>
>>> If it does not thing above, which will cause an unreasonable case.
>>> Like,
>>> dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME == 1
>>> dev_conf->rxmode.max_rx_pkt_len = 1500
>>> overhead_len = 26
>>> dev->data->mtu = dev_conf->rxmode.max_rx_pkt_len - overhead_len = 
>>> 1500 - 26 = 1474
>>>
>>
>> This looks correct, if the applicatin is requesting 'max_rx_pkt_len = 
>> 1500', the requeted MTU is 1474,
>> if application wants an MTU as 1500, it should set the 
>> 'max_rx_pkt_len' as "1500 + overhead".
>>
>>> In fact, DEV_RX_OFFLOAD_JUMBO_FRAME is set to rxmode.offloads when 
>>> mtu > 1500.
Now that there are two interfaces for modifying MTU, namely, 
'rte_eth_dev_configure()' & 'rte_eth_dev_set_mtu()'.
They modify MTU based on 'max_rx_pkt_len' and 'mtu' value, respectively. 
The 'max_rx_pkt_len' field has been used
  in xxx_dev_configure ops in many PMD drivers. In addition, if 
'DEV_RX_OFFLOAD_JUMBO_FRAME' is set, the value of
'max_rx_pkt_len' is also verified by using max_rx_pktlen and 
RTE_ETHER_MTU + overhead_len in i40e and ice driver.

Currently, DEV_RX_OFFLOAD_JUMBO_FRAME has not been removed, so it is 
necessary and reasonable
  to check 'max_rx_pkt_len' in 'rte_eth_dev_configure()'.

Please check it again. Looking forward to your reply.
>>
>> Overall the 'max_rx_pkt_len' setting is a little messy, it has been 
>> tried to fix in last release but we reverted them because of 
>> unexpected side affects.
>>
>> Current long term plan is,
>> - Switch both 'rte_eth_dev_configure()' & 'rte_eth_dev_set_mtu()' to 
>> work on MTU values. (instead one working on frame lenght and other on 
>> MTU)
>> - Remove the 'DEV_RX_OFFLOAD_JUMBO_FRAME' and decide jumbo frame 
>> request by requested MTU value check
>> - App decide the jumbo frame capability from the 'max_mtu' check
>> - App calculate Ethernet overhead using 'max_mtu' and 'max_rx_pktlen'
>>
>>>>       /*
>>>> @@ -1549,6 +1568,8 @@ rte_eth_dev_configure(uint16_t port_id, 
>>>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>>>       eth_dev_tx_queue_config(dev, 0);
>>>>   rollback:
>>>>       memcpy(&dev->data->dev_conf, &orig_conf, 
>>>> sizeof(dev->data->dev_conf));
>>>> +    if (old_mtu != dev->data->mtu)
>>>> +        dev->data->mtu = old_mtu;
>>>>       rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, 
>>>> dev_conf, ret);
>>>>       return ret;
>>>>
>>
>> .
>>
> .
> 

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

* Re: [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets
  2021-01-21 15:27         ` Lance Richardson
  2021-01-22 14:26           ` Lance Richardson
@ 2021-01-25 12:14           ` Ferruh Yigit
  1 sibling, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-25 12:14 UTC (permalink / raw)
  To: Lance Richardson, Steve Yang
  Cc: dev, Wenzhuo Lu, Beilei Xing, Bernard Iremonger

On 1/21/2021 3:27 PM, Lance Richardson wrote:
> On Mon, Jan 18, 2021 at 2:08 AM Steve Yang <stevex.yang@intel.com> wrote:
>>
>> When the max rx packet length is smaller than the sum of mtu size and
>> ether overhead size, it should be enlarged, otherwise the VLAN packets
>> will be dropped.
>>
>> Removed the rx_offloads assignment for jumbo frame during command line
>> parsing, and set the correct jumbo frame flag if MTU size is larger than
>> the default value 'RTE_ETHER_MTU' within 'init_config()'.
>>
>> Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
>> Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
>> Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
>> Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")
>>
>> Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
>> Cc: Beilei Xing <beilei.xing@intel.com>
>> Cc: Bernard Iremonger <bernard.iremonger@intel.com>
>>
>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>> ---
>>   app/test-pmd/cmdline.c    |  6 ------
>>   app/test-pmd/config.c     |  2 +-
>>   app/test-pmd/parameters.c |  7 ++-----
>>   app/test-pmd/testpmd.c    | 18 ++++++++++++++++++
>>   4 files changed, 21 insertions(+), 12 deletions(-)
>>
>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>> index 2ccbaa039e..65042fcff5 100644
>> --- a/app/test-pmd/cmdline.c
>> +++ b/app/test-pmd/cmdline.c
>> @@ -1886,7 +1886,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
>>
>>          RTE_ETH_FOREACH_DEV(pid) {
>>                  struct rte_port *port = &ports[pid];
>> -               uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
>>
>>                  if (!strcmp(res->name, "max-pkt-len")) {
>>                          if (res->value < RTE_ETHER_MIN_LEN) {
>> @@ -1898,11 +1897,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
>>                                  return;
>>
>>                          port->dev_conf.rxmode.max_rx_pkt_len = res->value;
>> -                       if (res->value > RTE_ETHER_MAX_LEN)
>> -                               rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
>> -                       else
>> -                               rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
>> -                       port->dev_conf.rxmode.offloads = rx_offloads;
>>                  } else {
>>                          printf("Unknown parameter\n");
>>                          return;
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 3f6c8642b1..1195f054f3 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -1434,7 +1434,7 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
>>                   * device supports jumbo frame.
>>                   */
>>                  eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu;
>> -               if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) {
>> +               if (mtu > RTE_ETHER_MTU) {
>>                          rte_port->dev_conf.rxmode.offloads |=
>>                                                  DEV_RX_OFFLOAD_JUMBO_FRAME;
>>                          rte_port->dev_conf.rxmode.max_rx_pkt_len =
>> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
>> index 414a0068fb..df5eb10d84 100644
>> --- a/app/test-pmd/parameters.c
>> +++ b/app/test-pmd/parameters.c
>> @@ -834,12 +834,9 @@ launch_args_parse(int argc, char** argv)
>>                          }
>>                          if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
>>                                  n = atoi(optarg);
>> -                               if (n >= RTE_ETHER_MIN_LEN) {
>> +                               if (n >= RTE_ETHER_MIN_LEN)
>>                                          rx_mode.max_rx_pkt_len = (uint32_t) n;
>> -                                       if (n > RTE_ETHER_MAX_LEN)
>> -                                               rx_offloads |=
>> -                                                       DEV_RX_OFFLOAD_JUMBO_FRAME;
>> -                               } else
>> +                               else
>>                                          rte_exit(EXIT_FAILURE,
>>                                                   "Invalid max-pkt-len=%d - should be > %d\n",
>>                                                   n, RTE_ETHER_MIN_LEN);
>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>> index 2b60f6c5d3..c256e719ae 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -1410,6 +1410,7 @@ init_config(void)
>>          struct rte_gro_param gro_param;
>>          uint32_t gso_types;
>>          uint16_t data_size;
>> +       uint16_t eth_overhead;
>>          bool warning = 0;
>>          int k;
>>          int ret;
>> @@ -1446,6 +1447,23 @@ init_config(void)
>>                          rte_exit(EXIT_FAILURE,
>>                                   "rte_eth_dev_info_get() failed\n");
>>
>> +               /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
>> +               if (port->dev_info.max_mtu != UINT16_MAX &&
>> +                   port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
>> +                       eth_overhead = port->dev_info.max_rx_pktlen -
>> +                               port->dev_info.max_mtu;
>> +               else
>> +                       eth_overhead =
>> +                               RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
>> +
>> +               if (port->dev_conf.rxmode.max_rx_pkt_len <=
>> +                       (uint32_t)(RTE_ETHER_MTU + eth_overhead))
>> +                       port->dev_conf.rxmode.max_rx_pkt_len =
>> +                                       RTE_ETHER_MTU + eth_overhead;
>> +               else
>> +                       port->dev_conf.rxmode.offloads |=
>> +                                       DEV_RX_OFFLOAD_JUMBO_FRAME;
>> +
>>                  if (!(port->dev_info.tx_offload_capa &
>>                        DEV_TX_OFFLOAD_MBUF_FAST_FREE))
>>                          port->dev_conf.txmode.offloads &=
>> --
>> 2.17.1
>>
> 
> Moving the setting of DEV_RX_OFFLOAD_JUMBO_FRAME from
> cmd_config_max_pkt_len_parsed() to init_config() doesn't seem to
> be correct for the case where max_rx_pkt_len is changed from the
> command line via "port config all max-pkt-len".
> 
> The init_config() function is only called when testpmd is started,
> but the DEV_RX_OFFLOAD_JUMBO_FRAME setting needs to
> be recomputed whenever max_rx_pkt_len changes.
> 

Hi Lance,

You are right, there is a patch trying to fix the command, can you please review it?
https://patches.dpdk.org/project/dpdk/list/?series=14925


> (Of course this won't matter when DEV_RX_OFFLOAD_JUMBO_FRAME
> is removed, which seems like a great idea, but for now this is impacting
> some test automation with 21.02-rc1.)
> 


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

* Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
  2021-01-19  8:46         ` oulijun
  2021-01-23  9:05           ` oulijun
@ 2021-01-25 12:22           ` Ferruh Yigit
  1 sibling, 0 replies; 115+ messages in thread
From: Ferruh Yigit @ 2021-01-25 12:22 UTC (permalink / raw)
  To: oulijun, Steve Yang, dev; +Cc: thomas, andrew.rybchenko

On 1/19/2021 8:46 AM, oulijun wrote:
> 
> 
> 在 2021/1/18 18:42, Ferruh Yigit 写道:
>> On 1/15/2021 10:44 AM, oulijun wrote:
>>> Hi Steve
>>> This is a very good job! But I have some question and suggestions.
>>> Please check it.
>>>
>>> 在 2021/1/14 17:45, Steve Yang 写道:
>>>> Ethdev is using default Ethernet overhead to decide if provided
>>>> 'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,
>>>> and limits it to MAX if it is.
>>>>
>>>> Since the application/driver used Ethernet overhead is different than
>>>> the ethdev one, check result is wrong.
>>>>
>>>> If the driver is using Ethernet overhead bigger than the default one,
>>>> the provided 'max_rx_pkt_len' is trimmed down, and in the driver when
>>>> correct Ethernet overhead is used to convert back, the resulting MTU is
>>>> less than the intended one, causing some packets to be dropped.
>>>>
>>>> Like,
>>>> app     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522
>>>> ethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518
>>>> driver  -> MTU = 1518 - 22 = 1496
>>>> Packets with size 1497-1500 are dropped although intention is to be able
>>>> to send/receive them.
>>>>
>>>> The fix is to make ethdev use the correct Ethernet overhead for port,
>>>> instead of default one.
>>>>
>>>> Fixes: 59d0ecdbf0e1 ("ethdev: MTU accessors")
>>>>
>>>> Signed-off-by: Steve Yang <stevex.yang@intel.com>
>>>> ---
>>>>   lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++---
>>>>   1 file changed, 24 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
>>>> index 17ddacc78d..19ca4c4512 100644
>>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>>> @@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>>>> nb_rx_q, uint16_t nb_tx_q,
>>>>       struct rte_eth_dev *dev;
>>>>       struct rte_eth_dev_info dev_info;
>>>>       struct rte_eth_conf orig_conf;
>>>> +    uint16_t overhead_len;
>>>>       int diag;
>>>>       int ret;
>>>> +    uint16_t old_mtu;
>>>>       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>>> @@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>>>> nb_rx_q, uint16_t nb_tx_q,
>>>>           memcpy(&dev->data->dev_conf, dev_conf,
>>>>                  sizeof(dev->data->dev_conf));
>>>> +    /* Backup mtu for rollback */
>>>> +    old_mtu = dev->data->mtu;
>>>> +
>>>>       ret = rte_eth_dev_info_get(port_id, &dev_info);
>>>>       if (ret != 0)
>>>>           goto rollback;
>>>> +    /* Get the real Ethernet overhead length */
>>>> +    if (dev_info.max_mtu != UINT16_MAX &&
>>>> +        dev_info.max_rx_pktlen > dev_info.max_mtu)
>>>> +        overhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;
>>>> +    else
>>>> +        overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
>>>> +
>>> The Ethernet frame header length supported by each NIC may be different, 
>>> which cause the difference of allowed packets size and drop you say.
>>> The diference of Ethernet frame header length have an impact for the maximum 
>>> Ethernet frame length, which is a boundary value
>>> of enabling jumbo frame through the ' max_rx_pkt_len '.
>>> However, we need to do the same thing you do above to get the overhead_len 
>>> every time, which will
>>> cause a lot of duplicate code in the framework and app. For examples, parsing 
>>> and processing for '--max-pkt-len=xxx' parameter,
>>>   and " cmd_config_max_pkt_len_parsed " in testpmd, and here modifying here 
>>> dev_configure API.
>>> It's a little redundant and troublesome.
>>>
>>> Maybe, it is necessary for driver to directly report the supported maximum 
>>> Ethernet frame length by rte_dev_info_get API.
>>> As following:
>>> struct rte_eth_dev_info {
>>>      xxxx
>>>      /**
>>>       * The maximum Ethernet frame length supported by each
>>>       * driver varies with the Ethernet header length.
>>>       */
>>>      uint16_t eth_max_len;
>>>      xxxx
>>> }
>>>
>>> int
>>> rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
>>> {
>>>      xxx
>>>      dev_info->min_mtu = RTE_ETHER_MIN_MTU;
>>>      dev_info->max_mtu = UINT16_MAX;
>>>      dev_info->eth_max_len = RTE_ETHER_MAX_LEN;
>>>      xxx
>>> }
>>>
>>> And then:
>>> xxx_devv_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
>>> {
>>>      xxx
>>>      info->eth_max_len = xxx_ETHER_MAX _LEN;
>>>      xxx
>>> }
>>> What do you think?
>>
>> Hi Lijun,
>>
>> The 'max_mtu' has been added in the past to solve exact same problem, perhaps 
>> it would be better to add something like 'eth_max_len' at that time.
>>
>> But as Steve mentioned we are planning to switch to more MTU based 
>> configuration, which should remove the need of the field you mentioned.
>>
>>>>       /* If number of queues specified by application for both Rx and Tx is
>>>>        * zero, use driver preferred values. This cannot be done individually
>>>>        * as it is valid for either Tx or Rx (but not both) to be zero.
>>>> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>>>> nb_rx_q, uint16_t nb_tx_q,
>>>>               goto rollback;
>>>>           }
>>>>       } else {
>>>> -        if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
>>>> -            dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
>>>> +        uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>>>> +        if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>>>> +            pktlen > RTE_ETHER_MTU + overhead_len)
>>>>               /* Use default value */
>>>>               dev->data->dev_conf.rxmode.max_rx_pkt_len =
>>>> -                            RTE_ETHER_MAX_LEN;
>>>> +                        RTE_ETHER_MTU + overhead_len;
>>>> +    }
>>>> +
>>>> +    /* Scale the MTU size to adapt max_rx_pkt_len */
>>>> +    if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>>> +        dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
>>>> +                overhead_len;
>>>>       }
>>> Now that we update mtu here when jumbo frame enabled. It is necessary to 
>>> check validity of max_rx_pkt_len.
>>> As following:
>>> if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
>>>      if (dev_conf->rxmode.max_rx_pkt_len > dev_info.max_rx_pktlen ||
>>>          dev_conf->rxmode.max_rx_pkt_len <=  RTE_ETHER_MTU + overhead_len) {
>>
>> It is not clear from API that if "max_rx_pkt_len <=  RTE_ETHER_MTU + 
>> overhead_len" is a valid value or not, the API says:
>> "max_rx_pkt_len;  /**< Only used if JUMBO_FRAME enabled. */"
>>
>> But it doesn't say that when 'DEV_RX_OFFLOAD_JUMBO_FRAME' is set, 
>> 'max_rx_pkt_len' should be less then 'RTE_ETHER_MTU'
>>
> The MTU setting entry does need to be adjusted. I agree! But I think this place 
> should be modified, and it's probably more reasonable.
> 
> Generally speaking, max_rx_pkt_len will be also updated with 'mtu + 
> overhead_len' also when application sets mtu > 1500, which means JUMBO_FRAME is 
> enabled.
> Namely, JUMBO_FRAME is enabled based on mtu > 1500 or max_rx_pkt_len > 1500 + 
> overhead_len.
> Besides, having following check for "rxmode.offloads & 
> DEV_RX_OFFLOAD_JUMBO_FRAME == 0":
> @@ -1410,11 +1422,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
> nb_rx_q, uint16_t nb_tx_q,
>                goto rollback;
>            }
>        } else {
>          uint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;
>          if (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||
>              pktlen > RTE_ETHER_MTU + overhead_len)
>                /* Use default value */
>                dev->data->dev_conf.rxmode.max_rx_pkt_len =
>                          RTE_ETHER_MTU + overhead_len;
> }
> One of check condition for the branch is "pktlen > RTE_ETHER_MTU + overhead_len ".
> 
> In view of the above two aspects, when application set 
> DEV_RX_OFFLOAD_JUMBO_FRAME in offload, the max_rx_pkt_len must be greater than " 
> RTE_ETHER_MTU + overhead_len "
> 

Hi Lijun,

Most probably intention was like you said, but that is not implemented or 
documented that way.

The API doc only says 'max_rx_pkt_len' is valid only when 'JUMBO_FRAME' is set, 
but it doesn't say what is the valid range.

And when 'JUMBO_FRAME' is set, the check in the 'rte_eth_dev_configure()' is 
same from the beggining of the project, and it is between 'RTE_ETHER_MIN_LEN' to 
'dev_info.max_rx_pktlen', and changing it will be the behaviour change.

So I suggest lets not add this new config restriction, but it is application's 
responsiblity to set/unset the 'JUMBO_FRAME' flag based on the packet size, and 
we can implemet this in the testpmd.

> Since DEV_RX_OFFLOAD_JUMBO_FRAME is not removed, so the check is necessary.
> 
>>>              xxxx
>>>          }
>>> } else {
>>>          xxx
>>> }
>>>
>>> If it does not thing above, which will cause an unreasonable case.
>>> Like,
>>> dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME == 1
>>> dev_conf->rxmode.max_rx_pkt_len = 1500
>>> overhead_len = 26
>>> dev->data->mtu = dev_conf->rxmode.max_rx_pkt_len - overhead_len = 1500 - 26 = 
>>> 1474
>>>
>>
>> This looks correct, if the applicatin is requesting 'max_rx_pkt_len = 1500', 
>> the requeted MTU is 1474,
>> if application wants an MTU as 1500, it should set the 'max_rx_pkt_len' as 
>> "1500 + overhead".
>>
>>> In fact, DEV_RX_OFFLOAD_JUMBO_FRAME is set to rxmode.offloads when mtu > 1500.
>>
>> Overall the 'max_rx_pkt_len' setting is a little messy, it has been tried to 
>> fix in last release but we reverted them because of unexpected side affects.
>>
>> Current long term plan is,
>> - Switch both 'rte_eth_dev_configure()' & 'rte_eth_dev_set_mtu()' to work on 
>> MTU values. (instead one working on frame lenght and other on MTU)
>> - Remove the 'DEV_RX_OFFLOAD_JUMBO_FRAME' and decide jumbo frame request by 
>> requested MTU value check
>> - App decide the jumbo frame capability from the 'max_mtu' check
>> - App calculate Ethernet overhead using 'max_mtu' and 'max_rx_pktlen'
>>
>>>>       /*
>>>> @@ -1549,6 +1568,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
>>>> nb_rx_q, uint16_t nb_tx_q,
>>>>       eth_dev_tx_queue_config(dev, 0);
>>>>   rollback:
>>>>       memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf));
>>>> +    if (old_mtu != dev->data->mtu)
>>>> +        dev->data->mtu = old_mtu;
>>>>       rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret);
>>>>       return ret;
>>>>
>>
>> .
>>


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

end of thread, other threads:[~2021-01-25 12:22 UTC | newest]

Thread overview: 115+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09  3:16 [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 01/12] net/dpaa2: fix the jumbo frame flag condition for mtu set Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 02/12] net/e1000: " Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 03/12] net/hns3: " Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 04/12] net/i40e: fix the jumbo frame flag condition Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 05/12] net/iavf: " Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 06/12] net/ice: " Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 07/12] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 08/12] net/octeontx: " Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
2020-12-21  7:16   ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 10/12] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 11/12] net/sfc: " Steve Yang
2020-12-09  3:16 ` [dpdk-dev] [PATCH v1 12/12] net/thunderx: " Steve Yang
2020-12-11  4:31 ` [dpdk-dev] [PATCH v1 00/12] fix rx packets dropped issue Guo, Jia
2020-12-14 17:44 ` Ferruh Yigit
2020-12-17  9:22 ` [dpdk-dev] [PATCH v2 00/22] " Steve Yang
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
2020-12-28 14:51     ` Andrew Rybchenko
2021-01-13 10:32       ` Ferruh Yigit
2020-12-30 10:19     ` oulijun
     [not found]       ` <DM6PR11MB43627F10DDAFC9801816FF5BF9D00@DM6PR11MB4362.namprd11.prod.outlook.com>
2021-01-13 10:25         ` Ferruh Yigit
2021-01-13 11:04         ` Ferruh Yigit
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
2021-01-13 11:26     ` Ferruh Yigit
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 04/22] net/dpaa2: " Steve Yang
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 05/22] net/e1000: " Steve Yang
2020-12-18  2:42     ` Guo, Jia
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 06/22] net/hns3: " Steve Yang
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
2020-12-18  2:44     ` Guo, Jia
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 08/22] net/iavf: " Steve Yang
2020-12-17  9:22   ` [dpdk-dev] [PATCH v2 09/22] net/ice: " Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
2020-12-19  0:54     ` Xu, Rosen
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 11/22] net/octeontx: " Steve Yang
2020-12-21 15:04     ` [dpdk-dev] [EXT] " Harman Kalra
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
2020-12-18 10:15     ` Nithin Dabilpuram
2020-12-21  7:19     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 14/22] net/sfc: " Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 15/22] net/thunderx: " Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
2020-12-18  2:43     ` Guo, Jia
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 17/22] net/cxgbe: " Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 19/22] net/enetc: " Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 20/22] net/hinic: " Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 21/22] net/nfp: " Steve Yang
2020-12-17  9:23   ` [dpdk-dev] [PATCH v2 22/22] net/liquidio: " Steve Yang
2021-01-13 11:32   ` [dpdk-dev] [PATCH v2 00/22] fix rx packets dropped issue Ferruh Yigit
2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 " Steve Yang
2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
2021-01-14 16:36     ` Ferruh Yigit
2021-01-14 17:13       ` Ferruh Yigit
2021-01-14 17:29         ` Andrew Boyer
2021-01-14 20:44           ` Ferruh Yigit
2021-01-15 10:44     ` oulijun
2021-01-18 10:42       ` Ferruh Yigit
2021-01-19  8:46         ` oulijun
2021-01-23  9:05           ` oulijun
2021-01-25 12:22           ` Ferruh Yigit
2021-01-18  7:04     ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 01/22] ethdev: fix MTU size exceeds max rx packet length Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
2021-01-21 15:27         ` Lance Richardson
2021-01-22 14:26           ` Lance Richardson
2021-01-25 12:14           ` Ferruh Yigit
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 04/22] net/dpaa2: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 05/22] net/e1000: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 06/22] net/hns3: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 08/22] net/iavf: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 09/22] net/ice: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 11/22] net/octeontx: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 14/22] net/sfc: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 15/22] net/thunderx: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 17/22] net/cxgbe: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 19/22] net/enetc: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 20/22] net/hinic: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 21/22] net/nfp: " Steve Yang
2021-01-18  7:04       ` [dpdk-dev] [PATCH v4 22/22] net/liquidio: " Steve Yang
2021-01-18 11:54       ` [dpdk-dev] [PATCH v4 00/22] fix rx packets dropped issue Ferruh Yigit
2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 02/22] app/testpmd: fix max rx packet length for VLAN packets Steve Yang
2021-01-14  9:45   ` [dpdk-dev] [PATCH v3 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-14 10:26     ` Hemant Agrawal
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 04/22] net/dpaa2: " Steve Yang
2021-01-14 10:27     ` Hemant Agrawal
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 05/22] net/e1000: " Steve Yang
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 06/22] net/hns3: " Steve Yang
2021-01-18  1:30     ` oulijun
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 07/22] net/i40e: fix the jumbo frame flag condition Steve Yang
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 08/22] net/iavf: " Steve Yang
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 09/22] net/ice: " Steve Yang
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 11/22] net/octeontx: " Steve Yang
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu Steve Yang
2021-01-14  9:46   ` [dpdk-dev] [PATCH v3 13/22] net/qede: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 14/22] net/sfc: " Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 15/22] net/thunderx: " Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 16/22] net/ixgbe: fix the jumbo frame flag condition Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 17/22] net/cxgbe: " Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 18/22] net/axgbe: fix the jumbo frame flag condition for mtu set Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 19/22] net/enetc: " Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 20/22] net/hinic: " Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 21/22] net/nfp: " Steve Yang
2021-01-14  9:47   ` [dpdk-dev] [PATCH v3 22/22] net/liquidio: " Steve Yang

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	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

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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