DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ixgbe: align setting MTU behavior with i40e
@ 2017-07-04  8:22 Beilei Xing
  2017-07-05  2:33 ` [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped Beilei Xing
  0 siblings, 1 reply; 7+ messages in thread
From: Beilei Xing @ 2017-07-04  8:22 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev

Currently, setting MTU will fail if MTU requires the support
of scattered packets before scatter is enabled.
To align with i40e, this patch allows this MTU setting when
device is stopped.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 830bbcb..60881d8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4811,6 +4811,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	struct rte_eth_dev_info dev_info;
 	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
 	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
+	struct rte_eth_dev_data *dev_data = dev->data;
 
 	ixgbe_dev_info_get(dev, &dev_info);
 
@@ -4818,13 +4819,15 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if ((mtu < 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 device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
 	 */
-	if (!rx_conf->enable_scatter &&
+	if (dev_data->dev_started && !rx_conf->enable_scatter &&
 	    (frame_size + 2 * IXGBE_VLAN_TAG_SIZE >
-	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
+	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
+		PMD_INIT_LOG(ERR, "Port should be stopped first.");
 		return -EINVAL;
+	}
 
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-- 
2.5.5

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

* [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped
  2017-07-04  8:22 [dpdk-dev] [PATCH] net/ixgbe: align setting MTU behavior with i40e Beilei Xing
@ 2017-07-05  2:33 ` Beilei Xing
  2017-07-05  3:19   ` Lu, Wenzhuo
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Beilei Xing @ 2017-07-05  2:33 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev

Currently, setting MTU will fail if MTU requires the support
of scattered packets before scatter is enabled.
This patch allows setting this special MTU when device is
stopped, cause scatter will be re-configured during starting
port.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v2 changes:
 - change commit log

 drivers/net/ixgbe/ixgbe_ethdev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb5574e..ece5d6c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4812,6 +4812,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	struct rte_eth_dev_info dev_info;
 	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
 	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
+	struct rte_eth_dev_data *dev_data = dev->data;
 
 	ixgbe_dev_info_get(dev, &dev_info);
 
@@ -4819,13 +4820,15 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if ((mtu < 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 device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
 	 */
-	if (!rx_conf->enable_scatter &&
+	if (dev_data->dev_started && !rx_conf->enable_scatter &&
 	    (frame_size + 2 * IXGBE_VLAN_TAG_SIZE >
-	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
+	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
+		PMD_INIT_LOG(ERR, "Stop port first.");
 		return -EINVAL;
+	}
 
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped
  2017-07-05  2:33 ` [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped Beilei Xing
@ 2017-07-05  3:19   ` Lu, Wenzhuo
  2017-07-05 13:59   ` Ferruh Yigit
  2017-07-06  3:36   ` [dpdk-dev] [PATCH v3] " Beilei Xing
  2 siblings, 0 replies; 7+ messages in thread
From: Lu, Wenzhuo @ 2017-07-05  3:19 UTC (permalink / raw)
  To: Xing, Beilei; +Cc: dev

Hi,


> -----Original Message-----
> From: Xing, Beilei
> Sent: Wednesday, July 5, 2017 10:34 AM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: [PATCH v2] net/ixgbe: remove MTU setting limitation when port's
> stopped
> 
> Currently, setting MTU will fail if MTU requires the support of scattered
> packets before scatter is enabled.
> This patch allows setting this special MTU when device is stopped, cause
> scatter will be re-configured during starting port.
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped
  2017-07-05  2:33 ` [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped Beilei Xing
  2017-07-05  3:19   ` Lu, Wenzhuo
@ 2017-07-05 13:59   ` Ferruh Yigit
  2017-07-06  3:23     ` Xing, Beilei
  2017-07-06  3:36   ` [dpdk-dev] [PATCH v3] " Beilei Xing
  2 siblings, 1 reply; 7+ messages in thread
From: Ferruh Yigit @ 2017-07-05 13:59 UTC (permalink / raw)
  To: Beilei Xing, wenzhuo.lu; +Cc: dev

On 7/5/2017 3:33 AM, Beilei Xing wrote:
> Currently, setting MTU will fail if MTU requires the support
> of scattered packets before scatter is enabled.
> This patch allows setting this special MTU when device is
> stopped, cause scatter will be re-configured during starting
> port.
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
> v2 changes:
>  - change commit log
> 
>  drivers/net/ixgbe/ixgbe_ethdev.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index fb5574e..ece5d6c 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -4812,6 +4812,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
>  	struct rte_eth_dev_info dev_info;
>  	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
>  	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
> +	struct rte_eth_dev_data *dev_data = dev->data;
>  
>  	ixgbe_dev_info_get(dev, &dev_info);
>  
> @@ -4819,13 +4820,15 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
>  	if ((mtu < 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 device is started, refuse mtu that requires the support of
> +	 * scattered packets when this feature has not been enabled before.
>  	 */
> -	if (!rx_conf->enable_scatter &&
> +	if (dev_data->dev_started && !rx_conf->enable_scatter &&

Should dev->data->scattered_rx be used here?

rx_conf->enable_scatter is configuration value provided by user, but
dev->data->scattered_rx keeps the actual status of the feature.
Driver may decide to enable scattered rx even tough configuration didn't
asked for it, this behavior is what this patch relies on.

Can you confirm that there is no other case that can prevent enabling
scattered rx?
Otherwise this patch will let setting MTU bigger than mbuf and if
somehow scattered rx is not enabled, this may break the Rx path I guess.

>  	    (frame_size + 2 * IXGBE_VLAN_TAG_SIZE >
> -	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
> +	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
> +		PMD_INIT_LOG(ERR, "Stop port first.");
>  		return -EINVAL;
> +	}
>  
>  	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
> 

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

* Re: [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped
  2017-07-05 13:59   ` Ferruh Yigit
@ 2017-07-06  3:23     ` Xing, Beilei
  0 siblings, 0 replies; 7+ messages in thread
From: Xing, Beilei @ 2017-07-06  3:23 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Wednesday, July 5, 2017 10:00 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting
> limitation when port's stopped
> 
> On 7/5/2017 3:33 AM, Beilei Xing wrote:
> > Currently, setting MTU will fail if MTU requires the support of
> > scattered packets before scatter is enabled.
> > This patch allows setting this special MTU when device is stopped,
> > cause scatter will be re-configured during starting port.
> >
> > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> > ---
> > v2 changes:
> >  - change commit log
> >
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index fb5574e..ece5d6c 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -4812,6 +4812,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
> >  	struct rte_eth_dev_info dev_info;
> >  	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
> >  	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
> > +	struct rte_eth_dev_data *dev_data = dev->data;
> >
> >  	ixgbe_dev_info_get(dev, &dev_info);
> >
> > @@ -4819,13 +4820,15 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
> >  	if ((mtu < 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 device is started, refuse mtu that requires the support of
> > +	 * scattered packets when this feature has not been enabled before.
> >  	 */
> > -	if (!rx_conf->enable_scatter &&
> > +	if (dev_data->dev_started && !rx_conf->enable_scatter &&
> 
> Should dev->data->scattered_rx be used here?

Agree, I missed this case: if launch testpmd with max_pkt_len bigger than mbuf.
Thanks.

> 
> rx_conf->enable_scatter is configuration value provided by user, but
> dev->data->scattered_rx keeps the actual status of the feature.
> Driver may decide to enable scattered rx even tough configuration didn't
> asked for it, this behavior is what this patch relies on.
> 
> Can you confirm that there is no other case that can prevent enabling
> scattered rx?

I checked that scattered_rx is disabled only when device is stopped.

> Otherwise this patch will let setting MTU bigger than mbuf and if somehow
> scattered rx is not enabled, this may break the Rx path I guess.
> 
> >  	    (frame_size + 2 * IXGBE_VLAN_TAG_SIZE >
> > -	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
> > +	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
> > +		PMD_INIT_LOG(ERR, "Stop port first.");
> >  		return -EINVAL;
> > +	}
> >
> >  	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> >  	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
> >


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

* [dpdk-dev] [PATCH v3] net/ixgbe: remove MTU setting limitation when port's stopped
  2017-07-05  2:33 ` [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped Beilei Xing
  2017-07-05  3:19   ` Lu, Wenzhuo
  2017-07-05 13:59   ` Ferruh Yigit
@ 2017-07-06  3:36   ` Beilei Xing
  2017-07-06  9:49     ` Ferruh Yigit
  2 siblings, 1 reply; 7+ messages in thread
From: Beilei Xing @ 2017-07-06  3:36 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev

Currently, setting MTU will fail if MTU requires the support
of scattered packets before scattered_rx is enabled.
This patch allows setting this special MTU when device is
stopped, cause scattered_rx will be re-configured during
starting port.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v3 changes:
 -Check dev_data->scattered_rx instead of rx_conf->enable_scatter
v2 changes:
 -Change commit log
 drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb5574e..4814aeb 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4811,7 +4811,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev_info dev_info;
 	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
-	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
+	struct rte_eth_dev_data *dev_data = dev->data;
 
 	ixgbe_dev_info_get(dev, &dev_info);
 
@@ -4819,13 +4819,15 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	if ((mtu < 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 device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
 	 */
-	if (!rx_conf->enable_scatter &&
+	if (dev_data->dev_started && !dev_data->scattered_rx &&
 	    (frame_size + 2 * IXGBE_VLAN_TAG_SIZE >
-	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
+	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
+		PMD_INIT_LOG(ERR, "Stop port first.");
 		return -EINVAL;
+	}
 
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH v3] net/ixgbe: remove MTU setting limitation when port's stopped
  2017-07-06  3:36   ` [dpdk-dev] [PATCH v3] " Beilei Xing
@ 2017-07-06  9:49     ` Ferruh Yigit
  0 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2017-07-06  9:49 UTC (permalink / raw)
  To: Beilei Xing, wenzhuo.lu; +Cc: dev

On 7/6/2017 4:36 AM, Beilei Xing wrote:
> Currently, setting MTU will fail if MTU requires the support
> of scattered packets before scattered_rx is enabled.
> This patch allows setting this special MTU when device is
> stopped, cause scattered_rx will be re-configured during
> starting port.
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Applied to dpdk-next-net/master, thanks.

(Kept Wenzhuo's ACK from previous version)

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

end of thread, other threads:[~2017-07-06  9:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-04  8:22 [dpdk-dev] [PATCH] net/ixgbe: align setting MTU behavior with i40e Beilei Xing
2017-07-05  2:33 ` [dpdk-dev] [PATCH v2] net/ixgbe: remove MTU setting limitation when port's stopped Beilei Xing
2017-07-05  3:19   ` Lu, Wenzhuo
2017-07-05 13:59   ` Ferruh Yigit
2017-07-06  3:23     ` Xing, Beilei
2017-07-06  3:36   ` [dpdk-dev] [PATCH v3] " Beilei Xing
2017-07-06  9:49     ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).