All of lore.kernel.org
 help / color / mirror / Atom feed
* [wpan-next v3 0/3] ieee802154: A bunch of light changes
@ 2022-01-25 12:25 Miquel Raynal
  2022-01-25 12:25 ` [wpan-next v3 1/3] net: ieee802154: hwsim: Ensure frame checksum are valid Miquel Raynal
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Miquel Raynal @ 2022-01-25 12:25 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni, Miquel Raynal

Here are a few small cleanups and improvements in preparation of a wider
series bringing a lot of features. These are aside changes, hence they
have their own small series.

Changes in v3:
* Split the v2 into two series: fixes for the wpan branch and cleanups
  for wpan-next. Here are random "cleanups".
* Reworded the ieee802154_wake/stop_queue helpers kdoc as discussed
  with Alexander.

Miquel Raynal (3):
  net: ieee802154: hwsim: Ensure frame checksum are valid
  net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant
  net: mac802154: Explain the use of ieee802154_wake/stop_queue()

 drivers/net/ieee802154/mac802154_hwsim.c |  2 +-
 include/net/mac802154.h                  | 12 ++++++++++++
 net/ieee802154/nl-phy.c                  |  4 ++--
 3 files changed, 15 insertions(+), 3 deletions(-)

-- 
2.27.0


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

* [wpan-next v3 1/3] net: ieee802154: hwsim: Ensure frame checksum are valid
  2022-01-25 12:25 [wpan-next v3 0/3] ieee802154: A bunch of light changes Miquel Raynal
@ 2022-01-25 12:25 ` Miquel Raynal
  2022-01-25 12:25 ` [wpan-next v3 2/3] net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant Miquel Raynal
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Miquel Raynal @ 2022-01-25 12:25 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni, Miquel Raynal

There is no point in accepting frames with a wrong or missing checksum,
at least not outside of a promiscuous setting. Set the right flag by
default in the hwsim driver to ensure checksums are not ignored.

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

diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
index 00ec188a3257..be77f489be13 100644
--- a/drivers/net/ieee802154/mac802154_hwsim.c
+++ b/drivers/net/ieee802154/mac802154_hwsim.c
@@ -791,7 +791,7 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
 	phy->idx = idx;
 	INIT_LIST_HEAD(&phy->edges);
 
-	hw->flags = IEEE802154_HW_PROMISCUOUS;
+	hw->flags = IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_RX_DROP_BAD_CKSUM;
 	hw->parent = dev;
 
 	err = ieee802154_register_hw(hw);
-- 
2.27.0


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

* [wpan-next v3 2/3] net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant
  2022-01-25 12:25 [wpan-next v3 0/3] ieee802154: A bunch of light changes Miquel Raynal
  2022-01-25 12:25 ` [wpan-next v3 1/3] net: ieee802154: hwsim: Ensure frame checksum are valid Miquel Raynal
@ 2022-01-25 12:25 ` Miquel Raynal
  2022-01-25 12:25 ` [wpan-next v3 3/3] net: mac802154: Explain the use of ieee802154_wake/stop_queue() Miquel Raynal
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Miquel Raynal @ 2022-01-25 12:25 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni, Miquel Raynal

This define already exist but is hardcoded in nl-phy.c. Use the
definition when relevant.

While at it, also convert the type from uint32_t to u32.

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

diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index dd5a45f8a78a..359249ab77bf 100644
--- a/net/ieee802154/nl-phy.c
+++ b/net/ieee802154/nl-phy.c
@@ -30,7 +30,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid,
 {
 	void *hdr;
 	int i, pages = 0;
-	uint32_t *buf = kcalloc(32, sizeof(uint32_t), GFP_KERNEL);
+	u32 *buf = kcalloc(IEEE802154_MAX_PAGE + 1, sizeof(u32), GFP_KERNEL);
 
 	pr_debug("%s\n", __func__);
 
@@ -47,7 +47,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid,
 	    nla_put_u8(msg, IEEE802154_ATTR_PAGE, phy->current_page) ||
 	    nla_put_u8(msg, IEEE802154_ATTR_CHANNEL, phy->current_channel))
 		goto nla_put_failure;
