From: Dean Nelson <dnelson@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: rric@kernel.org, sgoutham@cavium.com, netdev@vger.kernel.org,
Vadim.Lomovtsev@cavium.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: net: thunder: change q_len's type to handle max ring size
Date: Thu, 8 Feb 2018 15:57:21 -0600 [thread overview]
Message-ID: <41824374-cdea-a3ef-0109-20565dbba43e@redhat.com> (raw)
In-Reply-To: <20180208.153453.774785043965984772.davem@davemloft.net>
On 02/08/2018 02:34 PM, David Miller wrote:
> From: Dean Nelson <dnelson@redhat.com>
> 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 <dnelson@redhat.com>
>
> 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
next prev parent reply other threads:[~2018-02-08 21:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 19:21 net: thunder: change q_len's type to handle max ring size Dean Nelson
2018-02-08 20:34 ` David Miller
2018-02-08 21:57 ` Dean Nelson [this message]
2018-02-09 4:29 ` Sunil Kovvuri
2018-02-09 12:52 ` Dean Nelson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41824374-cdea-a3ef-0109-20565dbba43e@redhat.com \
--to=dnelson@redhat.com \
--cc=Vadim.Lomovtsev@cavium.com \
--cc=davem@davemloft.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rric@kernel.org \
--cc=sgoutham@cavium.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).