netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes
@ 2022-06-13  4:37 Alexander Aring
  2022-06-13  4:37 ` [PATCHv2 wpan-next 1/2] mac802154: util: fix release queue handling Alexander Aring
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Alexander Aring @ 2022-06-13  4:37 UTC (permalink / raw)
  To: stefan; +Cc: linux-wpan, netdev, miquel.raynal, aahringo

Hi,

I was wondering why nothing worked anymore. I found it...

changes since v2:

 - fix fixes tags in mac802154: util: fix release queue handling
 - add patch mac802154: fix atomic_dec_and_test checks got somehow
   confused 2 patch same issue

Alexander Aring (2):
  mac802154: util: fix release queue handling
  mac802154: fix atomic_dec_and_test checks

 net/mac802154/tx.c   | 4 ++--
 net/mac802154/util.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.31.1


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

* [PATCHv2 wpan-next 1/2] mac802154: util: fix release queue handling
  2022-06-13  4:37 [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Alexander Aring
@ 2022-06-13  4:37 ` Alexander Aring
  2022-06-13  4:37 ` [PATCHv2 wpan-next 2/2] mac802154: fix atomic_dec_and_test checks Alexander Aring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Alexander Aring @ 2022-06-13  4:37 UTC (permalink / raw)
  To: stefan; +Cc: linux-wpan, netdev, miquel.raynal, aahringo

The semantic of atomic_dec_and_test() is to return true if zero is
reached and we need call ieee802154_wake_queue() when zero is reached.

Fixes: 20a19d1df3e4 ("net: mac802154: Bring the ability to hold the transmit queue")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 net/mac802154/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac802154/util.c b/net/mac802154/util.c
index 60eb7bd3bfc1..60f6c0f10641 100644
--- a/net/mac802154/util.c
+++ b/net/mac802154/util.c
@@ -79,7 +79,7 @@ void ieee802154_release_queue(struct ieee802154_local *local)
 	unsigned long flags;
 
 	spin_lock_irqsave(&local->phy->queue_lock, flags);
-	if (!atomic_dec_and_test(&local->phy->hold_txs))
+	if (atomic_dec_and_test(&local->phy->hold_txs))
 		ieee802154_wake_queue(&local->hw);
 	spin_unlock_irqrestore(&local->phy->queue_lock, flags);
 }
-- 
2.31.1


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

* [PATCHv2 wpan-next 2/2] mac802154: fix atomic_dec_and_test checks
  2022-06-13  4:37 [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Alexander Aring
  2022-06-13  4:37 ` [PATCHv2 wpan-next 1/2] mac802154: util: fix release queue handling Alexander Aring