-	for (i = 0; i < 32; i++) {
+	for (i = 0; i <= IEEE802154_MAX_PAGE; i++) {
 		if (phy->supported.channels[i])
 			buf[pages++] = phy->supported.channels[i] | (i << 27);
 	}
-- 
2.27.0


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

* [wpan-next v3 3/3] net: mac802154: Explain the use of ieee802154_wake/stop_queue()
  2022-01-25 12:25 [wpan-next v3 0/3] ieee802154: A bunch of light changes Miquel Raynal
  2022-01-25 12:25 ` [wpan-next v3 1/3] net: ieee802154: hwsim: Ensure frame checksum are valid Miquel Raynal
  2022-01-25 12:25 ` [wpan-next v3 2/3] net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant Miquel Raynal
@ 2022-01-25 12:25 ` Miquel Raynal
  2022-01-27 15:54 ` [wpan-next v3 0/3] ieee802154: A bunch of light changes Stefan Schmidt
  2022-01-28 10:27 ` Stefan Schmidt
  4 siblings, 0 replies; 7+ messages in thread
From: Miquel Raynal @ 2022-01-25 12:25 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni, Miquel Raynal

It is not straightforward to the newcomer that a single skb can
currently be sent at a time and that the internal process is to stop the
queue when processing a frame before re-enabling it.

Make this clear by documenting the ieee802154_wake/stop_queue()
helpers.

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

diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index d524ffb9eb25..2c3bbc6645ba 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -464,6 +464,12 @@ void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb,
  * ieee802154_wake_queue - wake ieee802154 queue
  * @hw: pointer as obtained from ieee802154_alloc_hw().
  *
+ * Tranceivers usually have either one transmit framebuffer or one framebuffer
+ * for both transmitting and receiving. Hence, the core currently only handles
+ * one frame at a time for each phy, which means we had to stop the queue to
+ * avoid new skb to come during the transmission. The queue then needs to be
+ * woken up after the operation.
+ *
  * Drivers should use this function instead of netif_wake_queue.
  */
 void ieee802154_wake_queue(struct ieee802154_hw *hw);
@@ -472,6 +478,12 @@ void ieee802154_wake_queue(struct ieee802154_hw *hw);
  * ieee802154_stop_queue - stop ieee802154 queue
  * @hw: pointer as obtained from ieee802154_alloc_hw().
  *
+ * Tranceivers usually have either one transmit framebuffer or one framebuffer
+ * for both transmitting and receiving. Hence, the core currently only handles
+ * one frame at a time for each phy, which means we need to tell upper layers to
+ * stop giving us new skbs while we are busy with the transmitted one. The queue
+ * must then be stopped before transmitting.
+ *
  * Drivers should use this function instead of netif_stop_queue.
  */
 void ieee802154_stop_queue(struct ieee802154_hw *hw);
-- 
2.27.0


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

* Re: [wpan-next v3 0/3] ieee802154: A bunch of light changes
  2022-01-25 12:25 [wpan-next v3 0/3] ieee802154: A bunch of light changes Miquel Raynal
                   ` (2 preceding siblings ...)
  2022-01-25 12:25 ` [wpan-next v3 3/3] net: mac802154: Explain the use of ieee802154_wake/stop_queue() Miquel Raynal
@ 2022-01-27 15:54 ` Stefan Schmidt
  2022-01-28  0:34   ` Alexander Aring
  2022-01-28 10:27 ` Stefan Schmidt
  4 siblings, 1 reply; 7+ messages in thread
From: Stefan Schmidt @ 2022-01-27 15:54 UTC (permalink / raw)
  To: Miquel Raynal, Alexander Aring, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni

Hello.

On 25.01.22 13:25, Miquel Raynal wrote:
> Here are a few small cleanups and improvements in preparation of a wider
> series bringing a lot of features. These are aside changes, hence they
> have their own small series.
> 
> Changes in v3:
> * Split the v2 into two series: fixes for the wpan branch and cleanups
>    for wpan-next. Here are random "cleanups".
> * Reworded the ieee802154_wake/stop_queue helpers kdoc as discussed
>    with Alexander.
> 
> Miquel Raynal (3):
>    net: ieee802154: hwsim: Ensure frame checksum are valid
>    net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant
>    net: mac802154: Explain the use of ieee802154_wake/stop_queue()
> 
>   drivers/net/ieee802154/mac802154_hwsim.c |  2 +-
>   include/net/mac802154.h                  | 12 ++++++++++++
>   net/ieee802154/nl-phy.c                  |  4 ++--
>   3 files changed, 15 insertions(+), 3 deletions(-)
> 

I am happy with all three of them now. Alex, let me know if there is 
anything else you want to be adressed and ack if not so I can pull these in.

regards
Stefan Schmidt

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

* Re: [wpan-next v3 0/3] ieee802154: A bunch of light changes
  2022-01-27 15:54 ` [wpan-next v3 0/3] ieee802154: A bunch of light changes Stefan Schmidt
@ 2022-01-28  0:34   ` Alexander Aring
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2022-01-28  0:34 UTC (permalink / raw)
  To: Stefan Schmidt
  Cc: Miquel Raynal, linux-wpan - ML, David S. Miller, Jakub Kicinski,
	open list:NETWORKING [GENERAL],
	David Girault, Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni

Hi,

On Thu, Jan 27, 2022 at 10:54 AM Stefan Schmidt
<stefan@datenfreihafen.org> wrote:
>
> Hello.
>
> On 25.01.22 13:25, Miquel Raynal wrote:
> > Here are a few small cleanups and improvements in preparation of a wider
> > series bringing a lot of features. These are aside changes, hence they
> > have their own small series.
> >
> > Changes in v3:
> > * Split the v2 into two series: fixes for the wpan branch and cleanups
> >    for wpan-next. Here are random "cleanups".
> > * Reworded the ieee802154_wake/stop_queue helpers kdoc as discussed
> >    with Alexander.
> >
> > Miquel Raynal (3):
> >    net: ieee802154: hwsim: Ensure frame checksum are valid
> >    net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant
> >    net: mac802154: Explain the use of ieee802154_wake/stop_queue()
> >
> >   drivers/net/ieee802154/mac802154_hwsim.c |  2 +-
> >   include/net/mac802154.h                  | 12 ++++++++++++
> >   net/ieee802154/nl-phy.c                  |  4 ++--
> >   3 files changed, 15 insertions(+), 3 deletions(-)
> >
>
> I am happy with all three of them now. Alex, let me know if there is
> anything else you want to be adressed and ack if not so I can pull these in.

Everything is fine.

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

Thanks.

- Alex

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

* Re: [wpan-next v3 0/3] ieee802154: A bunch of light changes
  2022-01-25 12:25 [wpan-next v3 0/3] ieee802154: A bunch of light changes Miquel Raynal
                   ` (3 preceding siblings ...)
  2022-01-27 15:54 ` [wpan-next v3 0/3] ieee802154: A bunch of light changes Stefan Schmidt
@ 2022-01-28 10:27 ` Stefan Schmidt
  4 siblings, 0 replies; 7+ messages in thread
From: Stefan Schmidt @ 2022-01-28 10:27 UTC (permalink / raw)
  To: Miquel Raynal, Alexander Aring, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni


Hello.

On 25.01.22 13:25, Miquel Raynal wrote:
> Here are a few small cleanups and improvements in preparation of a wider
> series bringing a lot of features. These are aside changes, hence they
> have their own small series.
> 
> Changes in v3:
> * Split the v2 into two series: fixes for the wpan branch and cleanups
>    for wpan-next. Here are random "cleanups".
> * Reworded the ieee802154_wake/stop_queue helpers kdoc as discussed
>    with Alexander.
> 
> Miquel Raynal (3):
>    net: ieee802154: hwsim: Ensure frame checksum are valid
>    net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant
>    net: mac802154: Explain the use of ieee802154_wake/stop_queue()
> 
>   drivers/net/ieee802154/mac802154_hwsim.c |  2 +-
>   include/net/mac802154.h                  | 12 ++++++++++++
>   net/ieee802154/nl-phy.c                  |  4 ++--
>   3 files changed, 15 insertions(+), 3 deletions(-)
> 

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] 7+ messages in thread

end of thread, other threads:[~2022-01-28 10:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 12:25 [wpan-next v3 0/3] ieee802154: A bunch of light changes Miquel Raynal
2022-01-25 12:25 ` [wpan-next v3 1/3] net: ieee802154: hwsim: Ensure frame checksum are valid Miquel Raynal
2022-01-25 12:25 ` [wpan-next v3 2/3] net: ieee802154: Use the IEEE802154_MAX_PAGE define when relevant Miquel Raynal
2022-01-25 12:25 ` [wpan-next v3 3/3] net: mac802154: Explain the use of ieee802154_wake/stop_queue() Miquel Raynal
2022-01-27 15:54 ` [wpan-next v3 0/3] ieee802154: A bunch of light changes Stefan Schmidt
2022-01-28  0:34   ` Alexander Aring
2022-01-28 10:27 ` 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.