Skip to contentSkip to conversation

net/ixgbe: clear registers of all queues on VF reset

PATCH Applied Simon Ellmann 4 participants 8 messages Dec 17, 2020 – Jan 5, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

---
 drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_vf.c +1 -1
index 91a5775eb..5e3ae1b51 100644
@@ -84,7 +84,7 @@ static void ixgbe_virt_clr_reg(struct ixgbe_hw *hw)
 
 	IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0);
 
-	for (i = 0; i < 7; i++) {
+	for (i = 0; i < 8; i++) {
 		IXGBE_WRITE_REG(hw, IXGBE_VFRDH(i), 0);
 		IXGBE_WRITE_REG(hw, IXGBE_VFRDT(i), 0);
 		IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), 0);
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Simon Ellmann <[email protected]>
Sent: Friday, December 18, 2020 01:15
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Simon Ellmann <[email protected]>
Subject: [PATCH] net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

Fixes d17d0b7a2407 ("ixgbe/base: reset VF registers")
Quoted 5 lines
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Good catch, thanks!

Quoted 2 lines

--
2.29.2

Applied
#2 lore raw
Quoted 31 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Wang, Haiyue
Sent: Friday, December 18, 2020 10:35 AM
To: Simon Ellmann <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: clear registers of all queues on VF reset

Quoted 11 lines

-----Original Message-----
From: Simon Ellmann <[email protected]>
Sent: Friday, December 18, 2020 01:15
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Simon Ellmann <[email protected]>
Subject: [PATCH] net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

Fixes d17d0b7a2407 ("ixgbe/base: reset VF registers")
Quoted 5 lines
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 3 lines

Good catch, thanks!

Applied to dpdk-next-net-intel.

Thanks
Qi

Quoted 3 lines
Quoted 3 lines

--
2.29.2

#3 lore raw
In reply to Wang, Haiyue
Quoted 21 lines · Haiyue
Quoted 11 lines

-----Original Message-----
From: Simon Ellmann <[email protected]>
Sent: Friday, December 18, 2020 01:15
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Simon Ellmann <[email protected]>
Subject: [PATCH] net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

Fixes d17d0b7a2407 ("ixgbe/base: reset VF registers")
Quoted 5 lines
---
  drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines

Good catch, thanks!

This seems a very long lived defect, I am just suspicious if there was a reason to limit queue number to 7.

Simon,

How did you find the defect? And did you test/verify it with the update? (assuming you are using all 8 queues for the VF)

#4 lore raw
Quoted 27 lines · Ferruh Yigit
Quoted 21 lines · Haiyue
Quoted 11 lines

-----Original Message-----
From: Simon Ellmann <[email protected]>
Sent: Friday, December 18, 2020 01:15
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Simon Ellmann <[email protected]>
Subject: [PATCH] net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

Fixes d17d0b7a2407 ("ixgbe/base: reset VF registers")
Quoted 5 lines

---
  drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines

Good catch, thanks!

Quoted 6 lines

This seems a very long lived defect, I am just suspicious if there was a reason to limit queue number to 7.

Simon,

How did you find the defect? And did you test/verify it with the update? (assuming you are using all 8 queues for the VF)

Hi Ferruh,

