patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] net/i40e: fix vf runtime queues rss config
@ 2019-08-07  0:09 Xiao Zhang
  2019-08-08 16:41 ` [dpdk-stable] [v2] " Xiao Zhang
  0 siblings, 1 reply; 16+ messages in thread
From: Xiao Zhang @ 2019-08-07  0:09 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, beilei.xing, Xiao Zhang, stable

I40evf queue can not work properly with kernel pf driver. Eg. when
configured to use 8 queue pairs, only 4 queues can receive packets, and
half packets will be lost if using 2 queue pairs.
This issue is caused by misconfiguration of look up table, use aq command
to setup the lut to make it work properly.

Fixes: cea7a51c1750 ("i40evf: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb98..43ce2bd 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2574,6 +2574,25 @@ i40evf_hw_rss_hash_set(struct i40e_vf *vf, struct rte_eth_rss_conf *rss_conf)
 	if (ret)
 		return ret;
 
+	if (vf->flags & I40E_FLAG_RSS_AQ_CAPABLE) {
+		uint8_t *lut;
+		uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
+		lut = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
+		if (!lut) {
+			PMD_DRV_LOG(ERR, "No memory can be allocated");
+			return -ENOMEM;
+		}
+
+		for (uint32_t i = 0; i < rss_lut_size; i++)
+			lut[i] = i % vf->num_queue_pairs;
+
+		ret = i40evf_set_rss_lut(&vf->vsi, lut,
+					 rss_lut_size);
+		rte_free(lut);
+		if (ret)
+			return ret;
+	}
+
 	hena = i40e_config_hena(vf->adapter, rss_conf->rss_hf);
 	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
 	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
@@ -2607,13 +2626,15 @@ i40evf_config_rss(struct i40e_vf *vf)
 	}
 
 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
-	/* Fill out the look up table */
-	for (i = 0, j = 0; i < nb_q; i++, j++) {
-		if (j >= num)
-			j = 0;
-		lut = (lut << 8) | j;
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
+		/* Fill out the look up table */
+		for (i = 0, j = 0; i < nb_q; i++, j++) {
+			if (j >= num)
+				j = 0;
+			lut = (lut << 8) | j;
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+		}
 	}
 
 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4


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

* [dpdk-stable] [v2] net/i40e: fix vf runtime queues rss config
  2019-08-07  0:09 [dpdk-stable] net/i40e: fix vf runtime queues rss config Xiao Zhang
@ 2019-08-08 16:41 ` Xiao Zhang
  2019-08-09  2:44   ` Xing, Beilei
  2019-08-12 10:29   ` [dpdk-stable] [v3] " Xiao Zhang
  0 siblings, 2 replies; 16+ messages in thread
From: Xiao Zhang @ 2019-08-08 16:41 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, qi.z.zhang, Xiao Zhang, stable

I40evf queue can not work properly with kernel pf driver. Eg. when
configure 8 queues pair, only 4 queues can receive packets, and half
packets will be lost if using 2 queues pair.
This issue is caused by misconfiguration of look up table, use aq command
to setup the lut to make it work properly.

Fixes: cea7a51c1750 ("i40evf: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v2 change for loop format to avoid build patch issue.
---
 drivers/net/i40e/i40e_ethdev_vf.c | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb98..2d3cf3e 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2574,6 +2574,26 @@ i40evf_hw_rss_hash_set(struct i40e_vf *vf, struct rte_eth_rss_conf *rss_conf)
 	if (ret)
 		return ret;
 
+	if (vf->flags & I40E_FLAG_RSS_AQ_CAPABLE) {
+		uint8_t *lut;
+		uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
+		uint32_t i;
+		lut = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
+		if (!lut) {
+			PMD_DRV_LOG(ERR, "No memory can be allocated");
+			return -ENOMEM;
+		}
+
+		for (i = 0; i < rss_lut_size; i++)
+			lut[i] = i % vf->num_queue_pairs;
+
+		ret = i40evf_set_rss_lut(&vf->vsi, lut,
+					 rss_lut_size);
+		rte_free(lut);
+		if (ret)
+			return ret;
+	}
+
 	hena = i40e_config_hena(vf->adapter, rss_conf->rss_hf);
 	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
 	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
@@ -2607,13 +2627,15 @@ i40evf_config_rss(struct i40e_vf *vf)
 	}
 
 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
-	/* Fill out the look up table */
-	for (i = 0, j = 0; i < nb_q; i++, j++) {
-		if (j >= num)
-			j = 0;
-		lut = (lut << 8) | j;
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
+		/* Fill out the look up table */
+		for (i = 0, j = 0; i < nb_q; i++, j++) {
+			if (j >= num)
+				j = 0;
+			lut = (lut << 8) | j;
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+		}
 	}
 
 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4


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

* Re: [dpdk-stable] [v2] net/i40e: fix vf runtime queues rss config
  2019-08-08 16:41 ` [dpdk-stable] [v2] " Xiao Zhang
@ 2019-08-09  2:44   ` Xing, Beilei
  2019-08-09  3:25     ` Zhang, Xiao
  2019-08-12 10:29   ` [dpdk-stable] [v3] " Xiao Zhang
  1 sibling, 1 reply; 16+ messages in thread
From: Xing, Beilei @ 2019-08-09  2:44 UTC (permalink / raw)
  To: Zhang, Xiao, dev; +Cc: Zhang, Qi Z, stable


