From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Aring <aahringo@redhat.com>
Cc: Alexander Aring <alex.aring@gmail.com>,
Stefan Schmidt <stefan@datenfreihafen.org>,
linux-wpan@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, 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>,
Guilhem Imberton <guilhem.imberton@qorvo.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH wpan-next 1/6] ieee802154: Add support for user scanning requests
Date: Wed, 7 Dec 2022 14:44:57 +0100 [thread overview]
Message-ID: <20221207144457.3033270f@xps-13> (raw)
In-Reply-To: <CAK-6q+hMDMGqpNzStXu+tpGgwn13mYqRgAKUJQXdA3eWi-rsGQ@mail.gmail.com>
Hi Alexander,
aahringo@redhat.com wrote on Wed, 7 Dec 2022 08:27:35 -0500:
> Hi,
>
> On Mon, Dec 5, 2022 at 4:58 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Alexander,
> >
> > aahringo@redhat.com wrote on Sun, 4 Dec 2022 17:44:24 -0500:
> >
> > > Hi,
> > >
> > > On Tue, Nov 29, 2022 at 11:02 AM Miquel Raynal
> > > <miquel.raynal@bootlin.com> wrote:
> > > >
> > > > The ieee802154 layer should be able to scan a set of channels in order
> > > > to look for beacons advertizing PANs. Supporting this involves adding
> > > > two user commands: triggering scans and aborting scans. The user should
> > > > also be notified when a new beacon is received and also upon scan
> > > > termination.
> > > >
> > > > A scan request structure is created to list the requirements and to be
> > > > accessed asynchronously when changing channels or receiving beacons.
> > > >
> > > > Mac layers may now implement the ->trigger_scan() and ->abort_scan()
> > > > hooks.
> > > >
> > > > Co-developed-by: David Girault <david.girault@qorvo.com>
> > > > Signed-off-by: David Girault <david.girault@qorvo.com>
> > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > > ---
> > > > include/linux/ieee802154.h | 3 +
> > > > include/net/cfg802154.h | 25 +++++
> > > > include/net/nl802154.h | 49 +++++++++
> > > > net/ieee802154/nl802154.c | 215 +++++++++++++++++++++++++++++++++++++
> > > > net/ieee802154/nl802154.h | 3 +
> > > > net/ieee802154/rdev-ops.h | 28 +++++
> > > > net/ieee802154/trace.h | 40 +++++++
> > > > 7 files changed, 363 insertions(+)
> > > >
> > > > diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
> > > > index 0303eb84d596..b22e4147d334 100644
> > > > --- a/include/linux/ieee802154.h
> > > > +++ b/include/linux/ieee802154.h
> > > > @@ -44,6 +44,9 @@
> > > > #define IEEE802154_SHORT_ADDR_LEN 2
> > > > #define IEEE802154_PAN_ID_LEN 2
> > > >
> > > > +/* Duration in superframe order */
> > > > +#define IEEE802154_MAX_SCAN_DURATION 14
> > > > +#define IEEE802154_ACTIVE_SCAN_DURATION 15
> > > > #define IEEE802154_LIFS_PERIOD 40
> > > > #define IEEE802154_SIFS_PERIOD 12
> > > > #define IEEE802154_MAX_SIFS_FRAME_SIZE 18
> > > > diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
> > > > index d09c393d229f..76d4f95e9974 100644
> > > > --- a/include/net/cfg802154.h
> > > > +++ b/include/net/cfg802154.h
> > > > @@ -18,6 +18,7 @@
> > > >
> > > > struct wpan_phy;
> > > > struct wpan_phy_cca;
> > > > +struct cfg802154_scan_request;
> > > >
> > > > #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
> > > > struct ieee802154_llsec_device_key;
> > > > @@ -67,6 +68,10 @@ struct cfg802154_ops {
> > > > struct wpan_dev *wpan_dev, bool mode);
> > > > int (*set_ackreq_default)(struct wpan_phy *wpan_phy,
> > > > struct wpan_dev *wpan_dev, bool ackreq);
> > > > + int (*trigger_scan)(struct wpan_phy *wpan_phy,
> > > > + struct cfg802154_scan_request *request);
> > > > + int (*abort_scan)(struct wpan_phy *wpan_phy,
> > > > + struct wpan_dev *wpan_dev);
> > > > #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
> > > > void (*get_llsec_table)(struct wpan_phy *wpan_phy,
> > > > struct wpan_dev *wpan_dev,
> > > > @@ -278,6 +283,26 @@ struct ieee802154_coord_desc {
> > > > bool gts_permit;
> > > > };
> > > >
> > > > +/**
> > > > + * struct cfg802154_scan_request - Scan request
> > > > + *
> > > > + * @type: type of scan to be performed
> > > > + * @page: page on which to perform the scan
> > > > + * @channels: channels in te %page to be scanned
> > > > + * @duration: time spent on each channel, calculated with:
> > > > + * aBaseSuperframeDuration * (2 ^ duration + 1)
> > > > + * @wpan_dev: the wpan device on which to perform the scan
> > > > + * @wpan_phy: the wpan phy on which to perform the scan
> > > > + */
> > > > +struct cfg802154_scan_request {
> > > > + enum nl802154_scan_types type;
> > > > + u8 page;
> > > > + u32 channels;
> > > > + u8 duration;
> > > > + struct wpan_dev *wpan_dev;
> > > > + struct wpan_phy *wpan_phy;
> > > > +};
> > > > +
> > > > struct ieee802154_llsec_key_id {
> > > > u8 mode;
> > > > u8 id;
> > > > diff --git a/include/net/nl802154.h b/include/net/nl802154.h
> > > > index b79a89d5207c..79fbd820b25a 100644
> > > > --- a/include/net/nl802154.h
> > > > +++ b/include/net/nl802154.h
> > > > @@ -73,6 +73,9 @@ enum nl802154_commands {
> > > > NL802154_CMD_DEL_SEC_LEVEL,
> > > >
> > > > NL802154_CMD_SCAN_EVENT,
> > > > + NL802154_CMD_TRIGGER_SCAN,
> > > > + NL802154_CMD_ABORT_SCAN,
> > > > + NL802154_CMD_SCAN_DONE,
> > >
> > > Is NL802154_CMD_SCAN_DONE reserved now? I don't see it implemented in
> > > this series and I think we had some discussion about the need of abort
> > > vs done. Is the event now?
> >
> > To be very honest I went back and forth about the "abort" information
> > so I don't remember exactly what was supposed to be implemented. The
> > current implementation forwards to userspace the reason (whether the
> > scan was finished or was aborted for an external reason). So it is
> > implemented this way:
> >
>
> I think it was also to implement a way to signal all listeners that
> there is such an operation ongoing? Do we have something like that?
When the kernel receives a CMD_TRIGGER_SCAN it starts the scan and if
everything is on track sends to the userspace listeners a
CMD_TRIGGER_SCAN in return, meaning "a scan has started".
So any listener would see:
CMD_TRIGGER_SCAN
SCAN_EVENT (+ content of the beacon)
...
SCAN_EVENT (+ content of the beacon)
CMD_SCAN_DONE (+ reason, see below)
> > * Patch 6/6 adds in mac802154/scan.c:
> >
> > + cmd = aborted ? NL802154_CMD_ABORT_SCAN : NL802154_CMD_SCAN_DONE;
> > + nl802154_scan_done(wpan_phy, wpan_dev, cmd);
> >
> > * And in patch 1/6, in ieee802154/nl802154.c:
> >
> > +static int nl802154_send_scan_msg(struct cfg802154_registered_device *rdev,
> > + struct wpan_dev *wpan_dev, u8 cmd)
> > +{
> > [...]
> > +
> > + ret = nl802154_prep_scan_msg(msg, rdev, wpan_dev, 0, 0, 0, cmd);
> >
> > Is this working for you?
>
> Sure this works in some way, I would put a reason parameter on DONE,
> but however...
Of course, I can do that. So NL802154_CMD_SCAN_DONE plus an u8
parameter:
NL802154_SCAN_DONE_REASON_FINISHED
NL802154_SCAN_DONE_REASON_ABORTED
?
Thanks,
Miquèl
next prev parent reply other threads:[~2022-12-07 13:45 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 16:00 [PATCH wpan-next 0/6] IEEE 802.15.4 passive scan support Miquel Raynal
2022-11-29 16:00 ` [PATCH wpan-next 1/6] ieee802154: Add support for user scanning requests Miquel Raynal
2022-12-04 22:44 ` Alexander Aring
2022-12-05 9:57 ` Miquel Raynal
2022-12-07 13:27 ` Alexander Aring
2022-12-07 13:44 ` Miquel Raynal [this message]
2022-12-08 2:22 ` Alexander Aring
2023-02-04 4:19 ` Jakub Kicinski
2023-02-10 10:18 ` Miquel Raynal
2023-02-10 10:26 ` Stefan Schmidt
2023-02-10 10:35 ` Miquel Raynal
2023-02-10 18:59 ` Jakub Kicinski
2023-02-10 22:47 ` Miquel Raynal
2023-02-06 1:39 ` Alexander Aring
2023-02-06 9:12 ` Miquel Raynal
2023-02-07 0:33 ` Alexander Aring
2023-02-07 12:55 ` Alexander Aring
2023-02-07 12:57 ` Alexander Aring
2023-02-13 17:35 ` Miquel Raynal
2023-02-14 13:34 ` Alexander Aring
2023-02-14 13:53 ` Alexander Aring
2023-02-14 14:06 ` Miquel Raynal
2023-02-14 14:46 ` Miquel Raynal
2023-02-17 4:37 ` Alexander Aring
2023-02-17 8:49 ` Miquel Raynal
2023-02-17 4:34 ` Alexander Aring
2023-02-17 9:02 ` Miquel Raynal
2023-02-21 2:43 ` Alexander Aring
2023-02-10 17:21 ` Miquel Raynal
2023-02-12 20:15 ` Alexander Aring
2023-02-13 10:15 ` Miquel Raynal
2023-02-14 13:51 ` Alexander Aring
2023-02-14 14:28 ` Miquel Raynal
2023-02-17 4:46 ` Alexander Aring
2023-02-17 8:52 ` Miquel Raynal
2023-02-21 2:54 ` Alexander Aring
2023-02-21 3:05 ` Alexander Aring
2023-02-24 13:57 ` Miquel Raynal
2022-11-29 16:00 ` [PATCH wpan-next 2/6] ieee802154: Define a beacon frame header Miquel Raynal
2022-11-29 16:00 ` [PATCH wpan-next 3/6] ieee802154: Introduce a helper to validate a channel Miquel Raynal
2022-11-29 16:00 ` [PATCH wpan-next 4/6] mac802154: Prepare forcing specific symbol duration Miquel Raynal
2022-11-29 16:00 ` [PATCH wpan-next 5/6] mac802154: Add MLME Tx locked helpers Miquel Raynal
2022-11-29 16:00 ` [PATCH wpan-next 6/6] mac802154: Handle passive scanning Miquel Raynal
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=20221207144457.3033270f@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=aahringo@redhat.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=david.girault@qorvo.com \
--cc=edumazet@google.com \
--cc=frederic.blain@qorvo.com \
--cc=guilhem.imberton@qorvo.com \
--cc=kuba@kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nico@ni.fr.eu.org \
--cc=pabeni@redhat.com \
--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).