Re: [PATCH wpan-next 10/20] net: mac802154: Handle passive scanning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alexander,

aahringo@xxxxxxxxxx wrote on Thu, 14 Jul 2022 23:42:08 -0400:

> Hi,
> 
> On Thu, Jul 14, 2022 at 11:33 PM Alexander Aring <aahringo@xxxxxxxxxx> wrote:
> >
> > Hi,
> >
> > On Fri, Jul 1, 2022 at 10:36 AM Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:  
> > >
> > > Implement the core hooks in order to provide the softMAC layer support
> > > for passive scans. Scans are requested by the user and can be aborted.
> > >
> > > Changing the channels is prohibited during the scan.
> > >
> > > As transceivers enter promiscuous mode during scans, they might stop
> > > checking frame validity so we ensure this gets done at mac level.
> > >
> > > The implementation uses a workqueue triggered at a certain interval
> > > depending on the symbol duration for the current channel and the
> > > duration order provided.
> > >
> > > Received beacons during a passive scan are processed also in a work
> > > queue and forwarded to the upper layer.
> > >
> > > Active scanning is not supported yet.
> > >
> > > Co-developed-by: David Girault <david.girault@xxxxxxxxx>
> > > Signed-off-by: David Girault <david.girault@xxxxxxxxx>
> > > Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> > > ---
> > >  include/linux/ieee802154.h   |   4 +
> > >  include/net/cfg802154.h      |  12 ++
> > >  net/mac802154/Makefile       |   2 +-
> > >  net/mac802154/cfg.c          |  39 ++++++
> > >  net/mac802154/ieee802154_i.h |  29 ++++
> > >  net/mac802154/iface.c        |   6 +
> > >  net/mac802154/main.c         |   4 +
> > >  net/mac802154/rx.c           |  49 ++++++-
> > >  net/mac802154/scan.c         | 264 +++++++++++++++++++++++++++++++++++
> > >  9 files changed, 405 insertions(+), 4 deletions(-)
> > >  create mode 100644 net/mac802154/scan.c
> > >

[...]

> > > +int mac802154_trigger_scan_locked(struct
ieee802154_sub_if_data *sdata,
> > > +                                 struct cfg802154_scan_request *request)
> > > +{
> > > +       struct ieee802154_local *local = sdata->local;
> > > +       int ret;
> > > +
> > > +       lockdep_assert_held(&local->scan_lock);
> > > +
> > > +       if (mac802154_is_scanning(local))
> > > +               return -EBUSY;
> > > +
> > > +       /* TODO: support other scanning type */
> > > +       if (request->type != NL802154_SCAN_PASSIVE)
> > > +               return -EOPNOTSUPP;
> > > +
> > > +       /* Store scanning parameters */
> > > +       rcu_assign_pointer(local->scan_req, request);
> > > +
> > > +       /* Software scanning requires to set promiscuous mode, so we need to
> > > +        * pause the Tx queue during the entire operation.
> > > +        */
> > > +       ieee802154_mlme_op_pre(local);
> > > +
> > > +       ret = mac802154_set_promiscuous_mode(local, true);
> > > +       if (ret)
> > > +               goto cancel_mlme;  
> >
> > I know some driver datasheets and as I said before, it's not allowed
> > to set promiscuous mode while in receive mode. We need to stop tx,
> > what we are doing. Then call stop() driver callback,
> > synchronize_net(), mac802154_set_promiscuous_mode(...), start(). The
> > same always for the opposite.  
>
> s/always/as well/

Mmmh. I didn't know. I will look into it.

> I need to say, it needs to be something like that... we need to be
> careful here e.g. lots of monitor interfaces on one phy which has
> currently a serious use case for hwsim.
> 
> We also don't need to do anything above if we already are in
> promiscuous mode, which might be worth checking.

True!

Thanks,
Miquèl




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux