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>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH wpan/next v4 5/8] ieee802154: hwsim: Implement address filtering
Date: Sat, 15 Oct 2022 10:59:28 +0200 [thread overview]
Message-ID: <20221012155828.5a5cade8@xps-13> (raw)
In-Reply-To: <CAK-6q+hO1AFzdH_DRYVM77VJhotsoeiBzqL0o7ND7sPYJhSrbQ@mail.gmail.com>
Hi Alexander,
aahringo@redhat.com wrote on Mon, 10 Oct 2022 21:21:17 -0400:
> Hi,
>
> On Mon, Oct 10, 2022 at 9:13 PM Alexander Aring <aahringo@redhat.com> wrote:
> >
> > Hi,
> >
> > On Mon, Oct 10, 2022 at 9:04 PM Alexander Aring <aahringo@redhat.com> wrote:
> > >
> > > Hi,
> > >
> > > On Fri, Oct 7, 2022 at 4:53 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > > >
> > > > We have access to the address filters being theoretically applied, we
> > > > also have access to the actual filtering level applied, so let's add a
> > > > proper frame validation sequence in hwsim.
> > > >
> > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > > ---
> > > > drivers/net/ieee802154/mac802154_hwsim.c | 111 ++++++++++++++++++++++-
> > > > include/net/ieee802154_netdev.h | 8 ++
> > > > 2 files changed, 117 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
> > > > index 458be66b5195..84ee948f35bc 100644
> > > > --- a/drivers/net/ieee802154/mac802154_hwsim.c
> > > > +++ b/drivers/net/ieee802154/mac802154_hwsim.c
> > > > @@ -18,6 +18,7 @@
> > > > #include <linux/netdevice.h>
> > > > #include <linux/device.h>
> > > > #include <linux/spinlock.h>
> > > > +#include <net/ieee802154_netdev.h>
> > > > #include <net/mac802154.h>
> > > > #include <net/cfg802154.h>
> > > > #include <net/genetlink.h>
> > > > @@ -139,6 +140,113 @@ static int hwsim_hw_addr_filt(struct ieee802154_hw *hw,
> > > > return 0;
> > > > }
> > > >
> > > > +static void hwsim_hw_receive(struct ieee802154_hw *hw, struct sk_buff *skb,
> > > > + u8 lqi)
> > > > +{
> > > > + struct ieee802154_hdr hdr;
> > > > + struct hwsim_phy *phy = hw->priv;
> > > > + struct hwsim_pib *pib;
> > > > +
> > > > + rcu_read_lock();
> > > > + pib = rcu_dereference(phy->pib);
> > > > +
> > > > + if (!pskb_may_pull(skb, 3)) {
> > > > + dev_dbg(hw->parent, "invalid frame\n");
> > > > + goto drop;
> > > > + }
> > > > +
> > > > + memcpy(&hdr, skb->data, 3);
> > > > +
> > > > + /* Level 4 filtering: Frame fields validity */
> > > > + if (hw->phy->filtering == IEEE802154_FILTERING_4_FRAME_FIELDS) {
> >
> > I see, there is this big if handling. But it accesses the
> > hw->phy->filtering value. It should be part of the hwsim pib setting
> > set by the driver callback. It is a question here of mac802154 layer
> > setting vs driver layer setting. We should do what the mac802154 tells
> > the driver to do, this way we do what the mac802154 layer is set to.
> >
> > However it's a minor thing and it's okay to do it so...
>
> * whereas we never let the driver know at any time of what different
> filter levels exist _currently_ we have only the promiscuous mode
> on/off switch which is do nothing or 4_FRAME_FIELDS.
> It will work for now, changing anything in the mac802154 filtering
> fields or something will end in probably breakage in this handling. In
> my point of view as the current state is it should not do that, as
> remember that hwsim will "simulate" hardware it should not be able to
> access mac802154 fields (especially when doing receiving of frames) as
> other hardware will only set register bits (as hwsim pib values is
> there for)...
>
> Still I think it's fine for now.
I see your point, indeed I could have added another PIB attribute
instead of accessing the PHY state.
I am fine doing it in a followup patch if this what you prefer. Shall I
do it?
Thanks,
Miquèl
next prev parent reply other threads:[~2022-10-15 8:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 8:53 [PATCH wpan/next v4 0/8] net: ieee802154: Improve filtering support Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 1/8] mac802154: Introduce filtering levels Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 2/8] mac802154: move receive parameters above start Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 3/8] mac802154: set filter at drv_start() Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 4/8] ieee802154: hwsim: Record the address filter values Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 5/8] ieee802154: hwsim: Implement address filtering Miquel Raynal
2022-10-11 1:04 ` Alexander Aring
2022-10-11 1:13 ` Alexander Aring
2022-10-11 1:21 ` Alexander Aring
2022-10-15 8:59 ` Miquel Raynal [this message]
2022-10-16 0:59 ` Alexander Aring
2022-10-12 10:48 ` Stefan Schmidt
2022-10-15 8:59 ` Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 6/8] mac802154: Drop IEEE802154_HW_RX_DROP_BAD_CKSUM Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 7/8] mac802154: Avoid delivering frames received in a non satisfying filtering mode Miquel Raynal
2022-10-07 8:53 ` [PATCH wpan/next v4 8/8] mac802154: Ensure proper scan-level filtering Miquel Raynal
2022-10-12 10:50 ` Stefan Schmidt
2022-10-15 8:58 ` Miquel Raynal
2022-10-11 1:01 ` [PATCH wpan/next v4 0/8] net: ieee802154: Improve filtering support Alexander Aring
2022-10-12 10:59 ` Stefan Schmidt
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=20221012155828.5a5cade8@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=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).