net/i40e: fix incorrect hash look up table
PATCH 1/1 net/i40e: fix incorrect hash look up table
The hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some queues in LUT will be invalid if rx queues is less than last time. When enable RSS by creating RSS rule, some packets will not be into the valid queues.
This patch fixes this issue by initializing the LUT when creating an RSS rule.
--- drivers/net/i40e/i40e_ethdev.c | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
drivers/net/i40e/i40e_ethdev.c +52 -0
@@ -13070,6 +13070,49 @@ i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,return 0 ; } +static int +i40e_rss_init_lut (struct i40e_pf *pf) +{ +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* +* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) + num =i40e_pf_calc_configured_queues_num (pf); +else + num = pf->dev_data->nb_rx_queues; + + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +PMD_INIT_LOG (INFO ,"Max of contiguous %u PF queues are configured" , + num); + +if (num ==0 ) { +PMD_INIT_LOG (ERR , +"No PF queues are configured to enable RSS for port %u" , + pf->dev_data->port_id); +return -ENOTSUP ; + } + +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)); + } + } + +return 0 ; +} +/* Write HENA register to enable hash */ static int i40e_rss_hash_set (struct i40e_pf *pf,struct i40e_rte_flow_rss_conf *rss_conf)
@@ -13318,12 +13361,21 @@ static int i40e_rss_enable_hash(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf) { + enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;struct i40e_rte_flow_rss_conf rss_conf;if (!(conf->conf.types & pf->adapter->flow_types_mask))return -ENOTSUP ; +/* +* If the RSS is disabled before this, the LUT is uninitialized. +* So it is necessary to initialize it here. +*/ +if (!(mq_mode Ð_MQ_RX_RSS_FLAG ) && !pf->rss_info.conf.queue_num) +if (i40e_rss_init_lut (pf)) +return -ENOTSUP ; +memset (&rss_conf,0 ,sizeof (rss_conf));rte_memcpy (&rss_conf, conf,sizeof (rss_conf));
Signature · 1 line
2.17.1
Regards,
Chen Bo
Quoted 106 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: July 15, 2020 14:35
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/i40e: fix incorrect hash look up tableThe hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some queues in LUT will be invalid if rx queues is less than last time. When enable RSS by creating RSS rule, some packets will not be into the valid queues.
This patch fixes this issue by initializing the LUT when creating an RSS rule.Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)drivers/net/i40e/i40e_ethdev.c +24
-0@@ -13070,6 +13070,49 @@ i40e_rss_conf_init(structi40e_rte_flow_rss_conf *out, return 0; } +static int +i40e_rss_init_lut (struct i40e_pf *pf) +{ +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* +* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) + num =i40e_pf_calc_configured_queues_num (pf); +else + num = pf->dev_data->nb_rx_queues; + + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +PMD_INIT_LOG (INFO ,"Max of contiguous %u PF queues are configured", + num); + +if (num ==0 ) { + PMD_INIT_LOG(ERR, + "No PF queues are configured to enable RSS forport %u",
drivers/net/i40e/i40e_ethdev.c +12
-0+ pf->dev_data->port_id); +return -ENOTSUP ; + } + +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),
drivers/net/i40e/i40e_ethdev.c +7
-0+ rte_bswap32(lut)); + } + } + +return 0 ; +} + /* Write HENA register to enable hash */ static int i40e_rss_hash_set(struct
i40e_pf*pf, structi40e_rte_flow_rss_conf*rss_conf) @@ -13318,12 +13361,21 @@ static int i40e_rss_enable_hash(structi40e_pf*pf,drivers/net/i40e/i40e_ethdev.c +7
-0struct i40e_rte_flow_rss_conf *conf) { + enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode; struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info; struct i40e_rte_flow_rss_conf rss_conf; if (!(conf->conf.types & pf->adapter->flow_types_mask)) return -ENOTSUP; + /* + * If the RSS is disabled before this, the LUT is uninitialized. + * So it is necessary to initialize it here. + */ + if (!(mq_mode & ETH_MQ_RX_RSS_FLAG) && !pf-Quoted 1 line
rss_info.conf.queue_num)
drivers/net/i40e/i40e_ethdev.c +3
-1+if (i40e_rss_init_lut (pf)) +return -ENOTSUP ; +memset (&rss_conf,0 ,sizeof (rss_conf));rte_memcpy (&rss_conf, conf,sizeof (rss_conf)); --2.17.1
hi, shougang
Quoted 17 lines · BoX C
Tested-by zhang,xi <[email protected]>Regards,
Chen BoQuoted 12 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: July 15, 2020 14:35
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/i40e: fix incorrect hash look up tableThe hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some queues in LUT will be invalid if rx queues is less than last time. When enable RSS by creating RSS rule, some packets will not be into the valid queues.
What does "So that some queues in LUT will be invalid if rx queues is less than last time" means, Could you explain more clear?
Quoted 20 lines
Quoted 20 lines
This patch fixes this issue by initializing the LUT when creating an RSS rule.
Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)drivers/net/i40e/i40e_ethdev.c +0
-0@@ -13070,6 +13070,49 @@ i40e_rss_conf_init(structi40e_rte_flow_rss_conf *out, return 0; }
Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, · line 13074
Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +2
-0+static int +i40e_rss_init_lut (struct i40e_pf *pf)
I saw that this function is almost the same functional as i40e_rss_config_queue_region, could you check if it could be reused and merged one.
Quoted 55 lines
Quoted 55 lines
drivers/net/i40e/i40e_ethdev.c +22
-0+{ +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* +* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) +num =i40e_pf_calc_configured_queues_num (pf); +else +num = pf->dev_data->nb_rx_queues; + +num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +PMD_INIT_LOG (INFO ,"Max of contiguous %u PF queues are configured", + num); + +if (num ==0 ) { +PMD_INIT_LOG(ERR, +"No PF queues are configured to enable RSS forport %u",
drivers/net/i40e/i40e_ethdev.c +12
-0+pf->dev_data->port_id); +return -ENOTSUP ; +} + +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),
drivers/net/i40e/i40e_ethdev.c +7
-0+ rte_bswap32(lut)); +} +} + +return 0 ; +} + /* Write HENA register to enable hash */ static int i40e_rss_hash_set(struct
i40e_pf*pf, structi40e_rte_flow_rss_conf*rss_conf) @@ -13318,12 +13361,21 @@ static int i40e_rss_enable_hash(structi40e_pf*pf,
structi40e_rte_flow_rss_conf*conf)
{drivers/net/i40e/i40e_ethdev.c +2
-0+enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;struct i40e_rte_flow_rss_conf rss_conf;
Quoted 7 lines
Quoted 7 lines
if (!(conf->conf.types &
pf->adapter->flow_types_mask)) return-ENOTSUP;+/*
+ * If the RSS is disabled before this, the LUT is uninitialized.
+ * So it is necessary to initialize it here.
+ */
Please don't use an empty /* line, use /* Comment....
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c static int · line 13377
Quoted 4 lines
+if (!(mq_mode &
ETH_MQ_RX_RSS_FLAG) && !pf-Quoted 1 line
rss_info.conf.queue_num)
drivers/net/i40e/i40e_ethdev.c +2
-0+if (i40e_rss_init_lut (pf)) +return -ENOTSUP ;
How can it know it is not support in function's caller, better to use variable to restore the calling return and return the variable.
Quoted 6 lines
Quoted 6 lines
+
memset(&rss_conf, 0, sizeof(rss_conf));
rte_memcpy(&rss_conf, conf, sizeof(rss_conf));--
2.17.1
PATCH v2 1/1 net/i40e: fix incorrect hash look up table
In reply to Shougang WangThe hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some invalid queue indexes may still in the LUT. When enable RSS by creating RSS rule, some packets will not be into the valid queues.
This patch fixes this issue by initializing the LUT when creating an RSS rule.
--- drivers/net/i40e/i40e_ethdev.c | 134 ++++++++++++++++----------------- 1 file changed, 63 insertions(+), 71 deletions(-)
drivers/net/i40e/i40e_ethdev.c +63 -71
@@ -13070,6 +13070,55 @@ i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,return 0 ; } +/* If conf is NULL, function will init hash LUT with default configration*/ +static int +i40e_rss_set_lut (struct i40e_pf *pf, +struct i40e_rte_flow_rss_conf *conf) +{ +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) + num =i40e_pf_calc_configured_queues_num (pf); +else + num = pf->dev_data->nb_rx_queues; + +if (conf ==NULL ) + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +else + num =RTE_MIN (num, conf->conf.queue_num); +PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , + num); + +if (num ==0 ) { +PMD_DRV_LOG (ERR , +"No PF queues are configured to enable RSS for port %u" , + pf->dev_data->port_id); +return -ENOTSUP ; + } + +/* Fill in redirection table */ +for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { +if (j == num) + j =0 ; +if (conf ==NULL ) + lut = (lut <<8 ) | (j & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +else + lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +if ((i &3 ) ==3 ) +I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); + } + +return 0 ; +} +/* Write HENA register to enable hash */ static int i40e_rss_hash_set (struct i40e_pf *pf,struct i40e_rte_flow_rss_conf *rss_conf)
@@ -13318,12 +13367,24 @@ static int i40e_rss_enable_hash(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf) { + enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;struct i40e_rte_flow_rss_conf rss_conf; +int ret;if (!(conf->conf.types & pf->adapter->flow_types_mask))return -ENOTSUP ; +/* If the RSS is disabled before this, the LUT is uninitialized. +* So it is necessary to initialize it here. +*/ +if (!(mq_mode Ð_MQ_RX_RSS_FLAG ) && !pf->rss_info.conf.queue_num && + !pf->adapter->rss_reta_updated) { + ret =i40e_rss_set_lut (pf,NULL ); +if (ret) +return ret; + } +memset (&rss_conf,0 ,sizeof (rss_conf));rte_memcpy (&rss_conf, conf,sizeof (rss_conf));
@@ -13362,39 +13423,7 @@ static int i40e_rss_config_queue_region(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf) { - struct i40e_hw *hw = I40E_PF_TO_HW(pf); -uint32_t lut =0 ; -uint16_t j, num; -uint32_t i; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured. -* It's necessary to calculate the actual PF queues that are configured. -*/ -if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) - num =i40e_pf_calc_configured_queues_num (pf); -else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, conf->conf.queue_num); -PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , - num); - -if (num ==0 ) { -PMD_DRV_LOG (ERR , -"No PF queues are configured to enable RSS for port %u" , - pf->dev_data->port_id); -return -ENOTSUP ; - } - -/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf, conf);i40e_rss_mark_invalid_rule (pf, conf);
@@ -13491,46 +13520,9 @@ i40e_rss_disable_hash(struct i40e_pf *pf,static int i40e_rss_clear_queue_region (struct i40e_pf *pf) { -struct i40e_hw *hw =I40E_PF_TO_HW (pf);struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info; -uint16_t queue[I40E_MAX_Q_PER_TC ]; -uint32_t num_rxq, i; -uint32_t lut =0 ; -uint16_t j, num; - - num_rxq =RTE_MIN (pf->dev_data->nb_rx_queues,I40E_MAX_Q_PER_TC ); -for (j =0 ; j < num_rxq; j++) - queue[j] = j; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured. -* It's necessary to calculate the actual PF queues that are configured. -*/ -if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) - num =i40e_pf_calc_configured_queues_num (pf); -else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, num_rxq); -PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , - num); - -if (num ==0 ) { -PMD_DRV_LOG (ERR , -"No PF queues are configured to enable RSS for port %u" , - pf->dev_data->port_id); -return -ENOTSUP ; - } - -/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf,NULL ); rss_info->conf.queue_num =0 ;memset (&rss_info->conf.queue,0 ,sizeof (uint16_t ));
Signature · 1 line
2.17.1
Regards,
Xie Wei
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Shougang Wang
Sent: Tuesday, July 21, 2020 1:49 PM
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect hash look up table
The hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some invalid queue indexes may still in the LUT. When enable RSS by creating RSS rule, some packets will not be into the valid queues. This patch fixes this issue by initializing the LUT when creating an RSS rule.
--- drivers/net/i40e/i40e_ethdev.c | 134 ++++++++++++++++----------------- 1 file changed, 63 insertions(+), 71 deletions(-)
drivers/net/i40e/i40e_ethdev.c +49 -0
@@ -13070,6 +13070,55 @@ i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,return 0 ; } +/* If conf is NULL, function will init hash LUT with default +configration*/ static int i40e_rss_set_lut (struct i40e_pf *pf, +struct i40e_rte_flow_rss_conf *conf) { +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) + num =i40e_pf_calc_configured_queues_num (pf); +else + num = pf->dev_data->nb_rx_queues; + +if (conf ==NULL ) + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +else + num =RTE_MIN (num, conf->conf.queue_num); +PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , + num); + +if (num ==0 ) { +PMD_DRV_LOG (ERR , +"No PF queues are configured to enable RSS for port %u" , + pf->dev_data->port_id); +return -ENOTSUP ; + } + +/* Fill in redirection table */ +for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { +if (j == num) + j =0 ; +if (conf ==NULL ) + lut = (lut <<8 ) | (j & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +else + lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +if ((i &3 ) ==3 ) +I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); + } + +return 0 ; +} + /* Write HENA register to enable hash */ static int i40e_rss_hash_set(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *rss_conf) @@ -13318,12 +13367,24 @@ static int i40e_rss_enable_hash(struct i40e_pf *pf,struct i40e_rte_flow_rss_conf *conf) { +enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;
struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info; struct i40e_rte_flow_rss_conf rss_conf;
+ int ret;
if (!(conf->conf.types & pf->adapter->flow_types_mask))
return -ENOTSUP;
+ /* If the RSS is disabled before this, the LUT is uninitialized.
+ * So it is necessary to initialize it here.
+ */
+ if (!(mq_mode & ETH_MQ_RX_RSS_FLAG) && !pf->rss_info.conf.queue_num &&
+ !pf->adapter->rss_reta_updated) {
+ ret = i40e_rss_set_lut(pf, NULL);
+ if (ret)
+ return ret;
+ }
+
memset(&rss_conf, 0, sizeof(rss_conf)); rte_memcpy(&rss_conf, conf, sizeof(rss_conf));
@@ -13362,39 +13423,7 @@ static int
i40e_rss_config_queue_region(struct i40e_pf *pf,
struct i40e_rte_flow_rss_conf *conf)
{
- struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- uint32_t lut = 0;
- uint16_t j, num;
- uint32_t i;
-
- /* If both VMDQ and RSS enabled, not all of PF queues are configured.
- * It's necessary to calculate the actual PF queues that are configured.
- */
- if (pf->dev_data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG)
- num = i40e_pf_calc_configured_queues_num(pf);
- else
- num = pf->dev_data->nb_rx_queues;
-
- num = RTE_MIN(num, conf->conf.queue_num);
- PMD_DRV_LOG(INFO, "Max of contiguous %u PF queues are configured",
- num);
-
- if (num == 0) {
- PMD_DRV_LOG(ERR,
- "No PF queues are configured to enable RSS for port %u",
- pf->dev_data->port_id);
- return -ENOTSUP;
- }
-
- /* Fill in redirection table */
- for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
- if (j == num)
- j = 0;
- lut = (lut << 8) | (conf->conf.queue[j] & ((0x1 <<
- hw->func_caps.rss_table_entry_width) - 1));
- if ((i & 3) == 3)
- I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
- }
+ i40e_rss_set_lut(pf, conf);
i40e_rss_mark_invalid_rule(pf, conf);
@@ -13491,46 +13520,9 @@ i40e_rss_disable_hash(struct i40e_pf *pf, static int i40e_rss_clear_queue_region(struct i40e_pf *pf) {
- struct i40e_hw *hw = I40E_PF_TO_HW(pf);
struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;
- uint16_t queue[I40E_MAX_Q_PER_TC];
- uint32_t num_rxq, i;
- uint32_t lut = 0;
- uint16_t j, num;
-
- num_rxq = RTE_MIN(pf->dev_data->nb_rx_queues, I40E_MAX_Q_PER_TC);
- for (j = 0; j < num_rxq; j++)
- queue[j] = j;
-
- /* If both VMDQ and RSS enabled, not all of PF queues are configured.
- * It's necessary to calculate the actual PF queues that are configured.
- */
- if (pf->dev_data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG)
- num = i40e_pf_calc_configured_queues_num(pf);
- else
- num = pf->dev_data->nb_rx_queues;
-
- num = RTE_MIN(num, num_rxq);
- PMD_DRV_LOG(INFO, "Max of contiguous %u PF queues are configured",
- num);
-
- if (num == 0) {
- PMD_DRV_LOG(ERR,
- "No PF queues are configured to enable RSS for port %u",
- pf->dev_data->port_id);
- return -ENOTSUP;
- }
-
- /* Fill in redirection table */
- for (i = 0, j = 0; i < hw->func_caps.rss_table_size; i++, j++) {
- if (j == num)
- j = 0;
- lut = (lut << 8) | (queue[j] & ((0x1 <<
- hw->func_caps.rss_table_entry_width) - 1));
- if ((i & 3) == 3)
- I40E_WRITE_REG(hw, I40E_PFQF_HLUT(i >> 2), lut);
- }
+ i40e_rss_set_lut(pf, NULL);
rss_info->conf.queue_num = 0; memset(&rss_info->conf.queue, 0, sizeof(uint16_t));
--
2.17.1
hi, shougang
Quoted 28 lines · WeiX
Tested-by Zhang, XiX <[email protected]>Regards,
Xie Wei-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Shougang Wang
Sent: Tuesday, July 21, 2020 1:49 PM
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect hash look up tableThe hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some invalid queue indexes may still in the LUT. When enable RSS by creating RSS rule, some packets will not be into the valid queues. This patch fixes this issue by initializing the LUT when creating an RSS rule.
Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 134 ++++++++++++++++----------------- 1 file changed, 63 insertions(+), 71 deletions(-)
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, · line 13074
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +2
-0@@ -13070,6 +13070,55 @@ i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,return 0 ; } +/* If conf is NULL, function will init hash LUT with default +configration*/
Please fix the checkpatch issue here.
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, · line 13075
Quoted 1 line
drivers/net/i40e/i40e_ethdev.c +0
-0static int i40e_rss_set_lut(struct i40e_pf *pf,
In order to eliminate any confuse with current i40e_set_rss_lut, please change the name, such as "i40e_rss_lut_init" or other better naming.
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ struct i40e_rte_flow_rss_conf *conf) { +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG )
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, · line 13094
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ num =i40e_pf_calc_configured_queues_num (pf); + else + num = pf->dev_data->nb_rx_queues; + +if (conf ==NULL ) + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +else + num =RTE_MIN (num, conf->conf.queue_num); +PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , + num);
Alignment should match open parenthesis.
Quoted 23 lines
drivers/net/i40e/i40e_ethdev.c +23
-0+ +if (num ==0 ) { +PMD_DRV_LOG (ERR , +"No PF queues are configured to enable RSS for port %u" , + pf->dev_data->port_id); +return -ENOTSUP ; + } + +/* Fill in redirection table */ +for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { +if (j == num) + j =0 ; +if (conf ==NULL ) + lut = (lut <<8 ) | (j & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +else + lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +if ((i &3 ) ==3 ) +I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); + } + +return 0 ;
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +5
-0+} + /* Write HENA register to enable hash */ static int i40e_rss_hash_set(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *rss_conf) @@ -13318,12 +13367,24 @@ static int i40e_rss_enable_hash(struct i40e_pf *pf,struct i40e_rte_flow_rss_conf *conf) { +enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;struct i40e_rte_flow_rss_conf rss_conf; +int ret;
Suggest set the 0 to ret and return ret at the end of this function, so ret could be use in all part.
Quoted 90 lines
if (!(conf->conf.types &
pf->adapter->flow_types_mask))
return-ENOTSUP;drivers/net/i40e/i40e_ethdev.c +11
-62+/* If the RSS is disabled before this, the LUT is uninitialized. +* So it is necessary to initialize it here. +*/ +if (!(mq_mode Ð_MQ_RX_RSS_FLAG ) && !pf->rss_info.conf.queue_num && + !pf->adapter->rss_reta_updated) { + ret =i40e_rss_set_lut (pf,NULL ); +if (ret) +return ret; + } +memset (&rss_conf,0 ,sizeof (rss_conf));rte_memcpy (&rss_conf, conf,sizeof (rss_conf));@@ -13362,39 +13423,7 @@ static int i40e_rss_config_queue_region(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf) { - struct i40e_hw *hw = I40E_PF_TO_HW(pf); -uint32_t lut =0 ; -uint16_t j, num; -uint32_t i; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured. -* It's necessary to calculate the actual PF queues that are configured. -*/ -if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) - num =i40e_pf_calc_configured_queues_num (pf); -else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, conf->conf.queue_num); -PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , - num); - -if (num ==0 ) { -PMD_DRV_LOG (ERR , -"No PF queues are configured to enable RSS for port %u" , - pf->dev_data->port_id); -return -ENOTSUP ; - } - -/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf, conf);i40e_rss_mark_invalid_rule (pf, conf);@@ -13491,46 +13520,9 @@ i40e_rss_disable_hash(struct i40e_pf *pf, static int i40e_rss_clear_queue_region(struct i40e_pf *pf) { -struct i40e_hw *hw =I40E_PF_TO_HW (pf);struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info; -uint16_t queue[I40E_MAX_Q_PER_TC ]; -uint32_t num_rxq, i; -uint32_t lut =0 ; -uint16_t j, num; - - num_rxq =RTE_MIN (pf->dev_data->nb_rx_queues,I40E_MAX_Q_PER_TC ); -for (j =0 ; j < num_rxq; j++) - queue[j] = j; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured. -* It's necessary to calculate the actual PF queues that are configured. -*/ -if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) - num =i40e_pf_calc_configured_queues_num (pf); -else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, num_rxq); -PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , - num); - -if (num ==0 ) { -PMD_DRV_LOG (ERR , -"No PF queues are configured to enable RSS for port %u" , - pf->dev_data->port_id); -return -ENOTSUP ; - } -
drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf, static int i40e_rss_clear_queue_region(struct i40e_pf *pf) { · line 13522
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +1
-9-/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf,NULL );
Need to check return value.
Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0
-1rss_info->conf.queue_num =0 ;memset (&rss_info->conf.queue,0 ,sizeof (uint16_t )); --2.17.1
Hi, Jeff
Quoted 58 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Wednesday, July 22, 2020 1:51 PM
To: Xie, WeiX <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect hash look up tablehi, shougang
Quoted 16 lines · WeiX
Tested-by Zhang, XiX <[email protected]>Regards,
Xie Wei-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Shougang Wang
Sent: Tuesday, July 21, 2020 1:49 PM
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect hash look up tableQuoted 1 line
The hash look up table(LUT) will not be initializing when starting testpmd
with --disable-rss. So that some invalid queue indexes may still in the LUT. When enable RSS by creating RSS rule, some packets will not be into the valid queues.
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct
Quoted 16 lines
This patch fixes this issue by initializing the LUT when creating an RSS rule.
Fixes feaae285b342 ("net/i40e: support hash configuration in RSSflow")
Cc: [email protected]Signed-off-by Shougang Wang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 134 ++++++++++++++++----------------- 1 file changed, 63 insertions(+), 71 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex393b5320f..e56543393100644drivers/net/i40e/i40e_ethdev.c +0
-0@@ -13070,6 +13070,55 @@ i40e_rss_conf_init(struct
i40e_rte_flow_rss_conf*out,drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +2
-0return 0 ; } +/* If conf is NULL, function will init hash LUT with default +configration*/ Please fix the checkpatch issue here.
Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct · line 13075
Quoted 1 line
drivers/net/i40e/i40e_ethdev.c +0
-0static int i40e_rss_set_lut(struct i40e_pf *pf,In order to eliminate any confuse with current
i40e_set_rss_lut, please change the name, such as "i40e_rss_lut_init" or other better naming.
Qi also gave me some comments. I will define i40e_rss_lut_init() to initialize the LUT.
Quoted 194 lines
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +7
-0+ struct i40e_rte_flow_rss_conf *conf) { +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured.
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +3
-0+* It's necessary to calculate the actual PF queues that are configured. +*/ + if (pf->dev_data->dev_conf.rxmode.mq_mode &
ETH_MQ_RX_VMDQ_FLAG)drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +9
-0+ num =i40e_pf_calc_configured_queues_num (pf); + else + num = pf->dev_data->nb_rx_queues; + +if (conf ==NULL ) + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +else + num =RTE_MIN (num, conf->conf.queue_num); + PMD_DRV_LOG(INFO, "Max of contiguous %u PF queues areconfigured",
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, · line 13094
Quoted 1 line
drivers/net/i40e/i40e_ethdev.c +1
-0+ num);Alignment should match open parenthesis.
drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4
-0+ +if (num ==0 ) { + PMD_DRV_LOG(ERR, + "No PF queues are configured to enable RSS forport %u",
Quoted 12 lines
drivers/net/i40e/i40e_ethdev.c +12
-0+ pf->dev_data->port_id); +return -ENOTSUP ; + } + +/* Fill in redirection table */ +for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { +if (j == num) + j =0 ; +if (conf ==NULL ) + lut = (lut <<8 ) | (j & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +else drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +9
-0+ lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +if ((i &3 ) ==3 ) +I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); + } + +return 0 ; +} + /* Write HENA register to enable hash */ static int
i40e_rss_hash_set(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *rss_conf)@@ -13318,12 +13367,24 @@ static int i40e_rss_enable_hash(structi40e_pf*pf,drivers/net/i40e/i40e_ethdev.c i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c +3
-0struct i40e_rte_flow_rss_conf *conf) { +enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;struct i40e_rte_flow_rss_conf rss_conf; +int ret;Suggest set the 0 to ret and return ret at the end of this function, so ret could be use in all part.
Quoted 19 lines
if (!(conf->conf.types &
pf->adapter->flow_types_mask))
return-ENOTSUP;drivers/net/i40e/i40e_ethdev.c +4
-0+/* If the RSS is disabled before this, the LUT is uninitialized. +* So it is necessary to initialize it here. +*/ + if (!(mq_mode & ETH_MQ_RX_RSS_FLAG) && !pf-rss_info.conf.queue_num &&
drivers/net/i40e/i40e_ethdev.c +6
-0+ !pf->adapter->rss_reta_updated) { + ret =i40e_rss_set_lut (pf,NULL ); +if (ret) +return ret; + } +memset (&rss_conf,0 ,sizeof (rss_conf));rte_memcpy (&rss_conf, conf,sizeof (rss_conf));drivers/net/i40e/i40e_ethdev.c static int · line 13370
Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +0
-6@@ -13362,39 +13423,7 @@ static int i40e_rss_config_queue_region(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf) { - struct i40e_hw *hw = I40E_PF_TO_HW(pf); -uint32_t lut =0 ; -uint16_t j, num; -uint32_t i; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured.
drivers/net/i40e/i40e_ethdev.c static int · line 13373
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0
-3-* It's necessary to calculate the actual PF queues that are configured. -*/ - if (pf->dev_data->dev_conf.rxmode.mq_mode &
ETH_MQ_RX_VMDQ_FLAG)drivers/net/i40e/i40e_ethdev.c static int · line 13379
Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0
-6- num =i40e_pf_calc_configured_queues_num (pf); - else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, conf->conf.queue_num); - PMD_DRV_LOG(INFO, "Max of contiguous %u PF queues areconfigured",
drivers/net/i40e/i40e_ethdev.c static int · line 13384
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +0
-5- num); - -if (num ==0 ) { - PMD_DRV_LOG(ERR, - "No PF queues are configured to enable RSS forport %u",
drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf,
Quoted 18 lines
drivers/net/i40e/i40e_ethdev.c +1
-13- pf->dev_data->port_id); -return -ENOTSUP ; - } - -/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf, conf);i40e_rss_mark_invalid_rule (pf, conf);@@ -13491,46 +13520,9 @@ i40e_rss_disable_hash(struct i40e_pf *pf,static int
i40e_rss_clear_queue_region(struct i40e_pf *pf){drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf, · line 13498
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +0
-7-struct i40e_hw *hw =I40E_PF_TO_HW (pf);struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info; -uint16_t queue[I40E_MAX_Q_PER_TC ]; -uint32_t num_rxq, i; -uint32_t lut =0 ; -uint16_t j, num; - - num_rxq = RTE_MIN(pf->dev_data->nb_rx_queues,
I40E_MAX_Q_PER_TC);drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf, · line 13502
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +0
-4-for (j =0 ; j < num_rxq; j++) - queue[j] = j; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured.
drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf, · line 13505
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0
-3-* It's necessary to calculate the actual PF queues that are configured. -*/ - if (pf->dev_data->dev_conf.rxmode.mq_mode &
ETH_MQ_RX_VMDQ_FLAG)drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf, · line 13511
Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0
-6- num =i40e_pf_calc_configured_queues_num (pf); - else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, num_rxq); - PMD_DRV_LOG(INFO, "Max of contiguous %u PF queues areconfigured",
drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf, · line 13516
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +0
-5- num); - -if (num ==0 ) { - PMD_DRV_LOG(ERR, - "No PF queues are configured to enable RSS forport %u",
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +0
-4- pf->dev_data->port_id); -return -ENOTSUP ; - } -drivers/net/i40e/i40e_ethdev.c i40e_rss_disable_hash(struct i40e_pf *pf, · line 13521
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +1
-9-/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf,NULL );Need to check return value.
Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0
-1rss_info->conf.queue_num =0 ;memset (&rss_info->conf.queue,0 ,sizeof (uint16_t )); --2.17.1
Quoted 10 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: Tuesday, July 21, 2020 1:49 PM
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect hash look up table
Quoted 4 lines
The hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some invalid queue indexes may still in the LUT. When enable RSS by creating RSS rule, some packets will not be into the valid queues. This patch fixes this issue by initializing the LUT when creating an RSS rule.
Could you explain why you only initialize the LUT when creating an RSS rule but not at dev_init or dev_start? What if user configure LUT table before create a RSS rule? Does that mean the LUT table will be flushed?
Quoted 187 lines
Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 134 ++++++++++++++++----------------- 1 file changed, 63 insertions(+), 71 deletions(-)drivers/net/i40e/i40e_ethdev.c +47
-0@@ -13070,6 +13070,55 @@ i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out, return 0; } +/* If conf is NULL, function will init hash LUT with default +configration*/ static int i40e_rss_set_lut (struct i40e_pf *pf, +struct i40e_rte_flow_rss_conf *conf) { +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) + num =i40e_pf_calc_configured_queues_num (pf); +else + num = pf->dev_data->nb_rx_queues; + +if (conf ==NULL ) + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +else + num =RTE_MIN (num, conf->conf.queue_num); +PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , + num); + +if (num ==0 ) { +PMD_DRV_LOG (ERR , +"No PF queues are configured to enable RSS for port %u" , + pf->dev_data->port_id); +return -ENOTSUP ; + } + +/* Fill in redirection table */ +for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { +if (j == num) + j =0 ; +if (conf ==NULL ) + lut = (lut <<8 ) | (j & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +else + lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << + hw->func_caps.rss_table_entry_width) -1 )); +if ((i &3 ) ==3 ) +I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); + } + +return 0 ; +} + /* Write HENA register to enable hash */ static int
i40e_rss_hash_set(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *rss_conf)drivers/net/i40e/i40e_ethdev.c +7
-0@@ -13318,12 +13367,24 @@ static int i40e_rss_enable_hash(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf) { +enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;struct i40e_rte_flow_rss_conf rss_conf; +int ret;if (!(conf->conf.types & pf->adapter->flow_types_mask))return -ENOTSUP ; +/* If the RSS is disabled before this, the LUT is uninitialized. +* So it is necessary to initialize it here. +*/ + if (!(mq_mode & ETH_MQ_RX_RSS_FLAG)&& !pf->rss_info.conf.queue_num &&
drivers/net/i40e/i40e_ethdev.c +8
-72+ !pf->adapter->rss_reta_updated) { + ret =i40e_rss_set_lut (pf,NULL ); +if (ret) +return ret; + } +memset (&rss_conf,0 ,sizeof (rss_conf));rte_memcpy (&rss_conf, conf,sizeof (rss_conf));@@ -13362,39 +13423,7 @@ static int i40e_rss_config_queue_region(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf) { - struct i40e_hw *hw = I40E_PF_TO_HW(pf); -uint32_t lut =0 ; -uint16_t j, num; -uint32_t i; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured. -* It's necessary to calculate the actual PF queues that are configured. -*/ -if (pf->dev_data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG) - num =i40e_pf_calc_configured_queues_num (pf); -else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, conf->conf.queue_num); -PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , - num); - -if (num ==0 ) { -PMD_DRV_LOG (ERR , -"No PF queues are configured to enable RSS for port %u" , - pf->dev_data->port_id); -return -ENOTSUP ; - } - -/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (conf->conf.queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf, conf);i40e_rss_mark_invalid_rule (pf, conf);@@ -13491,46 +13520,9 @@ i40e_rss_disable_hash(struct i40e_pf *pf, staticint i40e_rss_clear_queue_region (struct i40e_pf *pf) { -struct i40e_hw *hw =I40E_PF_TO_HW (pf);struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info; -uint16_t queue[I40E_MAX_Q_PER_TC ]; -uint32_t num_rxq, i; -uint32_t lut =0 ; -uint16_t j, num; - - num_rxq =RTE_MIN (pf->dev_data->nb_rx_queues, I40E_MAX_Q_PER_TC); -for (j =0 ; j < num_rxq; j++) - queue[j] = j; - -/* If both VMDQ and RSS enabled, not all of PF queues are configured. -* It's necessary to calculate the actual PF queues that are configured. -*/ -if (pf->dev_data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG) - num =i40e_pf_calc_configured_queues_num (pf); -else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num, num_rxq); -PMD_DRV_LOG (INFO ,"Max of contiguous %u PF queues are configured" , - num); - -if (num ==0 ) { -PMD_DRV_LOG (ERR , -"No PF queues are configured to enable RSS for port %u" , - pf->dev_data->port_id); -return -ENOTSUP ; - } - -/* Fill in redirection table */ -for (i =0 , j =0 ; i < hw->func_caps.rss_table_size; i++, j++) { -if (j == num) - j =0 ; - lut = (lut <<8 ) | (queue[j] & ((0x1 << - hw->func_caps.rss_table_entry_width) -1 )); -if ((i &3 ) ==3 ) -I40E_WRITE_REG (hw,I40E_PFQF_HLUT (i >>2 ), lut); - } +i40e_rss_set_lut (pf ,NULL ); rss_info->conf.queue_num =0 ;memset (&rss_info->conf.queue,0 ,sizeof (uint16_t )); --2.17.1
Hi, Qi
Quoted 20 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, July 22, 2020 1:31 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect hash look up tableQuoted 10 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: Tuesday, July 21, 2020 1:49 PM
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix incorrect hash look up table
Quoted 8 lines
Quoted 3 lines
The hash look up table(LUT) will not be initializing when starting testpmd with --disable-rss. So that some invalid queue indexes may still in the LUT. When enable RSS by creating RSS rule, some packets will not
be into the valid queues.
Quoted 1 line
This patch fixes this issue by initializing the LUT when creating an RSS rule.
Could you explain why you only initialize the LUT when creating an RSS rule but not at
dev_initordev_start?
It is good to initialize the LUT at dev_start, I will fix it.
Quoted 2 lines
What if user configure LUT table before create a RSS rule? Does that mean the LUT table will be flushed?
Yes.
Thanks.
Shougang
PATCH v3 1/1 net/i40e: fix incorrect hash look up table
In reply to Shougang WangThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not.
---
v3:
-Updated the time of initializing the look up table
--- drivers/net/i40e/i40e_ethdev.c | 85 ++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 36 deletions(-)
drivers/net/i40e/i40e_ethdev.c +49 -36
@@ -8984,42 +8984,7 @@ i40e_pf_calc_configured_queues_num(struct i40e_pf *pf)static int 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 i, lut =0 ; -uint16_t j, num; - -/* -* If both VMDQ and RSS enabled, not all of PF queues are configured. -* It's necessary to calculate the actual PF queues that are configured. -*/ -if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) - num =i40e_pf_calc_configured_queues_num (pf); -else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); -PMD_INIT_LOG (INFO ,"Max of contiguous %u PF queues are configured" , - num); - -if (num ==0 ) { -PMD_INIT_LOG (ERR , -"No PF queues are configured to enable RSS for port %u" , - pf->dev_data->port_id); -return -ENOTSUP ; - } - -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;if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) {
@@ -9195,12 +9160,60 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev,return ret; } +/* Initialize the hash look up table */ +static int +i40e_pf_init_rss_lut (struct i40e_pf *pf) +{ +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured. +* It's necessary to calculate the actual PF queues that are configured. +*/ +if (pf->dev_data->dev_conf.rxmode.mq_mode Ð_MQ_RX_VMDQ_FLAG ) + num =i40e_pf_calc_configured_queues_num (pf); +else + num = pf->dev_data->nb_rx_queues; + + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); +PMD_INIT_LOG (INFO ,"Max of contiguous %u PF queues are configured" , + num); + +if (num ==0 ) { +PMD_INIT_LOG (ERR , +"No PF queues are configured to enable RSS for port %u" , + pf->dev_data->port_id); +return -ENOTSUP ; + } + +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)); + } + } + +return 0 ; +} +static int i40e_pf_config_mq_rx (struct i40e_pf *pf) { -int ret =0 ; +int ret;enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode; +/* Initialize hash look up table */ + ret =i40e_pf_init_rss_lut (pf); +if (ret) +return ret; +/* RSS setup */ if (mq_mode Ð_MQ_RX_RSS_FLAG ) ret =i40e_pf_config_rss (pf);
Signature · 1 line
2.17.1
I don't understand why you add new function and new function mostly do the same thing. Why don't add fix in original code.
Quoted 141 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: Wednesday, July 22, 2020 16:16
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v3] net/i40e: fix incorrect hash look up tableThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not.Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>---
v3:(quoted diff) +0
-2-Updated the time of initializing the look up table --- drivers/net/i40e/i40e_ethdev.c | 85 ++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 36 deletions(-)drivers/net/i40e/i40e_ethdev.c +0
-6@@ -8984,42 +8984,7 @@ i40e_pf_calc_configured_queues_num(struct i40e_pf *pf) static int 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 i, lut =0 ; -uint16_t j, num; - -/* -* If both VMDQ and RSS enabled, not all of PF queues are configured.
drivers/net/i40e/i40e_ethdev.c +0
-3-* It's necessary to calculate the actual PF queues that are configured. -*/ - if (pf->dev_data->dev_conf.rxmode.mq_mode &
ETH_MQ_RX_VMDQ_FLAG)drivers/net/i40e/i40e_ethdev.c +0
-6- num =i40e_pf_calc_configured_queues_num (pf); - else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); - PMD_INIT_LOG(INFO, "Max of contiguous %u PF queues areconfigured",
drivers/net/i40e/i40e_ethdev.c +0
-5- num); - -if (num ==0 ) { - PMD_INIT_LOG(ERR, - "No PF queues are configured to enable RSS for port%u",
drivers/net/i40e/i40e_ethdev.c +0
-12- pf->dev_data->port_id); -return -ENOTSUP ; - } - -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),
drivers/net/i40e/i40e_ethdev.c +0
-3- rte_bswap32(lut)); - } - } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) == 0) { @@ -9195,12 +9160,60 @@ i40e_tunnel_filter_handle(struct
rte_eth_dev*dev,drivers/net/i40e/i40e_ethdev.c +8
-0return ret; } +/* Initialize the hash look up table */ static int +i40e_pf_init_rss_lut (struct i40e_pf *pf) { +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured.
drivers/net/i40e/i40e_ethdev.c +3
-0+* It's necessary to calculate the actual PF queues that are configured. +*/ + if (pf->dev_data->dev_conf.rxmode.mq_mode &
ETH_MQ_RX_VMDQ_FLAG)drivers/net/i40e/i40e_ethdev.c +6
-0+ num =i40e_pf_calc_configured_queues_num (pf); + else + num = pf->dev_data->nb_rx_queues; + + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); + PMD_INIT_LOG(INFO, "Max of contiguous %u PF queues areconfigured",
drivers/net/i40e/i40e_ethdev.c +5
-0+ num); + +if (num ==0 ) { + PMD_INIT_LOG(ERR, + "No PF queues are configured to enable RSS for port%u",
drivers/net/i40e/i40e_ethdev.c +12
-0+ pf->dev_data->port_id); +return -ENOTSUP ; + } + +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),
drivers/net/i40e/i40e_ethdev.c +8
-1+ rte_bswap32(lut)); + } + } + +return 0 ; +} +static int i40e_pf_config_mq_rx (struct i40e_pf *pf) { -int ret =0 ; +int ret; enum rte_eth_rx_mq_mode mq_mode = pf->dev_data-Quoted 1 line
dev_conf.rxmode.mq_mode;
drivers/net/i40e/i40e_ethdev.c +5
-1+/* Initialize hash look up table */ + ret =i40e_pf_init_rss_lut (pf); +if (ret) +return ret; +/* RSS setup */ if (mq_mode Ð_MQ_RX_RSS_FLAG ) ret =i40e_pf_config_rss (pf); --2.17.1
Quoted 149 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Yang, Qiming
Sent: Thursday, July 23, 2020 9:57 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: fix incorrect hash look up tableI don't understand why you add new function and new function mostly do the same thing.
Why don't add fix in original code.Quoted 135 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: Wednesday, July 22, 2020 16:16
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v3] net/i40e: fix incorrect hash look up tableThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not.Fixes feaae285b342 ("net/i40e: support hash configuration in RSSflow")
Cc: [email protected]Signed-off-by Shougang Wang <[email protected]>---
v3:(quoted diff) +1
-2-Updated the time of initializing the look up table --- drivers/net/i40e/i40e_ethdev.c | 85 ++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 36 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex05d5f2861..e35590d96100644drivers/net/i40e/i40e_ethdev.c +0
-6@@ -8984,42 +8984,7 @@ i40e_pf_calc_configured_queues_num(struct i40e_pf *pf) static int 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 i, lut =0 ; -uint16_t j, num; - -/* -* If both VMDQ and RSS enabled, not all of PF queues are configured.
drivers/net/i40e/i40e_ethdev.c +0
-3-* It's necessary to calculate the actual PF queues that are configured. -*/ - if (pf->dev_data->dev_conf.rxmode.mq_mode &
ETH_MQ_RX_VMDQ_FLAG)drivers/net/i40e/i40e_ethdev.c +0
-6- num =i40e_pf_calc_configured_queues_num (pf); - else - num = pf->dev_data->nb_rx_queues; - - num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); - PMD_INIT_LOG(INFO, "Max of contiguous %u PF queues areconfigured",
drivers/net/i40e/i40e_ethdev.c +0
-5- num); - -if (num ==0 ) { - PMD_INIT_LOG(ERR, - "No PF queues are configured to enable RSS for port%u",
drivers/net/i40e/i40e_ethdev.c +0
-12- pf->dev_data->port_id); -return -ENOTSUP ; - } - -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),
drivers/net/i40e/i40e_ethdev.c +0
-3- rte_bswap32(lut)); - } - } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) == 0) { @@ -9195,12 +9160,60 @@ i40e_tunnel_filter_handle(struct
rte_eth_dev*dev,drivers/net/i40e/i40e_ethdev.c +8
-0return ret; } +/* Initialize the hash look up table */ static int +i40e_pf_init_rss_lut (struct i40e_pf *pf) { +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t lut =0 ; +uint16_t j, num; +uint32_t i; + +/* If both VMDQ and RSS enabled, not all of PF queues are configured.
drivers/net/i40e/i40e_ethdev.c +3
-0+* It's necessary to calculate the actual PF queues that are configured. +*/ + if (pf->dev_data->dev_conf.rxmode.mq_mode &
ETH_MQ_RX_VMDQ_FLAG)drivers/net/i40e/i40e_ethdev.c +6
-0+ num =i40e_pf_calc_configured_queues_num (pf); + else + num = pf->dev_data->nb_rx_queues; + + num =RTE_MIN (num,I40E_MAX_Q_PER_TC ); + PMD_INIT_LOG(INFO, "Max of contiguous %u PF queues areconfigured",
drivers/net/i40e/i40e_ethdev.c +5
-0+ num); + +if (num ==0 ) { + PMD_INIT_LOG(ERR, + "No PF queues are configured to enable RSS for port%u",
drivers/net/i40e/i40e_ethdev.c +12
-0+ pf->dev_data->port_id); +return -ENOTSUP ; + } + +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),
drivers/net/i40e/i40e_ethdev.c +8
-1+ rte_bswap32(lut)); + } + } + +return 0 ; +} +static int i40e_pf_config_mq_rx (struct i40e_pf *pf) { -int ret =0 ; +int ret; enum rte_eth_rx_mq_mode mq_mode = pf->dev_data-Quoted 1 line
dev_conf.rxmode.mq_mode;
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c i40e_tunnel_filter_handle(struct rte_eth_dev *dev, · line 9218
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c +5
-0+/* Initialize hash look up table */ + ret =i40e_pf_init_rss_lut (pf); +if (ret) +return ret; +/* RSS setup */ if (mq_mode Ð_MQ_RX_RSS_FLAG )
I agree with Qiming, if we move this check into i40e_pf_config_rss, dose that looks we don't need to create a new function?
Quoted 3 lines
Quoted 3 lines
ret =
i40e_pf_config_rss(pf);
--
2.17.1
Quoted 26 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, July 23, 2020 8:53 PM
To: Yang, Qiming <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v3] net/i40e: fix incorrect hash look up tableQuoted 14 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Yang, Qiming
Sent: Thursday, July 23, 2020 9:57 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: fix incorrect hash look up tableI don't understand why you add new function and new function mostly do the same thing.
Why don't add fix in original code.
<snip>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
static int
i40e_pf_config_mq_rx(struct i40e_pf *pf){drivers/net/i40e/i40e_ethdev.c +1
-1-int ret =0 ; +int ret; enum rte_eth_rx_mq_mode mq_mode = pf->dev_data-Quoted 1 line
dev_conf.rxmode.mq_mode;
Quoted 10 lines
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c i40e_tunnel_filter_handle(struct rte_eth_dev *dev, · line 9218
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c +5
-0+/* Initialize hash look up table */ + ret =i40e_pf_init_rss_lut (pf); +if (ret) +return ret; +/* RSS setup */ if (mq_mode Ð_MQ_RX_RSS_FLAG )I agree with Qiming, if we move this check into
i40e_pf_config_rss, dose that looks we don't need to create a new function?
Indeed, I will do like this.
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
ret =
i40e_pf_config_rss(pf);
--
2.17.1
PATCH v4 1/1 net/i40e: fix incorrect hash look up table
In reply to Shougang WangThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not.
---
v4:
-Updated code.
--- drivers/net/i40e/i40e_ethdev.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/net/i40e/i40e_ethdev.c +4 -11
@@ -8985,6 +8985,7 @@ static int i40e_pf_config_rss(struct i40e_pf *pf) {struct i40e_hw *hw =I40E_PF_TO_HW (pf); +enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;uint16_t j, num;
@@ -9022,7 +9023,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }
@@ -9198,16 +9200,7 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev,static int i40e_pf_config_mq_rx (struct i40e_pf *pf) { -int ret =0 ; -enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode; - -/* RSS setup */ -if (mq_mode Ð_MQ_RX_RSS_FLAG ) - ret =i40e_pf_config_rss (pf); -else -i40e_pf_disable_rss (pf); - -return ret; +return i40e_pf_config_rss (pf); }/* Get the symmetric hash enable configurations per port */
Signature · 1 line
2.17.1
hi, shougang
Quoted 5 lines · Shougang Wang
The hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not.
"whatever" but not "whether"?
Quoted 35 lines
Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>---
v4:(quoted diff) +0
-2-Updated code. --- drivers/net/i40e/i40e_ethdev.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)drivers/net/i40e/i40e_ethdev.c +3
-1@@ -8985,6 +8985,7 @@ static int i40e_pf_config_rss(struct i40e_pf *pf) {struct i40e_hw *hw =I40E_PF_TO_HW (pf); +enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;uint16_t j, num;@@ -9022,7 +9023,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }
drivers/net/i40e/i40e_ethdev.c i40e_tunnel_filter_handle(struct rte_eth_dev *dev, · line 9201
Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +0
-0@@ -9198,16 +9200,7 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev,static int i40e_pf_config_mq_rx (struct i40e_pf *pf)
This function is still need or could it be replace by i40e_pf_config_rss?
Quoted 15 lines
drivers/net/i40e/i40e_ethdev.c +1
-10{ -int ret =0 ; -enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode; - -/* RSS setup */ -if (mq_mode Ð_MQ_RX_RSS_FLAG ) - ret =i40e_pf_config_rss (pf); -else -i40e_pf_disable_rss (pf); - -return ret; +return i40e_pf_config_rss (pf); }/* Get the symmetric hash enable configurations per port */
Hi, Jeff
Quoted 10 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday, July 24, 2020 11:58 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; [email protected]
Subject: Re: [PATCH v4] net/i40e: fix incorrect hash look up tablehi, shougang
On 7/24/2020 10:47 AM, Shougang Wang wrote:
Quoted 8 lines
Quoted 5 lines
The hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not."whatever" but not "whether"?
"whatever", I will fix it.
Quoted 40 lines
drivers/net/i40e/i40e_ethdev.c i40e_tunnel_filter_handle(struct rte_eth_dev
Quoted 39 lines
Fixes feaae285b342 ("net/i40e: support hash configuration in RSSflow")
Cc: [email protected]Signed-off-by Shougang Wang <[email protected]>---
v4:(quoted diff) +0
-2-Updated code. --- drivers/net/i40e/i40e_ethdev.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex05d5f2861..0a3f5e3c1100644drivers/net/i40e/i40e_ethdev.c +4
-1@@ -8985,6 +8985,7 @@ static int i40e_pf_config_rss(struct i40e_pf *pf) {struct i40e_hw *hw =I40E_PF_TO_HW (pf); +enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;uint16_t j, num;@@ -9022,7 +9023,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }@@ -9198,16 +9200,7 @@ i40e_tunnel_filter_handle(struct rte_eth_dev*dev,
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c i40e_tunnel_filter_handle(struct rte_eth_dev *dev, · line 9201
Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +0
-0static int i40e_pf_config_mq_rx (struct i40e_pf *pf)This function is still need or could it be replace by
i40e_pf_config_rss?
It can be replaced by i40e_pf_config_rss, thanks for your review.
Hi, Shougang
This version looks better, only two small questions.
Once somebody gave comments to your patch, you should reply the comments and CC when you send patch next version. You don't include me in this version, don't forget this next time.
Qiming
Quoted 29 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: Friday, July 24, 2020 10:47
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/i40e: fix incorrect hash look up tableThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not.Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>---
v4:(quoted diff) +0
-2-Updated code. --- drivers/net/i40e/i40e_ethdev.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)drivers/net/i40e/i40e_ethdev.c +0
-0
drivers/net/i40e/i40e_ethdev.c static int · line 8989
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +2
-0@@ -8985,6 +8985,7 @@ static int i40e_pf_config_rss(struct i40e_pf *pf) {struct i40e_hw *hw =I40E_PF_TO_HW (pf); +enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;
No tab?
Quoted 17 lines
drivers/net/i40e/i40e_ethdev.c +2
-3struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;uint16_t j, num;@@ -9022,7 +9023,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }@@ -9198,16 +9200,7 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev, static int i40e_pf_config_mq_rx(struct i40e_pf *pf) { -int ret =0 ; - enum rte_eth_rx_mq_mode mq_mode = pf->dev_data-
drivers/net/i40e/i40e_ethdev.c i40e_tunnel_filter_handle(struct rte_eth_dev · line 9202
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +1
-8>dev_conf.rxmode.mq_mode; - -/* RSS setup */ -if (mq_mode Ð_MQ_RX_RSS_FLAG ) - ret =i40e_pf_config_rss (pf); -else -i40e_pf_disable_rss (pf); - -return ret; +return i40e_pf_config_rss (pf);
If only have one function call in this function, we can delete it, and just use i40e_pf_config_rss(pf) instead of i40e_pf_config_mq_rx.
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +0
-1}/* Get the symmetric hash enable configurations per port */ --2.17.1
Hi, Qiming
Quoted 8 lines
-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Friday, July 24, 2020 1:08 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v4] net/i40e: fix incorrect hash look up table
Quoted 5 lines
Hi, Shougang
This version looks better, only two small questions. Once somebody gave comments to your patch, you should reply the comments and CC when you send patch next version.
You don't include me in this version, don't forget this next time.
Got it, I will keep in mind.
Quoted 28 lines
Qiming
Quoted 27 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shougang Wang
Sent: Friday, July 24, 2020 10:47
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4] net/i40e: fix incorrect hash look up tableThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whether RSS enabled or not.Fixes feaae285b342 ("net/i40e: support hash configuration in RSSflow")
Cc: [email protected]Signed-off-by Shougang Wang <[email protected]>---
v4:
-Updated code.--- drivers/net/i40e/i40e_ethdev.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c static int · line 8988
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex05d5f2861..0a3f5e3c1100644drivers/net/i40e/i40e_ethdev.c +2
-0@@ -8985,6 +8985,7 @@ static int i40e_pf_config_rss(struct i40e_pf *pf) {struct i40e_hw *hw =I40E_PF_TO_HW (pf); +enum rte_eth_rx_mq_mode mq_mode = +pf->dev_data->dev_conf.rxmode.mq_mode;No tab?
Actually, this line is on the same line as the code above, but it looks like two lines here. I will adjust the position of this definition to follow the "Christmas tree" in next version.
Quoted 19 lines
Quoted 19 lines
drivers/net/i40e/i40e_ethdev.c +2
-3struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;uint16_t j, num;@@ -9022,7 +9023,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }@@ -9198,16 +9200,7 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev, static int i40e_pf_config_mq_rx(struct i40e_pf *pf) { -int ret =0 ; -enum rte_eth_rx_mq_mode mq_mode = pf->dev_data- >dev_conf.rxmode.mq_mode;
Quoted 12 lines
drivers/net/i40e/i40e_ethdev.c i40e_tunnel_filter_handle(struct rte_eth_dev *dev, · line 9203
Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +1
-8- -/* RSS setup */ -if (mq_mode Ð_MQ_RX_RSS_FLAG ) - ret =i40e_pf_config_rss (pf); -else -i40e_pf_disable_rss (pf); - -return ret; +return i40e_pf_config_rss (pf);If only have one function call in this function, we can delete it, and just use
i40e_pf_config_rss(pf)instead ofi40e_pf_config_mq_rx.
Got it. Thanks for your review.
Thanks.
Shougang
PATCH v5 1/1 net/i40e: fix incorrect hash look up table
In reply to Shougang WangThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whatever RSS enabled or not.
---
v5:
-Removed useless function
--- drivers/net/i40e/i40e_ethdev.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -19
@@ -302,7 +302,6 @@ static int i40e_dev_init_vlan(struct rte_eth_dev *dev);static int i40e_veb_release (struct i40e_veb *veb);static struct i40e_veb *i40e_veb_setup (struct i40e_pf *pf,struct i40e_vsi *vsi); -static int i40e_pf_config_mq_rx (struct i40e_pf *pf);static int i40e_vsi_config_double_vlan (struct i40e_vsi *vsi,int on); static inline int i40e_find_all_mac_for_vlan(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f,
@@ -398,6 +397,7 @@ static void i40e_ethertype_filter_restore(struct i40e_pf *pf);static void i40e_tunnel_filter_restore (struct i40e_pf *pf);static void i40e_filter_restore (struct i40e_pf *pf);static void i40e_notify_all_vfs_link_status (struct rte_eth_dev *dev); +static int i40e_pf_config_rss (struct i40e_pf *pf);static const char *const valid_keys[] = {ETH_I40E_FLOATING_VEB_ARG ,
@@ -1954,7 +1954,7 @@ i40e_dev_configure(struct rte_eth_dev *dev) goto err;/* VMDQ setup. -* Needs to move VMDQ setting out of i40e_pf_config_mq_rx() as VMDQ and +* Needs to move VMDQ setting out of i40e_pf_config_rss() as VMDQ and * RSS setting have different requirements. * General PMD driver call sequence are NIC init, configure, * rx/tx_queue_setup and dev_start. In rx/tx_queue_setup() function, it
@@ -6478,7 +6478,7 @@ i40e_dev_rx_init(struct i40e_pf *pf)uint16_t i;struct i40e_rx_queue *rxq; -i40e_pf_config_mq_rx (pf); +i40e_pf_config_rss (pf);for (i =0 ; i < data->nb_rx_queues; i++) { rxq = data->rx_queues[i];if (!rxq || !rxq->q_set)
@@ -8984,6 +8984,7 @@ i40e_pf_calc_configured_queues_num(struct i40e_pf *pf)static int i40e_pf_config_rss (struct i40e_pf *pf) { +enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_hw *hw =I40E_PF_TO_HW (pf);struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;
@@ -9022,7 +9023,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }
@@ -9195,21 +9197,6 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev,return ret; } -static int -i40e_pf_config_mq_rx (struct i40e_pf *pf) -{ -int ret =0 ; -enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode; - -/* RSS setup */ -if (mq_mode Ð_MQ_RX_RSS_FLAG ) - ret =i40e_pf_config_rss (pf); -else -i40e_pf_disable_rss (pf); - -return ret; -} -/* Get the symmetric hash enable configurations per port */ static void i40e_get_symmetric_hash_enable_per_port (struct i40e_hw *hw,uint8_t *enable)
Signature · 1 line
2.17.1
Regards,
Xie Wei
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Shougang Wang
Sent: Friday, July 24, 2020 4:13 PM
To: [email protected]
Cc: Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v5] net/i40e: fix incorrect hash look up table
The hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized. This patch fixes the issue by initializing the LUT whatever RSS enabled or not.
---
v5:
-Removed useless function
--- drivers/net/i40e/i40e_ethdev.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -2
@@ -302,7 +302,6 @@ static int i40e_dev_init_vlan(struct rte_eth_dev *dev); static int i40e_veb_release(struct i40e_veb *veb); static struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *vsi); -static int i40e_pf_config_mq_rx (struct i40e_pf *pf);static int i40e_vsi_config_double_vlan (struct i40e_vsi *vsi,int on);static inline int i40e_find_all_mac_for_vlan (struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, @@ -398,6 +397,7 @@ static void i40e_ethertype_filter_restore(struct i40e_pf *pf); static void i40e_tunnel_filter_restore(struct i40e_pf *pf); static void i40e_filter_restore(struct i40e_pf *pf); static void i40e_notify_all_vfs_link_status(struct rte_eth_dev *dev); +static int i40e_pf_config_rss (struct i40e_pf *pf);static const char *const valid_keys[] = {ETH_I40E_FLOATING_VEB_ARG ,
@@ -1954,7 +1954,7 @@ i40e_dev_configure(struct rte_eth_dev *dev) goto err;/* VMDQ setup. -* Needs to move VMDQ setting out of i40e_pf_config_mq_rx() as VMDQ and +* Needs to move VMDQ setting out of i40e_pf_config_rss() as VMDQ and * RSS setting have different requirements. * General PMD driver call sequence are NIC init, configure, * rx/tx_queue_setup and dev_start. In rx/tx_queue_setup() function, it @@ -6478,7 +6478,7 @@ i40e_dev_rx_init(struct i40e_pf *pf)
uint16_t i;
struct i40e_rx_queue *rxq;
- i40e_pf_config_mq_rx(pf);
+ i40e_pf_config_rss(pf);
for (i = 0; i < data->nb_rx_queues; i++) {
rxq = data->rx_queues[i];
if (!rxq || !rxq->q_set)
@@ -8984,6 +8984,7 @@ i40e_pf_calc_configured_queues_num(struct i40e_pf *pf) static int i40e_pf_config_rss(struct i40e_pf *pf) {
+ enum rte_eth_rx_mq_mode mq_mode =
+pf->dev_data->dev_conf.rxmode.mq_mode;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
struct rte_eth_rss_conf rss_conf;
uint32_t i, lut = 0;
@@ -9022,7 +9023,8 @@ i40e_pf_config_rss(struct i40e_pf *pf)
}
rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
- if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) == 0) {
+ if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) == 0 ||
+ !(mq_mode & ETH_MQ_RX_RSS_FLAG)) {
i40e_pf_disable_rss(pf);
return 0;
}
@@ -9195,21 +9197,6 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev,
return ret;
}
-static int
-i40e_pf_config_mq_rx(struct i40e_pf *pf) -{
- int ret = 0;
- enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;
-
- /* RSS setup */
- if (mq_mode & ETH_MQ_RX_RSS_FLAG)
- ret = i40e_pf_config_rss(pf);
- else
- i40e_pf_disable_rss(pf);
-
- return ret;
-}
-
/* Get the symmetric hash enable configurations per port */ static void i40e_get_symmetric_hash_enable_per_port(struct i40e_hw *hw, uint8_t *enable)
--
2.17.1
PATCH v6 1/1 net/i40e: fix incorrect hash look up table
In reply to Shougang WangThe hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whatever RSS enabled or not.
---
v6:
-Remove useless comment.
drivers/net/i40e/i40e_ethdev.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-)
drivers/net/i40e/i40e_ethdev.c +5 -20
@@ -302,7 +302,6 @@ static int i40e_dev_init_vlan(struct rte_eth_dev *dev);static int i40e_veb_release (struct i40e_veb *veb);static struct i40e_veb *i40e_veb_setup (struct i40e_pf *pf,struct i40e_vsi *vsi); -static int i40e_pf_config_mq_rx (struct i40e_pf *pf);static int i40e_vsi_config_double_vlan (struct i40e_vsi *vsi,int on); static inline int i40e_find_all_mac_for_vlan(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f,
@@ -398,6 +397,7 @@ static void i40e_ethertype_filter_restore(struct i40e_pf *pf);static void i40e_tunnel_filter_restore (struct i40e_pf *pf);static void i40e_filter_restore (struct i40e_pf *pf);static void i40e_notify_all_vfs_link_status (struct rte_eth_dev *dev); +static int i40e_pf_config_rss (struct i40e_pf *pf);static const char *const valid_keys[] = {ETH_I40E_FLOATING_VEB_ARG ,
@@ -1954,8 +1954,6 @@ i40e_dev_configure(struct rte_eth_dev *dev) goto err;/* VMDQ setup. -* Needs to move VMDQ setting out of i40e_pf_config_mq_rx() as VMDQ and -* RSS setting have different requirements. * General PMD driver call sequence are NIC init, configure, * rx/tx_queue_setup and dev_start. In rx/tx_queue_setup() function, it * will try to lookup the VSI that specific queue belongs to if VMDQ
@@ -6478,7 +6476,7 @@ i40e_dev_rx_init(struct i40e_pf *pf)uint16_t i;struct i40e_rx_queue *rxq; -i40e_pf_config_mq_rx (pf); +i40e_pf_config_rss (pf);for (i =0 ; i < data->nb_rx_queues; i++) { rxq = data->rx_queues[i];if (!rxq || !rxq->q_set)
@@ -8984,6 +8982,7 @@ i40e_pf_calc_configured_queues_num(struct i40e_pf *pf)static int i40e_pf_config_rss (struct i40e_pf *pf) { +enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_hw *hw =I40E_PF_TO_HW (pf);struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;
@@ -9022,7 +9021,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }
@@ -9195,21 +9195,6 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev,return ret; } -static int -i40e_pf_config_mq_rx (struct i40e_pf *pf) -{ -int ret =0 ; -enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode; - -/* RSS setup */ -if (mq_mode Ð_MQ_RX_RSS_FLAG ) - ret =i40e_pf_config_rss (pf); -else -i40e_pf_disable_rss (pf); - -return ret; -} -/* Get the symmetric hash enable configurations per port */ static void i40e_get_symmetric_hash_enable_per_port (struct i40e_hw *hw,uint8_t *enable)
Signature · 1 line
2.17.1
Quoted 95 lines · Shougang Wang
The hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whatever RSS enabled or not.Fixes feaae285b342 ("net/i40e: support hash configuration in RSS flow")Signed-off-by Shougang Wang <[email protected]>Tested-by Zhang, XiX <[email protected]>---
v6:(quoted diff) +0
-1-Remove useless comment. drivers/net/i40e/i40e_ethdev.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-)drivers/net/i40e/i40e_ethdev.c +5
-20@@ -302,7 +302,6 @@ static int i40e_dev_init_vlan(struct rte_eth_dev *dev);static int i40e_veb_release (struct i40e_veb *veb);static struct i40e_veb *i40e_veb_setup (struct i40e_pf *pf,struct i40e_vsi *vsi); -static int i40e_pf_config_mq_rx (struct i40e_pf *pf);static int i40e_vsi_config_double_vlan (struct i40e_vsi *vsi,int on); static inline int i40e_find_all_mac_for_vlan(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f,@@ -398,6 +397,7 @@ static void i40e_ethertype_filter_restore(struct i40e_pf *pf);static void i40e_tunnel_filter_restore (struct i40e_pf *pf);static void i40e_filter_restore (struct i40e_pf *pf);static void i40e_notify_all_vfs_link_status (struct rte_eth_dev *dev); +static int i40e_pf_config_rss (struct i40e_pf *pf);static const char *const valid_keys[] = {ETH_I40E_FLOATING_VEB_ARG ,@@ -1954,8 +1954,6 @@ i40e_dev_configure(struct rte_eth_dev *dev) goto err;/* VMDQ setup. -* Needs to move VMDQ setting out of i40e_pf_config_mq_rx() as VMDQ and -* RSS setting have different requirements. * General PMD driver call sequence are NIC init, configure, * rx/tx_queue_setup and dev_start. In rx/tx_queue_setup() function, it * will try to lookup the VSI that specific queue belongs to if VMDQ @@ -6478,7 +6476,7 @@ i40e_dev_rx_init(struct i40e_pf *pf)uint16_t i;struct i40e_rx_queue *rxq; -i40e_pf_config_mq_rx (pf); +i40e_pf_config_rss (pf);for (i =0 ; i < data->nb_rx_queues; i++) { rxq = data->rx_queues[i];if (!rxq || !rxq->q_set)@@ -8984,6 +8982,7 @@ i40e_pf_calc_configured_queues_num(struct i40e_pf *pf)static int i40e_pf_config_rss (struct i40e_pf *pf) { +enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode;struct i40e_hw *hw =I40E_PF_TO_HW (pf);struct rte_eth_rss_conf rss_conf;uint32_t i, lut =0 ;@@ -9022,7 +9021,8 @@ i40e_pf_config_rss(struct i40e_pf *pf) } rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf; -if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 ) { +if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) ==0 || + !(mq_mode Ð_MQ_RX_RSS_FLAG )) {i40e_pf_disable_rss (pf);return 0 ; }@@ -9195,21 +9195,6 @@ i40e_tunnel_filter_handle(struct rte_eth_dev *dev,return ret; } -static int -i40e_pf_config_mq_rx (struct i40e_pf *pf) -{ -int ret =0 ; -enum rte_eth_rx_mq_mode mq_mode = pf->dev_data->dev_conf.rxmode.mq_mode; - -/* RSS setup */ -if (mq_mode Ð_MQ_RX_RSS_FLAG ) - ret =i40e_pf_config_rss (pf); -else -i40e_pf_disable_rss (pf); - -return ret; -} -/* Get the symmetric hash enable configurations per port */ static void i40e_get_symmetric_hash_enable_per_port (struct i40e_hw *hw,uint8_t *enable)
Zhang, Qi Z
AppliedQuoted 10 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Jeff Guo
Sent: Friday, July 24, 2020 5:55 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v6] net/i40e: fix incorrect hash look up table
Quoted 15 lines
Acked-by Jeff Guo <[email protected]>Quoted 12 lines · Shougang Wang
The hash look up table (LUT) is managed by global register but it is not initialized when RSS is disabled. Once user wants to enable RSS during runtime, the LUT will not be initialized.
This patch fixes the issue by initializing the LUT whatever RSS enabled or not.Fixes feaae285b342 ("net/i40e: support hash configuration in RSSflow")
Cc: [email protected]Signed-off-by Shougang Wang <[email protected]>Tested-by Zhang, XiX <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi