netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Aring <alex.aring@gmail.com>
Cc: Stefan Schmidt <stefan@datenfreihafen.org>,
	linux-wpan - ML <linux-wpan@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	Xue Liu <liuxuenetmail@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Harry Morris <harrymorris12@gmail.com>,
	David Girault <david.girault@qorvo.com>,
	Romuald Despres <romuald.despres@qorvo.com>,
	Frederic Blain <frederic.blain@qorvo.com>,
	Nicolas Schodet <nico@ni.fr.eu.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [wpan-next v2 8/9] net: mac802154: Explain the use of ieee802154_wake/stop_queue()
Date: Tue, 25 Jan 2022 12:32:55 +0100	[thread overview]
Message-ID: <20220125123255.05fef400@xps13> (raw)
In-Reply-To: <CAB_54W6dCoEinhdq-HAQj0CQ9_wf-xK9ESOfvB6K4JMwHo7Vaw@mail.gmail.com>

Hi Alexander,

alex.aring@gmail.com wrote on Sun, 23 Jan 2022 15:56:22 -0500:

> Hi,
> 
> On Thu, 20 Jan 2022 at 06:21, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > It is not straightforward to the newcomer that a single skb can be sent
> > at a time and that the internal process is to stop the queue when
> > processing a frame before re-enabling it. Make this clear by documenting
> > the ieee802154_wake/stop_queue() helpers.
> >
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  include/net/mac802154.h | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/include/net/mac802154.h b/include/net/mac802154.h
> > index d524ffb9eb25..94b2e3008e77 100644
> > --- a/include/net/mac802154.h
> > +++ b/include/net/mac802154.h
> > @@ -464,6 +464,12 @@ void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb,
> >   * ieee802154_wake_queue - wake ieee802154 queue
> >   * @hw: pointer as obtained from ieee802154_alloc_hw().
> >   *
> > + * Tranceivers have either one transmit framebuffer or one framebuffer for both
> > + * transmitting and receiving. Hence, the core only handles one frame at a time  
> 
> this is not a fundamental physical law, they might exist but not supported yet.

I think it's important to explain why we call these helpers
before/after transmissions. I've reworded the beginning of the sentence
to: "Tranceivers usually have..." to reflect that this is the current
state of the support, but is not marble solid either. I've also updated
the second sentence about the core "Hence, the core currently only
handles..."

> > + * for each phy, which means we had to stop the queue to avoid new skb to come
> > + * during the transmission. The queue then needs to be woken up after the
> > + * operation.
> > + *
> >   * Drivers should use this function instead of netif_wake_queue.  
> 
> It's a must.
>
> >   */
> >  void ieee802154_wake_queue(struct ieee802154_hw *hw);
> > @@ -472,6 +478,12 @@ void ieee802154_wake_queue(struct ieee802154_hw *hw);
> >   * ieee802154_stop_queue - stop ieee802154 queue
> >   * @hw: pointer as obtained from ieee802154_alloc_hw().
> >   *
> > + * Tranceivers have either one transmit framebuffer or one framebuffer for both
> > + * transmitting and receiving. Hence, the core only handles one frame at a time
> > + * for each phy, which means we need to tell upper layers to stop giving us new
> > + * skbs while we are busy with the transmitted one. The queue must then be
> > + * stopped before transmitting.
> > + *
> >   * Drivers should use this function instead of netif_stop_queue.
> >   */
> >  void ieee802154_stop_queue(struct ieee802154_hw *hw);  
> 
> Same for stop, stop has something additional here... it is never used
> by any driver because we do that on mac802154 layer. Simply, they
> don't use this function.

That's true, and this is addressed in a later series where we actually
stop exporting these helpers because we want everything to be handled
by the _xmit_complete/error() helpers and keep full control of the
queue. The comments added above will remain because they are useful to
understand why these helpers are called. But the last sentence above
their use from drivers being preferred to the netif_ calls will be
dropped.

Thanks,
Miquèl

  reply	other threads:[~2022-01-25 11:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 11:21 [wpan-next v2 0/9] ieee802154: A bunch of fixes Miquel Raynal
2022-01-20 11:21 ` [wpan-next v2 1/9] net: ieee802154: hwsim: Ensure proper channel selection at probe time Miquel Raynal
2022-01-23  7:29   ` [net] 98ccce2328: WARNING:suspicious_RCU_usage kernel test robot
2022-01-23 20:34   ` [wpan-next v2 1/9] net: ieee802154: hwsim: Ensure proper channel selection at probe time Alexander Aring
2022-01-25 10:40     ` Miquel Raynal
2022-01-20 11:21 ` [wpan-next v2 2/9] net: ieee802154: hwsim: Ensure frame checksum are valid Miquel Raynal
2022-01-20 11:21 ` [wpan-next v2 3/9] net: ieee802154: mcr20a: Fix lifs/sifs periods Miquel Raynal
2022-01-21 16:01   ` Stefan Schmidt
2022-01-20 11:21 ` [wpan-next v2 4/9] net: ieee802154: at86rf230: Stop leaking skb's Miquel Raynal
2022-01-23 20:43   ` Alexander Aring
2022-01-23 20:59     ` Alexander Aring
2022-01-23 22:41     ` Alexander Aring
2022-01-23 23:14       ` Alexander Aring
2022-01-25 10:58         ` Miquel Raynal
2022-01-20 11:21 ` [wpan-next v2 5/9] net: ieee802154: ca8210: " Miquel Raynal
2022-01-23 21:00   ` Alexander Aring
2022-01-20 11:21 ` [wpan-next v2 6/9] net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant Miquel Raynal
2022-01-21 16:00   ` Stefan Schmidt
2022-01-23 20:44   ` Alexander Aring
2022-01-24  8:06     ` Stefan Schmidt
2022-01-25 11:10       ` Miquel Raynal
2022-01-20 11:21 ` [wpan-next v2 7/9] net: ieee802154: Return meaningful error codes from the netlink helpers Miquel Raynal
2022-01-20 11:21 ` [wpan-next v2 8/9] net: mac802154: Explain the use of ieee802154_wake/stop_queue() Miquel Raynal
2022-01-23 20:56   ` Alexander Aring
2022-01-25 11:32     ` Miquel Raynal [this message]
2022-01-20 11:21 ` [wpan-next v2 9/9] MAINTAINERS: Remove Harry Morris bouncing address Miquel Raynal
2022-01-20 22:52 ` [wpan-next v2 0/9] ieee802154: A bunch of fixes Alexander Aring
2022-01-20 23:07   ` Alexander Aring
2022-01-21  8:27   ` Miquel Raynal
2022-01-21 12:48     ` Stefan Schmidt
2022-01-25  9:51       ` Miquel Raynal
2022-01-21 16:09 ` Stefan Schmidt

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=20220125123255.05fef400@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=david.girault@qorvo.com \
    --cc=frederic.blain@qorvo.com \
    --cc=harrymorris12@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=liuxuenetmail@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=nico@ni.fr.eu.org \
    --cc=romuald.despres@qorvo.com \
    --cc=stefan@datenfreihafen.org \
    --cc=thomas.petazzoni@bootlin.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).