aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-25 11:16:36 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-10-25 15:55:37 -0400
commit036562f9c4d942f2fbc77ae3215309bde340546f (patch)
tree07ae942f7c4dc57b91d5e0aec5a0a1be617a53a5
parenta5e1ec538f54c4cb8ec9ce30867cfbab57225280 (diff)
mac802154: rename mac802154_sub_if_data
Like wireless this structure should named ieee802154_sub_if_data and not mac802154_sub_if_data. This patch renames the struct and variables to sdata instead priv sometimes. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--net/mac802154/ieee802154_i.h2
-rw-r--r--net/mac802154/iface.c137
-rw-r--r--net/mac802154/mac_cmd.c4
-rw-r--r--net/mac802154/main.c54
-rw-r--r--net/mac802154/mib.c192
-rw-r--r--net/mac802154/monitor.c22
-rw-r--r--net/mac802154/tx.c4
7 files changed, 208 insertions, 207 deletions
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index eb55cd2d0b34..daaca371110f 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -66,7 +66,7 @@ struct ieee802154_local {
66 * Each ieee802154 device/transceiver may have several slaves and able 66 * Each ieee802154 device/transceiver may have several slaves and able
67 * to be associated with several networks at the same time. 67 * to be associated with several networks at the same time.
68 */ 68 */
69struct mac802154_sub_if_data { 69struct ieee802154_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 ieee802154_local *hw; 72 struct ieee802154_local *hw;
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 10f1ee27a616..d3eb8a445a81 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -33,7 +33,7 @@
33 33
34static int mac802154_wpan_update_llsec(struct net_device *dev) 34static int mac802154_wpan_update_llsec(struct net_device *dev)
35{ 35{
36 struct mac802154_sub_if_data *priv = netdev_priv(dev); 36 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
37 struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev); 37 struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
38 int rc = 0; 38 int rc = 0;
39 39
@@ -41,10 +41,10 @@ static int mac802154_wpan_update_llsec(struct net_device *dev)
41 struct ieee802154_llsec_params params; 41 struct ieee802154_llsec_params params;
42 int changed = 0; 42 int changed = 0;
43 43
44 params.pan_id = priv->pan_id; 44 params.pan_id = sdata->pan_id;
45 changed |= IEEE802154_LLSEC_PARAM_PAN_ID; 45 changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
46 46
47 params.hwaddr = priv->extended_addr; 47 params.hwaddr = sdata->extended_addr;
48 changed |= IEEE802154_LLSEC_PARAM_HWADDR; 48 changed |= IEEE802154_LLSEC_PARAM_HWADDR;
49 49
50 rc = ops->llsec->set_params(dev, &params, changed); 50 rc = ops->llsec->set_params(dev, &params, changed);
@@ -56,20 +56,20 @@ static int mac802154_wpan_update_llsec(struct net_device *dev)
56static int 56static int
57mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 57mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
58{ 58{
59 struct mac802154_sub_if_data *priv = netdev_priv(dev); 59 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
60 struct sockaddr_ieee802154 *sa = 60 struct sockaddr_ieee802154 *sa =
61 (struct sockaddr_ieee802154 *)&ifr->ifr_addr; 61 (struct sockaddr_ieee802154 *)&ifr->ifr_addr;
62 int err = -ENOIOCTLCMD; 62 int err = -ENOIOCTLCMD;
63 63
64 spin_lock_bh(&priv->mib_lock); 64 spin_lock_bh(&sdata->mib_lock);
65 65
66 switch (cmd) { 66 switch (cmd) {
67 case SIOCGIFADDR: 67 case SIOCGIFADDR:
68 { 68 {
69 u16 pan_id, short_addr; 69 u16 pan_id, short_addr;
70 70
71 pan_id = le16_to_cpu(priv->pan_id); 71 pan_id = le16_to_cpu(sdata->pan_id);
72 short_addr = le16_to_cpu(priv->short_addr); 72 short_addr = le16_to_cpu(sdata->short_addr);
73 if (pan_id == IEEE802154_PANID_BROADCAST || 73 if (pan_id == IEEE802154_PANID_BROADCAST ||
74 short_addr == IEEE802154_ADDR_BROADCAST) { 74 short_addr == IEEE802154_ADDR_BROADCAST) {
75 err = -EADDRNOTAVAIL; 75 err = -EADDRNOTAVAIL;
@@ -96,14 +96,14 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
96 break; 96 break;
97 } 97 }
98 98
99 priv->pan_id = cpu_to_le16(sa->addr.pan_id); 99 sdata->pan_id = cpu_to_le16(sa->addr.pan_id);
100 priv->short_addr = cpu_to_le16(sa->addr.short_addr); 100 sdata->short_addr = cpu_to_le16(sa->addr.short_addr);
101 101
102 err = mac802154_wpan_update_llsec(dev); 102 err = mac802154_wpan_update_llsec(dev);
103 break; 103 break;
104 } 104 }
105 105
106 spin_unlock_bh(&priv->mib_lock); 106 spin_unlock_bh(&sdata->mib_lock);
107 return err; 107 return err;
108} 108}
109 109
@@ -123,11 +123,11 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
123int mac802154_set_mac_params(struct net_device *dev, 123int mac802154_set_mac_params(struct net_device *dev,
124 const struct ieee802154_mac_params *params) 124 const struct ieee802154_mac_params *params)
125{ 125{
126 struct mac802154_sub_if_data *priv = netdev_priv(dev); 126 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
127 127
128 mutex_lock(&priv->hw->slaves_mtx); 128 mutex_lock(&sdata->hw->slaves_mtx);
129 priv->mac_params = *params; 129 sdata->mac_params = *params;
130 mutex_unlock(&priv->hw->slaves_mtx); 130 mutex_unlock(&sdata->hw->slaves_mtx);
131 131
132 return 0; 132 return 0;
133} 133}
@@ -135,18 +135,18 @@ int mac802154_set_mac_params(struct net_device *dev,
135void mac802154_get_mac_params(struct net_device *dev, 135void mac802154_get_mac_params(struct net_device *dev,
136 struct ieee802154_mac_params *params) 136 struct ieee802154_mac_params *params)
137{ 137{
138 struct mac802154_sub_if_data *priv = netdev_priv(dev); 138 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
139 139
140 mutex_lock(&priv->hw->slaves_mtx); 140 mutex_lock(&sdata->hw->slaves_mtx);
141 *params = priv->mac_params; 141 *params = sdata->mac_params;
142 mutex_unlock(&priv->hw->slaves_mtx); 142 mutex_unlock(&sdata->hw->slaves_mtx);
143} 143}
144 144
145static int mac802154_wpan_open(struct net_device *dev) 145static int mac802154_wpan_open(struct net_device *dev)
146{ 146{
147 int rc; 147 int rc;
148 struct mac802154_sub_if_data *priv = netdev_priv(dev); 148 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
149 struct wpan_phy *phy = priv->hw->phy; 149 struct wpan_phy *phy = sdata->hw->phy;
150 150
151 rc = mac802154_slave_open(dev); 151 rc = mac802154_slave_open(dev);
152 if (rc < 0) 152 if (rc < 0)
@@ -155,40 +155,40 @@ static int mac802154_wpan_open(struct net_device *dev)
155 mutex_lock(&phy->pib_lock); 155 mutex_lock(&phy->pib_lock);
156 156
157 if (phy->set_txpower) { 157 if (phy->set_txpower) {
158 rc = phy->set_txpower(phy, priv->mac_params.transmit_power); 158 rc = phy->set_txpower(phy, sdata->mac_params.transmit_power);
159 if (rc < 0) 159 if (rc < 0)
160 goto out; 160 goto out;
161 } 161 }
162 162
163 if (phy->set_lbt) { 163 if (phy->set_lbt) {
164 rc = phy->set_lbt(phy, priv->mac_params.lbt); 164 rc = phy->set_lbt(phy, sdata->mac_params.lbt);
165 if (rc < 0) 165 if (rc < 0)
166 goto out; 166 goto out;
167 } 167 }
168 168
169 if (phy->set_cca_mode) { 169 if (phy->set_cca_mode) {
170 rc = phy->set_cca_mode(phy, priv->mac_params.cca_mode); 170 rc = phy->set_cca_mode(phy, sdata->mac_params.cca_mode);
171 if (rc < 0) 171 if (rc < 0)
172 goto out; 172 goto out;
173 } 173 }
174 174
175 if (phy->set_cca_ed_level) { 175 if (phy->set_cca_ed_level) {
176 rc = phy->set_cca_ed_level(phy, priv->mac_params.cca_ed_level); 176 rc = phy->set_cca_ed_level(phy, sdata->mac_params.cca_ed_level);
177 if (rc < 0) 177 if (rc < 0)
178 goto out; 178 goto out;
179 } 179 }
180 180
181 if (phy->set_csma_params) { 181 if (phy->set_csma_params) {
182 rc = phy->set_csma_params(phy, priv->mac_params.min_be, 182 rc = phy->set_csma_params(phy, sdata->mac_params.min_be,
183 priv->mac_params.max_be, 183 sdata->mac_params.max_be,
184 priv->mac_params.csma_retries); 184 sdata->mac_params.csma_retries);
185 if (rc < 0) 185 if (rc < 0)
186 goto out; 186 goto out;
187 } 187 }
188 188
189 if (phy->set_frame_retries) { 189 if (phy->set_frame_retries) {
190 rc = phy->set_frame_retries(phy, 190 rc = phy->set_frame_retries(phy,
191 priv->mac_params.frame_retries); 191 sdata->mac_params.frame_retries);
192 if (rc < 0) 192 if (rc < 0)
193 goto out; 193 goto out;
194 } 194 }
@@ -201,14 +201,14 @@ out:
201 return rc; 201 return rc;
202} 202}
203 203
204static int mac802154_set_header_security(struct mac802154_sub_if_data *priv, 204static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,
205 struct ieee802154_hdr *hdr, 205 struct ieee802154_hdr *hdr,
206 const struct ieee802154_mac_cb *cb) 206 const struct ieee802154_mac_cb *cb)
207{ 207{
208 struct ieee802154_llsec_params params; 208 struct ieee802154_llsec_params params;
209 u8 level; 209 u8 level;
210 210
211 mac802154_llsec_get_params(&priv->sec, &params); 211 mac802154_llsec_get_params(&sdata->sec, &params);
212 212
213 if (!params.enabled && cb->secen_override && cb->secen) 213 if (!params.enabled && cb->secen_override && cb->secen)
214 return -EINVAL; 214 return -EINVAL;
@@ -241,7 +241,7 @@ static int mac802154_header_create(struct sk_buff *skb,
241 unsigned len) 241 unsigned len)
242{ 242{
243 struct ieee802154_hdr hdr; 243 struct ieee802154_hdr hdr;
244 struct mac802154_sub_if_data *priv = netdev_priv(dev); 244 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
245 struct ieee802154_mac_cb *cb = mac_cb(skb); 245 struct ieee802154_mac_cb *cb = mac_cb(skb);
246 int hlen; 246 int hlen;
247 247
@@ -254,25 +254,25 @@ static int mac802154_header_create(struct sk_buff *skb,
254 hdr.fc.ack_request = cb->ackreq; 254 hdr.fc.ack_request = cb->ackreq;
255 hdr.seq = ieee802154_mlme_ops(dev)->get_dsn(dev); 255 hdr.seq = ieee802154_mlme_ops(dev)->get_dsn(dev);
256 256
257 if (mac802154_set_header_security(priv, &hdr, cb) < 0) 257 if (mac802154_set_header_security(sdata, &hdr, cb) < 0)
258 return -EINVAL; 258 return -EINVAL;
259 259
260 if (!saddr) { 260 if (!saddr) {
261 spin_lock_bh(&priv->mib_lock); 261 spin_lock_bh(&sdata->mib_lock);
262 262
263 if (priv->short_addr == cpu_to_le16(IEEE802154_ADDR_BROADCAST) || 263 if (sdata->short_addr == cpu_to_le16(IEEE802154_ADDR_BROADCAST) ||
264 priv->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) || 264 sdata->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) ||
265 priv->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST)) { 265 sdata->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST)) {
266 hdr.source.mode = IEEE802154_ADDR_LONG; 266 hdr.source.mode = IEEE802154_ADDR_LONG;
267 hdr.source.extended_addr = priv->extended_addr; 267 hdr.source.extended_addr = sdata->extended_addr;
268 } else { 268 } else {
269 hdr.source.mode = IEEE802154_ADDR_SHORT; 269 hdr.source.mode = IEEE802154_ADDR_SHORT;
270 hdr.source.short_addr = priv->short_addr; 270 hdr.source.short_addr = sdata->short_addr;
271 } 271 }
272 272
273 hdr.source.pan_id = priv->pan_id; 273 hdr.source.pan_id = sdata->pan_id;
274 274
275 spin_unlock_bh(&priv->mib_lock); 275 spin_unlock_bh(&sdata->mib_lock);
276 } else { 276 } else {
277 hdr.source = *(const struct ieee802154_addr *)saddr; 277 hdr.source = *(const struct ieee802154_addr *)saddr;
278 } 278 }
@@ -310,16 +310,16 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
310static netdev_tx_t 310static netdev_tx_t
311mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) 311mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
312{ 312{
313 struct mac802154_sub_if_data *priv; 313 struct ieee802154_sub_if_data *sdata;
314 u8 chan, page; 314 u8 chan, page;
315 int rc; 315 int rc;
316 316
317 priv = netdev_priv(dev); 317 sdata = netdev_priv(dev);
318 318
319 spin_lock_bh(&priv->mib_lock); 319 spin_lock_bh(&sdata->mib_lock);
320 chan = priv->chan; 320 chan = sdata->chan;
321 page = priv->page; 321 page = sdata->page;
322 spin_unlock_bh(&priv->mib_lock); 322 spin_unlock_bh(&sdata->mib_lock);
323 323
324 if (chan == MAC802154_CHAN_NONE || 324 if (chan == MAC802154_CHAN_NONE ||
325 page >= WPAN_NUM_PAGES || 325 page >= WPAN_NUM_PAGES ||
@@ -328,7 +328,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
328 return NETDEV_TX_OK; 328 return NETDEV_TX_OK;
329 } 329 }
330 330
331 rc = mac802154_llsec_encrypt(&priv->sec, skb); 331 rc = mac802154_llsec_encrypt(&sdata->sec, skb);
332 if (rc) { 332 if (rc) {
333 pr_warn("encryption failed: %i\n", rc); 333 pr_warn("encryption failed: %i\n", rc);
334 kfree_skb(skb); 334 kfree_skb(skb);
@@ -339,7 +339,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
339 dev->stats.tx_packets++; 339 dev->stats.tx_packets++;
340 dev->stats.tx_bytes += skb->len; 340 dev->stats.tx_bytes += skb->len;
341 341
342 return mac802154_tx(priv->hw, skb, page, chan); 342 return mac802154_tx(sdata->hw, skb, page, chan);
343} 343}
344 344
345static struct header_ops mac802154_header_ops = { 345static struct header_ops mac802154_header_ops = {
@@ -357,16 +357,16 @@ static const struct net_device_ops mac802154_wpan_ops = {
357 357
358static void mac802154_wpan_free(struct net_device *dev) 358static void mac802154_wpan_free(struct net_device *dev)
359{ 359{
360 struct mac802154_sub_if_data *priv = netdev_priv(dev); 360 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
361 361
362 mac802154_llsec_destroy(&priv->sec); 362 mac802154_llsec_destroy(&sdata->sec);
363 363
364 free_netdev(dev); 364 free_netdev(dev);
365} 365}
366 366
367void mac802154_wpan_setup(struct net_device *dev) 367void mac802154_wpan_setup(struct net_device *dev)
368{ 368{
369 struct mac802154_sub_if_data *priv; 369 struct ieee802154_sub_if_data *sdata;
370 370
371 dev->addr_len = IEEE802154_ADDR_LEN; 371 dev->addr_len = IEEE802154_ADDR_LEN;
372 memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN); 372 memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
@@ -384,28 +384,29 @@ void mac802154_wpan_setup(struct net_device *dev)
384 dev->netdev_ops = &mac802154_wpan_ops; 384 dev->netdev_ops = &mac802154_wpan_ops;
385 dev->ml_priv = &mac802154_mlme_wpan; 385 dev->ml_priv = &mac802154_mlme_wpan;
386 386
387 priv = netdev_priv(dev); 387 sdata = netdev_priv(dev);
388 priv->type = IEEE802154_DEV_WPAN; 388 sdata->type = IEEE802154_DEV_WPAN;
389 389
390 priv->chan = MAC802154_CHAN_NONE; 390 sdata->chan = MAC802154_CHAN_NONE;
391 priv->page = 0; 391 sdata->page = 0;
392 392
393 spin_lock_init(&priv->mib_lock); 393 spin_lock_init(&sdata->mib_lock);
394 mutex_init(&priv->sec_mtx); 394 mutex_init(&sdata->sec_mtx);
395 395
396 get_random_bytes(&priv->bsn, 1); 396 get_random_bytes(&sdata->bsn, 1);
397 get_random_bytes(&priv->dsn, 1); 397 get_random_bytes(&sdata->dsn, 1);
398 398
399 /* defaults per 802.15.4-2011 */ 399 /* defaults per 802.15.4-2011 */
400 priv->mac_params.min_be = 3; 400 sdata->mac_params.min_be = 3;
401 priv->mac_params.max_be = 5; 401 sdata->mac_params.max_be = 5;
402 priv->mac_params.csma_retries = 4; 402 sdata->mac_params.csma_retries = 4;
403 priv->mac_params.frame_retries = -1; /* for compatibility, actual default is 3 */ 403 /* for compatibility, actual default is 3 */
404 sdata->mac_params.frame_retries = -1;
404 405
405 priv->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST); 406 sdata->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
406 priv->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST); 407 sdata->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
407 408
408 mac802154_llsec_init(&priv->sec); 409 mac802154_llsec_init(&sdata->sec);
409} 410}
410 411
411static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) 412static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
@@ -414,7 +415,7 @@ static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
414} 415}
415 416
416static int 417static int
417mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb, 418mac802154_subif_frame(struct ieee802154_sub_if_data *sdata, struct sk_buff *skb,
418 const struct ieee802154_hdr *hdr) 419 const struct ieee802154_hdr *hdr)
419{ 420{
420 __le16 span, sshort; 421 __le16 span, sshort;
@@ -568,7 +569,7 @@ static int mac802154_parse_frame_start(struct sk_buff *skb,
568void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb) 569void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
569{ 570{
570 int ret; 571 int ret;
571 struct mac802154_sub_if_data *sdata; 572 struct ieee802154_sub_if_data *sdata;
572 struct ieee802154_hdr hdr; 573 struct ieee802154_hdr hdr;
573 574
574 ret = mac802154_parse_frame_start(skb, &hdr); 575 ret = mac802154_parse_frame_start(skb, &hdr);
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index ad09d54bc690..bccaefbe0ba2 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -75,11 +75,11 @@ static int mac802154_mlme_start_req(struct net_device *dev,
75 75
76static struct wpan_phy *mac802154_get_phy(const struct net_device *dev) 76static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
77{ 77{
78 struct mac802154_sub_if_data *priv = netdev_priv(dev); 78 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
79 79
80 BUG_ON(dev->type != ARPHRD_IEEE802154); 80 BUG_ON(dev->type != ARPHRD_IEEE802154);
81 81
82 return to_phy(get_device(&priv->hw->phy->dev)); 82 return to_phy(get_device(&sdata->hw->phy->dev));
83} 83}
84 84
85static struct ieee802154_llsec_ops mac802154_llsec_ops = { 85static struct ieee802154_llsec_ops mac802154_llsec_ops = {
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 387d4cf94853..6f630d4990fa 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -31,28 +31,28 @@
31 31
32int mac802154_slave_open(struct net_device *dev) 32int mac802154_slave_open(struct net_device *dev)
33{ 33{
34 struct mac802154_sub_if_data *priv = netdev_priv(dev); 34 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
35 struct mac802154_sub_if_data *subif; 35 struct ieee802154_sub_if_data *subif;
36 struct ieee802154_local *local = priv->hw; 36 struct ieee802154_local *local = sdata->hw;
37 int res = 0; 37 int res = 0;
38 38
39 ASSERT_RTNL(); 39 ASSERT_RTNL();
40 40
41 if (priv->type == IEEE802154_DEV_WPAN) { 41 if (sdata->type == IEEE802154_DEV_WPAN) {
42 mutex_lock(&priv->hw->slaves_mtx); 42 mutex_lock(&sdata->hw->slaves_mtx);
43 list_for_each_entry(subif, &priv->hw->slaves, list) { 43 list_for_each_entry(subif, &sdata->hw->slaves, list) {
44 if (subif != priv && subif->type == priv->type && 44 if (subif != sdata && subif->type == sdata->type &&
45 subif->running) { 45 subif->running) {
46 mutex_unlock(&priv->hw->slaves_mtx); 46 mutex_unlock(&sdata->hw->slaves_mtx);
47 return -EBUSY; 47 return -EBUSY;
48 } 48 }
49 } 49 }
50 mutex_unlock(&priv->hw->slaves_mtx); 50 mutex_unlock(&sdata->hw->slaves_mtx);
51 } 51 }
52 52
53 mutex_lock(&priv->hw->slaves_mtx); 53 mutex_lock(&sdata->hw->slaves_mtx);
54 priv->running = true; 54 sdata->running = true;
55 mutex_unlock(&priv->hw->slaves_mtx); 55 mutex_unlock(&sdata->hw->slaves_mtx);
56 56
57 if (local->open_count++ == 0) { 57 if (local->open_count++ == 0) {
58 res = local->ops->start(&local->hw); 58 res = local->ops->start(&local->hw);
@@ -74,23 +74,23 @@ int mac802154_slave_open(struct net_device *dev)
74 netif_start_queue(dev); 74 netif_start_queue(dev);
75 return 0; 75 return 0;
76err: 76err:
77 priv->hw->open_count--; 77 sdata->hw->open_count--;
78 78
79 return res; 79 return res;
80} 80}
81 81
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 ieee802154_sub_if_data *sdata = netdev_priv(dev);
85 struct ieee802154_local *local = priv->hw; 85 struct ieee802154_local *local = sdata->hw;
86 86
87 ASSERT_RTNL(); 87 ASSERT_RTNL();
88 88
89 netif_stop_queue(dev); 89 netif_stop_queue(dev);
90 90
91 mutex_lock(&priv->hw->slaves_mtx); 91 mutex_lock(&sdata->hw->slaves_mtx);
92 priv->running = false; 92 sdata->running = false;
93 mutex_unlock(&priv->hw->slaves_mtx); 93 mutex_unlock(&sdata->hw->slaves_mtx);
94 94
95 if (!--local->open_count) 95 if (!--local->open_count)
96 local->ops->stop(&local->hw); 96 local->ops->stop(&local->hw);
@@ -101,15 +101,15 @@ int mac802154_slave_close(struct net_device *dev)
101static int 101static 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 ieee802154_sub_if_data *sdata;
105 struct ieee802154_local *local; 105 struct ieee802154_local *local;
106 int err; 106 int err;
107 107
108 local = wpan_phy_priv(phy); 108 local = wpan_phy_priv(phy);
109 109
110 priv = netdev_priv(dev); 110 sdata = netdev_priv(dev);
111 priv->dev = dev; 111 sdata->dev = dev;
112 priv->hw = local; 112 sdata->hw = local;
113 113
114 dev->needed_headroom = local->hw.extra_tx_headroom; 114 dev->needed_headroom = local->hw.extra_tx_headroom;
115 115
@@ -128,7 +128,7 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
128 128
129 rtnl_lock(); 129 rtnl_lock();
130 mutex_lock(&local->slaves_mtx); 130 mutex_lock(&local->slaves_mtx);
131 list_add_tail_rcu(&priv->list, &local->slaves); 131 list_add_tail_rcu(&sdata->list, &local->slaves);
132 mutex_unlock(&local->slaves_mtx); 132 mutex_unlock(&local->slaves_mtx);
133 rtnl_unlock(); 133 rtnl_unlock();
134 134
@@ -138,7 +138,7 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
138static void 138static void
139mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev) 139mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
140{ 140{
141 struct mac802154_sub_if_data *sdata; 141 struct ieee802154_sub_if_data *sdata;
142 142
143 ASSERT_RTNL(); 143 ASSERT_RTNL();
144 144
@@ -162,12 +162,12 @@ mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
162 162
163 switch (type) { 163 switch (type) {
164 case IEEE802154_DEV_MONITOR: 164 case IEEE802154_DEV_MONITOR:
165 dev = alloc_netdev(sizeof(struct mac802154_sub_if_data), 165 dev = alloc_netdev(sizeof(struct ieee802154_sub_if_data),
166 name, NET_NAME_UNKNOWN, 166 name, NET_NAME_UNKNOWN,
167 mac802154_monitor_setup); 167 mac802154_monitor_setup);
168 break; 168 break;
169 case IEEE802154_DEV_WPAN: 169 case IEEE802154_DEV_WPAN:
170 dev = alloc_netdev(sizeof(struct mac802154_sub_if_data), 170 dev = alloc_netdev(sizeof(struct ieee802154_sub_if_data),
171 name, NET_NAME_UNKNOWN, 171 name, NET_NAME_UNKNOWN,
172 mac802154_wpan_setup); 172 mac802154_wpan_setup);
173 break; 173 break;
@@ -382,7 +382,7 @@ EXPORT_SYMBOL(ieee802154_register_hw);
382void ieee802154_unregister_hw(struct ieee802154_hw *hw) 382void ieee802154_unregister_hw(struct ieee802154_hw *hw)
383{ 383{
384 struct ieee802154_local *local = mac802154_to_priv(hw); 384 struct ieee802154_local *local = mac802154_to_priv(hw);
385 struct mac802154_sub_if_data *sdata, *next; 385 struct ieee802154_sub_if_data *sdata, *next;
386 386
387 flush_workqueue(local->dev_workqueue); 387 flush_workqueue(local->dev_workqueue);
388 destroy_workqueue(local->dev_workqueue); 388 destroy_workqueue(local->dev_workqueue);
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 5d9592a128db..ef05b3bd9a63 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -38,11 +38,11 @@ struct hw_addr_filt_notify_work {
38 38
39static struct ieee802154_local *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 ieee802154_sub_if_data *sdata = netdev_priv(dev);
42 42
43 BUG_ON(dev->type != ARPHRD_IEEE802154); 43 BUG_ON(dev->type != ARPHRD_IEEE802154);
44 44
45 return priv->hw; 45 return sdata->hw;
46} 46}
47 47
48static void hw_addr_notify(struct work_struct *work) 48static void hw_addr_notify(struct work_struct *work)
@@ -62,7 +62,7 @@ static void hw_addr_notify(struct work_struct *work)
62 62
63static void set_hw_addr_filt(struct net_device *dev, unsigned long changed) 63static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
64{ 64{
65 struct mac802154_sub_if_data *priv = netdev_priv(dev); 65 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
66 struct hw_addr_filt_notify_work *work; 66 struct hw_addr_filt_notify_work *work;
67 67
68 work = kzalloc(sizeof(*work), GFP_ATOMIC); 68 work = kzalloc(sizeof(*work), GFP_ATOMIC);
@@ -72,92 +72,92 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
72 INIT_WORK(&work->work, hw_addr_notify); 72 INIT_WORK(&work->work, hw_addr_notify);
73 work->dev = dev; 73 work->dev = dev;
74 work->changed = changed; 74 work->changed = changed;
75 queue_work(priv->hw->dev_workqueue, &work->work); 75 queue_work(sdata->hw->dev_workqueue, &work->work);
76} 76}
77 77
78void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val) 78void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
79{ 79{
80 struct mac802154_sub_if_data *priv = netdev_priv(dev); 80 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
81 81
82 BUG_ON(dev->type != ARPHRD_IEEE802154); 82 BUG_ON(dev->type != ARPHRD_IEEE802154);
83 83
84 spin_lock_bh(&priv->mib_lock); 84 spin_lock_bh(&sdata->mib_lock);
85 priv->short_addr = val; 85 sdata->short_addr = val;
86 spin_unlock_bh(&priv->mib_lock); 86 spin_unlock_bh(&sdata->mib_lock);
87 87
88 if ((priv->hw->ops->set_hw_addr_filt) && 88 if ((sdata->hw->ops->set_hw_addr_filt) &&
89 (priv->hw->hw.hw_filt.short_addr != priv->short_addr)) { 89 (sdata->hw->hw.hw_filt.short_addr != sdata->short_addr)) {
90 priv->hw->hw.hw_filt.short_addr = priv->short_addr; 90 sdata->hw->hw.hw_filt.short_addr = sdata->short_addr;
91 set_hw_addr_filt(dev, IEEE802154_AFILT_SADDR_CHANGED); 91 set_hw_addr_filt(dev, IEEE802154_AFILT_SADDR_CHANGED);
92 } 92 }
93} 93}
94 94
95__le16 mac802154_dev_get_short_addr(const struct net_device *dev) 95__le16 mac802154_dev_get_short_addr(const struct net_device *dev)
96{ 96{
97 struct mac802154_sub_if_data *priv = netdev_priv(dev); 97 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
98 __le16 ret; 98 __le16 ret;
99 99
100 BUG_ON(dev->type != ARPHRD_IEEE802154); 100 BUG_ON(dev->type != ARPHRD_IEEE802154);
101 101
102 spin_lock_bh(&priv->mib_lock); 102 spin_lock_bh(&sdata->mib_lock);
103 ret = priv->short_addr; 103 ret = sdata->short_addr;
104 spin_unlock_bh(&priv->mib_lock); 104 spin_unlock_bh(&sdata->mib_lock);
105 105
106 return ret; 106 return ret;
107} 107}
108 108
109void mac802154_dev_set_ieee_addr(struct net_device *dev) 109void mac802154_dev_set_ieee_addr(struct net_device *dev)
110{ 110{
111 struct mac802154_sub_if_data *priv = netdev_priv(dev); 111 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
112 struct ieee802154_local *local = priv->hw; 112 struct ieee802154_local *local = sdata->hw;
113 113
114 priv->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr); 114 sdata->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
115 115
116 if (local->ops->set_hw_addr_filt && 116 if (local->ops->set_hw_addr_filt &&
117 local->hw.hw_filt.ieee_addr != priv->extended_addr) { 117 local->hw.hw_filt.ieee_addr != sdata->extended_addr) {
118 local->hw.hw_filt.ieee_addr = priv->extended_addr; 118 local->hw.hw_filt.ieee_addr = sdata->extended_addr;
119 set_hw_addr_filt(dev, IEEE802154_AFILT_IEEEADDR_CHANGED); 119 set_hw_addr_filt(dev, IEEE802154_AFILT_IEEEADDR_CHANGED);
120 } 120 }
121} 121}
122 122
123__le16 mac802154_dev_get_pan_id(const struct net_device *dev) 123__le16 mac802154_dev_get_pan_id(const struct net_device *dev)
124{ 124{
125 struct mac802154_sub_if_data *priv = netdev_priv(dev); 125 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
126 __le16 ret; 126 __le16 ret;
127 127
128 BUG_ON(dev->type != ARPHRD_IEEE802154); 128 BUG_ON(dev->type != ARPHRD_IEEE802154);
129 129
130 spin_lock_bh(&priv->mib_lock); 130 spin_lock_bh(&sdata->mib_lock);
131 ret = priv->pan_id; 131 ret = sdata->pan_id;
132 spin_unlock_bh(&priv->mib_lock); 132 spin_unlock_bh(&sdata->mib_lock);
133 133
134 return ret; 134 return ret;
135} 135}
136 136
137void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val) 137void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
138{ 138{
139 struct mac802154_sub_if_data *priv = netdev_priv(dev); 139 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
140 140
141 BUG_ON(dev->type != ARPHRD_IEEE802154); 141 BUG_ON(dev->type != ARPHRD_IEEE802154);
142 142
143 spin_lock_bh(&priv->mib_lock); 143 spin_lock_bh(&sdata->mib_lock);
144 priv->pan_id = val; 144 sdata->pan_id = val;
145 spin_unlock_bh(&priv->mib_lock); 145 spin_unlock_bh(&sdata->mib_lock);
146 146
147 if ((priv->hw->ops->set_hw_addr_filt) && 147 if ((sdata->hw->ops->set_hw_addr_filt) &&
148 (priv->hw->hw.hw_filt.pan_id != priv->pan_id)) { 148 (sdata->hw->hw.hw_filt.pan_id != sdata->pan_id)) {
149 priv->hw->hw.hw_filt.pan_id = priv->pan_id; 149 sdata->hw->hw.hw_filt.pan_id = sdata->pan_id;
150 set_hw_addr_filt(dev, IEEE802154_AFILT_PANID_CHANGED); 150 set_hw_addr_filt(dev, IEEE802154_AFILT_PANID_CHANGED);
151 } 151 }
152} 152}
153 153
154u8 mac802154_dev_get_dsn(const struct net_device *dev) 154u8 mac802154_dev_get_dsn(const struct net_device *dev)
155{ 155{
156 struct mac802154_sub_if_data *priv = netdev_priv(dev); 156 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
157 157
158 BUG_ON(dev->type != ARPHRD_IEEE802154); 158 BUG_ON(dev->type != ARPHRD_IEEE802154);
159 159
160 return priv->dsn++; 160 return sdata->dsn++;
161} 161}
162 162
163static void phy_chan_notify(struct work_struct *work) 163static void phy_chan_notify(struct work_struct *work)
@@ -165,38 +165,38 @@ static void phy_chan_notify(struct work_struct *work)
165 struct phy_chan_notify_work *nw = container_of(work, 165 struct phy_chan_notify_work *nw = container_of(work,
166 struct phy_chan_notify_work, work); 166 struct phy_chan_notify_work, work);
167 struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev); 167 struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
168 struct mac802154_sub_if_data *priv = netdev_priv(nw->dev); 168 struct ieee802154_sub_if_data *sdata = netdev_priv(nw->dev);
169 int res; 169 int res;
170 170
171 mutex_lock(&priv->hw->phy->pib_lock); 171 mutex_lock(&sdata->hw->phy->pib_lock);
172 res = local->ops->set_channel(&local->hw, priv->page, priv->chan); 172 res = local->ops->set_channel(&local->hw, sdata->page, sdata->chan);
173 if (res) { 173 if (res) {
174 pr_debug("set_channel failed\n"); 174 pr_debug("set_channel failed\n");
175 } else { 175 } else {
176 priv->hw->phy->current_channel = priv->chan; 176 sdata->hw->phy->current_channel = sdata->chan;
177 priv->hw->phy->current_page = priv->page; 177 sdata->hw->phy->current_page = sdata->page;
178 } 178 }
179 mutex_unlock(&priv->hw->phy->pib_lock); 179 mutex_unlock(&sdata->hw->phy->pib_lock);
180 180
181 kfree(nw); 181 kfree(nw);
182} 182}
183 183
184void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan) 184void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
185{ 185{
186 struct mac802154_sub_if_data *priv = netdev_priv(dev); 186 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
187 struct phy_chan_notify_work *work; 187 struct phy_chan_notify_work *work;
188 188
189 BUG_ON(dev->type != ARPHRD_IEEE802154); 189 BUG_ON(dev->type != ARPHRD_IEEE802154);
190 190
191 spin_lock_bh(&priv->mib_lock); 191 spin_lock_bh(&sdata->mib_lock);
192 priv->page = page; 192 sdata->page = page;
193 priv->chan = chan; 193 sdata->chan = chan;
194 spin_unlock_bh(&priv->mib_lock); 194 spin_unlock_bh(&sdata->mib_lock);
195 195
196 mutex_lock(&priv->hw->phy->pib_lock); 196 mutex_lock(&sdata->hw->phy->pib_lock);
197 if (priv->hw->phy->current_channel != priv->chan || 197 if (sdata->hw->phy->current_channel != sdata->chan ||
198 priv->hw->phy->current_page != priv->page) { 198 sdata->hw->phy->current_page != sdata->page) {
199 mutex_unlock(&priv->hw->phy->pib_lock); 199 mutex_unlock(&sdata->hw->phy->pib_lock);
200 200
201 work = kzalloc(sizeof(*work), GFP_ATOMIC); 201 work = kzalloc(sizeof(*work), GFP_ATOMIC);
202 if (!work) 202 if (!work)
@@ -204,9 +204,9 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
204 204
205 INIT_WORK(&work->work, phy_chan_notify); 205 INIT_WORK(&work->work, phy_chan_notify);
206 work->dev = dev; 206 work->dev = dev;
207 queue_work(priv->hw->dev_workqueue, &work->work); 207 queue_work(sdata->hw->dev_workqueue, &work->work);
208 } else { 208 } else {
209 mutex_unlock(&priv->hw->phy->pib_lock); 209 mutex_unlock(&sdata->hw->phy->pib_lock);
210 } 210 }
211} 211}
212 212
@@ -214,14 +214,14 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
214int mac802154_get_params(struct net_device *dev, 214int mac802154_get_params(struct net_device *dev,
215 struct ieee802154_llsec_params *params) 215 struct ieee802154_llsec_params *params)
216{ 216{
217 struct mac802154_sub_if_data *priv = netdev_priv(dev); 217 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
218 int res; 218 int res;
219 219
220 BUG_ON(dev->type != ARPHRD_IEEE802154); 220 BUG_ON(dev->type != ARPHRD_IEEE802154);
221 221
222 mutex_lock(&priv->sec_mtx); 222 mutex_lock(&sdata->sec_mtx);
223 res = mac802154_llsec_get_params(&priv->sec, params); 223 res = mac802154_llsec_get_params(&sdata->sec, params);
224 mutex_unlock(&priv->sec_mtx); 224 mutex_unlock(&sdata->sec_mtx);
225 225
226 return res; 226 return res;
227} 227}
@@ -230,14 +230,14 @@ int mac802154_set_params(struct net_device *dev,
230 const struct ieee802154_llsec_params *params, 230 const struct ieee802154_llsec_params *params,
231 int changed) 231 int changed)
232{ 232{
233 struct mac802154_sub_if_data *priv = netdev_priv(dev); 233 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
234 int res; 234 int res;
235 235
236 BUG_ON(dev->type != ARPHRD_IEEE802154); 236 BUG_ON(dev->type != ARPHRD_IEEE802154);
237 237
238 mutex_lock(&priv->sec_mtx); 238 mutex_lock(&sdata->sec_mtx);
239 res = mac802154_llsec_set_params(&priv->sec, params, changed); 239 res = mac802154_llsec_set_params(&sdata->sec, params, changed);
240 mutex_unlock(&priv->sec_mtx); 240 mutex_unlock(&sdata->sec_mtx);
241 241
242 return res; 242 return res;
243} 243}
@@ -247,14 +247,14 @@ int mac802154_add_key(struct net_device *dev,
247 const struct ieee802154_llsec_key_id *id, 247 const struct ieee802154_llsec_key_id *id,
248 const struct ieee802154_llsec_key *key) 248 const struct ieee802154_llsec_key *key)
249{ 249{
250 struct mac802154_sub_if_data *priv = netdev_priv(dev); 250 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
251 int res; 251 int res;
252 252
253 BUG_ON(dev->type != ARPHRD_IEEE802154); 253 BUG_ON(dev->type != ARPHRD_IEEE802154);
254 254
255 mutex_lock(&priv->sec_mtx); 255 mutex_lock(&sdata->sec_mtx);
256 res = mac802154_llsec_key_add(&priv->sec, id, key); 256 res = mac802154_llsec_key_add(&sdata->sec, id, key);
257 mutex_unlock(&priv->sec_mtx); 257 mutex_unlock(&sdata->sec_mtx);
258 258
259 return res; 259 return res;
260} 260}
@@ -262,14 +262,14 @@ int mac802154_add_key(struct net_device *dev,
262int mac802154_del_key(struct net_device *dev, 262int mac802154_del_key(struct net_device *dev,
263 const struct ieee802154_llsec_key_id *id) 263 const struct ieee802154_llsec_key_id *id)
264{ 264{
265 struct mac802154_sub_if_data *priv = netdev_priv(dev); 265 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
266 int res; 266 int res;
267 267
268 BUG_ON(dev->type != ARPHRD_IEEE802154); 268 BUG_ON(dev->type != ARPHRD_IEEE802154);
269 269
270 mutex_lock(&priv->sec_mtx); 270 mutex_lock(&sdata->sec_mtx);
271 res = mac802154_llsec_key_del(&priv->sec, id); 271 res = mac802154_llsec_key_del(&sdata->sec, id);
272 mutex_unlock(&priv->sec_mtx); 272 mutex_unlock(&sdata->sec_mtx);
273 273
274 return res; 274 return res;
275} 275}
@@ -278,28 +278,28 @@ int mac802154_del_key(struct net_device *dev,
278int mac802154_add_dev(struct net_device *dev, 278int mac802154_add_dev(struct net_device *dev,
279 const struct ieee802154_llsec_device *llsec_dev) 279 const struct ieee802154_llsec_device *llsec_dev)
280{ 280{
281 struct mac802154_sub_if_data *priv = netdev_priv(dev); 281 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
282 int res; 282 int res;
283 283
284 BUG_ON(dev->type != ARPHRD_IEEE802154); 284 BUG_ON(dev->type != ARPHRD_IEEE802154);
285 285
286 mutex_lock(&priv->sec_mtx); 286 mutex_lock(&sdata->sec_mtx);
287 res = mac802154_llsec_dev_add(&priv->sec, llsec_dev); 287 res = mac802154_llsec_dev_add(&sdata->sec, llsec_dev);
288 mutex_unlock(&priv->sec_mtx); 288 mutex_unlock(&sdata->sec_mtx);
289 289
290 return res; 290 return res;
291} 291}
292 292
293int mac802154_del_dev(struct net_device *dev, __le64 dev_addr) 293int mac802154_del_dev(struct net_device *dev, __le64 dev_addr)
294{ 294{
295 struct mac802154_sub_if_data *priv = netdev_priv(dev); 295 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
296 int res; 296 int res;
297 297
298 BUG_ON(dev->type != ARPHRD_IEEE802154); 298 BUG_ON(dev->type != ARPHRD_IEEE802154);
299 299
300 mutex_lock(&priv->sec_mtx); 300 mutex_lock(&sdata->sec_mtx);
301 res = mac802154_llsec_dev_del(&priv->sec, dev_addr); 301 res = mac802154_llsec_dev_del(&sdata->sec, dev_addr);
302 mutex_unlock(&priv->sec_mtx); 302 mutex_unlock(&sdata->sec_mtx);
303 303
304 return res; 304 return res;
305} 305}
@@ -309,14 +309,14 @@ int mac802154_add_devkey(struct net_device *dev,
309 __le64 device_addr, 309 __le64 device_addr,
310 const struct ieee802154_llsec_device_key *key) 310 const struct ieee802154_llsec_device_key *key)
311{ 311{
312 struct mac802154_sub_if_data *priv = netdev_priv(dev); 312 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
313 int res; 313 int res;
314 314
315 BUG_ON(dev->type != ARPHRD_IEEE802154); 315 BUG_ON(dev->type != ARPHRD_IEEE802154);
316 316
317 mutex_lock(&priv->sec_mtx); 317 mutex_lock(&sdata->sec_mtx);
318 res = mac802154_llsec_devkey_add(&priv->sec, device_addr, key); 318 res = mac802154_llsec_devkey_add(&sdata->sec, device_addr, key);
319 mutex_unlock(&priv->sec_mtx); 319 mutex_unlock(&sdata->sec_mtx);
320 320
321 return res; 321 return res;
322} 322}
@@ -325,14 +325,14 @@ int mac802154_del_devkey(struct net_device *dev,
325 __le64 device_addr, 325 __le64 device_addr,
326 const struct ieee802154_llsec_device_key *key) 326 const struct ieee802154_llsec_device_key *key)
327{ 327{
328 struct mac802154_sub_if_data *priv = netdev_priv(dev); 328 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
329 int res; 329 int res;
330 330
331 BUG_ON(dev->type != ARPHRD_IEEE802154); 331 BUG_ON(dev->type != ARPHRD_IEEE802154);
332 332
333 mutex_lock(&priv->sec_mtx); 333 mutex_lock(&sdata->sec_mtx);
334 res = mac802154_llsec_devkey_del(&priv->sec, device_addr, key); 334 res = mac802154_llsec_devkey_del(&sdata->sec, device_addr, key);
335 mutex_unlock(&priv->sec_mtx); 335 mutex_unlock(&sdata->sec_mtx);
336 336
337 return res; 337 return res;
338} 338}
@@ -341,14 +341,14 @@ int mac802154_del_devkey(struct net_device *dev,
341int mac802154_add_seclevel(struct net_device *dev, 341int mac802154_add_seclevel(struct net_device *dev,
342 const struct ieee802154_llsec_seclevel *sl) 342 const struct ieee802154_llsec_seclevel *sl)
343{ 343{
344 struct mac802154_sub_if_data *priv = netdev_priv(dev); 344 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
345 int res; 345 int res;
346 346
347 BUG_ON(dev->type != ARPHRD_IEEE802154); 347 BUG_ON(dev->type != ARPHRD_IEEE802154);
348 348
349 mutex_lock(&priv->sec_mtx); 349 mutex_lock(&sdata->sec_mtx);
350 res = mac802154_llsec_seclevel_add(&priv->sec, sl); 350 res = mac802154_llsec_seclevel_add(&sdata->sec, sl);
351 mutex_unlock(&priv->sec_mtx); 351 mutex_unlock(&sdata->sec_mtx);
352 352
353 return res; 353 return res;
354} 354}
@@ -356,14 +356,14 @@ int mac802154_add_seclevel(struct net_device *dev,
356int mac802154_del_seclevel(struct net_device *dev, 356int mac802154_del_seclevel(struct net_device *dev,
357 const struct ieee802154_llsec_seclevel *sl) 357 const struct ieee802154_llsec_seclevel *sl)
358{ 358{
359 struct mac802154_sub_if_data *priv = netdev_priv(dev); 359 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
360 int res; 360 int res;
361 361
362 BUG_ON(dev->type != ARPHRD_IEEE802154); 362 BUG_ON(dev->type != ARPHRD_IEEE802154);
363 363
364 mutex_lock(&priv->sec_mtx); 364 mutex_lock(&sdata->sec_mtx);
365 res = mac802154_llsec_seclevel_del(&priv->sec, sl); 365 res = mac802154_llsec_seclevel_del(&sdata->sec, sl);
366 mutex_unlock(&priv->sec_mtx); 366 mutex_unlock(&sdata->sec_mtx);
367 367
368 return res; 368 return res;
369} 369}
@@ -371,28 +371,28 @@ int mac802154_del_seclevel(struct net_device *dev,
371 371
372void mac802154_lock_table(struct net_device *dev) 372void mac802154_lock_table(struct net_device *dev)
373{ 373{
374 struct mac802154_sub_if_data *priv = netdev_priv(dev); 374 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
375 375
376 BUG_ON(dev->type != ARPHRD_IEEE802154); 376 BUG_ON(dev->type != ARPHRD_IEEE802154);
377 377
378 mutex_lock(&priv->sec_mtx); 378 mutex_lock(&sdata->sec_mtx);
379} 379}
380 380
381void mac802154_get_table(struct net_device *dev, 381void mac802154_get_table(struct net_device *dev,
382 struct ieee802154_llsec_table **t) 382 struct ieee802154_llsec_table **t)
383{ 383{
384 struct mac802154_sub_if_data *priv = netdev_priv(dev); 384 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
385 385
386 BUG_ON(dev->type != ARPHRD_IEEE802154); 386 BUG_ON(dev->type != ARPHRD_IEEE802154);
387 387
388 *t = &priv->sec.table; 388 *t = &sdata->sec.table;
389} 389}
390 390
391void mac802154_unlock_table(struct net_device *dev) 391void mac802154_unlock_table(struct net_device *dev)
392{ 392{
393 struct mac802154_sub_if_data *priv = netdev_priv(dev); 393 struct ieee802154_sub_if_data *sdata = netdev_priv(dev);
394 394
395 BUG_ON(dev->type != ARPHRD_IEEE802154); 395 BUG_ON(dev->type != ARPHRD_IEEE802154);
396 396
397 mutex_unlock(&priv->sec_mtx); 397 mutex_unlock(&sdata->sec_mtx);
398} 398}
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index a107fd2f2312..bd63e120b914 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -33,14 +33,14 @@
33static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, 33static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
34 struct net_device *dev) 34 struct net_device *dev)
35{ 35{
36 struct mac802154_sub_if_data *priv; 36 struct ieee802154_sub_if_data *sdata;
37 u8 chan, page; 37 u8 chan, page;
38 38
39 priv = netdev_priv(dev); 39 sdata = netdev_priv(dev);
40 40
41 /* FIXME: locking */ 41 /* FIXME: locking */
42 chan = priv->hw->phy->current_channel; 42 chan = sdata->hw->phy->current_channel;
43 page = priv->hw->phy->current_page; 43 page = sdata->hw->phy->current_page;
44 44
45 if (chan == MAC802154_CHAN_NONE) /* not initialized */ 45 if (chan == MAC802154_CHAN_NONE) /* not initialized */
46 return NETDEV_TX_OK; 46 return NETDEV_TX_OK;
@@ -53,14 +53,14 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
53 dev->stats.tx_packets++; 53 dev->stats.tx_packets++;
54 dev->stats.tx_bytes += skb->len; 54 dev->stats.tx_bytes += skb->len;
55 55
56 return mac802154_tx(priv->hw, skb, page, chan); 56 return mac802154_tx(sdata->hw, skb, page, chan);
57} 57}
58 58
59 59
60void mac802154_monitors_rx(struct ieee802154_local *local, 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 ieee802154_sub_if_data *sdata;
64 u16 crc = crc_ccitt(0, skb->data, skb->len); 64 u16 crc = crc_ccitt(0, skb->data, skb->len);
65 u8 *data; 65 u8 *data;
66 66
@@ -90,7 +90,7 @@ static const struct net_device_ops mac802154_monitor_ops = {
90 90
91void mac802154_monitor_setup(struct net_device *dev) 91void mac802154_monitor_setup(struct net_device *dev)
92{ 92{
93 struct mac802154_sub_if_data *priv; 93 struct ieee802154_sub_if_data *sdata;
94 94
95 dev->addr_len = 0; 95 dev->addr_len = 0;
96 dev->hard_header_len = 0; 96 dev->hard_header_len = 0;
@@ -105,9 +105,9 @@ void mac802154_monitor_setup(struct net_device *dev)
105 dev->netdev_ops = &mac802154_monitor_ops; 105 dev->netdev_ops = &mac802154_monitor_ops;
106 dev->ml_priv = &mac802154_mlme_reduced; 106 dev->ml_priv = &mac802154_mlme_reduced;
107 107
108 priv = netdev_priv(dev); 108 sdata = netdev_priv(dev);
109 priv->type = IEEE802154_DEV_MONITOR; 109 sdata->type = IEEE802154_DEV_MONITOR;
110 110
111 priv->chan = MAC802154_CHAN_NONE; /* not initialized */ 111 sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
112 priv->page = 0; 112 sdata->page = 0;
113} 113}
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index d4c92bd3ad32..d20dadd6f27c 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -41,7 +41,7 @@ struct xmit_work {
41static void mac802154_xmit_worker(struct work_struct *work) 41static void mac802154_xmit_worker(struct work_struct *work)
42{ 42{
43 struct xmit_work *xw = container_of(work, struct xmit_work, work); 43 struct xmit_work *xw = container_of(work, struct xmit_work, work);
44 struct mac802154_sub_if_data *sdata; 44 struct ieee802154_sub_if_data *sdata;
45 int res; 45 int res;
46 46
47 mutex_lock(&xw->local->phy->pib_lock); 47 mutex_lock(&xw->local->phy->pib_lock);
@@ -81,7 +81,7 @@ netdev_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 ieee802154_sub_if_data *sdata;
85 85
86 if (!(local->phy->channels_supported[page] & (1 << chan))) { 86 if (!(local->phy->channels_supported[page] & (1 << chan))) {
87 WARN_ON(1); 87 WARN_ON(1);