Skip to content

Commit

Permalink
net: mac802154: Create an error helper for asynchronous offloading er…
Browse files Browse the repository at this point in the history
…rors

A few drivers do the full transmit operation asynchronously, which means
that a bus error that happens when forwarding the packet to the
transmitter or a timeout happening when offloading the request 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 queue and always return the same
generic TRAC error code: IEEE802154_SYSTEM_ERROR.

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-6-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 30ca44e commit 5a1b57c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/net/mac802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,4 +508,13 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb,
int reason);

/**
* ieee802154_xmit_hw_error - frame could not be offloaded to the transmitter
* because of a hardware error (bus error, timeout, etc)
*
* @hw: pointer as obtained from ieee802154_alloc_hw().
* @skb: buffer for transmission
*/
void ieee802154_xmit_hw_error(struct ieee802154_hw *hw, struct sk_buff *skb);

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

void ieee802154_xmit_hw_error(struct ieee802154_hw *hw, struct sk_buff *skb)
{
ieee802154_xmit_error(hw, skb, IEEE802154_SYSTEM_ERROR);
}
EXPORT_SYMBOL(ieee802154_xmit_hw_error);

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

0 comments on commit 5a1b57c

Please sign in to comment.