From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Aring <alex.aring@gmail.com>
Cc: Nicolas Schodet <nico@ni.fr.eu.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
Stefan Schmidt <stefan@datenfreihafen.org>,
linux-wpan - ML <linux-wpan@vger.kernel.org>,
David Girault <david.girault@qorvo.com>,
Romuald Despres <romuald.despres@qorvo.com>,
Frederic Blain <frederic.blain@qorvo.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [net-next 12/18] net: mac802154: Handle scan requests
Date: Tue, 4 Jan 2022 19:18:02 +0100 [thread overview]
Message-ID: <20220104191802.2323e44a@xps13> (raw)
In-Reply-To: <CAB_54W6gHE1S9Q+-SVbrnAWPxBxnvf54XVTCmddtj8g-bZzMRA@mail.gmail.com>
Hi Alexander,
alex.aring@gmail.com wrote on Fri, 31 Dec 2021 14:27:12 -0500:
> Hi,
>
> On Thu, 30 Dec 2021 at 14:47, Alexander Aring <alex.aring@gmail.com> wrote:
> >
> > Hi,
> >
> > On Wed, 29 Dec 2021 at 09:45, Nicolas Schodet <nico@ni.fr.eu.org> wrote:
> > >
> > > Hi,
> > >
> > > * Alexander Aring <alex.aring@gmail.com> [2021-12-29 09:30]:
> > > > Hi,
> > > > On Wed, 22 Dec 2021 at 10:58, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > > > ...
> > > > > +{
> > > > > + bool promiscuous_on = mac802154_check_promiscuous(local);
> > > > > + int ret;
> > > > > +
> > > > > + if ((state && promiscuous_on) || (!state && !promiscuous_on))
> > > > > + return 0;
> > > > > +
> > > > > + ret = drv_set_promiscuous_mode(local, state);
> > > > > + if (ret)
> > > > > + pr_err("Failed to %s promiscuous mode for SW scanning",
> > > > > + state ? "set" : "reset");
> > > > The semantic of promiscuous mode on the driver layer is to turn off
> > > > ack response, address filtering and crc checking. Some transceivers
> > > > don't allow a more fine tuning on what to enable/disable. I think we
> > > > should at least do the checksum checking per software then?
> > > > Sure there is a possible tune up for more "powerful" transceivers then...
> > >
> > > In this case, the driver could change the (flags &
> > > IEEE802154_HW_RX_DROP_BAD_CKSUM) bit dynamically to signal it does not
> > > check the checksum anymore. Would it work?
> >
> > I think that would work, although the intention of the hw->flags is to
> > define what the hardware is supposed to support as not changing those
> > values dynamically during runtime so mac will care about it. However
> > we don't expose those flags to the userspace, so far I know. We can
> > still introduce two separated flags if necessary in future.
> >
> > Why do we need promiscuous mode at all? Why is it necessary for a
> > scan? What of "ack response, address filtering and crc checking" you
> > want to disable and why?
> >
>
> I see now why promiscuous mode is necessary here. The actual
> promiscuous mode setting for the driver is not the same as promiscuous
> mode in 802.15.4 spec. For until now it was there for running a
> sniffer device only.
> As the 802.15.4 spec defines some "filtering levels" I came up with a
> draft so we can define which filtering level should be done on the
> hardware.
I like the idea but I'm not sure on what side you want to tackle the
problem first. Is it the phy drivers which should advertise the mac
about the promiscuous mode they support (which matches the description
below but does not fit the purpose of an enum very well)? Or is it the
MAC that requests a particular filtering mode? In this case what a phy
driver should do if:
- the requested mode is more constrained than its usual promiscuous
capabilities?
- the requested mode is less constrained than its usual promiscuous
capabilities?
>
> diff --git a/include/net/mac802154.h b/include/net/mac802154.h
> index 72978fb72a3a..3839ed3f8f0d 100644
> --- a/include/net/mac802154.h
> +++ b/include/net/mac802154.h
> @@ -130,6 +130,48 @@ enum ieee802154_hw_flags {
> #define IEEE802154_HW_OMIT_CKSUM (IEEE802154_HW_TX_OMIT_CKSUM | \
> IEEE802154_HW_RX_OMIT_CKSUM)
>
> +/**
> + * enum ieee802154_filter_mode - hardware filter mode that a driver
> will pass to
> + * pass to mac802154.
Isn't it the opposite: The filtering level the mac is requesting? Here
it looks like we are describing driver capabilities (ie what drivers
advertise supporting).
> + *
> + * @IEEE802154_FILTER_MODE_0: No MFR filtering at all.
I suppose this would be for a sniffer accepting all frames, including
the bad ones.
> + *
> + * @IEEE802154_FILTER_MODE_1: IEEE802154_FILTER_MODE_1 with a bad FCS filter.
This means that the driver should only discard bad frames and propagate
all the remaining frames, right? So this typically is a regular sniffer
mode.
> + *
> + * @IEEE802154_FILTER_MODE_2: Same as IEEE802154_FILTER_MODE_1, known as
> + * 802.15.4 promiscuous mode, sets
> + * mib.PromiscuousMode.
I believe what you call mib.PromiscuousMode is the mode that is
referred in the spec, ie. being in the official promiscuous mode? So
that is the mode that should be used "by default" when really asking
for a 802154 promiscuous mode.
Is there really a need for a different mode than mode_1 ?
> + *
> + * @IEEE802154_FILTER_MODE_3_SCAN: Same as IEEE802154_FILTER_MODE_2 without
> + * set mib.PromiscuousMode.
And here what is the difference between MODE_1 and MODE_3 ?
I suppose here we should as well drop all non-beacon frames?
> + *
> + * @IEEE802154_FILTER_MODE_3_NO_SCAN:
> + * IEEE802154_FILTER_MODE_3_SCAN with MFR additional filter on:
> + *
> + * - No reserved value in frame type
> + * - No reserved value in frame version
> + * - Match mib.PanId or broadcast
> + * - Destination address field:
> + * - Match mib.ShortAddress or broadcast
> + * - Match mib.ExtendedAddress or GroupRxMode is true
> + * - ImplicitBroadcast is true and destination address field/destination
> + * panid is not included.
> + * - Device is coordinator only source address present in data
> + * frame/command frame and source panid matches mib.PanId
> + * - Device is coordinator only source address present in multipurpose
> + * frame and destination panid matches macPanId
> + * - Beacon frames source panid matches mib.PanId. If mib.PanId is
> + * broadcast it should always be accepted.
This is a bit counter intuitive, but do we agree on the fact that the
higher level of filtering should refer to promiscuous = false?
> + *
> + */
> +enum ieee802154_filter_mode {
> + IEEE802154_FILTER_MODE_0,
> + IEEE802154_FILTER_MODE_1,
> + IEEE802154_FILTER_MODE_2,
> + IEEE802154_FILTER_MODE_3_SCAN,
> + IEEE802154_FILTER_MODE_3_NO_SCAN,
> +};
> +
> /* struct ieee802154_ops - callbacks from mac802154 to the driver
> *
> * This structure contains various callbacks that the driver may
> @@ -249,7 +291,7 @@ struct ieee802154_ops {
> int (*set_frame_retries)(struct ieee802154_hw *hw,
> s8 retries);
> int (*set_promiscuous_mode)(struct ieee802154_hw *hw,
> - const bool on);
> + enum
> ieee802154_filter_mode mode);
> int (*enter_scan_mode)(struct ieee802154_hw *hw,
> struct
> cfg802154_scan_request *request);
> int (*exit_scan_mode)(struct ieee802154_hw *hw);
>
> ---
>
> In your case it will be IEEE802154_FILTER_MODE_3_SCAN mode, for a
> sniffer we probably want as default IEEE802154_FILTER_MODE_0, as
> "promiscuous mode" currently is.
>
> - Alex
Thanks,
Miquèl
next prev parent reply other threads:[~2022-01-04 18:18 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 15:57 [net-next 00/18] IEEE 802.15.4 passive scan support Miquel Raynal
2021-12-22 15:57 ` [net-next 01/18] ieee802154: hwsim: Ensure proper channel selection at probe time Miquel Raynal
2021-12-28 21:05 ` Alexander Aring
2022-01-04 15:44 ` Miquel Raynal
2022-01-04 23:08 ` Alexander Aring
2022-01-04 23:10 ` Alexander Aring
2022-01-05 8:14 ` Miquel Raynal
2022-01-06 0:15 ` Alexander Aring
2021-12-22 15:57 ` [net-next 02/18] ieee802154: hwsim: Provide a symbol duration Miquel Raynal
2021-12-22 15:57 ` [net-next 03/18] net: ieee802154: Move IEEE 802.15.4 Kconfig main entry Miquel Raynal
2021-12-22 15:57 ` [net-next 04/18] net: mac802154: Include the softMAC stack inside the IEEE 802.15.4 menu Miquel Raynal
2021-12-22 15:57 ` [net-next 05/18] net: ieee802154: Move the address structure earlier Miquel Raynal
2021-12-22 15:57 ` [net-next 06/18] net: ieee802154: Add a kernel doc header to the ieee802154_addr structure Miquel Raynal
2021-12-22 15:57 ` [net-next 07/18] net: ieee802154: Return meaningful error codes from the netlink helpers Miquel Raynal
2021-12-22 15:57 ` [net-next 08/18] net: ieee802154: Add support for internal PAN management Miquel Raynal
2021-12-22 20:55 ` Jakub Kicinski
2022-01-04 14:41 ` Miquel Raynal
2022-01-04 15:01 ` Jakub Kicinski
2022-01-04 15:13 ` Miquel Raynal
2021-12-28 22:22 ` Alexander Aring
2021-12-29 1:45 ` Alexander Aring
2022-01-04 15:05 ` Miquel Raynal
2022-01-04 22:07 ` Alexander Aring
2021-12-22 15:57 ` [net-next 09/18] net: ieee802154: Define a beacon frame header Miquel Raynal
2021-12-22 15:57 ` [net-next 10/18] net: ieee802154: Define frame types Miquel Raynal
2021-12-22 15:57 ` [net-next 11/18] net: ieee802154: Add support for scanning requests Miquel Raynal
2021-12-22 15:57 ` [net-next 12/18] net: mac802154: Handle scan requests Miquel Raynal
2021-12-29 14:30 ` Alexander Aring
2021-12-29 14:45 ` Nicolas Schodet
2021-12-30 19:47 ` Alexander Aring
2021-12-31 19:27 ` Alexander Aring
2022-01-04 18:18 ` Miquel Raynal [this message]
2022-01-05 1:16 ` Alexander Aring
2022-01-05 20:55 ` Miquel Raynal
2022-01-06 0:38 ` Alexander Aring
2022-01-06 8:44 ` Stefan Schmidt
2022-01-06 9:14 ` Miquel Raynal
2022-01-06 19:15 ` Miquel Raynal
2022-01-07 1:07 ` Alexander Aring
2022-01-07 11:02 ` Miquel Raynal
2022-01-10 17:17 ` Alexander Aring
2022-01-07 1:00 ` Jakub Kicinski
2022-01-07 1:09 ` Alexander Aring
2022-01-04 17:43 ` Miquel Raynal
2022-01-05 1:36 ` Alexander Aring
2021-12-22 15:57 ` [net-next 13/18] net: mac802154: Inform device drivers about the scanning operation Miquel Raynal
2021-12-22 15:57 ` [net-next 14/18] net: ieee802154: Full PAN management Miquel Raynal
2021-12-22 15:57 ` [net-next 15/18] net: ieee802154: Add support for beacon requests Miquel Raynal
2021-12-22 15:57 ` [net-next 16/18] net: mac802154: Handle beacons requests Miquel Raynal
2021-12-22 15:57 ` [net-next 17/18] net: mac802154: Let drivers provide their own beacons implementation Miquel Raynal
2021-12-28 22:25 ` Alexander Aring
2021-12-30 16:59 ` David Girault
2021-12-30 19:48 ` Alexander Aring
2022-01-05 8:48 ` Miquel Raynal
2022-01-06 0:23 ` Alexander Aring
2022-01-06 19:15 ` Miquel Raynal
2022-01-07 4:21 ` Alexander Aring
2022-01-07 7:40 ` Miquel Raynal
2022-01-11 13:43 ` Alexander Aring
2021-12-22 15:57 ` [net-next 18/18] net: ieee802154: Trace the registration of new PANs 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=20220104191802.2323e44a@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=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wpan@vger.kernel.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).