fix rx packets dropped issue
cover 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(-)
Signature · 1 line
2.17.1
PATCH 1/12 net/dpaa2: 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'.
--- drivers/net/dpaa2/dpaa2_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH 2/12 net/e1000: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/e1000/em_ethdev.c +1 -1
@@ -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 ;
drivers/net/e1000/igb_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 3/12 net/hns3: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/hns3/hns3_ethdev.c | 2 +- drivers/net/hns3/hns3_ethdev_vf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_ethdev.c +1 -1
@@ -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 );/*
drivers/net/hns3/hns3_ethdev_vf.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH 4/12 net/i40e: fix the jumbo frame flag condition
In reply to Steve YangThe 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'.
--- 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(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -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)
drivers/net/i40e/i40e_ethdev_vf.c +5 -5
@@ -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
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -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 ;
drivers/net/i40e/i40e_rxtx.c +4 -4
@@ -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 ; } }
Signature · 1 line
2.17.1
PATCH 5/12 net/iavf: fix the jumbo frame flag condition
In reply to Steve YangThe 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'.
--- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_ethdev.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/iavf/iavf.h +1 -0
@@ -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)
drivers/net/iavf/iavf_ethdev.c +5 -5
@@ -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
Signature · 1 line
2.17.1
PATCH 6/12 net/ice: fix the jumbo frame flag condition
In reply to Steve YangThe 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'.
--- 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(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -4
@@ -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 ; } }
drivers/net/ice/ice_ethdev.c +1 -1
@@ -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
drivers/net/ice/ice_ethdev.h +1 -0
@@ -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)
drivers/net/ice/ice_rxtx.c +5 -5
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 7/12 net/ipn3ke: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/ipn3ke/ipn3ke_representor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipn3ke/ipn3ke_representor.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH 8/12 net/octeontx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/octeontx/octeontx_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/octeontx/octeontx_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 9/12 net/octeontx2: fix the jumbo frame flag condition for mtu
In reply to Steve YangThe 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'.
--- drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [EXT] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtu
Quoted 59 lines
-----Original Message-----
From: Steve Yang <[email protected]>
Sent: Wednesday, December 9, 2020 8:46 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Harman Kalra <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Rasesh Mody <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]; Maciej Czekaj [C] <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Sunil Kumar Kori <[email protected]>; Vamsi Krishna Attunuru <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Steve Yang <[email protected]>
Subject: [EXT] [PATCH v1 09/12] net/octeontx2: fix the jumbo frame flag condition for mtuExternal 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 <[email protected]>---
drivers/net/octeontx2/otx2_ethdev_ops.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/octeontx2/otx2_ethdev_ops.c +1
-1@@ -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;
Quoted 2 lines
--
2.17.1
PATCH 10/12 net/qede: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/qede/qede_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/qede/qede_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 11/12 net/sfc: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/sfc/sfc_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/sfc/sfc_ethdev.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 12/12 net/thunderx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/thunderx/nicvf_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/thunderx/nicvf_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
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;
Quoted 80 lines
-----Original Message-----
From: Steve Yang <[email protected]>
Sent: Wednesday, December 9, 2020 11:16 AM
To: [email protected]
Cc: [email protected]; [email protected]; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Xu, Rosen <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]; [email protected]; Xu, Ting <[email protected]>; Li, Xiaoyun <[email protected]>; Lu, Wenzhuo <[email protected]>; Pei, Andy <[email protected]>; Wei, Dan <[email protected]>; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yang, SteveX <[email protected]>
Subject: [PATCH v1 00/12] fix rx packets dropped issueThe 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 setdrivers/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
Quoted 13 lines · 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;
Quoted 14 lines
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_lpeixgbe_dev_mtu_setcxgbe_dev_mtu_setcxgbe_dev_rx_queue_setupaxgb_mtu_setenetc_mtu_sethinic_dev_set_mtudpaa_mtu_setnfp_net_dev_mtu_setlio_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
v2 cover fix rx packets dropped issue
In reply to Steve YangThe 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(-)
Signature · 1 line
2.17.1
PATCH v2 1/22 ethdev: fix MTU size exceeds max rx packet length
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.
--- lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
lib/librte_ethdev/rte_ethdev.c +18 -3
@@ -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.
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 25 lines · 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 <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +1
-0@@ -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;
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1328
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +2
-0@@ -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.
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1330
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+ dev_info.max_mtu !=UINT16_MAX && + dev_info.max_rx_pktlen &&
It should be compared vs 0 explicitly in accordance with DPDK coding style.
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +5
-0+ 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.
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1425
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +3
-2@@ -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.
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1434
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +5
-1/* 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.
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* * If LRO is enabled, check that the maximum aggregated packet * size is supported by the configured device.
Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 29 lines · Andrew Rybchenko
Quoted 28 lines · 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 <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +1
-0@@ -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;
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1328
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+/* 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.
Quoted 42 lines
If kept, it should be compared vs 0 explicitly in accordance with DPDK coding style.
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1330
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+ dev_info.max_mtu !=UINT16_MAX && + dev_info.max_rx_pktlen &&It should be compared vs 0 explicitly in accordance with DPDK coding style.
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +5
-0+ 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. lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1425
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +3
-2@@ -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.
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1434
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +5
-1/* 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.:
Quoted 3 lines
configure -> set_mtu -> start -> stop -> re-configureand 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.
Quoted 5 lines
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* * If LRO is enabled, check that the maximum aggregated packet * size is supported by the configured device.
Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
In reply to Steve YangQuoted 49 lines · 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 <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +13
-2@@ -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)
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1434
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +5
-1/* 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
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* * If LRO is enabled, check that the maximum aggregated packet * size is supported by the configured device.
A message that is not in the archive (sent off-list or not yet received): DM6PR11MB43627F10DDAFC9801816FF5BF9D00@DM6PR11MB4362.namprd11.prod.outlook.com
Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 132 lines · SteveX
Hi Lijun,
Thanks for your review. Please check my comments inline. Regards,
Steve Yang.Quoted 107 lines
-----Original Message-----
From: oulijun <[email protected]>
Sent: Wednesday, December 30, 2020 6:20 PM
To: Yang, SteveX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Xu, Rosen <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; Ananyev, Konstantin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zhang, Helin <[email protected]>; [email protected]; [email protected]; Xu, Ting <[email protected]>; Li, Xiaoyun <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Zhao1, Wei <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet lengthlib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id,
Quoted 17 lines · 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 <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex17ddacc78d..ff6a1e675f100644lib/librte_ethdev/rte_ethdev.c +0
-0@@ -1292,6 +1292,7 @@ rte_eth_dev_configure(uint16_t port_id,
uint16_tnb_rx_q,uint16_tnb_tx_q,lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id,
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +1
-0struct 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_tnb_rx_q,uint16_tnb_tx_q,lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +6
-0if (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;
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, · line 1334
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+else +overhead_len = RTE_ETHER_HDR_LEN +
RTE_ETHER_CRC_LEN;lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id,
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +1
-0+/* 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_tnb_rx_q,uint16_tnb_tx_q,lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +0
-1goto rollback; } }else { -if (dev_conf->rxmode.max_rx_pkt_len <
RTE_ETHER_MIN_LEN||lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, · line 1414
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +0
-1-dev_conf->rxmode.max_rx_pkt_len >
RTE_ETHER_MAX_LEN)lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +3
-1+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;lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, · line 1428
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +1
-0+RTE_ETHER_MTU +
overhead_len;Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +0
-0}Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1434
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+/* 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. Sothe 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); } ```
Quoted 1 line
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.
Quoted 3 lines
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.
Quoted 22 lines
Quoted 14 lines
'
max_rx_pkt_len' is only used whenjumbo_frameenabled, as follows:
structrte_eth_rxmode{
.....uint32_tmax_rx_pkt_len; /**< Only used ifJUMBO_FRAMEenabled. */
/** Maximum allowed size of LRO aggregated packet. */ ....};So If
DEV_RX_OFFLOAD_JUMBO_FRAMEis set to rxmode.offload, driver should configure mtu to hardware according to 'max_rx_pkt_len' and updatedev->data->mtu. This seems more reasonable. And some PMD drivers are already doing this.Quoted 7 lines
In addition, validity check for '
max_rx_pkt_len' inrte_eth_dev_configureAPI may be error. It should be greater than 'RTE_ETHER_MTU+overhead_len'.
Because driver must enableDEV_RX_OFFLOAD_JUMBO_FRAMEwhen user set mtu
with greater than 1500 by 'rte_eth_dev_set_mtu' API.
Quoted 9 lines
I'm not sure if it is following validity check you mentioned.
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1425
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+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 'disableDEV_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;
Quoted 9 lines
Quoted 9 lines
What do you think?
Thanks
Lijun OuQuoted 4 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* * If LRO is enabled, check that the maximum aggregated packet * size is supported by the configured device.
Re: [dpdk-dev] [PATCH v2 01/22] ethdev: fix MTU size exceeds max rx packet length
In reply to a message not in the archiveOn 1/6/2021 3:36 AM, Yang, SteveX wrote:
<...>
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Fixes 59d0ecdbf0e1 ("ethdev: MTU accessors")Signed-off-by Steve Yang <[email protected]>---
PATCH v2 2/22 app/testpmd: fix max rx packet length for VLAN packets
In reply to Steve YangWhen 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()'.
--- 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(-)
app/test-pmd/cmdline.c +0 -6
@@ -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 ;
app/test-pmd/config.c +1 -1
@@ -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 =
app/test-pmd/parameters.c +2 -5
@@ -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 );
app/test-pmd/testpmd.c +20 -0
@@ -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 &=
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 02/22] app/testpmd: fix max rx packet length for VLAN packets
Quoted 14 lines · 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_offloadsassignment 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 <[email protected]>
<...>
app/test-pmd/testpmd.c init_config(void) · line 1451
Quoted 6 lines
app/test-pmd/testpmd.c +2
-0@@ -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.
Quoted 21 lines
app/test-pmd/testpmd.c +17
-0+ 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 &=
PATCH v2 3/22 net/dpaa: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/dpaa/dpaa_ethdev.c | 2 +- drivers/net/dpaa/dpaa_ethdev.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/dpaa/dpaa_ethdev.c +1 -1
@@ -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
drivers/net/dpaa/dpaa_ethdev.h +4 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v2 4/22 net/dpaa2: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/dpaa2/dpaa2_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.c +1 -1
@@ -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
drivers/net/dpaa2/dpaa2_ethdev.h +4 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v2 5/22 net/e1000: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/e1000/e1000_ethdev.h +1 -1
@@ -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. *
drivers/net/e1000/em_ethdev.c +2 -3
@@ -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 ;
drivers/net/e1000/igb_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 05/22] net/e1000: fix the jumbo frame flag condition for mtu set
Quoted 113 lines
-----Original Message-----
From: Steve Yang <[email protected]>
Sent: Thursday, December 17, 2020 5:23 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Xu, Rosen <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; Ananyev, Konstantin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zhang, Helin <[email protected]>; [email protected]; [email protected]; Xu, Ting <[email protected]>; Li, Xiaoyun <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Zhao1, Wei <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yang, SteveX <[email protected]>
Subject: [PATCH v2 05/22] net/e1000: fix the jumbo frame flag condition for mtu setThe 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 <[email protected]>--- 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(-)drivers/net/e1000/e1000_ethdev.h +1
-1@@ -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. *
(quoted diff) +0
-0
b/drivers/net/e1000/em_ethdev.cindex8ee9422bf4..2036c6e917100644drivers/net/e1000/em_ethdev.c +1
-2@@ -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)drivers/net/e1000/em_ethdev.c +1
-1rctl =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 ;(quoted diff) +0
-0
b/drivers/net/e1000/igb_ethdev.cindex647aa8d995..dfe87508c2100644drivers/net/e1000/igb_ethdev.c +1
-1@@ -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
PATCH v2 6/22 net/hns3: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/hns3/hns3_ethdev.c | 2 +- drivers/net/hns3/hns3_ethdev_vf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_ethdev.c +1 -1
@@ -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 );/*
drivers/net/hns3/hns3_ethdev_vf.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v2 7/22 net/i40e: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -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)
drivers/net/i40e/i40e_ethdev_vf.c +5 -5
@@ -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
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -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 ;
drivers/net/i40e/i40e_rxtx.c +4 -4
@@ -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 ; } }
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition
Quoted 192 lines
-----Original Message-----
From: Steve Yang <[email protected]>
Sent: Thursday, December 17, 2020 5:23 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Xu, Rosen <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; Ananyev, Konstantin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zhang, Helin <[email protected]>; [email protected]; [email protected]; Xu, Ting <[email protected]>; Li, Xiaoyun <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Zhao1, Wei <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yang, SteveX <[email protected]>
Subject: [PATCH v2 07/22] net/i40e: fix the jumbo frame flag conditionThe 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 <[email protected]>--- 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(-)drivers/net/i40e/i40e_ethdev.c +1
-1@@ -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 ;drivers/net/i40e/i40e_ethdev.c +0
-0else (quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.hindex696c5aaf7e..1f31a532a1100644drivers/net/i40e/i40e_ethdev.h +1
-0@@ -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)drivers/net/i40e/i40e_ethdev_vf.c +0
-0@@ -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 setcorrectly
drivers/net/i40e/i40e_ethdev_vf.c +0
-0*/ if (dev_data->dev_conf.rxmode.offloads &
DEV_RX_OFFLOAD_JUMBO_FRAME) {drivers/net/i40e/i40e_ethdev_vf.c +1
-1-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 mustbe "
"larger than %u and smaller than %u, as
jumbo "drivers/net/i40e/i40e_ethdev_vf.c +0
-1- "frame is enabled",(uint32_t)RTE_ETHER_MAX_LEN,
drivers/net/i40e/i40e_ethdev_vf.c +1
-0+ "frame is enabled",(uint32_t)I40E_ETH_MAX_LEN,
drivers/net/i40e/i40e_ethdev_vf.c +1
-1(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 mustbe "
"larger than %u and smaller than %u, as
jumbo "drivers/net/i40e/i40e_ethdev_vf.c +2
-2"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 ;drivers/net/i40e/i40e_ethdev_vf.c +0
-0else drivers/net/i40e/i40e_fdir.c index renamed from drivers/net/i40e/i40e_fdir.c +0
-0
50c0eee9f2..449b67b2a9100644drivers/net/i40e/i40e_fdir.c +1
-1@@ -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 ;drivers/net/i40e/i40e_rxtx.c index renamed from drivers/net/i40e/i40e_rxtx.c +0
-0
5df9a9df56..b8859bbff2100644drivers/net/i40e/i40e_rxtx.c +1
-1@@ -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"
drivers/net/i40e/i40e_rxtx.c +2
-2"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 mustbe "
drivers/net/i40e/i40e_rxtx.c +1
-2"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
PATCH v2 8/22 net/iavf: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_ethdev.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/iavf/iavf.h +1 -0
@@ -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)
drivers/net/iavf/iavf_ethdev.c +5 -5
@@ -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
Signature · 1 line
2.17.1
PATCH v2 9/22 net/ice: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -4
@@ -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 ; } }
drivers/net/ice/ice_ethdev.c +1 -1
@@ -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
drivers/net/ice/ice_ethdev.h +1 -0
@@ -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)
drivers/net/ice/ice_rxtx.c +5 -5
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v2 10/22 net/ipn3ke: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/ipn3ke/ipn3ke_ethdev.h | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ipn3ke/ipn3ke_ethdev.h +1 -0
@@ -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
drivers/net/ipn3ke/ipn3ke_representor.c +1 -1
@@ -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
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu set
Hi,
Quoted 86 lines
-----Original Message-----
From: Steve Yang <[email protected]>
Sent: Thursday, December 17, 2020 17:23
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Xu, Rosen <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; Ananyev, Konstantin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zhang, Helin <[email protected]>; [email protected]; [email protected]; Xu, Ting <[email protected]>; Li, Xiaoyun <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Zhao1, Wei <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yang, SteveX <[email protected]>
Subject: [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for mtu setThe 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 <[email protected]>--- drivers/net/ipn3ke/ipn3ke_ethdev.h | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)drivers/net/ipn3ke/ipn3ke_ethdev.h +1
-0@@ -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_MAX9728
#defineIPN3KE_MAC_RX_FRAME_MAXLENGTH0x00AEdrivers/net/ipn3ke/ipn3ke_representor.c +1
-1@@ -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 );
Quoted 3 lines
else
--
2.17.1
PATCH v2 11/22 net/octeontx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/octeontx/octeontx_ethdev.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/octeontx/octeontx_ethdev.c +1 -1
@@ -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 ;
drivers/net/octeontx/octeontx_ethdev.h +1 -0
@@ -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 \
Signature · 1 line
2.17.1
Re: [dpdk-dev] [EXT] [PATCH v2 11/22] net/octeontx: fix the jumbo frame flag condition for mtu set
Quoted 8 lines · Steve Yang
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'.
Quoted 6 lines
This fix will change the boundary condition with '
RTE_ETHER_MTU' and overhead.Fixes 3151e6a687a3 ("net/octeontx: support MTU")Signed-off-by Steve Yang <[email protected]>
Quoted 33 lines
--- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/octeontx/octeontx_ethdev.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)drivers/net/octeontx/octeontx_ethdev.c +1
-1@@ -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 ;drivers/net/octeontx/octeontx_ethdev.h +1
-0@@ -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 \Signature · 1 line
2.17.1
PATCH v2 12/22 net/octeontx2: fix the jumbo frame flag condition for mtu
In reply to Steve YangThe 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.
--- drivers/net/octeontx2/otx2_ethdev.h | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -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
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu
Quoted 45 lines · 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 <[email protected]>--- drivers/net/octeontx2/otx2_ethdev.h | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)drivers/net/octeontx2/otx2_ethdev.h +2
-0@@ -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 9212drivers/net/octeontx2/otx2_ethdev_ops.c +1
-1@@ -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 ;Signature · 1 line
2.17.1
Re: [dpdk-dev] [EXT] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtu
In reply to Steve YangQuoted 87 lines
-----Original Message-----
From: Steve Yang <[email protected]>
Sent: Thursday, December 17, 2020 2:53 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Shijith Thotton <[email protected]>; Srisivasubramanian Srinivasan <[email protected]>; [email protected]; Harman Kalra <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Rasesh Mody <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]; Maciej Czekaj [C] <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Vamsi Krishna Attunuru <[email protected]>; Sunil Kumar Kori <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Steve Yang <[email protected]>
Subject: [EXT] [PATCH v2 12/22] net/octeontx2: fix the jumbo frame flag condition for mtuExternal 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 <[email protected]>---
drivers/net/octeontx2/otx2_ethdev.h| 2 ++drivers/net/octeontx2/otx2_ethdev_ops.c| 2 +-2 files changed, 3 insertions(+), 1 deletion(-)drivers/net/octeontx2/otx2_ethdev.h +2
-0@@ -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 9212drivers/net/octeontx2/otx2_ethdev_ops.c +1
-1@@ -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;
Quoted 2 lines
--
2.17.1
PATCH v2 13/22 net/qede: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/qede/qede_rxtx.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_ethdev.c +1 -1
@@ -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 ;
drivers/net/qede/qede_rxtx.h +1 -0
@@ -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 |\
Signature · 1 line
2.17.1
PATCH v2 14/22 net/sfc: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/sfc/sfc_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/sfc/sfc_ethdev.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH v2 15/22 net/thunderx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/thunderx/base/nicvf_hw_defs.h | 1 + drivers/net/thunderx/nicvf_ethdev.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/thunderx/base/nicvf_hw_defs.h +1 -0
@@ -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 */
drivers/net/thunderx/nicvf_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v2 16/22 net/ixgbe: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -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 ;
drivers/net/ixgbe/ixgbe_ethdev.h +3 -0
@@ -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*/
drivers/net/ixgbe/ixgbe_pf.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag condition
Quoted 104 lines
-----Original Message-----
From: Steve Yang <[email protected]>
Sent: Thursday, December 17, 2020 5:23 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Xu, Rosen <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; Ananyev, Konstantin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zhang, Helin <[email protected]>; [email protected]; [email protected]; Xu, Ting <[email protected]>; Li, Xiaoyun <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Zhao1, Wei <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yang, SteveX <[email protected]>
Subject: [PATCH v2 16/22] net/ixgbe: fix the jumbo frame flag conditionThe 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 <[email protected]>---
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(-)drivers/net/ixgbe/ixgbe_ethdev.c +1
-1@@ -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 ;drivers/net/ixgbe/ixgbe_ethdev.c +0
-0hlreg0 |=IXGBE_HLREG0_JUMBOEN ;drivers/net/ixgbe/ixgbe_ethdev.h +3
-0@@ -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.cb/drivers/net/ixgbe/ixgbe_pf.cindex833863af5a..89698e8470100644drivers/net/ixgbe/ixgbe_pf.c +0
-0@@ -575,7 +575,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev,
__rte_unuseduint32_tvf,uint32_t*ms
IXGBE_MHADD_MFS_MASK) >>IXGBE_MHADD_MFS_SHIFT;drivers/net/ixgbe/ixgbe_pf.c +1
-2if (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
PATCH v2 17/22 net/cxgbe: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- drivers/net/cxgbe/cxgbe.h | 4 ++++ drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/cxgbe/cxgbe.h +4 -0
@@ -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 */
drivers/net/cxgbe/cxgbe_ethdev.c +2 -2
@@ -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
Signature · 1 line
2.17.1
PATCH v2 18/22 net/axgbe: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/axgbe/axgbe_ethdev.c | 2 +- drivers/net/axgbe/axgbe_ethdev.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_ethdev.c +1 -1
@@ -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 ;
drivers/net/axgbe/axgbe_ethdev.h +6 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v2 19/22 net/enetc: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/enetc/enetc.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc.h +4 -0
@@ -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
drivers/net/enetc/enetc_ethdev.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v2 20/22 net/hinic: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/hinic/hinic_pmd_ethdev.c +4 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v2 21/22 net/nfp: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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'.
--- drivers/net/nfp/nfp_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/nfp/nfp_net.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v2 22/22 net/liquidio: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/liquidio/lio_ethdev.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/liquidio/lio_ethdev.c +1 -1
@@ -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
drivers/net/liquidio/lio_ethdev.h +3 -0
@@ -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 */
Signature · 1 line
2.17.1
Quoted 34 lines · 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
Quoted 8 lines
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.
v3 cover fix rx packets dropped issue
In reply to Steve YangThe 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(-)
Signature · 1 line
2.17.1
PATCH v3 1/22 ethdev: fix MTU size exceeds max rx packet length
In reply to Steve YangEthdev 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.
--- lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
lib/librte_ethdev/rte_ethdev.c +24 -3
@@ -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;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 25 lines · 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 = 1496Packets 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 <[email protected]>
<...>
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1430
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +4
-3@@ -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.
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1437
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+ } + +/* 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?
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 38 lines · Ferruh Yigit
Quoted 25 lines · 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 <[email protected]><...>
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +2
-2@@ -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 ||
Quoted 9 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +1
-0+ 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.
Quoted 9 lines
Quoted 7 lines
+ }
+
+ /* Scale the MTU size to adaptmax_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?
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 48 lines · Ferruh Yigit
Quoted 27 lines · Ferruh Yigit
Quoted 25 lines · 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 = 1496Packets 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 <[email protected]><...>
Quoted 15 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1430
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +4
-3@@ -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.
Quoted 3 lines
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
Quoted 10 lines
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1437
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+ } + +/* 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?
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 49 lines · Andrew Boyer
Quoted 49 lines · On Jan 14, 2021, at 12:13 PM, Ferruh Yigit <[email protected]…
Quoted 43 lines · Ferruh Yigit
Quoted 25 lines · 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 <[email protected] <mailto:[email protected]>><...>
Quoted 11 lines
lib/librte_ethdev/rte_ethdev.c +3
-2@@ -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 */ Quoted 3 lines
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.
Quoted 7 lines
Quoted 3 lines
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 theJUMBO_FRAMEflag based on the mtu value indev_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.
Quoted 14 lines
Thanks,
AndrewQuoted 10 lines
Quoted 8 lines
Quoted 7 lines
+ }
+
+ /* Scale the MTU size to adaptmax_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?
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
In reply to Steve YangHi Steve
This is a very good job! But I have some question and suggestions. Please check it.
Quoted 52 lines · 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 = 1496Packets 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 <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +5
-0@@ -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);
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1337
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-0if (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
}intrte_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?
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +3
-2/* 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 */
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1437
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-1dev->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 = 1500overhead_len = 26dev->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.
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +2
-0/* @@ -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;
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 96 lines · oulijun
Hi Steve
This is a very good job! But I have some question and suggestions. Please check it.Quoted 50 lines · 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 <[email protected]>---
lib/librte_ethdev/rte_ethdev.c| 27 ++++++++++++++++++++++++---1 file changed, 24 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +5
-0@@ -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; +lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t · line 1336
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-0ret = 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 theoverhead_lenevery 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 heredev_configureAPI.
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_getAPI. As following:
structrte_eth_dev_info{
xxxx
/**
* The maximum Ethernet frame length supported by each
* driver varies with the Ethernet header length.
*/
uint16_teth_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
}
Quoted 8 lines
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.
Quoted 21 lines
Quoted 21 lines
lib/librte_ethdev/rte_ethdev.c +3
-2/* 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 adaptmax_rx_pkt_len*/
+ if (dev_conf->rxmode.offloads&DEV_RX_OFFLOAD_JUMBO_FRAME) {
Quoted 8 lines
Quoted 3 lines
+
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'
Quoted 6 lines
xxxx
}
} else {
xxx
}
Quoted 7 lines
If it does not thing above, which will cause an unreasonable case. Like,
dev_conf->rxmode.offloads&DEV_RX_OFFLOAD_JUMBO_FRAME== 1dev_conf->rxmode.max_rx_pkt_len= 1500overhead_len= 26dev->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".
Quoted 1 line
In fact,
DEV_RX_OFFLOAD_JUMBO_FRAMEis 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'
Quoted 11 lines
Quoted 11 lines
/*
lib/librte_ethdev/rte_ethdev.c +0
-0@@ -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;
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 145 lines · Ferruh Yigit
Quoted 96 lines · oulijun
Hi Steve
This is a very good job! But I have some question and suggestions. Please check it.Quoted 50 lines · 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 = 1496Packets 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 <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +5
-0@@ -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; +lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, · line 1336
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-0ret =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 theoverhead_lenevery 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
heredev_configureAPI.
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_getAPI. 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 }Quoted 8 lines
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.
Quoted 28 lines
Quoted 16 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* 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.lib/librte_ethdev/rte_ethdev.c +3
-2@@ -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 */ lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, · line 1438
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-1dev->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:Quoted 4 lines
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) {
Quoted 5 lines
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 ifJUMBO_FRAMEenabled. */"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.
Quoted 47 lines
Quoted 6 lines
xxxx } } else {xxx
}Quoted 8 lines
If it does not thing above, which will cause an unreasonable case. Like,
dev_conf->rxmode.offloads&DEV_RX_OFFLOAD_JUMBO_FRAME== 1dev_conf->rxmode.max_rx_pkt_len= 1500overhead_len= 26dev->data->mtu=dev_conf->rxmode.max_rx_pkt_len-overhead_len= 1500
- 26 = 1474This 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".Quoted 2 lines
In fact,
DEV_RX_OFFLOAD_JUMBO_FRAMEis set to rxmode.offloads when mtuQuoted 1 line
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'Quoted 5 lines
Quoted 5 lines
/*lib/librte_ethdev/rte_ethdev.c +0
-0@@ -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:Quoted 8 lines
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +2
-0memcpy (&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;.
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
Quoted 172 lines · oulijun
Quoted 145 lines · Ferruh Yigit
Quoted 96 lines · oulijun
Hi Steve
This is a very good job! But I have some question and suggestions. Please check it.Quoted 50 lines · 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 = 1496Packets 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 <[email protected]>--- lib/librte_ethdev/rte_ethdev.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +5
-0@@ -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; +lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, · line 1336
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-0ret =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 theoverhead_lenevery 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 heredev_configureAPI.
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_getAPI. 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 }Quoted 8 lines
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.
Quoted 28 lines
Quoted 16 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* 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.lib/librte_ethdev/rte_ethdev.c +3
-2@@ -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 */ lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, · line 1438
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-1dev->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:Quoted 4 lines
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) {Quoted 5 lines
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 ifJUMBO_FRAMEenabled. */"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_lenwill be also updated with 'mtu +overhead_len' also when application sets mtu > 1500, which meansJUMBO_FRAMEis enabled. Namely,JUMBO_FRAMEis enabled based on mtu > 1500 ormax_rx_pkt_len> 1500 +overhead_len.
Besides, having following check for "rxmode.offloads &DEV_RX_OFFLOAD_JUMBO_FRAME== 0":lib/librte_ethdev/rte_ethdev.c +0
-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".
Quoted 22 lines
In view of the above two aspects, when application set
DEV_RX_OFFLOAD_JUMBO_FRAMEin offload, themax_rx_pkt_lenmust be greater than "RTE_ETHER_MTU+overhead_len"Since
DEV_RX_OFFLOAD_JUMBO_FRAMEis not removed, so the check is necessary.Quoted 18 lines
Quoted 6 lines
xxxx } } else {xxx
}Quoted 7 lines
If it does not thing above, which will cause an unreasonable case. Like,
dev_conf->rxmode.offloads&DEV_RX_OFFLOAD_JUMBO_FRAME== 1dev_conf->rxmode.max_rx_pkt_len= 1500overhead_len= 26dev->data->mtu=dev_conf->rxmode.max_rx_pkt_len-overhead_len= 1500 - 26 = 1474This 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".Quoted 1 line
In fact,
DEV_RX_OFFLOAD_JUMBO_FRAMEis 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.
Quoted 29 lines
Quoted 11 lines
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'Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +0
-0/* @@ -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:Quoted 8 lines
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +2
-0memcpy (&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;.
.
Re: [dpdk-dev] [PATCH v3 01/22] ethdev: fix MTU size exceeds max rx packet length
In reply to oulijunQuoted 168 lines · oulijun
Quoted 141 lines · Ferruh Yigit
Quoted 95 lines · oulijun
Hi Steve
This is a very good job! But I have some question and suggestions. Please check it.Quoted 50 lines · 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 <[email protected]>---
lib/librte_ethdev/rte_ethdev.c| 27 ++++++++++++++++++++++++---1 file changed, 24 insertions(+), 3 deletions(-)lib/librte_ethdev/rte_ethdev.c +5
-0@@ -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; +lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t · line 1336
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +7
-0ret = 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 theoverhead_lenevery 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 heredev_configureAPI.
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_getAPI. As following:
structrte_eth_dev_info{
xxxx
/**
* The maximum Ethernet frame length supported by each
* driver varies with the Ethernet header length.
*/
uint16_teth_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
}Quoted 8 lines
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.
Quoted 21 lines
Quoted 21 lines
lib/librte_ethdev/rte_ethdev.c +3
-2/* 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 adaptmax_rx_pkt_len*/
+ if (dev_conf->rxmode.offloads&DEV_RX_OFFLOAD_JUMBO_FRAME) {Quoted 8 lines
Quoted 3 lines
+
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) {Quoted 5 lines
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 ifJUMBO_FRAMEenabled. */"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_lenwill be also updated with 'mtu +overhead_len' also when application sets mtu > 1500, which meansJUMBO_FRAMEis enabled. Namely,JUMBO_FRAMEis enabled based on mtu > 1500 ormax_rx_pkt_len> 1500 +overhead_len.
Besides, having following check for "rxmode.offloads &DEV_RX_OFFLOAD_JUMBO_FRAME== 0":lib/librte_ethdev/rte_ethdev.c +0
-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".
Quoted 2 lines
In view of the above two aspects, when application set
DEV_RX_OFFLOAD_JUMBO_FRAMEin offload, themax_rx_pkt_lenmust 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.
Quoted 45 lines
Since
DEV_RX_OFFLOAD_JUMBO_FRAMEis not removed, so the check is necessary.Quoted 43 lines
Quoted 6 lines
xxxx
}
} else {
xxx
}Quoted 7 lines
If it does not thing above, which will cause an unreasonable case. Like,
dev_conf->rxmode.offloads&DEV_RX_OFFLOAD_JUMBO_FRAME== 1dev_conf->rxmode.max_rx_pkt_len= 1500overhead_len= 26dev->data->mtu=dev_conf->rxmode.max_rx_pkt_len-overhead_len= 1500 - 26 = 1474This 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".Quoted 1 line
In fact,
DEV_RX_OFFLOAD_JUMBO_FRAMEis 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'Quoted 11 lines
Quoted 11 lines
/*
lib/librte_ethdev/rte_ethdev.c +0
-0@@ -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;.
v4 cover fix rx packets dropped issue
In reply to Steve YangThe 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(-)
Signature · 1 line
2.17.1
PATCH v4 1/22 ethdev: fix MTU size exceeds max rx packet length
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.
--- lib/librte_ethdev/rte_ethdev.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
lib/librte_ethdev/rte_ethdev.c +22 -3
@@ -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;
Signature · 1 line
2.17.1
PATCH v4 2/22 app/testpmd: fix max rx packet length for VLAN packets
In reply to Steve YangWhen 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()'.
--- 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(-)
app/test-pmd/cmdline.c +0 -6
@@ -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 ;
app/test-pmd/config.c +1 -1
@@ -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 =
app/test-pmd/parameters.c +2 -5
@@ -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 );
app/test-pmd/testpmd.c +18 -0
@@ -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 &=
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets
Quoted 119 lines · 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_offloadsassignment 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 <[email protected]>Cc Beilei Xing <[email protected]>Cc Bernard Iremonger <[email protected]>Signed-off-by Steve Yang <[email protected]>--- 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(-)app/test-pmd/cmdline.c +0
-6@@ -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 ;app/test-pmd/config.c +1
-1@@ -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 =app/test-pmd/parameters.c +2
-5@@ -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 );app/test-pmd/testpmd.c +18
-1@@ -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 &= --
Quoted 2 lines
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.)
Re: [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets
Quoted 129 lines · Lance Richardson
Quoted 119 lines · 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_offloadsassignment 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 <[email protected]>Cc Beilei Xing <[email protected]>Cc Bernard Iremonger <[email protected]>Signed-off-by Steve Yang <[email protected]>--- 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(-)app/test-pmd/cmdline.c +0
-6@@ -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 ;app/test-pmd/config.c +1
-1@@ -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 =app/test-pmd/parameters.c +2
-5@@ -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 );app/test-pmd/testpmd.c +18
-1@@ -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 &= --Quoted 2 lines
2.17.1
Moving the setting of
DEV_RX_OFFLOAD_JUMBO_FRAMEfromcmd_config_max_pkt_len_parsed()toinit_config()doesn't seem to be correct for the case wheremax_rx_pkt_lenis changed from the command line via "port config all max-pkt-len".
Quoted 7 lines
The
init_config()function is only called when testpmd is started, but theDEV_RX_OFFLOAD_JUMBO_FRAMEsetting needs to
be recomputed whenevermax_rx_pkt_lenchanges.(Of course this won't matter when
DEV_RX_OFFLOAD_JUMBO_FRAMEis 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.)
Re: [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets
In reply to Lance RichardsonQuoted 128 lines · Lance Richardson
Quoted 119 lines · 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_offloadsassignment 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 <[email protected]>Cc Beilei Xing <[email protected]>Cc Bernard Iremonger <[email protected]>Signed-off-by Steve Yang <[email protected]>--- 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(-)app/test-pmd/cmdline.c +0
-6@@ -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 ;app/test-pmd/config.c +1
-1@@ -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 =app/test-pmd/parameters.c +2
-5@@ -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 );app/test-pmd/testpmd.c +18
-1@@ -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 &= --Quoted 2 lines
2.17.1
Moving the setting of
DEV_RX_OFFLOAD_JUMBO_FRAMEfromcmd_config_max_pkt_len_parsed()toinit_config()doesn't seem to be correct for the case wheremax_rx_pkt_lenis changed from the command line via "port config all max-pkt-len".
Quoted 4 lines
The
init_config()function is only called when testpmd is started, but theDEV_RX_OFFLOAD_JUMBO_FRAMEsetting needs to
be recomputed whenevermax_rx_pkt_lenchanges.
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
Quoted 4 lines
(Of course this won't matter when
DEV_RX_OFFLOAD_JUMBO_FRAMEis removed, which seems like a great idea, but for now this is impacting some test automation with 21.02-rc1.)
PATCH v4 3/22 net/dpaa: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/dpaa/dpaa_ethdev.c | 2 +- drivers/net/dpaa/dpaa_ethdev.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/dpaa/dpaa_ethdev.c +1 -1
@@ -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
drivers/net/dpaa/dpaa_ethdev.h +4 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v4 4/22 net/dpaa2: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/dpaa2/dpaa2_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.c +1 -1
@@ -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
drivers/net/dpaa2/dpaa2_ethdev.h +4 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v4 5/22 net/e1000: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/e1000/e1000_ethdev.h +1 -1
@@ -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. *
drivers/net/e1000/em_ethdev.c +2 -3
@@ -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 ;
drivers/net/e1000/igb_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v4 6/22 net/hns3: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/hns3/hns3_ethdev.c | 2 +- drivers/net/hns3/hns3_ethdev_vf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_ethdev.c +1 -1
@@ -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 );/*
drivers/net/hns3/hns3_ethdev_vf.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v4 7/22 net/i40e: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -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)
drivers/net/i40e/i40e_ethdev_vf.c +5 -5
@@ -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
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -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 ;
drivers/net/i40e/i40e_rxtx.c +4 -4
@@ -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 ; } }
Signature · 1 line
2.17.1
PATCH v4 8/22 net/iavf: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_ethdev.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/iavf/iavf.h +1 -0
@@ -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)
drivers/net/iavf/iavf_ethdev.c +5 -5
@@ -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
Signature · 1 line
2.17.1
PATCH v4 9/22 net/ice: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -4
@@ -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 ; } }
drivers/net/ice/ice_ethdev.c +1 -1
@@ -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
drivers/net/ice/ice_ethdev.h +1 -0
@@ -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)
drivers/net/ice/ice_rxtx.c +5 -5
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v4 10/22 net/ipn3ke: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/ipn3ke/ipn3ke_ethdev.h | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ipn3ke/ipn3ke_ethdev.h +1 -0
@@ -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
drivers/net/ipn3ke/ipn3ke_representor.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v4 11/22 net/octeontx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/octeontx/octeontx_ethdev.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/octeontx/octeontx_ethdev.c +1 -1
@@ -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 ;
drivers/net/octeontx/octeontx_ethdev.h +1 -0
@@ -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 \
Signature · 1 line
2.17.1
PATCH v4 12/22 net/octeontx2: fix the jumbo frame flag condition for mtu
In reply to Steve YangThe 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.
--- drivers/net/octeontx2/otx2_ethdev.h | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -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
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v4 13/22 net/qede: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/qede/qede_rxtx.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_ethdev.c +1 -1
@@ -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 ;
drivers/net/qede/qede_rxtx.h +1 -0
@@ -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 |\
Signature · 1 line
2.17.1
PATCH v4 14/22 net/sfc: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/sfc/sfc_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/sfc/sfc_ethdev.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH v4 15/22 net/thunderx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/thunderx/base/nicvf_hw_defs.h | 1 + drivers/net/thunderx/nicvf_ethdev.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/thunderx/base/nicvf_hw_defs.h +1 -0
@@ -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 */
drivers/net/thunderx/nicvf_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v4 16/22 net/ixgbe: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -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 ;
drivers/net/ixgbe/ixgbe_ethdev.h +3 -0
@@ -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*/
drivers/net/ixgbe/ixgbe_pf.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v4 17/22 net/cxgbe: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- drivers/net/cxgbe/cxgbe.h | 4 ++++ drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/cxgbe/cxgbe.h +4 -0
@@ -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 */
drivers/net/cxgbe/cxgbe_ethdev.c +2 -2
@@ -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
Signature · 1 line
2.17.1
PATCH v4 18/22 net/axgbe: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/axgbe/axgbe_ethdev.c | 2 +- drivers/net/axgbe/axgbe_ethdev.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_ethdev.c +1 -1
@@ -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 ;
drivers/net/axgbe/axgbe_ethdev.h +6 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v4 19/22 net/enetc: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/enetc/enetc.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc.h +4 -0
@@ -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
drivers/net/enetc/enetc_ethdev.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v4 20/22 net/hinic: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/hinic/hinic_pmd_ethdev.c +4 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v4 21/22 net/nfp: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/nfp/nfp_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/nfp/nfp_net.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v4 22/22 net/liquidio: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/liquidio/lio_ethdev.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/liquidio/lio_ethdev.c +1 -1
@@ -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
drivers/net/liquidio/lio_ethdev.h +3 -0
@@ -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 */
Signature · 1 line
2.17.1
Quoted 52 lines · 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 = 1496Packets 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 inrte_ethdevand 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
Quoted 8 lines
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,
Series applied to dpdk-next-net/main, thanks.
PATCH v3 2/22 app/testpmd: fix max rx packet length for VLAN packets
In reply to Steve YangWhen 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()'.
--- 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(-)
app/test-pmd/cmdline.c +0 -6
@@ -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 ;
app/test-pmd/config.c +1 -1
@@ -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 =
app/test-pmd/parameters.c +2 -5
@@ -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 );
app/test-pmd/testpmd.c +18 -0
@@ -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 &=
Signature · 1 line
2.17.1
PATCH v3 3/22 net/dpaa: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/dpaa/dpaa_ethdev.c | 2 +- drivers/net/dpaa/dpaa_ethdev.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/dpaa/dpaa_ethdev.c +1 -1
@@ -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
drivers/net/dpaa/dpaa_ethdev.h +4 -0
@@ -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
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 03/22] net/dpaa: fix the jumbo frame flag condition for mtu set
PATCH v3 4/22 net/dpaa2: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/dpaa2/dpaa2_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.c +1 -1
@@ -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
drivers/net/dpaa2/dpaa2_ethdev.h +4 -0
@@ -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
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 04/22] net/dpaa2: fix the jumbo frame flag condition for mtu set
PATCH v3 5/22 net/e1000: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/e1000/e1000_ethdev.h +1 -1
@@ -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. *
drivers/net/e1000/em_ethdev.c +2 -3
@@ -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 ;
drivers/net/e1000/igb_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 6/22 net/hns3: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/hns3/hns3_ethdev.c | 2 +- drivers/net/hns3/hns3_ethdev_vf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/hns3/hns3_ethdev.c +1 -1
@@ -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 );/*
drivers/net/hns3/hns3_ethdev_vf.c +1 -1
@@ -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
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 06/22] net/hns3: fix the jumbo frame flag condition for mtu set
Quoted 44 lines · 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 <[email protected]>--- drivers/net/hns3/hns3_ethdev.c | 2 +- drivers/net/hns3/hns3_ethdev_vf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/net/hns3/hns3_ethdev.c +1
-1@@ -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 );/* drivers/net/hns3/hns3_ethdev_vf.c +1
-1@@ -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
PATCH v3 7/22 net/i40e: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -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)
drivers/net/i40e/i40e_ethdev_vf.c +5 -5
@@ -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
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -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 ;
drivers/net/i40e/i40e_rxtx.c +4 -4
@@ -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 ; } }
Signature · 1 line
2.17.1
PATCH v3 8/22 net/iavf: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_ethdev.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/iavf/iavf.h +1 -0
@@ -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)
drivers/net/iavf/iavf_ethdev.c +5 -5
@@ -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
Signature · 1 line
2.17.1
PATCH v3 9/22 net/ice: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -4
@@ -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 ; } }
drivers/net/ice/ice_ethdev.c +1 -1
@@ -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
drivers/net/ice/ice_ethdev.h +1 -0
@@ -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)
drivers/net/ice/ice_rxtx.c +5 -5
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 10/22 net/ipn3ke: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/ipn3ke/ipn3ke_ethdev.h | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ipn3ke/ipn3ke_ethdev.h +1 -0
@@ -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
drivers/net/ipn3ke/ipn3ke_representor.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v3 11/22 net/octeontx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/octeontx/octeontx_ethdev.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/octeontx/octeontx_ethdev.c +1 -1
@@ -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 ;
drivers/net/octeontx/octeontx_ethdev.h +1 -0
@@ -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 \
Signature · 1 line
2.17.1
PATCH v3 12/22 net/octeontx2: fix the jumbo frame flag condition for mtu
In reply to Steve YangThe 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.
--- drivers/net/octeontx2/otx2_ethdev.h | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -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
drivers/net/octeontx2/otx2_ethdev_ops.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 13/22 net/qede: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/qede/qede_rxtx.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_ethdev.c +1 -1
@@ -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 ;
drivers/net/qede/qede_rxtx.h +1 -0
@@ -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 |\
Signature · 1 line
2.17.1
PATCH v3 14/22 net/sfc: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/sfc/sfc_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/sfc/sfc_ethdev.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH v3 15/22 net/thunderx: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/thunderx/base/nicvf_hw_defs.h | 1 + drivers/net/thunderx/nicvf_ethdev.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/thunderx/base/nicvf_hw_defs.h +1 -0
@@ -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 */
drivers/net/thunderx/nicvf_ethdev.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 16/22 net/ixgbe: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- 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(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -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 ;
drivers/net/ixgbe/ixgbe_ethdev.h +3 -0
@@ -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*/
drivers/net/ixgbe/ixgbe_pf.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 17/22 net/cxgbe: fix the jumbo frame flag condition
In reply to Steve YangThe 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.
--- drivers/net/cxgbe/cxgbe.h | 4 ++++ drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/cxgbe/cxgbe.h +4 -0
@@ -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 */
drivers/net/cxgbe/cxgbe_ethdev.c +2 -2
@@ -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
Signature · 1 line
2.17.1
PATCH v3 18/22 net/axgbe: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/axgbe/axgbe_ethdev.c | 2 +- drivers/net/axgbe/axgbe_ethdev.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_ethdev.c +1 -1
@@ -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 ;
drivers/net/axgbe/axgbe_ethdev.h +6 -0
@@ -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
Signature · 1 line
2.17.1
PATCH v3 19/22 net/enetc: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/enetc/enetc.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc.h +4 -0
@@ -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
drivers/net/enetc/enetc_ethdev.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v3 20/22 net/hinic: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/hinic/hinic_pmd_ethdev.c +4 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v3 21/22 net/nfp: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/nfp/nfp_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/nfp/nfp_net.c +1 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 22/22 net/liquidio: fix the jumbo frame flag condition for mtu set
In reply to Steve YangThe 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.
--- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/liquidio/lio_ethdev.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/liquidio/lio_ethdev.c +1 -1
@@ -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
drivers/net/liquidio/lio_ethdev.h +3 -0
@@ -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 */
Signature · 1 line
2.17.1