From: Paolo Abeni <pabeni@redhat.com>
To: Hayes Wang <hayeswang@realtek.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
nic_swsd <nic_swsd@realtek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH net] r8152: avoid the driver drops a lot of packets
Date: Tue, 05 Sep 2023 13:21:06 +0200 [thread overview]
Message-ID: <223569649ad4ded66786fcc424156b2115b8ccd8.camel@redhat.com> (raw)
In-Reply-To: <48d03f3134bf49c0b04b34464cd7487b@realtek.com>
On Tue, 2023-09-05 at 10:37 +0000, Hayes Wang wrote:
> Paolo Abeni <pabeni@redhat.com>
> > Sent: Tuesday, September 5, 2023 6:11 PM
> [...]
> > > - /* limit the skb numbers for rx_queue */
> > > - if (unlikely(skb_queue_len(&tp->rx_queue) >=
> > 1000))
> > > - break;
> > > -
> >
> > Dropping this check looks dangerous to me. What if pause frames are
> > disabled on the other end or dropped? It looks like this would cause
> > unlimited memory consumption?!?
>
> When the driver stops submitting rx, the driver wouldn't get any packet
> from the device after the previous urbs which have been submitted return.
> That is, skb_queue_len(&tp->rx_queue) wouldn't increase any more until
> the driver starts submitting rx again.
>
> Now, the driver stops submitting rx when the skb_queue_len more than 256,
> so the check becomes redundant. The skb_queue_len has been limited less
> than 1000.
I'm sorry, I have a very superficial knowledge of the USB layer, but it
looks like that when such condition is reached, in the worst condition
there could be up to urbs in flight. AFAICS each of them carries a 16K
buffer, can be up to 10 standard-mtu packets - or much more small ones.
Setting an upper limits to the rx_queue still looks like a reasonable
safeguard.
> Besides, if the flow control is disabled, the packets may be dropped by
> the hardware when the FIFO of the device is full, after the driver stops
> submitting rx.
If the incoming rate exceeds the H/W processing capacity, packets are
dropped: that is expected and unavoidable.
Possibly exposing the root cause for such drops to user space via
appropriate stats would be useful.
Cheers,
Paolo
next prev parent reply other threads:[~2023-09-05 16:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 12:17 [PATCH net] r8152: avoid the driver drops a lot of packets Hayes Wang
2023-09-05 10:10 ` Paolo Abeni
2023-09-05 10:37 ` Hayes Wang
2023-09-05 11:21 ` Paolo Abeni [this message]
2023-09-05 12:58 ` Hayes Wang
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=223569649ad4ded66786fcc424156b2115b8ccd8.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=hayeswang@realtek.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.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