Skip to contentSkip to conversation

net/igc: remove MTU setting limitation

PATCH Applied [email protected] 3 participants 3 messages Feb 19, 2021 – Feb 24, 2021 1 message not in the archive Network drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/1 net/igc: remove MTU setting limitation

From: Dapeng Yu <[email protected]>

Currently, if requested MTU is bigger than mbuf size and scattered receive is not enabled, setting MTU to that value fails.

This patch allows setting this special MTU when device is stopped, because scattered_rx will be re-configured during next port start and driver may enable scattered receive according new MTU value.

After this patch, driver may select different receive function automatically after MTU set, according MTU values selected.

Fixes a5aeb2b9e225 ("net/igc: support Rx and Tx")
---
 drivers/net/igc/igc_ethdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/igc/igc_ethdev.c +6 -4
index dbaa7a83e..0ea6e2a04 100644
@@ -1590,12 +1590,14 @@ eth_igc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 
 	/*
-	 * refuse mtu that requires the support of scattered packets when
-	 * this feature has not been enabled before.
+	 * If device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
 	 */
-	if (!dev->data->scattered_rx &&
-	    frame_size > dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)
+	if (dev->data->dev_started && !dev->data->scattered_rx &&
+	    frame_size > dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM) {
+		PMD_INIT_LOG(ERR, "Stop port first.");
 		return -EINVAL;
+	}
 
 	rctl = IGC_READ_REG(hw, IGC_RCTL);
 
Signature · 1 line
2.27.0
Acked-by on v2 1/1
#2 lore raw

Seems that v2 is the same as v1, but v1 exposure the coding style issue. Anyway please add the change when update new version. Thanks.

Quoted 55 lines

-----Original Message-----
From: Yu, DapengX <[email protected]>
Sent: Friday, February 19, 2021 6:01 PM
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Yu, DapengX <[email protected]>; [email protected]
Subject: [PATCH v2] net/igc: remove MTU setting limitation

From: Dapeng Yu <[email protected]>

Currently, if requested MTU is bigger than mbuf size and scattered receive is not enabled, setting MTU to that value fails.

This patch allows setting this special MTU when device is stopped, because scattered_rx will be re-configured during next port start and driver may enable scattered receive according new MTU value.

After this patch, driver may select different receive function automatically after MTU set, according MTU values selected.

Fixes a5aeb2b9e225 ("net/igc: support Rx and Tx")
---
 drivers/net/igc/igc_ethdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/igc/igc_ethdev.c index renamed from drivers/net/igc/igc_ethdev.c +0 -0

dbaa7a83e..0ea6e2a04 100644

drivers/net/igc/igc_ethdev.c +6 -4
@@ -1590,12 +1590,14 @@ eth_igc_mtu_set(struct rte_eth_dev *dev,
 uint16_t mtu)
 		return -EINVAL;
 
 	/*
-	 * refuse mtu that requires the support of scattered packets when
-	 * this feature has not been enabled before.
+	 * If device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
 	 */
-	if (!dev->data->scattered_rx &&
-	    frame_size > dev->data->min_rx_buf_size -
 RTE_PKTMBUF_HEADROOM)
+	if (dev->data->dev_started && !dev->data->scattered_rx &&
+	    frame_size > dev->data->min_rx_buf_size -
 RTE_PKTMBUF_HEADROOM) {
+		PMD_INIT_LOG(ERR, "Stop port first.");
 		return -EINVAL;
+	}

rctl = IGC_READ_REG(hw, IGC_RCTL);

--
2.27.0

Applied
#3 lore raw
Quoted 10 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Guo, Jia
Sent: Wednesday, February 24, 2021 11:41 AM
To: Yu, DapengX <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/igc: remove MTU setting limitation

Quoted 28 lines

Seems that v2 is the same as v1, but v1 exposure the coding style issue. Anyway please add the change when update new version. Thanks.

Quoted 23 lines

-----Original Message-----
From: Yu, DapengX <[email protected]>
Sent: Friday, February 19, 2021 6:01 PM
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Yu, DapengX <[email protected]>; [email protected]
Subject: [PATCH v2] net/igc: remove MTU setting limitation

From: Dapeng Yu <[email protected]>

Currently, if requested MTU is bigger than mbuf size and scattered receive is not enabled, setting MTU to that value fails.

This patch allows setting this special MTU when device is stopped, because scattered_rx will be re-configured during next port start and driver may enable scattered receive according new MTU value.

After this patch, driver may select different receive function automatically after MTU set, according MTU values selected.

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

Applied to dpdk-next-net-intel.

Thanks
Qi