diff mbox series

[wpan-next,v2,01/14] net: ieee802154: Move the logic restarting the queue upon transmission

Message ID 20220207144804.708118-2-miquel.raynal@bootlin.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series ieee802154: Synchronous Tx API | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Miquel Raynal Feb. 7, 2022, 2:47 p.m. UTC
Create a new helper with the logic restarting the queue upon
transmission, so that we can create a second path for error conditions
which can reuse that code easily.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 net/mac802154/util.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/net/mac802154/util.c b/net/mac802154/util.c
index f2078238718b..6f82418e9dec 100644
--- a/net/mac802154/util.c
+++ b/net/mac802154/util.c
@@ -55,8 +55,9 @@  enum hrtimer_restart ieee802154_xmit_ifs_timer(struct hrtimer *timer)
 	return HRTIMER_NORESTART;
 }
 
-void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
-			      bool ifs_handling)
+static void
+ieee802154_wakeup_after_xmit_done(struct ieee802154_hw *hw, bool ifs_handling,
+				  unsigned int skb_len)
 {
 	if (ifs_handling) {
 		struct ieee802154_local *local = hw_to_local(hw);
@@ -72,7 +73,7 @@  void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
 		else
 			max_sifs_size = IEEE802154_MAX_SIFS_FRAME_SIZE;
 
-		if (skb->len > max_sifs_size)
+		if (skb_len > max_sifs_size)
 			hrtimer_start(&local->ifs_timer,
 				      hw->phy->lifs_period * NSEC_PER_USEC,
 				      HRTIMER_MODE_REL);
@@ -83,8 +84,21 @@  void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
 	} else {
 		ieee802154_wake_queue(hw);
 	}
+}
+
+static void ieee802154_xmit_end(struct ieee802154_hw *hw, bool ifs_handling,
+				unsigned int skb_len)
+{
+	ieee802154_wakeup_after_xmit_done(hw, ifs_handling, skb_len);
+}
+
+void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
+			      bool ifs_handling)
+{
+	unsigned int skb_len = skb->len;
 
 	dev_consume_skb_any(skb);
+	ieee802154_xmit_end(hw, ifs_handling, skb_len);
 }
 EXPORT_SYMBOL(ieee802154_xmit_complete);