DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: adjust the RSS table
@ 2018-11-23  1:35 Xiaoyun Li
  2018-12-03  5:29 ` Zhang, Qi Z
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Xiaoyun Li @ 2018-11-23  1:35 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, Xiaoyun Li

When starting the device, the RSS table is set. For 8 queues, the RSS hash
table would be like | 3,2,1,0,7,6,5,4 | 3,2,1,0,7,6,5,4 |... This patch
adjusts this table to set entries sequentially. Then for 8 queues, the
RSS table would be like | 0,1,2,3,4,5,6,7 | 0,1,2,3,4,5,6,7 |...

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 790ecc3..031eba0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -8468,6 +8468,7 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
 	struct rte_eth_rss_conf rss_conf;
+	uint32_t size = hw->func_caps.rss_table_size;
 	uint32_t i, lut = 0;
 	uint16_t j, num;
 
@@ -8489,13 +8490,17 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 		return -ENOTSUP;
 	}
 
-	for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
-		if (j == num)
-			j = 0;
+	for (i = size - 1, j = (size - 1) % num;; i--, j--) {
 		lut = (lut << 8) | (j & ((0x1 <<
-			hw->func_caps.rss_table_entry_width) - 1));
-		if ((i & 3) == 3)
+		      hw->func_caps.rss_table_entry_width) - 1));
+
+		if (j == 0)
+			j = num;
+
+		if ((i & 3) == 0)
 			I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
+		if (i == 0)
+			break;
 	}
 
 	rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] net/i40e: adjust the RSS table
  2018-11-23  1:35 [dpdk-dev] [PATCH] net/i40e: adjust the RSS table Xiaoyun Li
@ 2018-12-03  5:29 ` Zhang, Qi Z
  2018-12-03  6:58 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
  2018-12-03  8:26 ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
  2 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2018-12-03  5:29 UTC (permalink / raw)
  To: Li, Xiaoyun; +Cc: dev



> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Friday, November 23, 2018 9:36 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH] net/i40e: adjust the RSS table
> 
> When starting the device, the RSS table is set. For 8 queues, the RSS hash table
> would be like | 3,2,1,0,7,6,5,4 | 3,2,1,0,7,6,5,4 |... This patch adjusts this table
> to set entries sequentially. Then for 8 queues, the RSS table would be like |
> 0,1,2,3,4,5,6,7 | 0,1,2,3,4,5,6,7 |...

My understanding is this is a byte order issue.
Does below change will fix the same thing?

- I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
- I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), rte_bswap32(lut));


> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 790ecc3..031eba0 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -8468,6 +8468,7 @@ i40e_pf_config_rss(struct i40e_pf *pf)  {
>  	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
>  	struct rte_eth_rss_conf rss_conf;
> +	uint32_t size = hw->func_caps.rss_table_size;
>  	uint32_t i, lut = 0;
>  	uint16_t j, num;
> 
> @@ -8489,13 +8490,17 @@ i40e_pf_config_rss(struct i40e_pf *pf)
>  		return -ENOTSUP;
>  	}
> 
> -	for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
> -		if (j == num)
> -			j = 0;
> +	for (i = size - 1, j = (size - 1) % num;; i--, j--) {
>  		lut = (lut << 8) | (j & ((0x1 <<
> -			hw->func_caps.rss_table_entry_width) - 1));
> -		if ((i & 3) == 3)
> +		      hw->func_caps.rss_table_entry_width) - 1));
> +
> +		if (j == 0)
> +			j = num;
> +
> +		if ((i & 3) == 0)
>  			I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
> +		if (i == 0)
> +			break;
>  	}
> 
>  	rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> --
> 2.7.4

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

