All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wpan-next 0/2] ieee802154: Handle imited devices
@ 2023-03-24 11:05 Miquel Raynal
  2023-03-24 11:05 ` [PATCH wpan-next 1/2] net: ieee802154: Handle limited devices with only datagram support Miquel Raynal
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Miquel Raynal @ 2023-03-24 11:05 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	netdev, David Girault, Romuald Despres, Frederic Blain,
	Nicolas Schodet, Guilhem Imberton, Thomas Petazzoni,
	Miquel Raynal

As rightly pointed out by Alexander a few months ago, ca8210 devices
will not support sending frames which are not pure datagrams (hardMAC
wired to the softMAC layer). In order to not confuse users and clarify
that scanning and beaconing is not supported on these devices, let's add
a flag to prevent them to be used with the new APIs.

Miquel Raynal (2):
  net: ieee802154: Handle limited devices with only datagram support
  ieee802154: ca8210: Flag the driver as being limited

 drivers/net/ieee802154/ca8210.c |  3 ++-
 include/net/cfg802154.h         |  3 +++
 net/ieee802154/nl802154.c       | 10 ++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH wpan-next 1/2] net: ieee802154: Handle limited devices with only datagram support
  2023-03-24 11:05 [PATCH wpan-next 0/2] ieee802154: Handle imited devices Miquel Raynal
@ 2023-03-24 11:05 ` Miquel Raynal
  2023-03-24 11:05 ` [PATCH wpan-next 2/2] ieee802154: ca8210: Flag the driver as being limited Miquel Raynal
  2023-03-24 13:56 ` [PATCH wpan-next 0/2] ieee802154: Handle imited devices Alexander Aring
  2 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2023-03-24 11:05 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	netdev, David Girault, Romuald Despres, Frederic Blain,
	Nicolas Schodet, Guilhem Imberton, Thomas Petazzoni,
	Miquel Raynal

Some devices, like HardMAC ones can be a bit limited in the way they
handle mac commands. In particular, they might just not support it at
all and instead only be able to transmit and receive regular data
packets. In this case, they cannot be used for any of the internal
management commands that we have introduced so far and must be flagged
accordingly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 include/net/cfg802154.h   |  3 +++
 net/ieee802154/nl802154.c | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
index 0c2778a836db..e00057984489 100644
--- a/include/net/cfg802154.h
+++ b/include/net/cfg802154.h
@@ -178,12 +178,15 @@ wpan_phy_cca_cmp(const struct wpan_phy_cca *a, const struct wpan_phy_cca *b)
  *	setting.
  * @WPAN_PHY_FLAG_STATE_QUEUE_STOPPED: Indicates that the transmit queue was
  *	temporarily stopped.
+ * @WPAN_PHY_FLAG_DATAGRAMS_ONLY: Indicates that transceiver is only able to
+ *	send/receive datagrams.
  */
 enum wpan_phy_flags {
 	WPAN_PHY_FLAG_TXPOWER		= BIT(1),
 	WPAN_PHY_FLAG_CCA_ED_LEVEL	= BIT(2),
 	WPAN_PHY_FLAG_CCA_MODE		= BIT(3),
 	WPAN_PHY_FLAG_STATE_QUEUE_STOPPED = BIT(4),
+	WPAN_PHY_FLAG_DATAGRAMS_ONLY	= BIT(5),
 };
 
 struct wpan_phy {
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 0ecc49d9c8c9..052c1ecfa300 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1417,6 +1417,11 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
 		return -EINVAL;
 	}
 
+	if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
+		NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
+		return -EOPNOTSUPP;
+	}
+
 	request = kzalloc(sizeof(*request), GFP_KERNEL);
 	if (!request)
 		return -ENOMEM;
@@ -1584,6 +1589,11 @@ nl802154_send_beacons(struct sk_buff *skb, struct genl_info *info)
 		return -EPERM;
 	}
 
