[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220406153441.1667375-6-miquel.raynal@bootlin.com>
Date: Wed, 6 Apr 2022 17:34:35 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Alexander Aring <alex.aring@...il.com>,
Stefan Schmidt <stefan@...enfreihafen.org>,
linux-wpan@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
David Girault <david.girault@...vo.com>,
Romuald Despres <romuald.despres@...vo.com>,
Frederic Blain <frederic.blain@...vo.com>,
Nicolas Schodet <nico@...fr.eu.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Miquel Raynal <miquel.raynal@...tlin.com>
Subject: [PATCH v5 05/11] net: mac802154: Create a transmit bus error helper
A few drivers do the full transmit operation asynchronously, which means
that a bus error that happens when forwarding the packet to the
transmitter will not be reported immediately. The solution in this case
is to call this new helper to free the necessary resources, restart the
the queue and return a generic TRAC error code: IEEE802154_SYSTEM_ERROR.
Suggested-by: Alexander Aring <alex.aring@...il.com>
Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
---
include/net/mac802154.h | 9 +++++++++
net/mac802154/util.c | 10 ++++++++++
2 files changed, 19 insertions(+)
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index abbe88dc9df5..5240d94aad8e 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -498,6 +498,15 @@ void ieee802154_stop_queue(struct ieee802154_hw *hw);
void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
bool ifs_handling);
+/**
+ * ieee802154_xmit_bus_error - frame could not be delivered to the trasmitter
+ * because of a bus error
+ *
+ * @hw: pointer as obtained from ieee802154_alloc_hw().
+ * @skb: buffer for transmission
+ */
+void ieee802154_xmit_bus_error(struct ieee802154_hw *hw, struct sk_buff *skb);
+
/**
* ieee802154_xmit_error - frame transmission failed
*
diff --git a/net/mac802154/util.c b/net/mac802154/util.c
index ec523335336c..79ba803c40c9 100644
--- a/net/mac802154/util.c
+++ b/net/mac802154/util.c
@@ -102,6 +102,16 @@ void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb,
}
EXPORT_SYMBOL(ieee802154_xmit_error);
+void ieee802154_xmit_bus_error(struct ieee802154_hw *hw, struct sk_buff *skb)
+{
+ struct ieee802154_local *local = hw_to_local(hw);
+
+ local->tx_result = IEEE802154_SYSTEM_ERROR;
+ ieee802154_wake_queue(hw);
+ dev_kfree_skb_any(skb);
+}
+EXPORT_SYMBOL(ieee802154_xmit_bus_error);
+
void ieee802154_stop_device(struct ieee802154_local *local)
{
flush_workqueue(local->workqueue);
--
2.27.0
Powered by blists - more mailing lists