~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/mac802154/util.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/mac802154/util.c (Version linux-6.12-rc7) and /net/mac802154/util.c (Version linux-5.11.22)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*                                                  2 /*
  3  *                                                  3  *
  4  * Authors:                                         4  * Authors:
  5  * Alexander Aring <aar@pengutronix.de>             5  * Alexander Aring <aar@pengutronix.de>
  6  *                                                  6  *
  7  * Based on: net/mac80211/util.c                    7  * Based on: net/mac80211/util.c
  8  */                                                 8  */
  9                                                     9 
 10 #include "ieee802154_i.h"                          10 #include "ieee802154_i.h"
 11 #include "driver-ops.h"                            11 #include "driver-ops.h"
 12                                                    12 
 13 /* privid for wpan_phys to determine whether t     13 /* privid for wpan_phys to determine whether they belong to us or not */
 14 const void *const mac802154_wpan_phy_privid =      14 const void *const mac802154_wpan_phy_privid = &mac802154_wpan_phy_privid;
 15                                                    15 
 16 /**                                            !!  16 void ieee802154_wake_queue(struct ieee802154_hw *hw)
 17  * ieee802154_wake_queue - wake ieee802154 que << 
 18  * @hw: main hardware object                   << 
 19  *                                             << 
 20  * Tranceivers usually have either one transmi << 
 21  * for both transmitting and receiving. Hence, << 
 22  * one frame at a time for each phy, which mea << 
 23  * avoid new skb to come during the transmissi << 
 24  * woken up after the operation.               << 
 25  */                                            << 
 26 static void ieee802154_wake_queue(struct ieee8 << 
 27 {                                                  17 {
 28         struct ieee802154_local *local = hw_to     18         struct ieee802154_local *local = hw_to_local(hw);
 29         struct ieee802154_sub_if_data *sdata;      19         struct ieee802154_sub_if_data *sdata;
 30                                                    20 
 31         rcu_read_lock();                           21         rcu_read_lock();
 32         clear_bit(WPAN_PHY_FLAG_STATE_QUEUE_ST << 
 33         list_for_each_entry_rcu(sdata, &local-     22         list_for_each_entry_rcu(sdata, &local->interfaces, list) {
 34                 if (!sdata->dev)                   23                 if (!sdata->dev)
 35                         continue;                  24                         continue;
 36                                                    25 
 37                 netif_wake_queue(sdata->dev);      26                 netif_wake_queue(sdata->dev);
 38         }                                          27         }
 39         rcu_read_unlock();                         28         rcu_read_unlock();
 40 }                                                  29 }
                                                   >>  30 EXPORT_SYMBOL(ieee802154_wake_queue);
 41                                                    31 
 42 /**                                            !!  32 void ieee802154_stop_queue(struct ieee802154_hw *hw)
 43  * ieee802154_stop_queue - stop ieee802154 que << 
 44  * @hw: main hardware object                   << 
 45  *                                             << 
 46  * Tranceivers usually have either one transmi << 
 47  * for both transmitting and receiving. Hence, << 
 48  * one frame at a time for each phy, which mea << 
 49  * stop giving us new skbs while we are busy w << 
 50  * must then be stopped before transmitting.   << 
 51  */                                            << 
 52 static void ieee802154_stop_queue(struct ieee8 << 
 53 {                                                  33 {
 54         struct ieee802154_local *local = hw_to     34         struct ieee802154_local *local = hw_to_local(hw);
 55         struct ieee802154_sub_if_data *sdata;      35         struct ieee802154_sub_if_data *sdata;
 56                                                    36 
 57         rcu_read_lock();                           37         rcu_read_lock();
 58         list_for_each_entry_rcu(sdata, &local-     38         list_for_each_entry_rcu(sdata, &local->interfaces, list) {
 59                 if (!sdata->dev)                   39                 if (!sdata->dev)
 60                         continue;                  40                         continue;
 61                                                    41 
 62                 netif_stop_queue(sdata->dev);      42                 netif_stop_queue(sdata->dev);
 63         }                                          43         }
 64         rcu_read_unlock();                         44         rcu_read_unlock();
 65 }                                                  45 }
 66                                                !!  46 EXPORT_SYMBOL(ieee802154_stop_queue);
 67 void ieee802154_hold_queue(struct ieee802154_l << 
 68 {                                              << 
 69         unsigned long flags;                   << 
 70                                                << 
 71         spin_lock_irqsave(&local->phy->queue_l << 
 72         if (!atomic_fetch_inc(&local->phy->hol << 
 73                 ieee802154_stop_queue(&local-> << 
 74         spin_unlock_irqrestore(&local->phy->qu << 
 75 }                                              << 
 76                                                << 
 77 void ieee802154_release_queue(struct ieee80215 << 
 78 {                                              << 
 79         unsigned long flags;                   << 
 80                                                << 
 81         spin_lock_irqsave(&local->phy->queue_l << 
 82         if (atomic_dec_and_test(&local->phy->h << 
 83                 ieee802154_wake_queue(&local-> << 
 84         spin_unlock_irqrestore(&local->phy->qu << 
 85 }                                              << 
 86                                                << 
 87 void ieee802154_disable_queue(struct ieee80215 << 
 88 {                                              << 
 89         struct ieee802154_sub_if_data *sdata;  << 
 90                                                << 
 91         rcu_read_lock();                       << 
 92         list_for_each_entry_rcu(sdata, &local- << 
 93                 if (!sdata->dev)               << 
 94                         continue;              << 
 95                                                << 
 96                 netif_tx_disable(sdata->dev);  << 
 97         }                                      << 
 98         rcu_read_unlock();                     << 
 99 }                                              << 
100                                                    47 
101 enum hrtimer_restart ieee802154_xmit_ifs_timer     48 enum hrtimer_restart ieee802154_xmit_ifs_timer(struct hrtimer *timer)
102 {                                                  49 {
103         struct ieee802154_local *local =           50         struct ieee802154_local *local =
104                 container_of(timer, struct iee     51                 container_of(timer, struct ieee802154_local, ifs_timer);
105                                                    52 
106         ieee802154_release_queue(local);       !!  53         ieee802154_wake_queue(&local->hw);
107                                                    54 
108         return HRTIMER_NORESTART;                  55         return HRTIMER_NORESTART;
109 }                                                  56 }
110                                                    57 
111 void ieee802154_xmit_complete(struct ieee80215     58 void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
112                               bool ifs_handlin     59                               bool ifs_handling)
113 {                                                  60 {
114         struct ieee802154_local *local = hw_to << 
115                                                << 
116         local->tx_result = IEEE802154_SUCCESS; << 
117                                                << 
118         if (ifs_handling) {                        61         if (ifs_handling) {
                                                   >>  62                 struct ieee802154_local *local = hw_to_local(hw);
119                 u8 max_sifs_size;                  63                 u8 max_sifs_size;
120                                                    64 
121                 /* If transceiver sets CRC on      65                 /* If transceiver sets CRC on his own we need to use lifs
122                  * threshold len above 16 othe     66                  * threshold len above 16 otherwise 18, because it's not
123                  * part of skb->len.               67                  * part of skb->len.
124                  */                                68                  */
125                 if (hw->flags & IEEE802154_HW_     69                 if (hw->flags & IEEE802154_HW_TX_OMIT_CKSUM)
126                         max_sifs_size = IEEE80     70                         max_sifs_size = IEEE802154_MAX_SIFS_FRAME_SIZE -
127                                         IEEE80     71                                         IEEE802154_FCS_LEN;
128                 else                               72                 else
129                         max_sifs_size = IEEE80     73                         max_sifs_size = IEEE802154_MAX_SIFS_FRAME_SIZE;
130                                                    74 
131                 if (skb->len > max_sifs_size)      75                 if (skb->len > max_sifs_size)
132                         hrtimer_start(&local->     76                         hrtimer_start(&local->ifs_timer,
133                                       hw->phy-     77                                       hw->phy->lifs_period * NSEC_PER_USEC,
134                                       HRTIMER_     78                                       HRTIMER_MODE_REL);
135                 else                               79                 else
136                         hrtimer_start(&local->     80                         hrtimer_start(&local->ifs_timer,
137                                       hw->phy-     81                                       hw->phy->sifs_period * NSEC_PER_USEC,
138                                       HRTIMER_     82                                       HRTIMER_MODE_REL);
139         } else {                                   83         } else {
140                 ieee802154_release_queue(local !!  84                 ieee802154_wake_queue(hw);
141         }                                          85         }
142                                                    86 
143         dev_consume_skb_any(skb);                  87         dev_consume_skb_any(skb);
144         if (atomic_dec_and_test(&hw->phy->ongo << 
145                 wake_up(&hw->phy->sync_txq);   << 
146 }                                                  88 }
147 EXPORT_SYMBOL(ieee802154_xmit_complete);           89 EXPORT_SYMBOL(ieee802154_xmit_complete);
148                                                << 
149 void ieee802154_xmit_error(struct ieee802154_h << 
150                            int reason)         << 
151 {                                              << 
152         struct ieee802154_local *local = hw_to << 
153                                                << 
154         local->tx_result = reason;             << 
155         ieee802154_release_queue(local);       << 
156         dev_kfree_skb_any(skb);                << 
157         if (atomic_dec_and_test(&hw->phy->ongo << 
158                 wake_up(&hw->phy->sync_txq);   << 
159 }                                              << 
160 EXPORT_SYMBOL(ieee802154_xmit_error);          << 
161                                                << 
162 void ieee802154_xmit_hw_error(struct ieee80215 << 
163 {                                              << 
164         ieee802154_xmit_error(hw, skb, IEEE802 << 
165 }                                              << 
166 EXPORT_SYMBOL(ieee802154_xmit_hw_error);       << 
167                                                    90 
168 void ieee802154_stop_device(struct ieee802154_     91 void ieee802154_stop_device(struct ieee802154_local *local)
169 {                                                  92 {
170         flush_workqueue(local->workqueue);         93         flush_workqueue(local->workqueue);
171         hrtimer_cancel(&local->ifs_timer);         94         hrtimer_cancel(&local->ifs_timer);
172         drv_stop(local);                           95         drv_stop(local);
173 }                                                  96 }
174                                                    97 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php