> -----Original Message-----
> From: Zhang, Xiao
> Sent: Friday, August 9, 2019 12:41 AM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> Zhang, Xiao <xiao.zhang@intel.com>; stable@dpdk.org
> Subject: [v2] net/i40e: fix vf runtime queues rss config
> 
> I40evf queue can not work properly with kernel pf driver. Eg. when configure
> 8 queues pair, only 4 queues can receive packets, and half packets will be lost
> if using 2 queues pair.
> This issue is caused by misconfiguration of look up table, use aq command to
> setup the lut to make it work properly.
> 
> Fixes: cea7a51c1750 ("i40evf: support RSS")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---
> v2 change for loop format to avoid build patch issue.
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 36 +++++++++++++++++++++++++++++---
> ----
>  1 file changed, 29 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index 308fb98..2d3cf3e 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -2574,6 +2574,26 @@ i40evf_hw_rss_hash_set(struct i40e_vf *vf, struct
> rte_eth_rss_conf *rss_conf)
>  	if (ret)
>  		return ret;
> 
> +	if (vf->flags & I40E_FLAG_RSS_AQ_CAPABLE) {
> +		uint8_t *lut;
> +		uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) *
> 4;
> +		uint32_t i;
> +		lut = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
> +		if (!lut) {
> +			PMD_DRV_LOG(ERR, "No memory can be allocated");
> +			return -ENOMEM;
> +		}
> +
> +		for (i = 0; i < rss_lut_size; i++)
> +			lut[i] = i % vf->num_queue_pairs;
> +
> +		ret = i40evf_set_rss_lut(&vf->vsi, lut,
> +					 rss_lut_size);
> +		rte_free(lut);
> +		if (ret)
> +			return ret;
> +	}
> +

Why not moving the LUT configuration to the following i40evf_config_rss function?

>  	hena = i40e_config_hena(vf->adapter, rss_conf->rss_hf);
>  	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
>  	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
> @@ -2607,13 +2627,15 @@ i40evf_config_rss(struct i40e_vf *vf)
>  	}
> 
>  	num = RTE_MIN(vf->dev_data->nb_rx_queues,
> I40E_MAX_QP_NUM_PER_VF);
> -	/* Fill out the look up table */
> -	for (i = 0, j = 0; i < nb_q; i++, j++) {
> -		if (j >= num)
> -			j = 0;
> -		lut = (lut << 8) | j;
> -		if ((i & 3) == 3)
> -			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
> +	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
> +		/* Fill out the look up table */
> +		for (i = 0, j = 0; i < nb_q; i++, j++) {
> +			if (j >= num)
> +				j = 0;
> +			lut = (lut << 8) | j;
> +			if ((i & 3) == 3)
> +				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >>
> 2), lut);
> +		}
>  	}
> 
>  	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> --
> 2.7.4


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

* Re: [dpdk-stable] [v2] net/i40e: fix vf runtime queues rss config
  2019-08-09  2:44   ` Xing, Beilei
@ 2019-08-09  3:25     ` Zhang, Xiao
  0 siblings, 0 replies; 16+ messages in thread
From: Zhang, Xiao @ 2019-08-09  3:25 UTC (permalink / raw)
  To: Xing, Beilei, dev; +Cc: Zhang, Qi Z, stable



> -----Original Message-----
> From: Xing, Beilei
> Sent: Friday, August 9, 2019 10:44 AM
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; stable@dpdk.org
> Subject: RE: [v2] net/i40e: fix vf runtime queues rss config
> 
> 
> > -----Original Message-----
> > From: Zhang, Xiao
> > Sent: Friday, August 9, 2019 12:41 AM
> > To: dev@dpdk.org
> > Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Zhang, Xiao <xiao.zhang@intel.com>;
> > stable@dpdk.org
> > Subject: [v2] net/i40e: fix vf runtime queues rss config
> >
> > I40evf queue can not work properly with kernel pf driver. Eg. when
> > configure
> > 8 queues pair, only 4 queues can receive packets, and half packets
> > will be lost if using 2 queues pair.
> > This issue is caused by misconfiguration of look up table, use aq
> > command to setup the lut to make it work properly.
> >
> > Fixes: cea7a51c1750 ("i40evf: support RSS")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> > ---
> > v2 change for loop format to avoid build patch issue.
> > ---
> >  drivers/net/i40e/i40e_ethdev_vf.c | 36
> > +++++++++++++++++++++++++++++---
> > ----
> >  1 file changed, 29 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> > b/drivers/net/i40e/i40e_ethdev_vf.c
> > index 308fb98..2d3cf3e 100644
> > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > @@ -2574,6 +2574,26 @@ i40evf_hw_rss_hash_set(struct i40e_vf *vf,
> > struct rte_eth_rss_conf *rss_conf)
> >  	if (ret)
> >  		return ret;
> >
> > +	if (vf->flags & I40E_FLAG_RSS_AQ_CAPABLE) {
> > +		uint8_t *lut;
> > +		uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) *
> > 4;
> > +		uint32_t i;
> > +		lut = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
> > +		if (!lut) {
> > +			PMD_DRV_LOG(ERR, "No memory can be allocated");
> > +			return -ENOMEM;
> > +		}
> > +
> > +		for (i = 0; i < rss_lut_size; i++)
> > +			lut[i] = i % vf->num_queue_pairs;
> > +
> > +		ret = i40evf_set_rss_lut(&vf->vsi, lut,
> > +					 rss_lut_size);
> > +		rte_free(lut);
> > +		if (ret)
> > +			return ret;
> > +	}
> > +
> 
> Why not moving the LUT configuration to the following i40evf_config_rss
> function?

Yes, it's better to move the above code to i40evf_config_rss since the lagecy 
LUT configuration is also there. It will be more clear.