+	if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
+		NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
+		return -EOPNOTSUPP;
+	}
+
 	request = kzalloc(sizeof(*request), GFP_KERNEL);
 	if (!request)
 		return -ENOMEM;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH wpan-next 2/2] ieee802154: ca8210: Flag the driver as being limited
  2023-03-24 11:05 [PATCH wpan-next 0/2] ieee802154: Handle imited devices Miquel Raynal
  2023-03-24 11:05 ` [PATCH wpan-next 1/2] net: ieee802154: Handle limited devices with only datagram support Miquel Raynal
@ 2023-03-24 11:05 ` Miquel Raynal
  2023-03-24 13:56 ` [PATCH wpan-next 0/2] ieee802154: Handle imited devices Alexander Aring
  2 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2023-03-24 11:05 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	netdev, David Girault, Romuald Despres, Frederic Blain,
	Nicolas Schodet, Guilhem Imberton, Thomas Petazzoni,
	Miquel Raynal

This is a hardMAC device wired to Linux 802154 softMAC
implementation. It is a bit limited in the sense that it cannot handle
anything else that datagrams. Let's flag it like this to prevent using
unsupported features such as scan/beacons handling.

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

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 450b16ad40a4..bd5eeccc2fd2 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -2943,7 +2943,8 @@ static void ca8210_hw_setup(struct ieee802154_hw *ca8210_hw)
 	ca8210_hw->phy->flags =
 		WPAN_PHY_FLAG_TXPOWER |
 		WPAN_PHY_FLAG_CCA_ED_LEVEL |
-		WPAN_PHY_FLAG_CCA_MODE;
+		WPAN_PHY_FLAG_CCA_MODE |
+		WPAN_PHY_FLAG_DATAGRAMS_ONLY;
 }
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH wpan-next 0/2] ieee802154: Handle imited devices
  2023-03-24 11:05 [PATCH wpan-next 0/2] ieee802154: Handle imited devices Miquel Raynal
  2023-03-24 11:05 ` [PATCH wpan-next 1/2] net: ieee802154: Handle limited devices with only datagram support Miquel Raynal
  2023-03-24 11:05 ` [PATCH wpan-next 2/2] ieee802154: ca8210: Flag the driver as being limited Miquel Raynal
@ 2023-03-24 13:56 ` Alexander Aring
  2023-03-24 16:21   ` Stefan Schmidt
  2 siblings, 1 reply; 5+ messages in thread
From: Alexander Aring @ 2023-03-24 13:56 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Alexander Aring, Stefan Schmidt, linux-wpan, David S. Miller,
	Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Guilhem Imberton, Thomas Petazzoni

Hi,

On Fri, Mar 24, 2023 at 7:07 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> As rightly pointed out by Alexander a few months ago, ca8210 devices
> will not support sending frames which are not pure datagrams (hardMAC
> wired to the softMAC layer). In order to not confuse users and clarify
> that scanning and beaconing is not supported on these devices, let's add
> a flag to prevent them to be used with the new APIs.
>

Acked-by: Alexander Aring <aahringo@redhat.com>

I appreciate that you care about driver specific quirks which need to
be done here. The users of this driver are getting aware now there is
a lack of support here.

Thanks.

- Alex


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH wpan-next 0/2] ieee802154: Handle imited devices
  2023-03-24 13:56 ` [PATCH wpan-next 0/2] ieee802154: Handle imited devices Alexander Aring
@ 2023-03-24 16:21   ` Stefan Schmidt
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Schmidt @ 2023-03-24 16:21 UTC (permalink / raw)
  To: Alexander Aring, Miquel Raynal
  Cc: Alexander Aring, linux-wpan, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Eric Dumazet, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Guilhem Imberton, Thomas Petazzoni

Hello.

On 24.03.23 14:56, Alexander Aring wrote:
> Hi,
> 
> On Fri, Mar 24, 2023 at 7:07 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>>
>> As rightly pointed out by Alexander a few months ago, ca8210 devices
>> will not support sending frames which are not pure datagrams (hardMAC
>> wired to the softMAC layer). In order to not confuse users and clarify
>> that scanning and beaconing is not supported on these devices, let's add
>> a flag to prevent them to be used with the new APIs.
>>
> 
> Acked-by: Alexander Aring <aahringo@redhat.com>

This patch has been applied to the wpan-next tree and will be
part of the next pull request to net-next. Thanks!

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-24 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 11:05 [PATCH wpan-next 0/2] ieee802154: Handle imited devices Miquel Raynal
2023-03-24 11:05 ` [PATCH wpan-next 1/2] net: ieee802154: Handle limited devices with only datagram support Miquel Raynal
2023-03-24 11:05 ` [PATCH wpan-next 2/2] ieee802154: ca8210: Flag the driver as being limited Miquel Raynal
2023-03-24 13:56 ` [PATCH wpan-next 0/2] ieee802154: Handle imited devices Alexander Aring
2023-03-24 16:21   ` Stefan Schmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.