From: Paolo Abeni <pabeni@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Simon Horman <simon.horman@corigine.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net] net: renesas: rswitch: Fix return value in error path of xmit
Date: Thu, 01 Jun 2023 18:26:03 +0200 [thread overview]
Message-ID: <cd383482ff59517ed424bafc2b1def3a3b0b5c42.camel@redhat.com> (raw)
In-Reply-To: <20230601091012.5633540f@kernel.org>
On Thu, 2023-06-01 at 09:10 -0700, Jakub Kicinski wrote:
> On Thu, 01 Jun 2023 10:41:34 +0200 Paolo Abeni wrote:
> > > I agree that this is the correct return value for this case.
> > > But I do wonder if, as per the documentation of ndo_start_xmit,
> > > something should be done to avoid getting into such a situation.
> > >
> > > * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
> > > * struct net_device *dev);
> > > * Called when a packet needs to be transmitted.
> > > * Returns NETDEV_TX_OK. Can return NETDEV_TX_BUSY, but you should stop
> > > * the queue before that can happen; it's for obsolete devices and weird
> > > * corner cases, but the stack really does a non-trivial amount
> > > * of useless work if you return NETDEV_TX_BUSY.
> > > * Required; cannot be NULL.
> >
> > I agree with Simon, it looks like the driver usage of
> > netif_stop_subqueue()/netif_wake_subqueue() is a dubious.
> >
> > I think you will be better of using
> > netif_subqueue_maybe_stop()/netif_subqueue_completed_wake() alike what
> > rtl8169 is doing. e.g. netif_subqueue_maybe_stop() should be invoked
> > after the tx buffer enqueue, and netif_subqueue_completed_wake() should
> > be invoked after successful tx ring cleanup.
>
> That's a separate issue, tho, right? The cleanup is lockless and our
> magic lockless macro scheme does not protect from spurious wakeups.
> So they still need to check if the queue is full at the top of xmit.
> And they still need to return the correct error in that case..
I guess you are right, dubious wakeup could be addresses with a
separate patch if needed.
Fine by me to apply it as-is.
Cheers,
Paolo
next prev parent reply other threads:[~2023-06-01 16:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-29 7:38 [PATCH net] net: renesas: rswitch: Fix return value in error path of xmit Yoshihiro Shimoda
2023-05-30 11:42 ` Simon Horman
2023-06-01 8:41 ` Paolo Abeni
2023-06-01 16:10 ` Jakub Kicinski
2023-06-01 16:26 ` Paolo Abeni [this message]
2023-06-01 17:00 ` patchwork-bot+netdevbpf
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=cd383482ff59517ed424bafc2b1def3a3b0b5c42.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=s.shtylyov@omp.ru \
--cc=simon.horman@corigine.com \
--cc=yoshihiro.shimoda.uh@renesas.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).