Thanks,
Xiao
> 
> >  	hena = i40e_config_hena(vf->adapter, rss_conf->rss_hf);
> >  	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
> >  	i40e_write_rx_ctl(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
> @@
> > -2607,13 +2627,15 @@ i40evf_config_rss(struct i40e_vf *vf)
> >  	}
> >
> >  	num = RTE_MIN(vf->dev_data->nb_rx_queues,
> > I40E_MAX_QP_NUM_PER_VF);
> > -	/* Fill out the look up table */
> > -	for (i = 0, j = 0; i < nb_q; i++, j++) {
> > -		if (j >= num)
> > -			j = 0;
> > -		lut = (lut << 8) | j;
> > -		if ((i & 3) == 3)
> > -			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
> > +	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
> > +		/* Fill out the look up table */
> > +		for (i = 0, j = 0; i < nb_q; i++, j++) {
> > +			if (j >= num)
> > +				j = 0;
> > +			lut = (lut << 8) | j;
> > +			if ((i & 3) == 3)
> > +				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >>
> > 2), lut);
> > +		}
> >  	}
> >
> >  	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> > --
> > 2.7.4


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

* [dpdk-stable] [v3] net/i40e: fix vf runtime queues rss config
  2019-08-08 16:41 ` [dpdk-stable] [v2] " Xiao Zhang
  2019-08-09  2:44   ` Xing, Beilei
@ 2019-08-12 10:29   ` Xiao Zhang
  2019-08-12 17:43     ` [dpdk-stable] [v4] " Xiao Zhang
  1 sibling, 1 reply; 16+ messages in thread
From: Xiao Zhang @ 2019-08-12 10:29 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Xiao Zhang, stable

I40evf queue can not work properly with kernel pf driver. Eg. when
configure 8 queues pair, only 4 queues can receive packets, and half
packets will be lost if using 2 queues pair.
This issue is caused by misconfiguration of look up table, use aq command
to setup the lut to make it work properly.

