netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dnelson@redhat.com
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, 08 Feb 2018 15:34:53 -0500 (EST)	[thread overview]
Message-ID: <20180208.153453.774785043965984772.davem@davemloft.net> (raw)
In-Reply-To: <151811766130.10712.18293368656209944798.email-sent-by-dnelson@aqua>

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.

Another way to solve this could have been to encode that length
as "length - 1"

  reply	other threads:[~2018-02-08 20:34 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 [this message]
2018-02-08 21:57   ` Dean Nelson
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=20180208.153453.774785043965984772.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Vadim.Lomovtsev@cavium.com \
    --cc=dnelson@redhat.com \
    --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).