net: mac802154: Rename the main tx_work struct
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 19 May 2022 15:05:07 +0000 (17:05 +0200)
committerStefan Schmidt <stefan@datenfreihafen.org>
Fri, 10 Jun 2022 07:48:40 +0000 (09:48 +0200)
This entry is dedicated to synchronous transmissions done by drivers
without async hook. Make this clearer that this is not a work that any
driver can use by at least prefixing it with "sync_". While at it, let's
enhance the comment explaining why we choose one or the other.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20220519150516.443078-3-miquel.raynal@bootlin.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
net/mac802154/ieee802154_i.h
net/mac802154/main.c
net/mac802154/tx.c

index d7632c6d225f10907bc0a9fc12ecf1bae22888d4..a8b7b9049f14eaed1ba81887f16c5b31887c5a54 100644 (file)
@@ -55,7 +55,7 @@ struct ieee802154_local {
        struct sk_buff_head skb_queue;
 
        struct sk_buff *tx_skb;
-       struct work_struct tx_work;
+       struct work_struct sync_tx_work;
        /* A negative Linux error code or a null/positive MLME error status */
        int tx_result;
 };
index 392771bba9dd72e28bf2ef9b2f5897933c848a22..40fab08df24ba5953892a6f79a079db8cbe9ad7c 100644 (file)
@@ -95,7 +95,7 @@ ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops)
 
        skb_queue_head_init(&local->skb_queue);
 
-       INIT_WORK(&local->tx_work, ieee802154_xmit_sync_worker);
+       INIT_WORK(&local->sync_tx_work, ieee802154_xmit_sync_worker);
 
        /* init supported flags with 802.15.4 default ranges */
        phy->supported.max_minbe = 8;
index 97df5985b83079d056feca689016695d4a53f340..a01689ddd5470eca4785bb30c6aeb711977b4c73 100644 (file)
@@ -25,7 +25,7 @@
 void ieee802154_xmit_sync_worker(struct work_struct *work)
 {
        struct ieee802154_local *local =
-               container_of(work, struct ieee802154_local, tx_work);
+               container_of(work, struct ieee802154_local, sync_tx_work);
        struct sk_buff *skb = local->tx_skb;
        struct net_device *dev = skb->dev;
        int res;
@@ -76,7 +76,10 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
        /* Stop the netif queue on each sub_if_data object. */
        ieee802154_stop_queue(&local->hw);
 
-       /* async is priority, otherwise sync is fallback */
+       /* Drivers should preferably implement the async callback. In some rare
+        * cases they only provide a sync callback which we will use as a
+        * fallback.
+        */
        if (local->ops->xmit_async) {
                unsigned int len = skb->len;
 
@@ -90,7 +93,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
                dev->stats.tx_bytes += len;
        } else {
                local->tx_skb = skb;
-               queue_work(local->workqueue, &local->tx_work);
+               queue_work(local->workqueue, &local->sync_tx_work);
        }
 
        return NETDEV_TX_OK;