aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-25 11:16:35 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-10-25 15:55:37 -0400
commita5e1ec538f54c4cb8ec9ce30867cfbab57225280 (patch)
treec00e77229c84408c9a141da22c738e8976f5ef3d /net/mac802154
parent5a50439775853a8d565115edb63a5ab4bb780479 (diff)
mac802154: rename mac802154_priv to ieee802154_local
This patch rename the mac802154_priv to ieee802154_local. The mac802154_priv structure is like ieee80211_local and so we name it ieee802154_local. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/ieee802154_i.h12
-rw-r--r--net/mac802154/iface.c4
-rw-r--r--net/mac802154/main.c172
-rw-r--r--net/mac802154/mib.c21
-rw-r--r--net/mac802154/monitor.c4
-rw-r--r--net/mac802154/rx.c12
-rw-r--r--net/mac802154/tx.c36
7 files changed, 130 insertions, 131 deletions
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 0cb98e87645a..eb55cd2d0b34 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -26,7 +26,7 @@
26#include "llsec.h" 26#include "llsec.h"
27 27
28/* mac802154 device private data */ 28/* mac802154 device private data */
29struct mac802154_priv { 29struct ieee802154_local {
30 struct ieee802154_hw hw; 30 struct ieee802154_hw hw;
31 struct ieee802154_ops *ops; 31 struct ieee802154_ops *ops;
32 32
@@ -69,7 +69,7 @@ struct mac802154_priv {
69struct mac802154_sub_if_data { 69struct mac802154_sub_if_data {
70 struct list_head list; /* the ieee802154_priv->slaves list */ 70 struct list_head list; /* the ieee802154_priv->slaves list */
71 71
72 struct mac802154_priv *hw; 72 struct ieee802154_local *hw;
73 struct net_device *dev; 73 struct net_device *dev;
74 74
75 int type; 75 int type;
@@ -99,7 +99,7 @@ struct mac802154_sub_if_data {
99 struct mac802154_llsec sec; 99 struct mac802154_llsec sec;
100}; 100};
101 101
102#define mac802154_to_priv(_hw) container_of(_hw, struct mac802154_priv, hw) 102#define mac802154_to_priv(_hw) container_of(_hw, struct ieee802154_local, hw)
103 103
104#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */ 104#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */
105 105
@@ -109,13 +109,13 @@ extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
109int mac802154_slave_open(struct net_device *dev); 109int mac802154_slave_open(struct net_device *dev);
110int mac802154_slave_close(struct net_device *dev); 110int mac802154_slave_close(struct net_device *dev);
111 111
112void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb); 112void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb);
113void mac802154_monitor_setup(struct net_device *dev); 113void mac802154_monitor_setup(struct net_device *dev);
114 114
115void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb); 115void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb);
116void mac802154_wpan_setup(struct net_device *dev); 116void mac802154_wpan_setup(struct net_device *dev);
117 117
118netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, 118netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
119 u8 page, u8 chan); 119 u8 page, u8 chan);
120 120
121/* MIB callbacks */ 121/* MIB callbacks */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 03eedc3b23ef..10f1ee27a616 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -565,7 +565,7 @@ static int mac802154_parse_frame_start(struct sk_buff *skb,
565 return 0; 565 return 0;
566} 566}
567 567
568void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb) 568void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
569{ 569{
570 int ret; 570 int ret;
571 struct mac802154_sub_if_data *sdata; 571 struct mac802154_sub_if_data *sdata;
@@ -579,7 +579,7 @@ void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb)
579 } 579 }
580 580
581 rcu_read_lock(); 581 rcu_read_lock();
582 list_for_each_entry_rcu(sdata, &priv->slaves, list) { 582 list_for_each_entry_rcu(sdata, &local->slaves, list) {
583 if (sdata->type != IEEE802154_DEV_WPAN || 583 if (sdata->type != IEEE802154_DEV_WPAN ||
584 !netif_running(sdata->dev)) 584 !netif_running(sdata->dev))
585 continue; 585 continue;
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index b0bcc063e9af..387d4cf94853 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -33,7 +33,7 @@ int mac802154_slave_open(struct net_device *dev)
33{ 33{
34 struct mac802154_sub_if_data *priv = netdev_priv(dev); 34 struct mac802154_sub_if_data *priv = netdev_priv(dev);
35 struct mac802154_sub_if_data *subif; 35 struct mac802154_sub_if_data *subif;
36 struct mac802154_priv *ipriv = priv->hw; 36 struct ieee802154_local *local = priv->hw;
37 int res = 0; 37 int res = 0;
38 38
39 ASSERT_RTNL(); 39 ASSERT_RTNL();
@@ -54,17 +54,17 @@ int mac802154_slave_open(struct net_device *dev)
54 priv->running = true; 54 priv->running = true;
55 mutex_unlock(&priv->hw->slaves_mtx); 55 mutex_unlock(&priv->hw->slaves_mtx);
56 56
57 if (ipriv->open_count++ == 0) { 57 if (local->open_count++ == 0) {
58 res = ipriv->ops->start(&ipriv->hw); 58 res = local->ops->start(&local->hw);
59 WARN_ON(res); 59 WARN_ON(res);
60 if (res) 60 if (res)
61 goto err; 61 goto err;
62 } 62 }
63 63
64 if (ipriv->ops->ieee_addr) { 64 if (local->ops->ieee_addr) {
65 __le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr); 65 __le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr);
66 66
67 res = ipriv->ops->ieee_addr(&ipriv->hw, addr); 67 res = local->ops->ieee_addr(&local->hw, addr);
68 WARN_ON(res); 68 WARN_ON(res);
69 if (res) 69 if (res)
70 goto err; 70 goto err;
@@ -82,7 +82,7 @@ err:
82int mac802154_slave_close(struct net_device *dev) 82int mac802154_slave_close(struct net_device *dev)
83{ 83{
84 struct mac802154_sub_if_data *priv = netdev_priv(dev); 84 struct mac802154_sub_if_data *priv = netdev_priv(dev);
85 struct mac802154_priv *ipriv = priv->hw; 85 struct ieee802154_local *local = priv->hw;
86 86
87 ASSERT_RTNL(); 87 ASSERT_RTNL();
88 88
@@ -92,8 +92,8 @@ int mac802154_slave_close(struct net_device *dev)
92 priv->running = false; 92 priv->running = false;
93 mutex_unlock(&priv->hw->slaves_mtx); 93 mutex_unlock(&priv->hw->slaves_mtx);
94 94
95 if (!--ipriv->open_count) 95 if (!--local->open_count)
96 ipriv->ops->stop(&ipriv->hw); 96 local->ops->stop(&local->hw);
97 97
98 return 0; 98 return 0;
99} 99}
@@ -102,34 +102,34 @@ static int
102mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) 102mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
103{ 103{
104 struct mac802154_sub_if_data *priv; 104 struct mac802154_sub_if_data *priv;
105 struct mac802154_priv *ipriv; 105 struct ieee802154_local *local;
106 int err; 106 int err;
107 107
108 ipriv = wpan_phy_priv(phy); 108 local = wpan_phy_priv(phy);
109 109
110 priv = netdev_priv(dev); 110 priv = netdev_priv(dev);
111 priv->dev = dev; 111 priv->dev = dev;
112 priv->hw = ipriv; 112 priv->hw = local;
113 113
114 dev->needed_headroom = ipriv->hw.extra_tx_headroom; 114 dev->needed_headroom = local->hw.extra_tx_headroom;
115 115
116 SET_NETDEV_DEV(dev, &ipriv->phy->dev); 116 SET_NETDEV_DEV(dev, &local->phy->dev);
117 117
118 mutex_lock(&ipriv->slaves_mtx); 118 mutex_lock(&local->slaves_mtx);
119 if (!ipriv->running) { 119 if (!local->running) {
120 mutex_unlock(&ipriv->slaves_mtx); 120 mutex_unlock(&local->slaves_mtx);
121 return -ENODEV; 121 return -ENODEV;
122 } 122 }
123 mutex_unlock(&ipriv->slaves_mtx); 123 mutex_unlock(&local->slaves_mtx);
124 124
125 err = register_netdev(dev); 125 err = register_netdev(dev);
126 if (err < 0) 126 if (err < 0)
127 return err; 127 return err;
128 128
129 rtnl_lock(); 129 rtnl_lock();
130 mutex_lock(&ipriv->slaves_mtx); 130 mutex_lock(&local->slaves_mtx);
131 list_add_tail_rcu(&priv->list, &ipriv->slaves); 131 list_add_tail_rcu(&priv->list, &local->slaves);
132 mutex_unlock(&ipriv->slaves_mtx); 132 mutex_unlock(&local->slaves_mtx);
133 rtnl_unlock(); 133 rtnl_unlock();
134 134
135 return 0; 135 return 0;
@@ -194,52 +194,52 @@ err:
194 194
195static int mac802154_set_txpower(struct wpan_phy *phy, int db) 195static int mac802154_set_txpower(struct wpan_phy *phy, int db)
196{ 196{
197 struct mac802154_priv *priv = wpan_phy_priv(phy); 197 struct ieee802154_local *local = wpan_phy_priv(phy);
198 198
199 return priv->ops->set_txpower(&priv->hw, db); 199 return local->ops->set_txpower(&local->hw, db);
200} 200}
201 201
202static int mac802154_set_lbt(struct wpan_phy *phy, bool on) 202static int mac802154_set_lbt(struct wpan_phy *phy, bool on)
203{ 203{
204 struct mac802154_priv *priv = wpan_phy_priv(phy); 204 struct ieee802154_local *local = wpan_phy_priv(phy);
205 205
206 return priv->ops->set_lbt(&priv->hw, on); 206 return local->ops->set_lbt(&local->hw, on);
207} 207}
208 208
209static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode) 209static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode)
210{ 210{
211 struct mac802154_priv *priv = wpan_phy_priv(phy); 211 struct ieee802154_local *local = wpan_phy_priv(phy);
212 212
213 return priv->ops->set_cca_mode(&priv->hw, mode); 213 return local->ops->set_cca_mode(&local->hw, mode);
214} 214}
215 215
216static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level) 216static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level)
217{ 217{
218 struct mac802154_priv *priv = wpan_phy_priv(phy); 218 struct ieee802154_local *local = wpan_phy_priv(phy);
219 219
220 return priv->ops->set_cca_ed_level(&priv->hw, level); 220 return local->ops->set_cca_ed_level(&local->hw, level);
221} 221}
222 222
223static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be, 223static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be,
224 u8 max_be, u8 retries) 224 u8 max_be, u8 retries)
225{ 225{
226 struct mac802154_priv *priv = wpan_phy_priv(phy); 226 struct ieee802154_local *local = wpan_phy_priv(phy);
227 227
228 return priv->ops->set_csma_params(&priv->hw, min_be, max_be, retries); 228 return local->ops->set_csma_params(&local->hw, min_be, max_be, retries);
229} 229}
230 230
231static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries) 231static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
232{ 232{
233 struct mac802154_priv *priv = wpan_phy_priv(phy); 233 struct ieee802154_local *local = wpan_phy_priv(phy);
234 234
235 return priv->ops->set_frame_retries(&priv->hw, retries); 235 return local->ops->set_frame_retries(&local->hw, retries);
236} 236}
237 237
238struct ieee802154_hw * 238struct ieee802154_hw *
239ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops) 239ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
240{ 240{
241 struct wpan_phy *phy; 241 struct wpan_phy *phy;
242 struct mac802154_priv *priv; 242 struct ieee802154_local *local;
243 size_t priv_size; 243 size_t priv_size;
244 244
245 if (!ops || !ops->xmit || !ops->ed || !ops->start || 245 if (!ops || !ops->xmit || !ops->ed || !ops->start ||
@@ -249,24 +249,24 @@ ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
249 } 249 }
250 250
251 /* Ensure 32-byte alignment of our private data and hw private data. 251 /* Ensure 32-byte alignment of our private data and hw private data.
252 * We use the wpan_phy priv data for both our mac802154_priv and for 252 * We use the wpan_phy priv data for both our ieee802154_local and for
253 * the driver's private data 253 * the driver's private data
254 * 254 *
255 * in memory it'll be like this: 255 * in memory it'll be like this:
256 * 256 *
257 * +-----------------------+ 257 * +-------------------------+
258 * | struct wpan_phy | 258 * | struct wpan_phy |
259 * +-----------------------+ 259 * +-------------------------+
260 * | struct mac802154_priv | 260 * | struct ieee802154_local |
261 * +-----------------------+ 261 * +-------------------------+
262 * | driver's private data | 262 * | driver's private data |
263 * +-----------------------+ 263 * +-------------------------+
264 * 264 *
265 * Due to ieee802154 layer isn't aware of driver and MAC structures, 265 * Due to ieee802154 layer isn't aware of driver and MAC structures,
266 * so lets align them here. 266 * so lets align them here.
267 */ 267 */
268 268
269 priv_size = ALIGN(sizeof(*priv), NETDEV_ALIGN) + priv_data_len; 269 priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
270 270
271 phy = wpan_phy_alloc(priv_size); 271 phy = wpan_phy_alloc(priv_size);
272 if (!phy) { 272 if (!phy) {
@@ -274,106 +274,106 @@ ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
274 return NULL; 274 return NULL;
275 } 275 }
276 276
277 priv = wpan_phy_priv(phy); 277 local = wpan_phy_priv(phy);
278 priv->phy = phy; 278 local->phy = phy;
279 priv->hw.phy = priv->phy; 279 local->hw.phy = local->phy;
280 priv->hw.priv = (char *)priv + ALIGN(sizeof(*priv), NETDEV_ALIGN); 280 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
281 priv->ops = ops; 281 local->ops = ops;
282 282
283 INIT_LIST_HEAD(&priv->slaves); 283 INIT_LIST_HEAD(&local->slaves);
284 mutex_init(&priv->slaves_mtx); 284 mutex_init(&local->slaves_mtx);
285 285
286 return &priv->hw; 286 return &local->hw;
287} 287}
288EXPORT_SYMBOL(ieee802154_alloc_hw); 288EXPORT_SYMBOL(ieee802154_alloc_hw);
289 289
290void ieee802154_free_hw(struct ieee802154_hw *hw) 290void ieee802154_free_hw(struct ieee802154_hw *hw)
291{ 291{
292 struct mac802154_priv *priv = mac802154_to_priv(hw); 292 struct ieee802154_local *local = mac802154_to_priv(hw);
293 293
294 BUG_ON(!list_empty(&priv->slaves)); 294 BUG_ON(!list_empty(&local->slaves));
295 295
296 mutex_destroy(&priv->slaves_mtx); 296 mutex_destroy(&local->slaves_mtx);
297 297
298 wpan_phy_free(priv->phy); 298 wpan_phy_free(local->phy);
299} 299}
300EXPORT_SYMBOL(ieee802154_free_hw); 300EXPORT_SYMBOL(ieee802154_free_hw);
301 301
302int ieee802154_register_hw(struct ieee802154_hw *hw) 302int ieee802154_register_hw(struct ieee802154_hw *hw)
303{ 303{
304 struct mac802154_priv *priv = mac802154_to_priv(hw); 304 struct ieee802154_local *local = mac802154_to_priv(hw);
305 int rc = -ENOSYS; 305 int rc = -ENOSYS;
306 306
307 if (hw->flags & IEEE802154_HW_TXPOWER) { 307 if (hw->flags & IEEE802154_HW_TXPOWER) {
308 if (!priv->ops->set_txpower) 308 if (!local->ops->set_txpower)
309 goto out; 309 goto out;
310 310
311 priv->phy->set_txpower = mac802154_set_txpower; 311 local->phy->set_txpower = mac802154_set_txpower;
312 } 312 }
313 313
314 if (hw->flags & IEEE802154_HW_LBT) { 314 if (hw->flags & IEEE802154_HW_LBT) {
315 if (!priv->ops->set_lbt) 315 if (!local->ops->set_lbt)
316 goto out; 316 goto out;
317 317
318 priv->phy->set_lbt = mac802154_set_lbt; 318 local->phy->set_lbt = mac802154_set_lbt;
319 } 319 }
320 320
321 if (hw->flags & IEEE802154_HW_CCA_MODE) { 321 if (hw->flags & IEEE802154_HW_CCA_MODE) {
322 if (!priv->ops->set_cca_mode) 322 if (!local->ops->set_cca_mode)
323 goto out; 323 goto out;
324 324
325 priv->phy->set_cca_mode = mac802154_set_cca_mode; 325 local->phy->set_cca_mode = mac802154_set_cca_mode;
326 } 326 }
327 327
328 if (hw->flags & IEEE802154_HW_CCA_ED_LEVEL) { 328 if (hw->flags & IEEE802154_HW_CCA_ED_LEVEL) {
329 if (!priv->ops->set_cca_ed_level) 329 if (!local->ops->set_cca_ed_level)
330 goto out; 330 goto out;
331 331
332 priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level; 332 local->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
333 } 333 }
334 334
335 if (hw->flags & IEEE802154_HW_CSMA_PARAMS) { 335 if (hw->flags & IEEE802154_HW_CSMA_PARAMS) {
336 if (!priv->ops->set_csma_params) 336 if (!local->ops->set_csma_params)
337 goto out; 337 goto out;
338 338
339 priv->phy->set_csma_params = mac802154_set_csma_params; 339 local->phy->set_csma_params = mac802154_set_csma_params;
340 } 340 }
341 341
342 if (hw->flags & IEEE802154_HW_FRAME_RETRIES) { 342 if (hw->flags & IEEE802154_HW_FRAME_RETRIES) {
343 if (!priv->ops->set_frame_retries) 343 if (!local->ops->set_frame_retries)
344 goto out; 344 goto out;
345 345
346 priv->phy->set_frame_retries = mac802154_set_frame_retries; 346 local->phy->set_frame_retries = mac802154_set_frame_retries;
347 } 347 }
348 348
349 priv->dev_workqueue = 349 local->dev_workqueue =
350 create_singlethread_workqueue(wpan_phy_name(priv->phy)); 350 create_singlethread_workqueue(wpan_phy_name(local->phy));
351 if (!priv->dev_workqueue) { 351 if (!local->dev_workqueue) {
352 rc = -ENOMEM; 352 rc = -ENOMEM;
353 goto out; 353 goto out;
354 } 354 }
355 355
356 wpan_phy_set_dev(priv->phy, priv->hw.parent); 356 wpan_phy_set_dev(local->phy, local->hw.parent);
357 357
358 priv->phy->add_iface = mac802154_add_iface; 358 local->phy->add_iface = mac802154_add_iface;
359 priv->phy->del_iface = mac802154_del_iface; 359 local->phy->del_iface = mac802154_del_iface;
360 360
361 rc = wpan_phy_register(priv->phy); 361 rc = wpan_phy_register(local->phy);
362 if (rc < 0) 362 if (rc < 0)
363 goto out_wq; 363 goto out_wq;
364 364
365 rtnl_lock(); 365 rtnl_lock();
366 366
367 mutex_lock(&priv->slaves_mtx); 367 mutex_lock(&local->slaves_mtx);
368 priv->running = MAC802154_DEVICE_RUN; 368 local->running = MAC802154_DEVICE_RUN;
369 mutex_unlock(&priv->slaves_mtx); 369 mutex_unlock(&local->slaves_mtx);
370 370
371 rtnl_unlock(); 371 rtnl_unlock();
372 372
373 return 0; 373 return 0;
374 374
375out_wq: 375out_wq:
376 destroy_workqueue(priv->dev_workqueue); 376 destroy_workqueue(local->dev_workqueue);
377out: 377out:
378 return rc; 378 return rc;
379} 379}
@@ -381,19 +381,19 @@ EXPORT_SYMBOL(ieee802154_register_hw);
381 381
382void ieee802154_unregister_hw(struct ieee802154_hw *hw) 382void ieee802154_unregister_hw(struct ieee802154_hw *hw)
383{ 383{
384 struct mac802154_priv *priv = mac802154_to_priv(hw); 384 struct ieee802154_local *local = mac802154_to_priv(hw);
385 struct mac802154_sub_if_data *sdata, *next; 385 struct mac802154_sub_if_data *sdata, *next;
386 386
387 flush_workqueue(priv->dev_workqueue); 387 flush_workqueue(local->dev_workqueue);
388 destroy_workqueue(priv->dev_workqueue); 388 destroy_workqueue(local->dev_workqueue);
389 389
390 rtnl_lock(); 390 rtnl_lock();
391 391
392 mutex_lock(&priv->slaves_mtx); 392 mutex_lock(&local->slaves_mtx);
393 priv->running = MAC802154_DEVICE_STOPPED; 393 local->running = MAC802154_DEVICE_STOPPED;
394 mutex_unlock(&priv->slaves_mtx); 394 mutex_unlock(&local->slaves_mtx);
395 395
396 list_for_each_entry_safe(sdata, next, &priv->slaves, list) { 396 list_for_each_entry_safe(sdata, next, &local->slaves, list) {
397 mutex_lock(&sdata->hw->slaves_mtx); 397 mutex_lock(&sdata->hw->slaves_mtx);
398 list_del(&sdata->list); 398 list_del(&sdata->list);
399 mutex_unlock(&sdata->hw->slaves_mtx); 399 mutex_unlock(&sdata->hw->slaves_mtx);
@@ -403,7 +403,7 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
403 403
404 rtnl_unlock(); 404 rtnl_unlock();
405 405
406 wpan_phy_unregister(priv->phy); 406 wpan_phy_unregister(local->phy);
407} 407}
408EXPORT_SYMBOL(ieee802154_unregister_hw); 408EXPORT_SYMBOL(ieee802154_unregister_hw);
409 409
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 7c9467216199..5d9592a128db 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -36,7 +36,7 @@ struct hw_addr_filt_notify_work {
36 unsigned long changed; 36 unsigned long changed;
37}; 37};
38 38
39static struct mac802154_priv *mac802154_slave_get_priv(struct net_device *dev) 39static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)
40{ 40{
41 struct mac802154_sub_if_data *priv = netdev_priv(dev); 41 struct mac802154_sub_if_data *priv = netdev_priv(dev);
42 42
@@ -49,12 +49,11 @@ static void hw_addr_notify(struct work_struct *work)
49{ 49{
50 struct hw_addr_filt_notify_work *nw = container_of(work, 50 struct hw_addr_filt_notify_work *nw = container_of(work,
51 struct hw_addr_filt_notify_work, work); 51 struct hw_addr_filt_notify_work, work);
52 struct mac802154_priv *hw = mac802154_slave_get_priv(nw->dev); 52 struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
53 int res; 53 int res;
54 54
55 res = hw->ops->set_hw_addr_filt(&hw->hw, 55 res = local->ops->set_hw_addr_filt(&local->hw, &local->hw.hw_filt,
56 &hw->hw.hw_filt, 56 nw->changed);
57 nw->changed);
58 if (res) 57 if (res)
59 pr_debug("failed changed mask %lx\n", nw->changed); 58 pr_debug("failed changed mask %lx\n", nw->changed);
60 59
@@ -110,13 +109,13 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)
110void mac802154_dev_set_ieee_addr(struct net_device *dev) 109void mac802154_dev_set_ieee_addr(struct net_device *dev)
111{ 110{
112 struct mac802154_sub_if_data *priv = netdev_priv(dev); 111 struct mac802154_sub_if_data *priv = netdev_priv(dev);
113 struct mac802154_priv *mac = priv->hw; 112 struct ieee802154_local *local = priv->hw;
114 113
115 priv->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr); 114 priv->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
116 115
117 if (mac->ops->set_hw_addr_filt && 116 if (local->ops->set_hw_addr_filt &&
118 mac->hw.hw_filt.ieee_addr != priv->extended_addr) { 117 local->hw.hw_filt.ieee_addr != priv->extended_addr) {
119 mac->hw.hw_filt.ieee_addr = priv->extended_addr; 118 local->hw.hw_filt.ieee_addr = priv->extended_addr;
120 set_hw_addr_filt(dev, IEEE802154_AFILT_IEEEADDR_CHANGED); 119 set_hw_addr_filt(dev, IEEE802154_AFILT_IEEEADDR_CHANGED);
121 } 120 }
122} 121}
@@ -165,12 +164,12 @@ static void phy_chan_notify(struct work_struct *work)
165{ 164{
166 struct phy_chan_notify_work *nw = container_of(work, 165 struct phy_chan_notify_work *nw = container_of(work,
167 struct phy_chan_notify_work, work); 166 struct phy_chan_notify_work, work);
168 struct mac802154_priv *hw = mac802154_slave_get_priv(nw->dev); 167 struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
169 struct mac802154_sub_if_data *priv = netdev_priv(nw->dev); 168 struct mac802154_sub_if_data *priv = netdev_priv(nw->dev);
170 int res; 169 int res;
171 170
172 mutex_lock(&priv->hw->phy->pib_lock); 171 mutex_lock(&priv->hw->phy->pib_lock);
173 res = hw->ops->set_channel(&hw->hw, priv->page, priv->chan); 172 res = local->ops->set_channel(&local->hw, priv->page, priv->chan);
174 if (res) { 173 if (res) {
175 pr_debug("set_channel failed\n"); 174 pr_debug("set_channel failed\n");
176 } else { 175 } else {
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index ca82c72a635c..a107fd2f2312 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -57,7 +57,7 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
57} 57}
58 58
59 59
60void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb) 60void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
61{ 61{
62 struct sk_buff *skb2; 62 struct sk_buff *skb2;
63 struct mac802154_sub_if_data *sdata; 63 struct mac802154_sub_if_data *sdata;
@@ -65,7 +65,7 @@ void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb)
65 u8 *data; 65 u8 *data;
66 66
67 rcu_read_lock(); 67 rcu_read_lock();
68 list_for_each_entry_rcu(sdata, &priv->slaves, list) { 68 list_for_each_entry_rcu(sdata, &local->slaves, list) {
69 if (sdata->type != IEEE802154_DEV_MONITOR || 69 if (sdata->type != IEEE802154_DEV_MONITOR ||
70 !netif_running(sdata->dev)) 70 !netif_running(sdata->dev))
71 continue; 71 continue;
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index 62b5c7dfe7f3..dc01817a92c5 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -49,13 +49,13 @@ struct rx_work {
49static void 49static void
50mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) 50mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
51{ 51{
52 struct mac802154_priv *priv = mac802154_to_priv(hw); 52 struct ieee802154_local *local = mac802154_to_priv(hw);
53 53
54 mac_cb(skb)->lqi = lqi; 54 mac_cb(skb)->lqi = lqi;
55 skb->protocol = htons(ETH_P_IEEE802154); 55 skb->protocol = htons(ETH_P_IEEE802154);
56 skb_reset_mac_header(skb); 56 skb_reset_mac_header(skb);
57 57
58 if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { 58 if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
59 u16 crc; 59 u16 crc;
60 60
61 if (skb->len < 2) { 61 if (skb->len < 2) {
@@ -70,8 +70,8 @@ mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
70 skb_trim(skb, skb->len - 2); /* CRC */ 70 skb_trim(skb, skb->len - 2); /* CRC */
71 } 71 }
72 72
73 mac802154_monitors_rx(priv, skb); 73 mac802154_monitors_rx(local, skb);
74 mac802154_wpans_rx(priv, skb); 74 mac802154_wpans_rx(local, skb);
75 75
76 return; 76 return;
77 77
@@ -90,7 +90,7 @@ static void mac802154_rx_worker(struct work_struct *work)
90void 90void
91ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) 91ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
92{ 92{
93 struct mac802154_priv *priv = mac802154_to_priv(hw); 93 struct ieee802154_local *local = mac802154_to_priv(hw);
94 struct rx_work *work; 94 struct rx_work *work;
95 95
96 if (!skb) 96 if (!skb)
@@ -105,6 +105,6 @@ ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
105 work->hw = hw; 105 work->hw = hw;
106 work->lqi = lqi; 106 work->lqi = lqi;
107 107
108 queue_work(priv->dev_workqueue, &work->work); 108 queue_work(local->dev_workqueue, &work->work);
109} 109}
110EXPORT_SYMBOL(ieee802154_rx_irqsafe); 110EXPORT_SYMBOL(ieee802154_rx_irqsafe);
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 8f537bf731ca..d4c92bd3ad32 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -33,7 +33,7 @@
33struct xmit_work { 33struct xmit_work {
34 struct sk_buff *skb; 34 struct sk_buff *skb;
35 struct work_struct work; 35 struct work_struct work;
36 struct mac802154_priv *priv; 36 struct ieee802154_local *local;
37 u8 chan; 37 u8 chan;
38 u8 page; 38 u8 page;
39}; 39};
@@ -44,10 +44,10 @@ static void mac802154_xmit_worker(struct work_struct *work)
44 struct mac802154_sub_if_data *sdata; 44 struct mac802154_sub_if_data *sdata;
45 int res; 45 int res;
46 46
47 mutex_lock(&xw->priv->phy->pib_lock); 47 mutex_lock(&xw->local->phy->pib_lock);
48 if (xw->priv->phy->current_channel != xw->chan || 48 if (xw->local->phy->current_channel != xw->chan ||
49 xw->priv->phy->current_page != xw->page) { 49 xw->local->phy->current_page != xw->page) {
50 res = xw->priv->ops->set_channel(&xw->priv->hw, 50 res = xw->local->ops->set_channel(&xw->local->hw,
51 xw->page, 51 xw->page,
52 xw->chan); 52 xw->chan);
53 if (res) { 53 if (res) {
@@ -55,20 +55,20 @@ static void mac802154_xmit_worker(struct work_struct *work)
55 goto out; 55 goto out;
56 } 56 }
57 57
58 xw->priv->phy->current_channel = xw->chan; 58 xw->local->phy->current_channel = xw->chan;
59 xw->priv->phy->current_page = xw->page; 59 xw->local->phy->current_page = xw->page;
60 } 60 }
61 61
62 res = xw->priv->ops->xmit(&xw->priv->hw, xw->skb); 62 res = xw->local->ops->xmit(&xw->local->hw, xw->skb);
63 if (res) 63 if (res)
64 pr_debug("transmission failed\n"); 64 pr_debug("transmission failed\n");
65 65
66out: 66out:
67 mutex_unlock(&xw->priv->phy->pib_lock); 67 mutex_unlock(&xw->local->phy->pib_lock);
68 68
69 /* Restart the netif queue on each sub_if_data object. */ 69 /* Restart the netif queue on each sub_if_data object. */
70 rcu_read_lock(); 70 rcu_read_lock();
71 list_for_each_entry_rcu(sdata, &xw->priv->slaves, list) 71 list_for_each_entry_rcu(sdata, &xw->local->slaves, list)
72 netif_wake_queue(sdata->dev); 72 netif_wake_queue(sdata->dev);
73 rcu_read_unlock(); 73 rcu_read_unlock();
74 74
@@ -77,20 +77,20 @@ out:
77 kfree(xw); 77 kfree(xw);
78} 78}
79 79
80netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, 80netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
81 u8 page, u8 chan) 81 u8 page, u8 chan)
82{ 82{
83 struct xmit_work *work; 83 struct xmit_work *work;
84 struct mac802154_sub_if_data *sdata; 84 struct mac802154_sub_if_data *sdata;
85 85
86 if (!(priv->phy->channels_supported[page] & (1 << chan))) { 86 if (!(local->phy->channels_supported[page] & (1 << chan))) {
87 WARN_ON(1); 87 WARN_ON(1);
88 goto err_tx; 88 goto err_tx;
89 } 89 }
90 90
91 mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb); 91 mac802154_monitors_rx(mac802154_to_priv(&local->hw), skb);
92 92
93 if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { 93 if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
94 u16 crc = crc_ccitt(0, skb->data, skb->len); 94 u16 crc = crc_ccitt(0, skb->data, skb->len);
95 u8 *data = skb_put(skb, 2); 95 u8 *data = skb_put(skb, 2);
96 96
@@ -98,7 +98,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
98 data[1] = crc >> 8; 98 data[1] = crc >> 8;
99 } 99 }
100 100
101 if (skb_cow_head(skb, priv->hw.extra_tx_headroom)) 101 if (skb_cow_head(skb, local->hw.extra_tx_headroom))
102 goto err_tx; 102 goto err_tx;
103 103
104 work = kzalloc(sizeof(*work), GFP_ATOMIC); 104 work = kzalloc(sizeof(*work), GFP_ATOMIC);
@@ -109,17 +109,17 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
109 109
110 /* Stop the netif queue on each sub_if_data object. */ 110 /* Stop the netif queue on each sub_if_data object. */
111 rcu_read_lock(); 111 rcu_read_lock();
112 list_for_each_entry_rcu(sdata, &priv->slaves, list) 112 list_for_each_entry_rcu(sdata, &local->slaves, list)
113 netif_stop_queue(sdata->dev); 113 netif_stop_queue(sdata->dev);
114 rcu_read_unlock(); 114 rcu_read_unlock();
115 115
116 INIT_WORK(&work->work, mac802154_xmit_worker); 116 INIT_WORK(&work->work, mac802154_xmit_worker);
117 work->skb = skb; 117 work->skb = skb;
118 work->priv = priv; 118 work->local = local;
119 work->page = page; 119 work->page = page;
120 work->chan = chan; 120 work->chan = chan;
121 121
122 queue_work(priv->dev_workqueue, &work->work); 122 queue_work(local->dev_workqueue, &work->work);
123 123
124 return NETDEV_TX_OK; 124 return NETDEV_TX_OK;
125 125