From: Alexander Aring <aahringo@redhat.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Alexander Aring <alex.aring@gmail.com>,
Stefan Schmidt <stefan@datenfreihafen.org>,
linux-wpan - ML <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>,
Network Development <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>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH wpan-next v2 01/11] net: mac802154: Introduce filtering levels
Date: Sun, 4 Sep 2022 13:13:51 -0400 [thread overview]
Message-ID: <CAK-6q+izdwhN=3VcB=oYJjMvkWh4YPWHPcJwmAktXe9FCQ1pAQ@mail.gmail.com> (raw)
In-Reply-To: <20220826144049.256134-2-miquel.raynal@bootlin.com>
Hi,
On Fri, Aug 26, 2022 at 10:41 AM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> The 802154 specification details several filtering levels in which the
> PHY and the MAC could be. The amount of filtering will vary if they are
> in promiscuous mode or in scanning mode. Otherwise they are expected to
> do some very basic checks, such as enforcing the frame validity. Either
> the PHY is able to do so, and the MAC has nothing to do, or the PHY has
> a lower filtering level than expected and the MAC should take over.
>
> For now we define these levels in an enumeration, we add a per-PHY
> parameter showing the PHY filtering level and we set it to a default
> value. The drivers, if they cannot reach this level of filtering, should
> overwrite this value so that it reflects what they do. Then, in the
> core, this filtering level will be used to decide whether some
> additional software processing is needed or not.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> include/net/cfg802154.h | 3 +++
> include/net/mac802154.h | 24 ++++++++++++++++++++++++
> net/mac802154/iface.c | 2 ++
> 3 files changed, 29 insertions(+)
>
> diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
> index 04b996895fc1..2f29e95da47a 100644
> --- a/include/net/cfg802154.h
> +++ b/include/net/cfg802154.h
> @@ -223,6 +223,9 @@ struct wpan_phy {
> atomic_t hold_txs;
> wait_queue_head_t sync_txq;
>
> + /* Current filtering level on reception */
> + unsigned long filtering;
> +
enum ieee802154_filtering_level?
> char priv[] __aligned(NETDEV_ALIGN);
> };
>
> diff --git a/include/net/mac802154.h b/include/net/mac802154.h
> index 357d25ef627a..41c28118790c 100644
> --- a/include/net/mac802154.h
> +++ b/include/net/mac802154.h
> @@ -130,6 +130,30 @@ enum ieee802154_hw_flags {
> #define IEEE802154_HW_OMIT_CKSUM (IEEE802154_HW_TX_OMIT_CKSUM | \
> IEEE802154_HW_RX_OMIT_CKSUM)
>
> +/**
> + * enum ieee802154_filtering_level - Filtering levels applicable to a PHY
> + *
> + * @IEEE802154_FILTERING_NONE: No filtering at all, what is received is
> + * forwarded to the softMAC
> + * @IEEE802154_FILTERING_1_FCS: First filtering level, frames with an invalid
> + * FCS should be dropped
> + * @IEEE802154_FILTERING_2_PROMISCUOUS: Second filtering level, promiscuous
> + * mode, identical in terms of filtering to the first level at the PHY
> + * level, but no ACK should be transmitted automatically and at the MAC
> + * level the frame should be forwarded to the upper layer directly
You have no ACK back in all filtering levels except in
IEEE802154_FILTERING_4_FRAME_FIELDS. It is some kind of mixed thing
between "receive mode and filtering mode" but I am fine with it.
> + * @IEEE802154_FILTERING_3_SCAN: Third filtering level, enforced during scans,
> + * which only forwards beacons
> + * @IEEE802154_FILTERING_4_FRAME_FIELDS: Fourth filtering level actually
> + * enforcing the validity of the content of the frame with various checks
> + */
> +enum ieee802154_filtering_level {
> + IEEE802154_FILTERING_NONE,
> + IEEE802154_FILTERING_1_FCS,
> + IEEE802154_FILTERING_2_PROMISCUOUS,
> + IEEE802154_FILTERING_3_SCAN,
> + IEEE802154_FILTERING_4_FRAME_FIELDS,
> +};
> +
> /* struct ieee802154_ops - callbacks from mac802154 to the driver
> *
> * This structure contains various callbacks that the driver may
> diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
> index 500ed1b81250..4bab2807acbe 100644
> --- a/net/mac802154/iface.c
> +++ b/net/mac802154/iface.c
> @@ -587,6 +587,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
> sdata->dev->netdev_ops = &mac802154_wpan_ops;
> sdata->dev->ml_priv = &mac802154_mlme_wpan;
> wpan_dev->promiscuous_mode = false;
> + wpan_dev->wpan_phy->filtering = IEEE802154_FILTERING_4_FRAME_FIELDS;
> wpan_dev->header_ops = &ieee802154_header_ops;
>
> mutex_init(&sdata->sec_mtx);
> @@ -601,6 +602,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
> sdata->dev->needs_free_netdev = true;
> sdata->dev->netdev_ops = &mac802154_monitor_ops;
> wpan_dev->promiscuous_mode = true;
> + wpan_dev->wpan_phy->filtering = IEEE802154_FILTERING_2_PROMISCUOUS;
In my opinion this is currently IEEE802154_FILTERING_NONE ?
- Alex
next prev parent reply other threads:[~2022-09-04 17:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 14:40 [PATCH wpan-next v2 00/11] net: ieee802154: Support scanning/beaconing Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 01/11] net: mac802154: Introduce filtering levels Miquel Raynal
2022-09-04 17:13 ` Alexander Aring [this message]
2022-08-26 14:40 ` [PATCH wpan-next v2 02/11] net: mac802154: Drop IEEE802154_HW_RX_DROP_BAD_CKSUM Miquel Raynal
2022-09-05 1:34 ` Alexander Aring
2022-08-26 14:40 ` [PATCH wpan-next v2 03/11] net: mac802154: Allow the creation of coordinator interfaces Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 04/11] net: ieee802154: Advertize coordinators discovery Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 05/11] net: ieee802154: Handle " Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 06/11] net: ieee802154: Trace the registration of new PANs Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 07/11] net: ieee802154: Add support for user scanning requests Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 08/11] net: ieee802154: Define a beacon frame header Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 09/11] net: mac802154: Prepare forcing specific symbol duration Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 10/11] net: mac802154: Introduce a global device lock Miquel Raynal
2022-08-26 14:40 ` [PATCH wpan-next v2 11/11] net: 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='CAK-6q+izdwhN=3VcB=oYJjMvkWh4YPWHPcJwmAktXe9FCQ1pAQ@mail.gmail.com' \
--to=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=kuba@kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--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).