Fixes: cea7a51c1750 ("i40evf: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v3 move LUT configuration in to i40evf_configure_rss
v2 change for loop format to avoid build patch issue
---
 drivers/net/i40e/i40e_ethdev_vf.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb98..ad685c6 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2608,12 +2608,32 @@ i40evf_config_rss(struct i40e_vf *vf)
 
 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
 	/* Fill out the look up table */
-	for (i = 0, j = 0; i < nb_q; i++, j++) {
-		if (j >= num)
-			j = 0;
-		lut = (lut << 8) | j;
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
+		for (i = 0, j = 0; i < nb_q; i++, j++) {
+			if (j >= num)
+				j = 0;
+			lut = (lut << 8) | j;
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+		}
+	} else {
+		uint8_t *lut;
+		uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
+		int ret;
+		lut = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
+		if (!lut) {
+			PMD_DRV_LOG(ERR, "No memory can be allocated");
+			return -ENOMEM;
+		}
+
+		for (i = 0; i < rss_lut_size; i++)
+			lut[i] = i % vf->num_queue_pairs;
+
+		ret = i40evf_set_rss_lut(&vf->vsi, lut,
+					 rss_lut_size);
+		rte_free(lut);
+		if (ret)
+			return ret;
 	}
 
 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4


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

* Re: [dpdk-stable] [dpdk-dev] [v4] net/i40e: fix vf runtime queues rss config
  2019-08-12 17:43     ` [dpdk-stable] [v4] " Xiao Zhang
@ 2019-08-12 12:07       ` Aaron Conole
  2019-08-13  1:43       ` [dpdk-stable] " Xing, Beilei
  2019-08-13 10:40       ` [dpdk-stable] [v5] " Xiao Zhang
  2 siblings, 0 replies; 16+ messages in thread
From: Aaron Conole @ 2019-08-12 12:07 UTC (permalink / raw)
  To: Xiao Zhang; +Cc: dev, beilei.xing, stable

Xiao Zhang <xiao.zhang@intel.com> writes:

> I40evf queue can not work properly with kernel pf driver. Eg. when
> configure 8 queues pair, only 4 queues can receive packets, and half
> packets will be lost if using 2 queues pair.
> This issue is caused by misconfiguration of look up table, use aq command
> to setup the lut to make it work properly.
>
> Fixes: cea7a51c1750 ("i40evf: support RSS")
> Cc: stable@dpdk.org
>
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---

I see a large number of failures:

https://travis-ci.com/ovsrobot/dpdk/builds/122763118

Can you check this?

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

* [dpdk-stable] [v4] net/i40e: fix vf runtime queues rss config
  2019-08-12 10:29   ` [dpdk-stable] [v3] " Xiao Zhang
@ 2019-08-12 17:43     ` Xiao Zhang
  2019-08-12 12:07       ` [dpdk-stable] [dpdk-dev] " Aaron Conole
                         ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Xiao Zhang @ 2019-08-12 17:43 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Xiao Zhang, stable

I40evf queue can not work properly with kernel pf driver. Eg. when
configure 8 queues pair, only 4 queues can receive packets, and half
packets will be lost if using 2 queues pair.
This issue is caused by misconfiguration of look up table, use aq command
to setup the lut to make it work properly.

Fixes: cea7a51c1750 ("i40evf: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v4 move local variable definition to the begin of the function
v3 move LUT configuration in to i40evf_configure_rss
v2 change for loop format to avoid build patch issue
---
 drivers/net/i40e/i40e_ethdev_vf.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb98..8c34afb 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
 	struct rte_eth_rss_conf rss_conf;
 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
 	uint16_t num;
+	uint8_t *lut;
+	int ret;
 
 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
 		i40evf_disable_rss(vf);
@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
 
 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
 	/* Fill out the look up table */
-	for (i = 0, j = 0; i < nb_q; i++, j++) {
-		if (j >= num)
-			j = 0;
-		lut = (lut << 8) | j;
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
+		for (i = 0, j = 0; i < nb_q; i++, j++) {
+			if (j >= num)
+				j = 0;
+			lut = (lut << 8) | j;
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+		}
+	} else {
+		lut = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
+		if (!lut) {
+			PMD_DRV_LOG(ERR, "No memory can be allocated");
+			return -ENOMEM;
+		}
+
+		for (i = 0; i < rss_lut_size; i++)
+			lut[i] = i % vf->num_queue_pairs;
+
+		ret = i40evf_set_rss_lut(&vf->vsi, lut,
+					 rss_lut_size);
+		rte_free(lut);
+		if (ret)
+			return ret;
 	}
 
 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4


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

* Re: [dpdk-stable] [v4] net/i40e: fix vf runtime queues rss config
  2019-08-12 17:43     ` [dpdk-stable] [v4] " Xiao Zhang
  2019-08-12 12:07       ` [dpdk-stable] [dpdk-dev] " Aaron Conole
@ 2019-08-13  1:43       ` Xing, Beilei
  2019-08-13 10:40       ` [dpdk-stable] [v5] " Xiao Zhang
  2 siblings, 0 replies; 16+ messages in thread
From: Xing, Beilei @ 2019-08-13  1:43 UTC (permalink / raw)
  To: Zhang, Xiao, dev; +Cc: stable

Hi,

> -----Original Message-----
> From: Zhang, Xiao
> Sent: Tuesday, August 13, 2019 1:44 AM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Xiao <xiao.zhang@intel.com>;
> stable@dpdk.org
> Subject: [v4] net/i40e: fix vf runtime queues rss config
> 
> I40evf queue can not work properly with kernel pf driver. Eg. when configure
> 8 queues pair, only 4 queues can receive packets, and half packets will be lost
> if using 2 queues pair.
> This issue is caused by misconfiguration of look up table, use aq command to
> setup the lut to make it work properly.
> 
> Fixes: cea7a51c1750 ("i40evf: support RSS")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---
> v4 move local variable definition to the begin of the function
> v3 move LUT configuration in to i40evf_configure_rss
> v2 change for loop format to avoid build patch issue
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 32 ++++++++++++++++++++++++++------
>  1 file changed, 26 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index 308fb98..8c34afb 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
>  	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
>  	struct rte_eth_rss_conf rss_conf;
>  	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
> +	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
>  	uint16_t num;
> +	uint8_t *lut;

The pointer *lut is conflict with above 'uint32_t lut = 0'.

> +	int ret;
> 
>  	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
>  		i40evf_disable_rss(vf);
> @@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> 
>  	num = RTE_MIN(vf->dev_data->nb_rx_queues,
> I40E_MAX_QP_NUM_PER_VF);
>  	/* Fill out the look up table */
> -	for (i = 0, j = 0; i < nb_q; i++, j++) {
> -		if (j >= num)
> -			j = 0;
> -		lut = (lut << 8) | j;
> -		if ((i & 3) == 3)
> -			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
> +	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
> +		for (i = 0, j = 0; i < nb_q; i++, j++) {
> +			if (j >= num)
> +				j = 0;
> +			lut = (lut << 8) | j;
> +			if ((i & 3) == 3)
> +				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >>
> 2), lut);
> +		}
> +	} else {
> +		lut = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
> +		if (!lut) {
> +			PMD_DRV_LOG(ERR, "No memory can be allocated");
> +			return -ENOMEM;
> +		}
> +
> +		for (i = 0; i < rss_lut_size; i++)
> +			lut[i] = i % vf->num_queue_pairs;
> +
> +		ret = i40evf_set_rss_lut(&vf->vsi, lut,
> +					 rss_lut_size);
> +		rte_free(lut);
> +		if (ret)
> +			return ret;
>  	}
> 
>  	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> --
> 2.7.4


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

* Re: [dpdk-stable] [v5] net/i40e: fix vf runtime queues rss config
  2019-08-13 10:40       ` [dpdk-stable] [v5] " Xiao Zhang
@ 2019-08-13  2:21         ` Xing, Beilei
  2019-08-13  6:28         ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong
  2019-08-13 22:17         ` [dpdk-stable] [v6] " Xiao Zhang
  2 siblings, 0 replies; 16+ messages in thread
From: Xing, Beilei @ 2019-08-13  2:21 UTC (permalink / raw)
  To: Zhang, Xiao, dev; +Cc: stable



> -----Original Message-----
> From: Zhang, Xiao
> Sent: Tuesday, August 13, 2019 6:41 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Xiao <xiao.zhang@intel.com>;
> stable@dpdk.org
> Subject: [v5] net/i40e: fix vf runtime queues rss config
> 
> I40evf queue can not work properly with kernel pf driver. Eg. when configure
> 8 queues pair, only 4 queues can receive packets, and half packets will be lost
> if using 2 queues pair.
> This issue is caused by misconfiguration of look up table, use aq command to
> setup the lut to make it work properly.
> 
> Fixes: cea7a51c1750 ("i40evf: support RSS")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>

Acked-by: Beilei Xing <beilei.xing@intel.com>

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

* Re: [dpdk-stable] [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
  2019-08-13 10:40       ` [dpdk-stable] [v5] " Xiao Zhang
  2019-08-13  2:21         ` Xing, Beilei
@ 2019-08-13  6:28         ` Ye Xiaolong
  2019-08-13  7:24           ` Zhang, Xiao
  2019-08-13 22:17         ` [dpdk-stable] [v6] " Xiao Zhang
  2 siblings, 1 reply; 16+ messages in thread
From: Ye Xiaolong @ 2019-08-13  6:28 UTC (permalink / raw)
  To: Xiao Zhang; +Cc: dev, beilei.xing, stable

Hi, Xiao

On 08/13, Xiao Zhang wrote:
>I40evf queue can not work properly with kernel pf driver. Eg. when
>configure 8 queues pair, only 4 queues can receive packets, and half
>packets will be lost if using 2 queues pair.
>This issue is caused by misconfiguration of look up table, use aq
>command to setup the lut to make it work properly.

So the original code of lookup table configuration is problematic? Can we just
remove them?

Thanks,
Xiaolong

>
>Fixes: cea7a51c1750 ("i40evf: support RSS")
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>---
>v5 fix compile issue
>v4 move local variable definition to the begin of the function
>v3 move LUT configuration in to i40evf_configure_rss
>v2 change for loop format to avoid build patch issue
>---
> drivers/net/i40e/i40e_ethdev_vf.c | 32 ++++++++++++++++++++++++++------
> 1 file changed, 26 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
>index 308fb98..c77b30c 100644
>--- a/drivers/net/i40e/i40e_ethdev_vf.c
>+++ b/drivers/net/i40e/i40e_ethdev_vf.c
>@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
> 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
> 	struct rte_eth_rss_conf rss_conf;
> 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
>+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
> 	uint16_t num;
>+	uint8_t *lut_info;
>+	int ret;
> 
> 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> 		i40evf_disable_rss(vf);
>@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> 
> 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
> 	/* Fill out the look up table */
>-	for (i = 0, j = 0; i < nb_q; i++, j++) {
>-		if (j >= num)
>-			j = 0;
>-		lut = (lut << 8) | j;
>-		if ((i & 3) == 3)
>-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
>+		for (i = 0, j = 0; i < nb_q; i++, j++) {
>+			if (j >= num)
>+				j = 0;
>+			lut = (lut << 8) | j;
>+			if ((i & 3) == 3)
>+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>+		}
>+	} else {
>+		lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
>+		if (!lut_info) {
>+			PMD_DRV_LOG(ERR, "No memory can be allocated");
>+			return -ENOMEM;
>+		}
>+
>+		for (i = 0; i < rss_lut_size; i++)
>+			lut_info[i] = i % vf->num_queue_pairs;
>+
>+		ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
>+					 rss_lut_size);
>+		rte_free(lut_info);
>+		if (ret)
>+			return ret;
> 	}
> 
> 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
>-- 
>2.7.4
>

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

* Re: [dpdk-stable] [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
  2019-08-13  6:28         ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong
@ 2019-08-13  7:24           ` Zhang, Xiao
  2019-08-13  7:37             ` Ye Xiaolong
  0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Xiao @ 2019-08-13  7:24 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: dev, Xing, Beilei, stable



> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Tuesday, August 13, 2019 2:28 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
> 
> Hi, Xiao
> 
> On 08/13, Xiao Zhang wrote:
> >I40evf queue can not work properly with kernel pf driver. Eg. when
> >configure 8 queues pair, only 4 queues can receive packets, and half
> >packets will be lost if using 2 queues pair.
> >This issue is caused by misconfiguration of look up table, use aq
> >command to setup the lut to make it work properly.
> 
> So the original code of lookup table configuration is problematic? Can we just
> remove them?

The original code does not work with device X722 VF. For other devices using i40evf, the original code works.
The commit message may missed this information.
And the new code only workable for devices capable with AQ command, so we can not remove the original code.

> 
> Thanks,
> Xiaolong
> 
> >
> >Fixes: cea7a51c1750 ("i40evf: support RSS")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> >---
> >v5 fix compile issue
> >v4 move local variable definition to the begin of the function
> >v3 move LUT configuration in to i40evf_configure_rss
> >v2 change for loop format to avoid build patch issue
> >---
> > drivers/net/i40e/i40e_ethdev_vf.c | 32
> >++++++++++++++++++++++++++------
> > 1 file changed, 26 insertions(+), 6 deletions(-)
> >
> >diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> >b/drivers/net/i40e/i40e_ethdev_vf.c
> >index 308fb98..c77b30c 100644
> >--- a/drivers/net/i40e/i40e_ethdev_vf.c
> >+++ b/drivers/net/i40e/i40e_ethdev_vf.c
> >@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
> > 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
> > 	struct rte_eth_rss_conf rss_conf;
> > 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
> >+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
> > 	uint16_t num;
> >+	uint8_t *lut_info;
> >+	int ret;
> >
> > 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> > 		i40evf_disable_rss(vf);
> >@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> >
> > 	num = RTE_MIN(vf->dev_data->nb_rx_queues,
> I40E_MAX_QP_NUM_PER_VF);
> > 	/* Fill out the look up table */
> >-	for (i = 0, j = 0; i < nb_q; i++, j++) {
> >-		if (j >= num)
> >-			j = 0;
> >-		lut = (lut << 8) | j;
> >-		if ((i & 3) == 3)
> >-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
> >+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
> >+		for (i = 0, j = 0; i < nb_q; i++, j++) {
> >+			if (j >= num)
> >+				j = 0;
> >+			lut = (lut << 8) | j;
> >+			if ((i & 3) == 3)
> >+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2),
> lut);
> >+		}
> >+	} else {
> >+		lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
> >+		if (!lut_info) {
> >+			PMD_DRV_LOG(ERR, "No memory can be allocated");
> >+			return -ENOMEM;
> >+		}
> >+
> >+		for (i = 0; i < rss_lut_size; i++)
> >+			lut_info[i] = i % vf->num_queue_pairs;
> >+
> >+		ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
> >+					 rss_lut_size);
> >+		rte_free(lut_info);
> >+		if (ret)
> >+			return ret;
> > 	}
> >
> > 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> >--
> >2.7.4
> >

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

* Re: [dpdk-stable] [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
  2019-08-13  7:24           ` Zhang, Xiao
@ 2019-08-13  7:37             ` Ye Xiaolong
  2019-08-13  7:59               ` Zhang, Xiao
  0 siblings, 1 reply; 16+ messages in thread
From: Ye Xiaolong @ 2019-08-13  7:37 UTC (permalink / raw)
  To: Zhang, Xiao; +Cc: dev, Xing, Beilei, stable

On 08/13, Zhang, Xiao wrote:
>
>
>> -----Original Message-----
>> From: Ye, Xiaolong
>> Sent: Tuesday, August 13, 2019 2:28 PM
>> To: Zhang, Xiao <xiao.zhang@intel.com>
>> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
>> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
>> 
>> Hi, Xiao
>> 
>> On 08/13, Xiao Zhang wrote:
>> >I40evf queue can not work properly with kernel pf driver. Eg. when
>> >configure 8 queues pair, only 4 queues can receive packets, and half
>> >packets will be lost if using 2 queues pair.
>> >This issue is caused by misconfiguration of look up table, use aq
>> >command to setup the lut to make it work properly.
>> 
>> So the original code of lookup table configuration is problematic? Can we just
>> remove them?
>
>The original code does not work with device X722 VF. For other devices using i40evf, the original code works.
>The commit message may missed this information.
>And the new code only workable for devices capable with AQ command, so we can not remove the original code.

Ok, can you add these info in your commit message and send a new version?

Thanks,
Xiaolong

>
>> 
>> Thanks,
>> Xiaolong
>> 
>> >
>> >Fixes: cea7a51c1750 ("i40evf: support RSS")
>> >Cc: stable@dpdk.org
>> >
>> >Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>> >---
>> >v5 fix compile issue
>> >v4 move local variable definition to the begin of the function
>> >v3 move LUT configuration in to i40evf_configure_rss
>> >v2 change for loop format to avoid build patch issue
>> >---
>> > drivers/net/i40e/i40e_ethdev_vf.c | 32
>> >++++++++++++++++++++++++++------
>> > 1 file changed, 26 insertions(+), 6 deletions(-)
>> >
>> >diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
>> >b/drivers/net/i40e/i40e_ethdev_vf.c
>> >index 308fb98..c77b30c 100644
>> >--- a/drivers/net/i40e/i40e_ethdev_vf.c
>> >+++ b/drivers/net/i40e/i40e_ethdev_vf.c
>> >@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
>> > 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
>> > 	struct rte_eth_rss_conf rss_conf;
>> > 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
>> >+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
>> > 	uint16_t num;
>> >+	uint8_t *lut_info;
>> >+	int ret;
>> >
>> > 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
>> > 		i40evf_disable_rss(vf);
>> >@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
>> >
>> > 	num = RTE_MIN(vf->dev_data->nb_rx_queues,
>> I40E_MAX_QP_NUM_PER_VF);
>> > 	/* Fill out the look up table */
>> >-	for (i = 0, j = 0; i < nb_q; i++, j++) {
>> >-		if (j >= num)
>> >-			j = 0;
>> >-		lut = (lut << 8) | j;
>> >-		if ((i & 3) == 3)
>> >-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>> >+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
>> >+		for (i = 0, j = 0; i < nb_q; i++, j++) {
>> >+			if (j >= num)
>> >+				j = 0;
>> >+			lut = (lut << 8) | j;
>> >+			if ((i & 3) == 3)
>> >+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2),
>> lut);
>> >+		}
>> >+	} else {
>> >+		lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
>> >+		if (!lut_info) {
>> >+			PMD_DRV_LOG(ERR, "No memory can be allocated");
>> >+			return -ENOMEM;
>> >+		}
>> >+
>> >+		for (i = 0; i < rss_lut_size; i++)
>> >+			lut_info[i] = i % vf->num_queue_pairs;
>> >+
>> >+		ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
>> >+					 rss_lut_size);
>> >+		rte_free(lut_info);
>> >+		if (ret)
>> >+			return ret;
>> > 	}
>> >
>> > 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
>> >--
>> >2.7.4
>> >

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

* Re: [dpdk-stable] [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
  2019-08-13  7:37             ` Ye Xiaolong
@ 2019-08-13  7:59               ` Zhang, Xiao
  0 siblings, 0 replies; 16+ messages in thread
From: Zhang, Xiao @ 2019-08-13  7:59 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: dev, Xing, Beilei, stable



> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Tuesday, August 13, 2019 3:37 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
> 
> On 08/13, Zhang, Xiao wrote:
> >
> >
> >> -----Original Message-----
> >> From: Ye, Xiaolong
> >> Sent: Tuesday, August 13, 2019 2:28 PM
> >> To: Zhang, Xiao <xiao.zhang@intel.com>
> >> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>;
> >> stable@dpdk.org
> >> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss
> >> config
> >>
> >> Hi, Xiao
> >>
> >> On 08/13, Xiao Zhang wrote:
> >> >I40evf queue can not work properly with kernel pf driver. Eg. when
> >> >configure 8 queues pair, only 4 queues can receive packets, and half
> >> >packets will be lost if using 2 queues pair.
> >> >This issue is caused by misconfiguration of look up table, use aq
> >> >command to setup the lut to make it work properly.
> >>
> >> So the original code of lookup table configuration is problematic?
> >> Can we just remove them?
> >
> >The original code does not work with device X722 VF. For other devices using
> i40evf, the original code works.
> >The commit message may missed this information.
> >And the new code only workable for devices capable with AQ command, so we
> can not remove the original code.
> 
> Ok, can you add these info in your commit message and send a new version?
> 

Yes, it's ok.

> Thanks,
> Xiaolong
> 
> >
> >>
> >> Thanks,
> >> Xiaolong
> >>
> >> >
> >> >Fixes: cea7a51c1750 ("i40evf: support RSS")
> >> >Cc: stable@dpdk.org
> >> >
> >> >Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> >> >---
> >> >v5 fix compile issue
> >> >v4 move local variable definition to the begin of the function
> >> >v3 move LUT configuration in to i40evf_configure_rss
> >> >v2 change for loop format to avoid build patch issue
> >> >---
> >> > drivers/net/i40e/i40e_ethdev_vf.c | 32
> >> >++++++++++++++++++++++++++------
> >> > 1 file changed, 26 insertions(+), 6 deletions(-)
> >> >
> >> >diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> >> >b/drivers/net/i40e/i40e_ethdev_vf.c
> >> >index 308fb98..c77b30c 100644
> >> >--- a/drivers/net/i40e/i40e_ethdev_vf.c
> >> >+++ b/drivers/net/i40e/i40e_ethdev_vf.c
> >> >@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
> >> > 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
> >> > 	struct rte_eth_rss_conf rss_conf;
> >> > 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
> >> >+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
> >> > 	uint16_t num;
> >> >+	uint8_t *lut_info;
> >> >+	int ret;
> >> >
> >> > 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> >> > 		i40evf_disable_rss(vf);
> >> >@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> >> >
> >> > 	num = RTE_MIN(vf->dev_data->nb_rx_queues,
> >> I40E_MAX_QP_NUM_PER_VF);
> >> > 	/* Fill out the look up table */
> >> >-	for (i = 0, j = 0; i < nb_q; i++, j++) {
> >> >-		if (j >= num)
> >> >-			j = 0;
> >> >-		lut = (lut << 8) | j;
> >> >-		if ((i & 3) == 3)
> >> >-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
> >> >+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
> >> >+		for (i = 0, j = 0; i < nb_q; i++, j++) {
> >> >+			if (j >= num)
> >> >+				j = 0;
> >> >+			lut = (lut << 8) | j;
> >> >+			if ((i & 3) == 3)
> >> >+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2),
> >> lut);
> >> >+		}
> >> >+	} else {
> >> >+		lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
> >> >+		if (!lut_info) {
> >> >+			PMD_DRV_LOG(ERR, "No memory can be allocated");
> >> >+			return -ENOMEM;
> >> >+		}
> >> >+
> >> >+		for (i = 0; i < rss_lut_size; i++)
> >> >+			lut_info[i] = i % vf->num_queue_pairs;
> >> >+
> >> >+		ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
> >> >+					 rss_lut_size);
> >> >+		rte_free(lut_info);
> >> >+		if (ret)
> >> >+			return ret;
> >> > 	}
> >> >
> >> > 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> >> >--
> >> >2.7.4
> >> >

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

