From: Dean Nelson <hidden> Date: 2018-02-08 19:21:06
The Cavium thunder nicvf driver supports rx/tx rings of up to 65536 entries per.
The number of entires are stored in the q_len member of struct q_desc_mem. The
problem is that q_len being a u16, results in 65536 becoming 0.
In getting pointers to descriptors in the rings, the driver uses q_len minus 1
as a mask after incrementing the pointer, in order to go back to the beginning
and not go past the end of the ring.
With the q_len set to 0 the mask is no longer correct and the driver does go
beyond the end of the ring, causing various ills. Usually the first thing that
shows up is a "NETDEV WATCHDOG: enP2p1s0f1 (nicvf): transmit queue 7 timed out"
warning.
This patch remedies the problem by changing q_len to a u32.
Signed-off-by: Dean Nelson <redacted>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: David Miller <davem@davemloft.net> Date: 2018-02-08 20:34:57
From: Dean Nelson <redacted>
Date:
The Cavium thunder nicvf driver supports rx/tx rings of up to 65536 entries per.
The number of entires are stored in the q_len member of struct q_desc_mem. The
problem is that q_len being a u16, results in 65536 becoming 0.
In getting pointers to descriptors in the rings, the driver uses q_len minus 1
as a mask after incrementing the pointer, in order to go back to the beginning
and not go past the end of the ring.
With the q_len set to 0 the mask is no longer correct and the driver does go
beyond the end of the ring, causing various ills. Usually the first thing that
shows up is a "NETDEV WATCHDOG: enP2p1s0f1 (nicvf): transmit queue 7 timed out"
warning.
This patch remedies the problem by changing q_len to a u32.
Signed-off-by: Dean Nelson <redacted>
Applied, thanks.
Another way to solve this could have been to encode that length
as "length - 1"
From: Dean Nelson <hidden> Date: 2018-02-08 21:57:24
On 02/08/2018 02:34 PM, David Miller wrote:
From: Dean Nelson <redacted>
Date:
quoted
The Cavium thunder nicvf driver supports rx/tx rings of up to 65536 entries per.
The number of entires are stored in the q_len member of struct q_desc_mem. The
problem is that q_len being a u16, results in 65536 becoming 0.
In getting pointers to descriptors in the rings, the driver uses q_len minus 1
as a mask after incrementing the pointer, in order to go back to the beginning
and not go past the end of the ring.
With the q_len set to 0 the mask is no longer correct and the driver does go
beyond the end of the ring, causing various ills. Usually the first thing that
shows up is a "NETDEV WATCHDOG: enP2p1s0f1 (nicvf): transmit queue 7 timed out"
warning.
This patch remedies the problem by changing q_len to a u32.
Signed-off-by: Dean Nelson <redacted>
Applied, thanks.
Thank you!
Another way to solve this could have been to encode that length
as "length - 1"
True. I had pondered that, but felt that since changing q_len's type
didn't add any length to the structure and that it was less impactful
from a number-of-lines of code changed perspective, I'd opt for this
route.
Cavium, if you'd prefer this goes the route that Dave just mentioned,
please let me know and I can make a new patch against what's been
applied?
Thanks,
Dean
On Fri, Feb 9, 2018 at 3:27 AM, Dean Nelson [off-list ref] wrote:
On 02/08/2018 02:34 PM, David Miller wrote:
quoted
From: Dean Nelson <redacted>
Date:
quoted
The Cavium thunder nicvf driver supports rx/tx rings of up to 65536
entries per.
The number of entires are stored in the q_len member of struct
q_desc_mem. The
problem is that q_len being a u16, results in 65536 becoming 0.
In getting pointers to descriptors in the rings, the driver uses q_len
minus 1
as a mask after incrementing the pointer, in order to go back to the
beginning
and not go past the end of the ring.
With the q_len set to 0 the mask is no longer correct and the driver does
go
beyond the end of the ring, causing various ills. Usually the first thing
that
shows up is a "NETDEV WATCHDOG: enP2p1s0f1 (nicvf): transmit queue 7
timed out"
warning.
This patch remedies the problem by changing q_len to a u32.
Signed-off-by: Dean Nelson <redacted>
Applied, thanks.
Thank you!
quoted
Another way to solve this could have been to encode that length
as "length - 1"
True. I had pondered that, but felt that since changing q_len's type
didn't add any length to the structure and that it was less impactful
from a number-of-lines of code changed perspective, I'd opt for this
route.
Cavium, if you'd prefer this goes the route that Dave just mentioned,
please let me know and I can make a new patch against what's been
applied?
Thanks for fixing this and i think the current patch is fine.
Thanks,
Sunil.
From: Dean Nelson <hidden> Date: 2018-02-09 12:52:04
On 02/08/2018 10:29 PM, Sunil Kovvuri wrote:
On Fri, Feb 9, 2018 at 3:27 AM, Dean Nelson [off-list ref] wrote:
quoted
On 02/08/2018 02:34 PM, David Miller wrote:
quoted
From: Dean Nelson <redacted>
Date:
quoted
The Cavium thunder nicvf driver supports rx/tx rings of up to 65536
entries per.
...
quoted
quoted
Another way to solve this could have been to encode that length
as "length - 1"
True. I had pondered that, but felt that since changing q_len's type
didn't add any length to the structure and that it was less impactful
from a number-of-lines of code changed perspective, I'd opt for this
route.
Cavium, if you'd prefer this goes the route that Dave just mentioned,
please let me know and I can make a new patch against what's been
applied?
Thanks for fixing this and i think the current patch is fine.
You're welcome. And thanks for responding. So I'll leave things as they
are.