@ 2022-06-13  4:37 ` Alexander Aring
  2022-06-13 14:14 ` [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Miquel Raynal
  2022-06-14  8:32 ` Stefan Schmidt
  3 siblings, 0 replies; 8+ messages in thread
From: Alexander Aring @ 2022-06-13  4:37 UTC (permalink / raw)
  To: stefan; +Cc: linux-wpan, netdev, miquel.raynal, aahringo

We need to call wake_up() when hold_txs reaches zero. The semantic of
atomic_dec_and_test() is that it returns true when it's zero.

Fixes: f0feb3490473 ("net: mac802154: Introduce a tx queue flushing mechanism")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 net/mac802154/tx.c   | 4 ++--
 net/mac802154/util.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 5b471e932271..8ddcd2e841ca 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -44,7 +44,7 @@ void ieee802154_xmit_sync_worker(struct work_struct *work)
 err_tx:
 	/* Restart the netif queue on each sub_if_data object. */
 	ieee802154_release_queue(local);
-	if (!atomic_dec_and_test(&local->phy->ongoing_txs))
+	if (atomic_dec_and_test(&local->phy->ongoing_txs))
 		wake_up(&local->phy->sync_txq);
 	kfree_skb(skb);
 	netdev_dbg(dev, "transmission failed\n");
@@ -101,7 +101,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
 
 err_wake_netif_queue:
 	ieee802154_release_queue(local);
-	if (!atomic_dec_and_test(&local->phy->ongoing_txs))
+	if (atomic_dec_and_test(&local->phy->ongoing_txs))
 		wake_up(&local->phy->sync_txq);
 err_free_skb:
 	kfree_skb(skb);
diff --git a/net/mac802154/util.c b/net/mac802154/util.c
index 60f6c0f10641..f08605f59b60 100644
--- a/net/mac802154/util.c
+++ b/net/mac802154/util.c
@@ -141,7 +141,7 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
 	}
 
 	dev_consume_skb_any(skb);
-	if (!atomic_dec_and_test(&hw->phy->ongoing_txs))
+	if (atomic_dec_and_test(&hw->phy->ongoing_txs))
 		wake_up(&hw->phy->sync_txq);
 }
 EXPORT_SYMBOL(ieee802154_xmit_complete);
@@ -154,7 +154,7 @@ void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb,
 	local->tx_result = reason;
 	ieee802154_release_queue(local);
 	dev_kfree_skb_any(skb);
-	if (!atomic_dec_and_test(&hw->phy->ongoing_txs))
+	if (atomic_dec_and_test(&hw->phy->ongoing_txs))
 		wake_up(&hw->phy->sync_txq);
 }
 EXPORT_SYMBOL(ieee802154_xmit_error);
-- 
2.31.1


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

* Re: [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes
  2022-06-13  4:37 [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Alexander Aring
  2022-06-13  4:37 ` [PATCHv2 wpan-next 1/2] mac802154: util: fix release queue handling Alexander Aring
  2022-06-13  4:37 ` [PATCHv2 wpan-next 2/2] mac802154: fix atomic_dec_and_test checks Alexander Aring
@ 2022-06-13 14:14 ` Miquel Raynal
  2022-06-15  2:53   ` Alexander Aring
  2022-06-14  8:32 ` Stefan Schmidt
  3 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2022-06-13 14:14 UTC (permalink / raw)
  To: Alexander Aring; +Cc: stefan, linux-wpan, netdev

Hi Alex,

aahringo@redhat.com wrote on Mon, 13 Jun 2022 00:37:33 -0400:

> Hi,
> 
> I was wondering why nothing worked anymore. I found it...
> 
> changes since v2:
> 
>  - fix fixes tags in mac802154: util: fix release queue handling
>  - add patch mac802154: fix atomic_dec_and_test checks got somehow
>    confused 2 patch same issue

I've got initially confused with your patchset but yes indeed the API
works the opposite way compared to my gut understanding.

We bought hardware and I am currently setting up a real network to
hopefully track these regressions myself in the future.

For these two patches:

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

> 
> Alexander Aring (2):
>   mac802154: util: fix release queue handling
>   mac802154: fix atomic_dec_and_test checks
> 
>  net/mac802154/tx.c   | 4 ++--
>  net/mac802154/util.c | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 


Thanks,
Miquèl

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

* Re: [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes
  2022-06-13  4:37 [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Alexander Aring
                   ` (2 preceding siblings ...)
  2022-06-13 14:14 ` [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Miquel Raynal
@ 2022-06-14  8:32 ` Stefan Schmidt
  3 siblings, 0 replies; 8+ messages in thread
From: Stefan Schmidt @ 2022-06-14  8:32 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan, netdev, miquel.raynal

Hello.

On 13.06.22 06:37, Alexander Aring wrote:
> Hi,
> 
> I was wondering why nothing worked anymore. I found it...
> 
> changes since v2:
> 
>   - fix fixes tags in mac802154: util: fix release queue handling
>   - add patch mac802154: fix atomic_dec_and_test checks got somehow
>     confused 2 patch same issue
> 
> Alexander Aring (2):
>    mac802154: util: fix release queue handling
>    mac802154: fix atomic_dec_and_test checks
> 
>   net/mac802154/tx.c   | 4 ++--
>   net/mac802154/util.c | 6 +++---
>   2 files changed, 5 insertions(+), 5 deletions(-)


These patches have 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] 8+ messages in thread

* Re: [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes
  2022-06-13 14:14 ` [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Miquel Raynal
@ 2022-06-15  2:53   ` Alexander Aring
  2022-06-15  7:25     ` Miquel Raynal
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Aring @ 2022-06-15  2:53 UTC (permalink / raw)
  To: Miquel Raynal; +Cc: Stefan Schmidt, linux-wpan - ML, Network Development

Hi,

On Mon, Jun 13, 2022 at 10:15 AM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> Hi Alex,
>
> aahringo@redhat.com wrote on Mon, 13 Jun 2022 00:37:33 -0400:
>
> > Hi,
> >
> > I was wondering why nothing worked anymore. I found it...
> >
> > changes since v2:
> >
> >  - fix fixes tags in mac802154: util: fix release queue handling
> >  - add patch mac802154: fix atomic_dec_and_test checks got somehow
> >    confused 2 patch same issue
>
> I've got initially confused with your patchset but yes indeed the API
> works the opposite way compared to my gut understanding.
>

not the first time I am seeing this, I fixed similar issues already at
other places.

btw I told you the right semantic at [0] ....

> We bought hardware and I am currently setting up a real network to
> hopefully track these regressions myself in the future.
>

I wonder why you don't use hwsim... and you already mentioned hwsim to
me. You can simply make a 6lowpan interface on it and ping it - no
hardware needed and this would already show issues... Now you can say,
why I do not test it... maybe I do next time but review takes longer
then.

- Alex

[0] https://lore.kernel.org/linux-wpan/CAK-6q+jCYDQ-rtyawz1m2Yt+ti=3d6PrhZebB=-PjcX-6L-Kdg@mail.gmail.com/


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

* Re: [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes
  2022-06-15  2:53   ` Alexander Aring
@ 2022-06-15  7:25     ` Miquel Raynal
  2022-06-15  9:08       ` Miquel Raynal
  0 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2022-06-15  7:25 UTC (permalink / raw)
  To: Alexander Aring; +Cc: Stefan Schmidt, linux-wpan - ML, Network Development

Hi Alex,

aahringo@redhat.com wrote on Tue, 14 Jun 2022 22:53:19 -0400:

> Hi,
> 
> On Mon, Jun 13, 2022 at 10:15 AM Miquel Raynal
> <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Alex,
> >
> > aahringo@redhat.com wrote on Mon, 13 Jun 2022 00:37:33 -0400:
> >  
> > > Hi,
> > >
> > > I was wondering why nothing worked anymore. I found it...
> > >
> > > changes since v2:
> > >
> > >  - fix fixes tags in mac802154: util: fix release queue handling
> > >  - add patch mac802154: fix atomic_dec_and_test checks got somehow
> > >    confused 2 patch same issue  
> >
> > I've got initially confused with your patchset but yes indeed the API
> > works the opposite way compared to my gut understanding.
> >  
> 
> not the first time I am seeing this, I fixed similar issues already at
> other places.
> 
> btw I told you the right semantic at [0] ....

I focused on the if statement more than the actual syntax...

> 
> > We bought hardware and I am currently setting up a real network to
> > hopefully track these regressions myself in the future.
> >  
> 
> I wonder why you don't use hwsim... and you already mentioned hwsim to
> me.

I do use hwsim but I was exclusively testing the mlme ops with it.

> You can simply make a 6lowpan interface on it and ping it - no
> hardware needed and this would already show issues...

Actually I just learnt about how to create 6lowpan interfaces and do
basic data exchanges, it's rather easy and straightforward, but I must
admit I was not familiar at all with this area and thought it would be
more complex... Indeed, hwsim would work just fine for this purpose,
I will add this to my checklist.

> Now you can say,
> why I do not test it... maybe I do next time but review takes longer
> then.

I'm not saying this at all :) It is my duty, not yours, reviews and
feedback are more than enough.

> 
> - Alex
> 
> [0] https://lore.kernel.org/linux-wpan/CAK-6q+jCYDQ-rtyawz1m2Yt+ti=3d6PrhZebB=-PjcX-6L-Kdg@mail.gmail.com/

Thanks,
Miquèl

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

* Re: [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes
  2022-06-15  7:25     ` Miquel Raynal
@ 2022-06-15  9:08       ` Miquel Raynal
  0 siblings, 0 replies; 8+ messages in thread
From: Miquel Raynal @ 2022-06-15  9:08 UTC (permalink / raw)
  To: Alexander Aring; +Cc: Stefan Schmidt, linux-wpan - ML, Network Development


miquel.raynal@bootlin.com wrote on Wed, 15 Jun 2022 09:25:58 +0200:

> Hi Alex,
> 
> aahringo@redhat.com wrote on Tue, 14 Jun 2022 22:53:19 -0400:
> 
> > Hi,
> > 
> > On Mon, Jun 13, 2022 at 10:15 AM Miquel Raynal
> > <miquel.raynal@bootlin.com> wrote:
> > >
> > > Hi Alex,
> > >
> > > aahringo@redhat.com wrote on Mon, 13 Jun 2022 00:37:33 -0400:
> > >  
> > > > Hi,
> > > >
> > > > I was wondering why nothing worked anymore. I found it...
> > > >
> > > > changes since v2:
> > > >
> > > >  - fix fixes tags in mac802154: util: fix release queue handling
> > > >  - add patch mac802154: fix atomic_dec_and_test checks got somehow
> > > >    confused 2 patch same issue  
> > >
> > > I've got initially confused with your patchset but yes indeed the API
> > > works the opposite way compared to my gut understanding.
> > >  
> > 
> > not the first time I am seeing this, I fixed similar issues already at
> > other places.
> > 
> > btw I told you the right semantic at [0] ....
> 
> I focused on the if statement more than the actual syntax...
> 
> > 
> > > We bought hardware and I am currently setting up a real network to
> > > hopefully track these regressions myself in the future.
> > >  
> > 
> > I wonder why you don't use hwsim... and you already mentioned hwsim to
> > me.
> 
> I do use hwsim but I was exclusively testing the mlme ops with it.
> 
> > You can simply make a 6lowpan interface on it and ping it - no
> > hardware needed and this would already show issues...
> 
> Actually I just learnt about how to create 6lowpan interfaces and do
> basic data exchanges, it's rather easy and straightforward, but I must
> admit I was not familiar at all with this area and thought it would be
> more complex... Indeed, hwsim would work just fine for this purpose,
> I will add this to my checklist.
> 
> > Now you can say,
> > why I do not test it... maybe I do next time but review takes longer
> > then.
> 
> I'm not saying this at all :) It is my duty, not yours, reviews and
> feedback are more than enough.

Ok 6lowpan is _really_ well integrated, apologies for not taking the
time to use it before.

BTW I see all around the internet that ping6 produces this warning:

	ping6: Warning: source address might be selected on device
	other than: lowpan0

At a first glance I could not find an explanation, do you also have it
on your side? Do you know what it means?


Thanks,
Miquèl

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

end of thread, other threads:[~2022-06-15  9:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13  4:37 [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Alexander Aring
2022-06-13  4:37 ` [PATCHv2 wpan-next 1/2] mac802154: util: fix release queue handling Alexander Aring
2022-06-13  4:37 ` [PATCHv2 wpan-next 2/2] mac802154: fix atomic_dec_and_test checks Alexander Aring
2022-06-13 14:14 ` [PATCHv2 wpan-next 0/2] mac802154: atomic_dec_and_test() fixes Miquel Raynal
2022-06-15  2:53   ` Alexander Aring
2022-06-15  7:25     ` Miquel Raynal
2022-06-15  9:08       ` Miquel Raynal
2022-06-14  8:32 ` Stefan Schmidt

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).