Subject: Re: [wpan-next v2 23/27] net: mac802154: Add support for active scans

From: Miquel Raynal <[email-masked]>
Date: Thu, 13 Jan 2022 18:14:51 +0100

Hi Alexander,

[email-masked] wrote on Wed, 12 Jan 2022 18:16:11 -0500:

> Hi,
> 
> On Wed, 12 Jan 2022 at 12:34, Miquel Raynal <[email-masked]> wrote:
> ...
> > +static int mac802154_scan_send_beacon_req_locked(struct ieee802154_local *local)
> > +{
> > +       struct sk_buff *skb;
> > +       int ret;
> > +
> > +       lockdep_assert_held(&local->scan_lock);
> > +
> > +       skb = alloc_skb(IEEE802154_BEACON_REQ_SKB_SZ, GFP_KERNEL);
> > +       if (!skb)
> > +               return -ENOBUFS;
> > +
> > +       ret = ieee802154_beacon_req_push(skb, &local->beacon_req);
> > +       if (ret) {
> > +               kfree_skb(skb);
> > +               return ret;
> > +       }
> > +
> > +       return drv_xmit_async(local, skb);  
> 
> I think you need to implement a sync transmit handling here.

True.

> And what
> I mean is not using dryv_xmit_sync() (It is a long story and should
> not be used, it's just that the driver is allowed to call bus api
> functions which can sleep).

Understood.

> We don't have such a function yet (but I
> think it can be implemented), you should wait until the transmission
> is done. If we don't wait we fill framebuffers on the hardware while
> the hardware is transmitting the framebuffer which is... bad.

Do you already have something in mind?

If I focus on the scan operation, it could be that we consider the
queue empty, then we put this transfer, wait for completion and
continue. But this only work for places where we know we have full
control over what is transmitted (eg. during a scan) and not for all
transfers. Would this fit your idea?

Or do you want something more generic with some kind of an
internal queue where we have the knowledge of what has been queued and
a token to link with every xmit_done call that is made?

I'm open to suggestions.

Thanks,
Miquèl