diff mbox series

[wpan-next,20/20] ieee802154: hwsim: Allow devices to be coordinators

Message ID 20220701143052.1267509-21-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
In order to be able to create coordinator interfaces, we need the
drivers to advertize that they support this type of interface. Fill in
the right bit in the hwsim capabilities to allow the creation of these
coordinator interfaces.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/net/ieee802154/mac802154_hwsim.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

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

On Fri, Jul 1, 2022 at 10:37 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> In order to be able to create coordinator interfaces, we need the
> drivers to advertize that they support this type of interface. Fill in
> the right bit in the hwsim capabilities to allow the creation of these
> coordinator interfaces.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/net/ieee802154/mac802154_hwsim.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
> index a5b9fc2fb64c..a678ede07219 100644
> --- a/drivers/net/ieee802154/mac802154_hwsim.c
> +++ b/drivers/net/ieee802154/mac802154_hwsim.c
> @@ -776,6 +776,8 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
>         /* 950 MHz GFSK 802.15.4d-2009 */
>         hw->phy->supported.channels[6] |= 0x3ffc00;
>
> +       hw->phy->supported.iftypes |= BIT(NL802154_IFTYPE_COORD);

I think we can do that for more than one driver (except ca8210). What
about the other iftypes?

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

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

> Hi,
> 
> On Fri, Jul 1, 2022 at 10:37 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > In order to be able to create coordinator interfaces, we need the
> > drivers to advertize that they support this type of interface. Fill in
> > the right bit in the hwsim capabilities to allow the creation of these
> > coordinator interfaces.
> >
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/net/ieee802154/mac802154_hwsim.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
> > index a5b9fc2fb64c..a678ede07219 100644
> > --- a/drivers/net/ieee802154/mac802154_hwsim.c
> > +++ b/drivers/net/ieee802154/mac802154_hwsim.c
> > @@ -776,6 +776,8 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
> >         /* 950 MHz GFSK 802.15.4d-2009 */
> >         hw->phy->supported.channels[6] |= 0x3ffc00;
> >
> > +       hw->phy->supported.iftypes |= BIT(NL802154_IFTYPE_COORD);  
> 
> I think we can do that for more than one driver (except ca8210).

Yes of course. I can update this patch and make the change to all the
drivers except ca8210 indeed.

> What about the other iftypes?

The NODE type is set by default at initialization time:
net/mac802154/main.c-120-       /* always supported */
net/mac802154/main.c:121:       phy->supported.iftypes = BIT(NL802154_IFTYPE_NODE);

The MONITOR type is only set if the device supports the promiscuous
mode:
net/mac802154/main.c-255-       if (hw->flags & IEEE802154_HW_PROMISCUOUS)
net/mac802154/main.c:256:               local->phy->supported.iftypes |= BIT(NL802154_IFTYPE_MONITOR);

Which indeed makes echo to one of your other review, saying that we
should probably prevent the creation of MONITOR types if the device has
no promiscuous support.

Thanks,
Miquèl
diff mbox series

Patch

diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
index a5b9fc2fb64c..a678ede07219 100644
--- a/drivers/net/ieee802154/mac802154_hwsim.c
+++ b/drivers/net/ieee802154/mac802154_hwsim.c
@@ -776,6 +776,8 @@  static int hwsim_add_one(struct genl_info *info, struct device *dev,
 	/* 950 MHz GFSK 802.15.4d-2009 */
 	hw->phy->supported.channels[6] |= 0x3ffc00;
 
+	hw->phy->supported.iftypes |= BIT(NL802154_IFTYPE_COORD);
+
 	ieee802154_random_extended_addr(&hw->phy->perm_extended_addr);
 
 	/* hwsim phy channel 13 as default */