* [dpdk-dev] [PATCH v2] net/i40e: adjust the RSS table
  2018-11-23  1:35 [dpdk-dev] [PATCH] net/i40e: adjust the RSS table Xiaoyun Li
  2018-12-03  5:29 ` Zhang, Qi Z
@ 2018-12-03  6:58 ` Xiaoyun Li
  2018-12-03  8:30   ` Zhang, Qi Z
  2018-12-03  8:26 ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
  2 siblings, 1 reply; 6+ messages in thread
From: Xiaoyun Li @ 2018-12-03  6:58 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, Xiaoyun Li

When starting the device, the RSS table is initialized. So the RSS
update before device_start would be overwitten. This patch allows users
to update the RSS reta table before device_start and adjusts the order
to set entries sequentially.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
v2:
 * Adds support to update RSS table before device_start.
 * Simplify the codes with rte_bswap32.
 * Polish the commit log.
---
 drivers/net/i40e/i40e_ethdev.c | 21 ++++++++++++++-------
 drivers/net/i40e/i40e_ethdev.h |  3 +++
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 552a7a5..fea42b0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2444,6 +2444,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	pf->tm_conf.committed = false;
 
 	hw->adapter_stopped = 1;
+
+	pf->adapter->is_rss_reta_update = 0;
 }
 
 static void
@@ -4255,6 +4257,8 @@ i40e_dev_rss_reta_update(struct rte_eth_dev *dev,
 	}
 	ret = i40e_set_rss_lut(pf->main_vsi, lut, reta_size);
 
+	pf->adapter->is_rss_reta_update = 1;
+
 out:
 	rte_free(lut);
 
@@ -8492,13 +8496,16 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 		return -ENOTSUP;
 	}
 
-	for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
-		if (j == num)
-			j = 0;
-		lut = (lut << 8) | (j & ((0x1 <<
-			hw->func_caps.rss_table_entry_width) - 1));
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
+	if (pf->adapter->is_rss_reta_update == 0) {
+		for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
+			if (j == num)
+				j = 0;
+			lut = (lut << 8) | (j & ((0x1 <<
+				hw->func_caps.rss_table_entry_width) - 1));
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2),
+					       rte_bswap32(lut));
+		}
 	}
 
 	rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 11ecfc3..854aada 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -1081,6 +1081,9 @@ struct i40e_adapter {
 
 	/* For devargs */
 	uint8_t use_latest_vec;
+
+	/* For RSS reta table update */
+	uint8_t is_rss_reta_update;
 };
 
 /**
-- 
2.7.4

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

* [dpdk-dev] [PATCH v3] net/i40e: adjust the RSS table
  2018-11-23  1:35 [dpdk-dev] [PATCH] net/i40e: adjust the RSS table Xiaoyun Li
  2018-12-03  5:29 ` Zhang, Qi Z
  2018-12-03  6:58 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
@ 2018-12-03  8:26 ` Xiaoyun Li
  2018-12-03  9:25   ` Zhang, Qi Z
  2 siblings, 1 reply; 6+ messages in thread
From: Xiaoyun Li @ 2018-12-03  8:26 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, Xiaoyun Li

When starting the device, the RSS table is initialized. So the RSS
update before device_start would be overwritten. This patch allows users
to update the RSS reta table before device_start and adjusts the order
to set entries sequentially.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
v3:
 * Rename the variable and fix typo in commit log.
v2:
 * Add support to update RSS table before device_start.
 * Simplify the codes with rte_bswap32.
 * Polish the commit log.
---
 drivers/net/i40e/i40e_ethdev.c | 21 ++++++++++++++-------
 drivers/net/i40e/i40e_ethdev.h |  3 +++
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 552a7a5..65fd717 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2444,6 +2444,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	pf->tm_conf.committed = false;
 
 	hw->adapter_stopped = 1;
+
+	pf->adapter->rss_reta_updated = 0;
 }
 
 static void
@@ -4255,6 +4257,8 @@ i40e_dev_rss_reta_update(struct rte_eth_dev *dev,
 	}
 	ret = i40e_set_rss_lut(pf->main_vsi, lut, reta_size);
 
+	pf->adapter->rss_reta_updated = 1;
+
 out:
 	rte_free(lut);
 
@@ -8492,13 +8496,16 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 		return -ENOTSUP;
 	}
 
