[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220819192228.7c76e86c@xps-13>
Date: Fri, 19 Aug 2022 19:22:28 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Alexander Aring <aahringo@...hat.com>
Cc: Alexander Aring <alex.aring@...il.com>,
Stefan Schmidt <stefan@...enfreihafen.org>,
linux-wpan - ML <linux-wpan@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Network Development <netdev@...r.kernel.org>,
David Girault <david.girault@...vo.com>,
Romuald Despres <romuald.despres@...vo.com>,
Frederic Blain <frederic.blain@...vo.com>,
Nicolas Schodet <nico@...fr.eu.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH wpan-next 10/20] net: mac802154: Handle passive scanning
Hi Alexander,
aahringo@...hat.com wrote on Thu, 14 Jul 2022 23:42:08 -0400:
> Hi,
>
> On Thu, Jul 14, 2022 at 11:33 PM Alexander Aring <aahringo@...hat.com> wrote:
> >
> > Hi,
> >
> > On Fri, Jul 1, 2022 at 10:36 AM Miquel Raynal <miquel.raynal@...tlin.com> 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@...vo.com>
> > > Signed-off-by: David Girault <david.girault@...vo.com>
> > > Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
> > > ---
> > > 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
Powered by blists - more mailing lists