* [dpdk-stable] [v5] net/i40e: fix vf runtime queues rss config
  2019-08-12 17:43     ` [dpdk-stable] [v4] " Xiao Zhang
  2019-08-12 12:07       ` [dpdk-stable] [dpdk-dev] " Aaron Conole
  2019-08-13  1:43       ` [dpdk-stable] " Xing, Beilei
@ 2019-08-13 10:40       ` Xiao Zhang
  2019-08-13  2:21         ` Xing, Beilei
                           ` (2 more replies)
  2 siblings, 3 replies; 16+ messages in thread
From: Xiao Zhang @ 2019-08-13 10:40 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Xiao Zhang, stable

I40evf queue can not work properly with kernel pf driver. Eg. when
configure 8 queues pair, only 4 queues can receive packets, and half
packets will be lost if using 2 queues pair.
This issue is caused by misconfiguration of look up table, use aq
command to setup the lut to make it work properly.

Fixes: cea7a51c1750 ("i40evf: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v5 fix compile issue
v4 move local variable definition to the begin of the function
v3 move LUT configuration in to i40evf_configure_rss
v2 change for loop format to avoid build patch issue
---
 drivers/net/i40e/i40e_ethdev_vf.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb98..c77b30c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
 	struct rte_eth_rss_conf rss_conf;
 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
 	uint16_t num;
+	uint8_t *lut_info;
+	int ret;
 
 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
 		i40evf_disable_rss(vf);
@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
 
 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
 	/* Fill out the look up table */
-	for (i = 0, j = 0; i < nb_q; i++, j++) {
-		if (j >= num)
-			j = 0;
-		lut = (lut << 8) | j;
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
+		for (i = 0, j = 0; i < nb_q; i++, j++) {
+			if (j >= num)
+				j = 0;
+			lut = (lut << 8) | j;
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+		}
+	} else {
+		lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
+		if (!lut_info) {
+			PMD_DRV_LOG(ERR, "No memory can be allocated");
+			return -ENOMEM;
+		}
+
+		for (i = 0; i < rss_lut_size; i++)
+			lut_info[i] = i % vf->num_queue_pairs;
+
+		ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
+					 rss_lut_size);
+		rte_free(lut_info);
+		if (ret)
+			return ret;
 	}
 
 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4


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

