diff mbox series

[wpan-next,05/20] net: ieee802154: Define frame types

Message ID 20220701143052.1267509-6-miquel.raynal@bootlin.com (mailing list archive)
State Superseded
Headers show
Series net: ieee802154: Support scanning/beaconing | expand

Commit Message

Miquel Raynal July 1, 2022, 2:30 p.m. UTC
A 802.15.4 frame can be of different types, here is a definition
matching the specification. This enumeration will be soon be used when
adding scanning support.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 include/net/ieee802154_netdev.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Alexander Aring July 11, 2022, 2:06 a.m. UTC | #1
Hi,

On Fri, Jul 1, 2022 at 10:36 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> A 802.15.4 frame can be of different types, here is a definition
> matching the specification. This enumeration will be soon be used when
> adding scanning support.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  include/net/ieee802154_netdev.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
> index d0d188c3294b..13167851b1c3 100644
> --- a/include/net/ieee802154_netdev.h
> +++ b/include/net/ieee802154_netdev.h
> @@ -69,6 +69,17 @@ struct ieee802154_hdr_fc {
>  #endif
>  };
>
> +enum ieee802154_frame_type {
> +       IEEE802154_BEACON_FRAME,
> +       IEEE802154_DATA_FRAME,
> +       IEEE802154_ACKNOWLEDGEMENT_FRAME,
> +       IEEE802154_MAC_COMMAND_FRAME,
> +       IEEE802154_RESERVED_FRAME,
> +       IEEE802154_MULTIPURPOSE_FRAME,
> +       IEEE802154_FRAGMENT_FRAME,
> +       IEEE802154_EXTENDED_FRAME,
> +};

Please use and extend include/linux/ieee802154.h e.g. IEEE802154_FC_TYPE_DATA.
I am also not a fan of putting those structs on payload, because there
can be several problems with it, we should introduce inline helpers to
check/get each individual fields but... the struct is currently how
it's implemented.

- Alex
Miquel Raynal Aug. 19, 2022, 5:13 p.m. UTC | #2
Hi Alexander,

aahringo@redhat.com wrote on Sun, 10 Jul 2022 22:06:57 -0400:

> Hi,
> 
> On Fri, Jul 1, 2022 at 10:36 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > A 802.15.4 frame can be of different types, here is a definition
> > matching the specification. This enumeration will be soon be used when
> > adding scanning support.
> >
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  include/net/ieee802154_netdev.h | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
> > index d0d188c3294b..13167851b1c3 100644
> > --- a/include/net/ieee802154_netdev.h
> > +++ b/include/net/ieee802154_netdev.h
> > @@ -69,6 +69,17 @@ struct ieee802154_hdr_fc {
> >  #endif
> >  };
> >
> > +enum ieee802154_frame_type {
> > +       IEEE802154_BEACON_FRAME,
> > +       IEEE802154_DATA_FRAME,
> > +       IEEE802154_ACKNOWLEDGEMENT_FRAME,
> > +       IEEE802154_MAC_COMMAND_FRAME,
> > +       IEEE802154_RESERVED_FRAME,
> > +       IEEE802154_MULTIPURPOSE_FRAME,
> > +       IEEE802154_FRAGMENT_FRAME,
> > +       IEEE802154_EXTENDED_FRAME,
> > +};  
> 
> Please use and extend include/linux/ieee802154.h e.g. IEEE802154_FC_TYPE_DATA.
> I am also not a fan of putting those structs on payload, because there
> can be several problems with it, we should introduce inline helpers to
> check/get each individual fields but... the struct is currently how
> it's implemented.

Ok, I can easily do that.

Thanks,
Miquèl
diff mbox series

Patch

diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index d0d188c3294b..13167851b1c3 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -69,6 +69,17 @@  struct ieee802154_hdr_fc {
 #endif
 };
 
+enum ieee802154_frame_type {
+	IEEE802154_BEACON_FRAME,
+	IEEE802154_DATA_FRAME,
+	IEEE802154_ACKNOWLEDGEMENT_FRAME,
+	IEEE802154_MAC_COMMAND_FRAME,
+	IEEE802154_RESERVED_FRAME,
+	IEEE802154_MULTIPURPOSE_FRAME,
+	IEEE802154_FRAGMENT_FRAME,
+	IEEE802154_EXTENDED_FRAME,
+};
+
 struct ieee802154_hdr {
 	struct ieee802154_hdr_fc fc;
 	u8 seq;