I was implementing ixgbevf for ixy.rs (https://ixy.rs/) by reading the code in DPDK and Linux. While doing that I noticed that DPDK was only resetting 7 queues which looked like a off-by-one error to me. I would have expected a comment if this behaviour was intentional. I haven't checked the update.

Simon

#5 lore raw
Quoted 32 lines · Simon Ellmann
Quoted 30 lines · Ferruh Yigit
Quoted 21 lines · Haiyue
Quoted 11 lines

-----Original Message-----
From: Simon Ellmann <[email protected]>
Sent: Friday, December 18, 2020 01:15
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Simon Ellmann <[email protected]>
Subject: [PATCH] net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

Fixes d17d0b7a2407 ("ixgbe/base: reset VF registers")
Quoted 5 lines

---
  drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines

Good catch, thanks!

This seems a very long lived defect, I am just suspicious if there was a reason to limit queue number to 7.

Quoted 8 lines
Quoted 3 lines

Simon,

How did you find the defect? And did you test/verify it with the update? (assuming you are using all 8 queues for the VF)

Hi Ferruh,

I was implementing ixgbevf for ixy.rs (https://ixy.rs/) by reading the code in DPDK and Linux. While doing that I noticed that DPDK was only resetting 7 queues which looked like a off-by-one error to me. I would have expected a comment if this behaviour was intentional. I haven't checked the update.

Most probably you are right, but when I tried to test this, the HW I have doesn't let me set more than 4 queues for the VF, so I was a little suspicious about hardcoded 8 value.

What do you think using 'hw->mac.max_rx_queues' instead? Which seems used a few other places to walk the queues?

Also can you please point the equivalent code in the Linux driver? As far as I can see it also uses 'adapter->num_rx_queues', but I wonder if is there any hardcoded value there.

#6 lore raw
Quoted 59 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, January 5, 2021 18:30
To: Simon Ellmann <[email protected]>; Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: clear registers of all queues on VF reset

Quoted 38 lines · Simon Ellmann
Quoted 27 lines · Ferruh Yigit
Quoted 21 lines · Haiyue
Quoted 11 lines

-----Original Message-----
From: Simon Ellmann <[email protected]>
Sent: Friday, December 18, 2020 01:15
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Simon Ellmann <[email protected]>
Subject: [PATCH] net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

Fixes d17d0b7a2407 ("ixgbe/base: reset VF registers")
Quoted 5 lines

---
  drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines

Good catch, thanks!

Quoted 8 lines

This seems a very long lived defect, I am just suspicious if there was a reason to limit queue number to 7.

Simon,

How did you find the defect? And did you test/verify it with the update? (assuming you are using all 8 queues for the VF)

Quoted 7 lines

Hi Ferruh,

I was implementing ixgbevf for ixy.rs (https://ixy.rs/) by reading the code in DPDK and Linux. While doing that I noticed that DPDK was only resetting 7 queues which looked like a off-by-one error to me. I would have expected a comment if this behaviour was intentional. I haven't checked the update.

Most probably you are right, but when I tried to test this, the HW I have doesn't let me set more than 4 queues for the VF, so I was a little suspicious about hardcoded 8 value.

Quoted 7 lines

What do you think using 'hw->mac.max_rx_queues' instead? Which seems used a few other places to walk the queues?

Also can you please point the equivalent code in the Linux driver? As far as I can see it also uses 'adapter->num_rx_queues', but I wonder if is there any hardcoded value there.

I found the original detail log:

----
ixgbevf: Clear VF registers we are required to configure anyway after VFLR

This function resets just about any register that could "possibly leak" any information from one VM instance to another. The registers set it is returning to initial values is the same as those we are required to reconfigure after a VFLR anyway. So this shouldn't affect any driver that is doing what it is suppose to.

----

Also, the datasheet says it is '0 ... 7'

Receive DMA Registers,

0x01000 + 0x40*n, n=0...7 VFRDBAL ...

So it should be safe to uses '8' to reset the VF hardware BAR0 information. The 'hw->mac.max_rx_queues' is about the software resource allocation in PF.

#7 lore raw
Quoted 80 lines · Haiyue
Quoted 59 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, January 5, 2021 18:30
To: Simon Ellmann <[email protected]>; Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: clear registers of all queues on VF reset

Quoted 38 lines · Simon Ellmann
Quoted 27 lines · Ferruh Yigit
Quoted 21 lines · Haiyue
Quoted 11 lines

-----Original Message-----
From: Simon Ellmann <[email protected]>
Sent: Friday, December 18, 2020 01:15
To: Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Cc: [email protected]; Simon Ellmann <[email protected]>
Subject: [PATCH] net/ixgbe: clear registers of all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF.

Fixes d17d0b7a2407 ("ixgbe/base: reset VF registers")
Quoted 5 lines
---
   drivers/net/ixgbe/base/ixgbe_vf.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines

Good catch, thanks!

Quoted 8 lines

This seems a very long lived defect, I am just suspicious if there was a reason to limit queue number to 7.

Simon,

How did you find the defect? And did you test/verify it with the update? (assuming you are using all 8 queues for the VF)

Quoted 7 lines

Hi Ferruh,

I was implementing ixgbevf for ixy.rs (https://ixy.rs/) by reading the code in DPDK and Linux. While doing that I noticed that DPDK was only resetting 7 queues which looked like a off-by-one error to me. I would have expected a comment if this behaviour was intentional. I haven't checked the update.

Most probably you are right, but when I tried to test this, the HW I have doesn't let me set more than 4 queues for the VF, so I was a little suspicious about hardcoded 8 value.

Quoted 7 lines

What do you think using 'hw->mac.max_rx_queues' instead? Which seems used a few other places to walk the queues?

Also can you please point the equivalent code in the Linux driver? As far as I can see it also uses 'adapter->num_rx_queues', but I wonder if is there any hardcoded value there.

I found the original detail log:

----
ixgbevf: Clear VF registers we are required to configure anyway after VFLR

This function resets just about any register that could "possibly leak" any information from one VM instance to another. The registers set it is returning to initial values is the same as those we are required to reconfigure after a VFLR anyway. So this shouldn't affect any driver that is doing what it is suppose to.

----

Quoted 9 lines

Also, the datasheet says it is '0 ... 7'

Receive DMA Registers,

0x01000 + 0x40*n, n=0...7 VFRDBAL ...

So it should be safe to uses '8' to reset the VF hardware BAR0 information. The 'hw->mac.max_rx_queues' is about the software resource allocation in PF.

Thanks Haiuye for the clarification, so I will proceed with the patch.