* Re: [dpdk-stable] [v6] net/i40e: fix vf runtime queues rss config
  2019-08-13 22:17         ` [dpdk-stable] [v6] " Xiao Zhang
@ 2019-08-13 14:55           ` Ye Xiaolong
  0 siblings, 0 replies; 16+ messages in thread
From: Ye Xiaolong @ 2019-08-13 14:55 UTC (permalink / raw)
  To: Xiao Zhang; +Cc: dev, stable

On 08/14, Xiao Zhang wrote:
>I40evf queue can not work properly with kernel pf driver for X722 vf. 
>Eg. when configure 8 queues pair, only 4 queues can receive packets, 
>and half packets will be lost if using 2 queues pair.
>This issue is caused by misconfiguration of look up table, the original
>code of LUT configuration did not work for X722 vf, use aq command to 
>setup the LUT to make it work properly.
>
>Fixes: cea7a51c1750 ("i40evf: support RSS")
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>---
>v6 update commit message
>v5 fix compile issue
>v4 move local variable definition to the begin of the function
>v3 move LUT configuration in to i40evf_configure_rss
>v2 change for loop format to avoid build patch issue
>---
> drivers/net/i40e/i40e_ethdev_vf.c | 32 ++++++++++++++++++++++++++------
> 1 file changed, 26 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
>index 308fb98..c77b30c 100644
>--- a/drivers/net/i40e/i40e_ethdev_vf.c
>+++ b/drivers/net/i40e/i40e_ethdev_vf.c
>@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
> 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
> 	struct rte_eth_rss_conf rss_conf;
> 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
>+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
> 	uint16_t num;
>+	uint8_t *lut_info;
>+	int ret;
> 
> 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> 		i40evf_disable_rss(vf);
>@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> 
> 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
> 	/* Fill out the look up table */
>-	for (i = 0, j = 0; i < nb_q; i++, j++) {
>-		if (j >= num)
>-			j = 0;
>-		lut = (lut << 8) | j;
>-		if ((i & 3) == 3)
>-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
>+		for (i = 0, j = 0; i < nb_q; i++, j++) {
>+			if (j >= num)
>+				j = 0;
>+			lut = (lut << 8) | j;
>+			if ((i & 3) == 3)
>+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>+		}
>+	} else {
>+		lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
>+		if (!lut_info) {
>+			PMD_DRV_LOG(ERR, "No memory can be allocated");
>+			return -ENOMEM;
>+		}
>+
>+		for (i = 0; i < rss_lut_size; i++)
>+			lut_info[i] = i % vf->num_queue_pairs;
>+
>+		ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
>+					 rss_lut_size);
>+		rte_free(lut_info);
>+		if (ret)
>+			return ret;
> 	}
> 
> 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
>-- 
>2.7.4
>

