[RFC] app/testpmd: use RSS conf from software when configuring DCB

Message ID 20230412095239.1709477-1-zhoumin@loongson.cn (mailing list archive)
State New
Delegated to: Ferruh Yigit
Headers
Series [RFC] app/testpmd: use RSS conf from software when configuring DCB |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Min Zhou April 12, 2023, 9:52 a.m. UTC
  In the testpmd command, we have to stop the port firstly before configuring
the DCB. However, some PMDs may execute a hardware reset during the port
stop, such as ixgbe. Some kind of reset operations of PMD could clear the
configurations of RSS in the hardware register. This would cause the loss
of RSS configurations that were set during the testpmd initialization. As
a result, I find that I cannot enable RSS and DCB at the same time in the
testpmd command when using Intel 82599 NIC.

Although this patch can solve the problem I encountered, is there any risk
of using rss conf from software instead of reading from the hardware
register when configuring DCB?

Signed-off-by: Min Zhou <zhoumin@loongson.cn>
---
 app/test-pmd/testpmd.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
  

Comments

Min Zhou April 27, 2023, 8:33 a.m. UTC | #1
Kindly ping.

Any comments or suggestions will be appreciated.

Best regards
Min


On 2023/4/12 下午5:52, Min Zhou wrote:
> In the testpmd command, we have to stop the port firstly before configuring
> the DCB. However, some PMDs may execute a hardware reset during the port
> stop, such as ixgbe. Some kind of reset operations of PMD could clear the
> configurations of RSS in the hardware register. This would cause the loss
> of RSS configurations that were set during the testpmd initialization. As
> a result, I find that I cannot enable RSS and DCB at the same time in the
> testpmd command when using Intel 82599 NIC.
>
> Although this patch can solve the problem I encountered, is there any risk
> of using rss conf from software instead of reading from the hardware
> register when configuring DCB?
>
> Signed-off-by: Min Zhou <zhoumin@loongson.cn>
> ---
>   app/test-pmd/testpmd.c | 11 +----------
>   1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 5cb6f92523..3c382267b8 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -4247,14 +4247,12 @@ const uint16_t vlan_tags[] = {
>   };
>   
>   static  int
> -get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
> +get_eth_dcb_conf(portid_t pid __rte_unused, struct rte_eth_conf *eth_conf,
>   		 enum dcb_mode_enable dcb_mode,
>   		 enum rte_eth_nb_tcs num_tcs,
>   		 uint8_t pfc_en)
>   {
>   	uint8_t i;
> -	int32_t rc;
> -	struct rte_eth_rss_conf rss_conf;
>   
>   	/*
>   	 * Builds up the correct configuration for dcb+vt based on the vlan tags array
> @@ -4296,12 +4294,6 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
>   		struct rte_eth_dcb_tx_conf *tx_conf =
>   				&eth_conf->tx_adv_conf.dcb_tx_conf;
>   
> -		memset(&rss_conf, 0, sizeof(struct rte_eth_rss_conf));
> -
> -		rc = rte_eth_dev_rss_hash_conf_get(pid, &rss_conf);
> -		if (rc != 0)
> -			return rc;
> -
>   		rx_conf->nb_tcs = num_tcs;
>   		tx_conf->nb_tcs = num_tcs;
>   
> @@ -4313,7 +4305,6 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
>   		eth_conf->rxmode.mq_mode =
>   				(enum rte_eth_rx_mq_mode)
>   					(rx_mq_mode & RTE_ETH_MQ_RX_DCB_RSS);
> -		eth_conf->rx_adv_conf.rss_conf = rss_conf;
>   		eth_conf->txmode.mq_mode = RTE_ETH_MQ_TX_DCB;
>   	}
>
  
Min Zhou May 8, 2023, 1:21 a.m. UTC | #2
Kindly ping.

Should we solve this problem by modifying PMDs?

Is it suitable to maintain the RSS configurations for NIC by testpmd in 
order to set DCB?


On Thur, Apr 27, 2023 at 4:33PM, zhoumin wrote:
> Kindly ping.
>
> Any comments or suggestions will be appreciated.
>
> Best regards
> Min
>
>
> On 2023/4/12 下午5:52, Min Zhou wrote:
>> In the testpmd command, we have to stop the port firstly before 
>> configuring
>> the DCB. However, some PMDs may execute a hardware reset during the port
>> stop, such as ixgbe. Some kind of reset operations of PMD could clear 
>> the
>> configurations of RSS in the hardware register. This would cause the 
>> loss
>> of RSS configurations that were set during the testpmd 
>> initialization. As
>> a result, I find that I cannot enable RSS and DCB at the same time in 
>> the
>> testpmd command when using Intel 82599 NIC.
>>
>> Although this patch can solve the problem I encountered, is there any 
>> risk
>> of using rss conf from software instead of reading from the hardware
>> register when configuring DCB?
>>
>> Signed-off-by: Min Zhou <zhoumin@loongson.cn>
>> ---
>>   app/test-pmd/testpmd.c | 11 +----------
>>   1 file changed, 1 insertion(+), 10 deletions(-)
>>
>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>> index 5cb6f92523..3c382267b8 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -4247,14 +4247,12 @@ const uint16_t vlan_tags[] = {
>>   };
>>     static  int
>> -get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
>> +get_eth_dcb_conf(portid_t pid __rte_unused, struct rte_eth_conf 
>> *eth_conf,
>>            enum dcb_mode_enable dcb_mode,
>>            enum rte_eth_nb_tcs num_tcs,
>>            uint8_t pfc_en)
>>   {
>>       uint8_t i;
>> -    int32_t rc;
>> -    struct rte_eth_rss_conf rss_conf;
>>         /*
>>        * Builds up the correct configuration for dcb+vt based on the 
>> vlan tags array
>> @@ -4296,12 +4294,6 @@ get_eth_dcb_conf(portid_t pid, struct 
>> rte_eth_conf *eth_conf,
>>           struct rte_eth_dcb_tx_conf *tx_conf =
>>                   &eth_conf->tx_adv_conf.dcb_tx_conf;
>>   -        memset(&rss_conf, 0, sizeof(struct rte_eth_rss_conf));
>> -
>> -        rc = rte_eth_dev_rss_hash_conf_get(pid, &rss_conf);
>> -        if (rc != 0)
>> -            return rc;
>> -
>>           rx_conf->nb_tcs = num_tcs;
>>           tx_conf->nb_tcs = num_tcs;
>>   @@ -4313,7 +4305,6 @@ get_eth_dcb_conf(portid_t pid, struct 
>> rte_eth_conf *eth_conf,
>>           eth_conf->rxmode.mq_mode =
>>                   (enum rte_eth_rx_mq_mode)
>>                       (rx_mq_mode & RTE_ETH_MQ_RX_DCB_RSS);
>> -        eth_conf->rx_adv_conf.rss_conf = rss_conf;
>>           eth_conf->txmode.mq_mode = RTE_ETH_MQ_TX_DCB;
>>       }

Best regards,

Min
  
Ferruh Yigit June 6, 2023, 6:09 p.m. UTC | #3
On 5/8/2023 2:21 AM, zhoumin wrote:
> Kindly ping.
> 

Hi Min,

Sorry for the delay.

> Should we solve this problem by modifying PMDs?
> 
> Is it suitable to maintain the RSS configurations for NIC by testpmd in
> order to set DCB?
> 
> 
> On Thur, Apr 27, 2023 at 4:33PM, zhoumin wrote:
>> Kindly ping.
>>
>> Any comments or suggestions will be appreciated.
>>
>> Best regards
>> Min
>>
>>
>> On 2023/4/12 下午5:52, Min Zhou wrote:
>>> In the testpmd command, we have to stop the port firstly before
>>> configuring
>>> the DCB. However, some PMDs may execute a hardware reset during the port
>>> stop, such as ixgbe. Some kind of reset operations of PMD could clear
>>> the
>>> configurations of RSS in the hardware register. This would cause the
>>> loss
>>> of RSS configurations that were set during the testpmd
>>> initialization. As
>>> a result, I find that I cannot enable RSS and DCB at the same time in
>>> the
>>> testpmd command when using Intel 82599 NIC.
>>>

cc'ed ixgbe maintainers too.

@Qiming, @Wenjun, are you testing DCB with RSS configuration?


Min,

Can you please give more detail on the problem, do you have in only on
device reset, or is there a generic problem on enabling DCB with RSS?

Also can you please describe how/why removing RSS configuration (this
patch) helps on the problem?

Thanks,
ferruh


>>> Although this patch can solve the problem I encountered, is there any
>>> risk
>>> of using rss conf from software instead of reading from the hardware
>>> register when configuring DCB?
>>>
>>> Signed-off-by: Min Zhou <zhoumin@loongson.cn>
>>> ---
>>>   app/test-pmd/testpmd.c | 11 +----------
>>>   1 file changed, 1 insertion(+), 10 deletions(-)
>>>
>>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>>> index 5cb6f92523..3c382267b8 100644
>>> --- a/app/test-pmd/testpmd.c
>>> +++ b/app/test-pmd/testpmd.c
>>> @@ -4247,14 +4247,12 @@ const uint16_t vlan_tags[] = {
>>>   };
>>>     static  int
>>> -get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
>>> +get_eth_dcb_conf(portid_t pid __rte_unused, struct rte_eth_conf
>>> *eth_conf,
>>>            enum dcb_mode_enable dcb_mode,
>>>            enum rte_eth_nb_tcs num_tcs,
>>>            uint8_t pfc_en)
>>>   {
>>>       uint8_t i;
>>> -    int32_t rc;
>>> -    struct rte_eth_rss_conf rss_conf;
>>>         /*
>>>        * Builds up the correct configuration for dcb+vt based on the
>>> vlan tags array
>>> @@ -4296,12 +4294,6 @@ get_eth_dcb_conf(portid_t pid, struct
>>> rte_eth_conf *eth_conf,
>>>           struct rte_eth_dcb_tx_conf *tx_conf =
>>>                   &eth_conf->tx_adv_conf.dcb_tx_conf;
>>>   -        memset(&rss_conf, 0, sizeof(struct rte_eth_rss_conf));
>>> -
>>> -        rc = rte_eth_dev_rss_hash_conf_get(pid, &rss_conf);
>>> -        if (rc != 0)
>>> -            return rc;
>>> -
>>>           rx_conf->nb_tcs = num_tcs;
>>>           tx_conf->nb_tcs = num_tcs;
>>>   @@ -4313,7 +4305,6 @@ get_eth_dcb_conf(portid_t pid, struct
>>> rte_eth_conf *eth_conf,
>>>           eth_conf->rxmode.mq_mode =
>>>                   (enum rte_eth_rx_mq_mode)
>>>                       (rx_mq_mode & RTE_ETH_MQ_RX_DCB_RSS);
>>> -        eth_conf->rx_adv_conf.rss_conf = rss_conf;
>>>           eth_conf->txmode.mq_mode = RTE_ETH_MQ_TX_DCB;
>>>       }
> 
> Best regards,
> 
> Min
>
  
Min Zhou June 14, 2023, 2:22 a.m. UTC | #4
Hi Ferruh,

On Wed, June 7, 2023 at 2:09AM, Ferruh Yigit wrote:
> On 5/8/2023 2:21 AM, zhoumin wrote:
>> Kindly ping.
>>
> Hi Min,
>
> Sorry for the delay.
>
>> Should we solve this problem by modifying PMDs?
>>
>> Is it suitable to maintain the RSS configurations for NIC by testpmd in
>> order to set DCB?
>>
>>
>> On Thur, Apr 27, 2023 at 4:33PM, zhoumin wrote:
>>> Kindly ping.
>>>
>>> Any comments or suggestions will be appreciated.
>>>
>>> Best regards
>>> Min
>>>
>>>
>>> On 2023/4/12 下午5:52, Min Zhou wrote:
>>>> In the testpmd command, we have to stop the port firstly before
>>>> configuring
>>>> the DCB. However, some PMDs may execute a hardware reset during the port
>>>> stop, such as ixgbe. Some kind of reset operations of PMD could clear
>>>> the
>>>> configurations of RSS in the hardware register. This would cause the
>>>> loss
>>>> of RSS configurations that were set during the testpmd
>>>> initialization. As
>>>> a result, I find that I cannot enable RSS and DCB at the same time in
>>>> the
>>>> testpmd command when using Intel 82599 NIC.
>>>>
> cc'ed ixgbe maintainers too.
OK, thanks.
>
> @Qiming, @Wenjun, are you testing DCB with RSS configuration?
>
>
> Min,
>
> Can you please give more detail on the problem, do you have in only on
> device reset, or is there a generic problem on enabling DCB with RSS?

Yes, I will give more details on the problem blow.

I think it is not a generic problem on enabling DCB with RSS. It depends 
on the implementation of "port stop" in the driver's codes. I can 
successfully enable DCB with RSS in the testpmd when it uses the i40e 
driver.

It's very easy to reproduce this problem. I will demonstrate the process 
below:

1. First we start the testpmd program with enabling  RSS using 82599 NICs:

$ ./build/app/dpdk-testpmd -l 0-6 -- -i --rss-ip --rxq=6 --txq=6 
--nb-cores=6

2. Then show the RSS configuration in the testpmd:

testpmd> show port 0 rss-hash

RSS functions:
   ipv4  ipv6  ipv6-ex

3. The above outputs are normal and then we try to enable DCB:

testpmd> port config 0 dcb vt off 4 pfc on
Please stop port 0 first

4. So we have to stop the port before enabling DCB:

testpmd> port stop 0
Stopping ports...
Checking link statuses...
ixgbe_dev_link_update_share(): Other link thread is running now!
Done

5. However, we will find that the RSS was disabled after stopping the port:

testpmd> show port 0 rss-hash
RSS disabled


RSS is enabled in the MRQC register of 82599. The MRQC register supplied 
in section 8.2.3.7.12 of the Intel 82599 datasheet.

I added some outputs before and after port reset in the port stop 
process of ixgbe driver as follows:

diff --git a/drivers/net/ixgbe/base/ixgbe_82599.c 
b/drivers/net/ixgbe/base/ixgbe_82599.c
index c6e8b7e976..b13431a43f 100644
--- a/drivers/net/ixgbe/base/ixgbe_82599.c
+++ b/drivers/net/ixgbe/base/ixgbe_82599.c
@@ -1053,6 +1053,7 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
                 if (link_up)
                         ctrl = IXGBE_CTRL_RST;
         }
+       printf("%s: MRQC = 0x%x\n", __func__, IXGBE_READ_REG(hw, 
IXGBE_MRQC));

         ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
         IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
@@ -1065,6 +1066,7 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
                 if (!(ctrl & IXGBE_CTRL_RST_MASK))
                         break;
         }
+       printf("%s: MRQC = 0x%x\n", __func__, IXGBE_READ_REG(hw, 
IXGBE_MRQC));

         if (ctrl & IXGBE_CTRL_RST_MASK) {
                 status = IXGBE_ERR_RESET_FAILED;

We could find that the RSS configurations will be cleared after port 
reset as follows:

testpmd> port stop 0
Stopping ports...
ixgbe_reset_hw_82599: MRQC = 0x1a0001
ixgbe_reset_hw_82599: MRQC = 0x0
Checking link statuses...
ixgbe_dev_link_update_share(): Other link thread is running now!
Done

However, I have not find the exact descriptions about this behavior in 
the 82599 datasheet. Could @Qiming, @Wenjun give me some indications ?

So, if we want to get the RSS configurations by reading from the 
register after the port stop, we will get nothing.

> Also can you please describe how/why removing RSS configuration (this
> patch) helps on the problem?

As above said, I'm concerned whether we could reuse the RSS 
configurations recorded in the testpmd if the port reset cannot be 
avoided in the driver.

So, this patch wants to reuse the RSS configurations maintained by 
testpmd instead of reading from the register.

I'm not sure if this is a reasonable method to solve this problem.

> Thanks,
> ferruh

[...]

Best regards,

Min
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5cb6f92523..3c382267b8 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4247,14 +4247,12 @@  const uint16_t vlan_tags[] = {
 };
 
 static  int
-get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
+get_eth_dcb_conf(portid_t pid __rte_unused, struct rte_eth_conf *eth_conf,
 		 enum dcb_mode_enable dcb_mode,
 		 enum rte_eth_nb_tcs num_tcs,
 		 uint8_t pfc_en)
 {
 	uint8_t i;
-	int32_t rc;
-	struct rte_eth_rss_conf rss_conf;
 
 	/*
 	 * Builds up the correct configuration for dcb+vt based on the vlan tags array
@@ -4296,12 +4294,6 @@  get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
 		struct rte_eth_dcb_tx_conf *tx_conf =
 				&eth_conf->tx_adv_conf.dcb_tx_conf;
 
-		memset(&rss_conf, 0, sizeof(struct rte_eth_rss_conf));
-
-		rc = rte_eth_dev_rss_hash_conf_get(pid, &rss_conf);
-		if (rc != 0)
-			return rc;
-
 		rx_conf->nb_tcs = num_tcs;
 		tx_conf->nb_tcs = num_tcs;
 
@@ -4313,7 +4305,6 @@  get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
 		eth_conf->rxmode.mq_mode =
 				(enum rte_eth_rx_mq_mode)
 					(rx_mq_mode & RTE_ETH_MQ_RX_DCB_RSS);
-		eth_conf->rx_adv_conf.rss_conf = rss_conf;
 		eth_conf->txmode.mq_mode = RTE_ETH_MQ_TX_DCB;
 	}