Skip to content

Commit

Permalink
net: mac802154: Create an offloaded transmission error helper
Browse files Browse the repository at this point in the history
So far there is only a helper for successful transmissions, which led
device drivers to implement their own handling in case of
error. Unfortunately, we really need all the drivers to give the hand
back to the core once they are done in order to be able to build a
proper synchronous API. So let's create a _xmit_error() helper and take
this opportunity to fill the new device-global field storing Tx
statuses.

Suggested-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20220407100903.1695973-5-miquel.raynal@bootlin.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
  • Loading branch information
Miquel Raynal authored and Stefan Schmidt committed Apr 25, 2022
1 parent 337e2f8 commit 30ca44e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/net/mac802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,14 @@ 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_error - offloaded frame transmission failed
*
* @hw: pointer as obtained from ieee802154_alloc_hw().
* @skb: buffer for transmission
* @reason: error code
*/
void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb,
int reason);

#endif /* NET_MAC802154_H */
11 changes: 11 additions & 0 deletions net/mac802154/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
}
EXPORT_SYMBOL(ieee802154_xmit_complete);

void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb,
int reason)
{
struct ieee802154_local *local = hw_to_local(hw);

local->tx_result = reason;
ieee802154_wake_queue(hw);
dev_kfree_skb_any(skb);
}
EXPORT_SYMBOL(ieee802154_xmit_error);

void ieee802154_stop_device(struct ieee802154_local *local)
{
flush_workqueue(local->workqueue);
Expand Down

0 comments on commit 30ca44e

Please sign in to comment.