Applied to dpdk-next-net-intel with Beilei's ack.

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

* [dpdk-stable] [v6] net/i40e: fix vf runtime queues rss config
  2019-08-13 10:40       ` [dpdk-stable] [v5] " Xiao Zhang
  2019-08-13  2:21         ` Xing, Beilei
  2019-08-13  6:28         ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong
@ 2019-08-13 22:17         ` Xiao Zhang
  2019-08-13 14:55           ` Ye Xiaolong
  2 siblings, 1 reply; 16+ messages in thread
From: Xiao Zhang @ 2019-08-13 22:17 UTC (permalink / raw)
  To: dev; +Cc: xiaolong.ye, Xiao Zhang, stable

I40evf queue can not work properly with kernel pf driver for X722 vf. 
Eg. when configure 8 queues pair, only 4 queues can receive packets, 
and half packets will be lost if using 2 queues pair.
This issue is caused by misconfiguration of look up table, the original
code of LUT configuration did not work for X722 vf, use aq command to 
setup the LUT to make it work properly.

Fixes: cea7a51c1750 ("i40evf: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v6 update commit message
v5 fix compile issue
v4 move local variable definition to the begin of the function
v3 move LUT configuration in to i40evf_configure_rss
v2 change for loop format to avoid build patch issue
---
 drivers/net/i40e/i40e_ethdev_vf.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb98..c77b30c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
 	struct rte_eth_rss_conf rss_conf;
 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+	uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
 	uint16_t num;
+	uint8_t *lut_info;
+	int ret;
 
 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
 		i40evf_disable_rss(vf);
@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
 
 	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
 	/* Fill out the look up table */
-	for (i = 0, j = 0; i < nb_q; i++, j++) {
-		if (j >= num)
-			j = 0;
-		lut = (lut << 8) | j;
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
+		for (i = 0, j = 0; i < nb_q; i++, j++) {
+			if (j >= num)
+				j = 0;
+			lut = (lut << 8) | j;
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+		}
+	} else {
+		lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
+		if (!lut_info) {
+			PMD_DRV_LOG(ERR, "No memory can be allocated");
+			return -ENOMEM;
+		}
+
+		for (i = 0; i < rss_lut_size; i++)
+			lut_info[i] = i % vf->num_queue_pairs;
+
+		ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
+					 rss_lut_size);
+		rte_free(lut_info);
+		if (ret)
+			return ret;
 	}
 
 	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4


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

end of thread, other threads:[~2019-08-13 14:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07  0:09 [dpdk-stable] net/i40e: fix vf runtime queues rss config Xiao Zhang
2019-08-08 16:41 ` [dpdk-stable] [v2] " Xiao Zhang
2019-08-09  2:44   ` Xing, Beilei
2019-08-09  3:25     ` Zhang, Xiao
2019-08-12 10:29   ` [dpdk-stable] [v3] " Xiao Zhang
2019-08-12 17:43     ` [dpdk-stable] [v4] " Xiao Zhang
2019-08-12 12:07       ` [dpdk-stable] [dpdk-dev] " Aaron Conole
2019-08-13  1:43       ` [dpdk-stable] " Xing, Beilei
2019-08-13 10:40       ` [dpdk-stable] [v5] " Xiao Zhang
2019-08-13  2:21         ` Xing, Beilei
2019-08-13  6:28         ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong
2019-08-13  7:24           ` Zhang, Xiao
2019-08-13  7:37             ` Ye Xiaolong
2019-08-13  7:59               ` Zhang, Xiao
2019-08-13 22:17         ` [dpdk-stable] [v6] " Xiao Zhang
2019-08-13 14:55           ` Ye Xiaolong

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).