Skip to content

Commit 1375e3b

Browse files
miquelraynalStefan-Schmidt
authored andcommitted
mac802154: Send beacons using the MLME Tx path
Using ieee802154_subif_start_xmit() to bypass the net queue when sending beacons is broken because it does not acquire the HARD_TX_LOCK(), hence not preventing datagram buffers to be smashed by beacons upon contention situation. Using the mlme_tx helper is not the best fit either but at least it is not buggy and has little-to-no performance hit. More details are given in the comment explaining this choice in the code. Fixes: 3accf47 ("mac802154: Handle basic beaconing") Reported-by: Alexander Aring <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stefan Schmidt <[email protected]>
1 parent 1edecbd commit 1375e3b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

net/mac802154/scan.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,25 @@ static int mac802154_transmit_beacon(struct ieee802154_local *local,
326326
return ret;
327327
}
328328

329-
return ieee802154_subif_start_xmit(skb, sdata->dev);
329+
/* Using the MLME transmission helper for sending beacons is a bit
330+
* overkill because we do not really care about the final outcome.
331+
*
332+
* Even though, going through the whole net stack with a regular
333+
* dev_queue_xmit() is not relevant either because we want beacons to be
334+
* sent "now" rather than go through the whole net stack scheduling
335+
* (qdisc & co).
336+
*
337+
* Finally, using ieee802154_subif_start_xmit() would only be an option
338+
* if we had a generic transmit helper which would acquire the
339+
* HARD_TX_LOCK() to prevent buffer handling conflicts with regular
340+
* packets.
341+
*
342+
* So for now we keep it simple and send beacons with our MLME helper,
343+
* even if it stops the ieee802154 queue entirely during these
344+
* transmissions, wich anyway does not have a huge impact on the
345+
* performances given the current design of the stack.
346+
*/
347+
return ieee802154_mlme_tx(local, sdata, skb);
330348
}
331349

332350
void mac802154_beacon_worker(struct work_struct *work)

0 commit comments

Comments
 (0)