diff mbox series

net/e1000: remove MTU setting limitation

Message ID 20210219100323.102093-1-dapengx.yu@intel.com (mailing list archive)
State Awaiting Upstream
Delegated to: Qi Zhang
Headers show
Series net/e1000: remove MTU setting limitation | expand

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/github-robot success github build: passed
ci/travis-robot fail travis build: failed
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Yu, DapengX Feb. 19, 2021, 10:03 a.m. UTC
From: Dapeng Yu <dapengx.yu@intel.com>

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: 59d0ecdbf0e1 ("ethdev: MTU accessors")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
 drivers/net/e1000/em_ethdev.c  | 12 ++++++++----
 drivers/net/e1000/igb_ethdev.c | 12 ++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)

Comments

Guo, Jia Feb. 24, 2021, 3:37 a.m. UTC | #1
Seems that this is align with the fixing process of the other pmds(ixgbe/txgbe) and it is not bad. Thanks.

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

> -----Original Message-----
> From: Yu, DapengX <dapengx.yu@intel.com>
> Sent: Friday, February 19, 2021 6:03 PM
> To: Guo, Jia <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/e1000: remove MTU setting limitation
> 
> From: Dapeng Yu <dapengx.yu@intel.com>
> 
> 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: 59d0ecdbf0e1 ("ethdev: MTU accessors")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> ---
>  drivers/net/e1000/em_ethdev.c  | 12 ++++++++----
> drivers/net/e1000/igb_ethdev.c | 12 ++++++++----
>  2 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/e1000/em_ethdev.c
> b/drivers/net/e1000/em_ethdev.c index 9b8c4a7de..3c6f643c1 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -1805,11 +1805,15 @@ eth_em_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
>  	if (mtu < RTE_ETHER_MIN_MTU || frame_size >
> dev_info.max_rx_pktlen)
>  		return -EINVAL;
> 
> -	/* 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 device is started, refuse mtu that requires the support of
> +	 * scattered packets when this feature has not been enabled before.
> +	 */
> +	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;
> +	}
> 
>  	hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	rctl = E1000_READ_REG(hw, E1000_RCTL); diff --git
> a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index
> 5323504e9..1716d6b90 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -4394,11 +4394,15 @@ eth_igb_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
>  			frame_size > dev_info.max_rx_pktlen)
>  		return -EINVAL;
> 
> -	/* 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 device is started, refuse mtu that requires the support of
> +	 * scattered packets when this feature has not been enabled before.
> +	 */
> +	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 = E1000_READ_REG(hw, E1000_RCTL);
> 
> --
> 2.27.0
Qi Zhang Feb. 24, 2021, 12:18 p.m. UTC | #2
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Guo, Jia
> Sent: Wednesday, February 24, 2021 11:38 AM
> To: Yu, DapengX <dapengx.yu@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/e1000: remove MTU setting limitation
> 
> Seems that this is align with the fixing process of the other pmds(ixgbe/txgbe)
> and it is not bad. Thanks.
> 
> Acked-by: Jeff Guo <jia.guo@intel.com>
> 
> > -----Original Message-----
> > From: Yu, DapengX <dapengx.yu@intel.com>
> > Sent: Friday, February 19, 2021 6:03 PM
> > To: Guo, Jia <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>
> > Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
> > Subject: [PATCH] net/e1000: remove MTU setting limitation
> >
> > From: Dapeng Yu <dapengx.yu@intel.com>
> >
> > 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: 59d0ecdbf0e1 ("ethdev: MTU accessors")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
diff mbox series

Patch

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 9b8c4a7de..3c6f643c1 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1805,11 +1805,15 @@  eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen)
 		return -EINVAL;
 
-	/* 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 device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
+	 */
+	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;
+	}
 
 	hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 5323504e9..1716d6b90 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -4394,11 +4394,15 @@  eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 			frame_size > dev_info.max_rx_pktlen)
 		return -EINVAL;
 
-	/* 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 device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
+	 */
+	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 = E1000_READ_REG(hw, E1000_RCTL);