-	for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
-		if (j == num)
-			j = 0;
-		lut = (lut << 8) | (j & ((0x1 <<
-			hw->func_caps.rss_table_entry_width) - 1));
-		if ((i & 3) == 3)
-			I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
+	if (pf->adapter->rss_reta_updated == 0) {
+		for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
+			if (j == num)
+				j = 0;
+			lut = (lut << 8) | (j & ((0x1 <<
+				hw->func_caps.rss_table_entry_width) - 1));
+			if ((i & 3) == 3)
+				I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2),
+					       rte_bswap32(lut));
+		}
 	}
 
 	rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 11ecfc3..930eb9a 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -1081,6 +1081,9 @@ struct i40e_adapter {
 
 	/* For devargs */
 	uint8_t use_latest_vec;
+
+	/* For RSS reta table update */
+	uint8_t rss_reta_updated;
 };
 
 /**
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: adjust the RSS table
  2018-12-03  6:58 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
@ 2018-12-03  8:30   ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2018-12-03  8:30 UTC (permalink / raw)
  To: Li, Xiaoyun; +Cc: dev

minor captures inline

Otherwise
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Monday, December 3, 2018 2:59 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH v2] net/i40e: adjust the RSS table
> 
> When starting the device, the RSS table is initialized. So the RSS update before
> device_start would be overwitten. This patch allows users to update the RSS

s/ overwitten /overwritten

> reta table before device_start and adjusts the order to set entries sequentially.

> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>




> ---
> v2:
>  * Adds support to update RSS table before device_start.
>  * Simplify the codes with rte_bswap32.
>  * Polish the commit log.
> ---
>  drivers/net/i40e/i40e_ethdev.c | 21 ++++++++++++++-------
> drivers/net/i40e/i40e_ethdev.h |  3 +++
>  2 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 552a7a5..fea42b0 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -2444,6 +2444,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
>  	pf->tm_conf.committed = false;
> 
>  	hw->adapter_stopped = 1;


> +
> +	pf->adapter->is_rss_reta_update = 0;

How about rename to rss_reta_updated?

>  }
> 
>  static void
> @@ -4255,6 +4257,8 @@ i40e_dev_rss_reta_update(struct rte_eth_dev *dev,
>  	}
>  	ret = i40e_set_rss_lut(pf->main_vsi, lut, reta_size);
> 
> +	pf->adapter->is_rss_reta_update = 1;
> +
>  out:
>  	rte_free(lut);
> 
> @@ -8492,13 +8496,16 @@ i40e_pf_config_rss(struct i40e_pf *pf)
>  		return -ENOTSUP;
>  	}
> 
> -	for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
> -		if (j == num)
> -			j = 0;
> -		lut = (lut << 8) | (j & ((0x1 <<
> -			hw->func_caps.rss_table_entry_width) - 1));
> -		if ((i & 3) == 3)
> -			I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
> +	if (pf->adapter->is_rss_reta_update == 0) {
> +		for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
> +			if (j == num)
> +				j = 0;
> +			lut = (lut << 8) | (j & ((0x1 <<
> +				hw->func_caps.rss_table_entry_width) - 1));
> +			if ((i & 3) == 3)
> +				I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2),
> +					       rte_bswap32(lut));
> +		}
>  	}
> 
>  	rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
> index 11ecfc3..854aada 100644
> --- a/drivers/net/i40e/i40e_ethdev.h
> +++ b/drivers/net/i40e/i40e_ethdev.h
> @@ -1081,6 +1081,9 @@ struct i40e_adapter {
> 
>  	/* For devargs */
>  	uint8_t use_latest_vec;
> +
> +	/* For RSS reta table update */
> +	uint8_t is_rss_reta_update;


>  };
> 
>  /**
> --
> 2.7.4

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

* Re: [dpdk-dev] [PATCH v3] net/i40e: adjust the RSS table
  2018-12-03  8:26 ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
@ 2018-12-03  9:25   ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2018-12-03  9:25 UTC (permalink / raw)
  To: Li, Xiaoyun; +Cc: dev



> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Monday, December 3, 2018 4:27 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH v3] net/i40e: adjust the RSS table
> 
> When starting the device, the RSS table is initialized. So the RSS update before
> device_start would be overwritten. This patch allows users to update the RSS
> reta table before device_start and adjusts the order to set entries sequentially.
> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2018-12-03  9:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23  1:35 [dpdk-dev] [PATCH] net/i40e: adjust the RSS table Xiaoyun Li
2018-12-03  5:29 ` Zhang, Qi Z
2018-12-03  6:58 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
2018-12-03  8:30   ` Zhang, Qi Z
2018-12-03  8:26 ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
2018-12-03  9:25   ` Zhang, Qi Z

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