aboutsummaryrefslogtreecommitdiffstats
path: root/net/6lowpan
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-04-11 05:04:18 -0400
committerMarcel Holtmann <marcel@holtmann.org>2016-04-13 04:41:09 -0400
commit2e4d60cbcfc2d16a2a2efaae3fe08f2e457d59a1 (patch)
tree1ecef44ca224fa5e64dc0dbba6f19d9c2826045c /net/6lowpan
parent5a7f97e570fbe0ae7e6fd035f7af0cd6a1a9baa1 (diff)
6lowpan: change naming for lowpan private data
This patch changes the naming for interface private data for lowpan intefaces. The current private data scheme is: ------------------------------------------------- | 6LoWPAN Generic | LinkLayer 6LoWPAN | ------------------------------------------------- the current naming schemes are: - 6LoWPAN Generic: - lowpan_priv - LinkLayer 6LoWPAN: - BTLE - lowpan_dev - 802.15.4: - lowpan_dev_info the new naming scheme with this patch will be: - 6LoWPAN Generic: - lowpan_dev - LinkLayer 6LoWPAN: - BTLE - lowpan_btle_dev - 802.15.4: - lowpan_802154_dev Signed-off-by: Alexander Aring <aar@pengutronix.de> Reviewed-by: Stefan Schmidt<stefan@osg.samsung.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/6lowpan')
-rw-r--r--net/6lowpan/core.c8
-rw-r--r--net/6lowpan/debugfs.c22
-rw-r--r--net/6lowpan/iphc.c38
-rw-r--r--net/6lowpan/nhc_udp.c2
4 files changed, 35 insertions, 35 deletions
diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c
index 34e44c0c0836..7a240b3eaed1 100644
--- a/net/6lowpan/core.c
+++ b/net/6lowpan/core.c
@@ -27,11 +27,11 @@ int lowpan_register_netdevice(struct net_device *dev,
27 dev->mtu = IPV6_MIN_MTU; 27 dev->mtu = IPV6_MIN_MTU;
28 dev->priv_flags |= IFF_NO_QUEUE; 28 dev->priv_flags |= IFF_NO_QUEUE;
29 29
30 lowpan_priv(dev)->lltype = lltype; 30 lowpan_dev(dev)->lltype = lltype;
31 31
32 spin_lock_init(&lowpan_priv(dev)->ctx.lock); 32 spin_lock_init(&lowpan_dev(dev)->ctx.lock);
33 for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++) 33 for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++)
34 lowpan_priv(dev)->ctx.table[i].id = i; 34 lowpan_dev(dev)->ctx.table[i].id = i;
35 35
36 ret = register_netdevice(dev); 36 ret = register_netdevice(dev);
37 if (ret < 0) 37 if (ret < 0)
@@ -85,7 +85,7 @@ static int lowpan_event(struct notifier_block *unused,
85 case NETDEV_DOWN: 85 case NETDEV_DOWN:
86 for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++) 86 for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++)
87 clear_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE, 87 clear_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE,
88 &lowpan_priv(dev)->ctx.table[i].flags); 88 &lowpan_dev(dev)->ctx.table[i].flags);
89 break; 89 break;
90 default: 90 default:
91 return NOTIFY_DONE; 91 return NOTIFY_DONE;
diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c
index 0793a8157472..acbaa3db493b 100644
--- a/net/6lowpan/debugfs.c
+++ b/net/6lowpan/debugfs.c
@@ -172,7 +172,7 @@ static const struct file_operations lowpan_ctx_pfx_fops = {
172static int lowpan_dev_debugfs_ctx_init(struct net_device *dev, 172static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
173 struct dentry *ctx, u8 id) 173 struct dentry *ctx, u8 id)
174{ 174{
175 struct lowpan_priv *lpriv = lowpan_priv(dev); 175 struct lowpan_dev *ldev = lowpan_dev(dev);
176 struct dentry *dentry, *root; 176 struct dentry *dentry, *root;
177 char buf[32]; 177 char buf[32];
178 178
@@ -185,25 +185,25 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
185 return -EINVAL; 185 return -EINVAL;
186 186
187 dentry = debugfs_create_file("active", 0644, root, 187 dentry = debugfs_create_file("active", 0644, root,
188 &lpriv->ctx.table[id], 188 &ldev->ctx.table[id],
189 &lowpan_ctx_flag_active_fops); 189 &lowpan_ctx_flag_active_fops);
190 if (!dentry) 190 if (!dentry)
191 return -EINVAL; 191 return -EINVAL;
192 192
193 dentry = debugfs_create_file("compression", 0644, root, 193 dentry = debugfs_create_file("compression", 0644, root,
194 &lpriv->ctx.table[id], 194 &ldev->ctx.table[id],
195 &lowpan_ctx_flag_c_fops); 195 &lowpan_ctx_flag_c_fops);
196 if (!dentry) 196 if (!dentry)
197 return -EINVAL; 197 return -EINVAL;
198 198
199 dentry = debugfs_create_file("prefix", 0644, root, 199 dentry = debugfs_create_file("prefix", 0644, root,
200 &lpriv->ctx.table[id], 200 &ldev->ctx.table[id],
201 &lowpan_ctx_pfx_fops); 201 &lowpan_ctx_pfx_fops);
202 if (!dentry) 202 if (!dentry)
203 return -EINVAL; 203 return -EINVAL;
204 204
205 dentry = debugfs_create_file("prefix_len", 0644, root, 205 dentry = debugfs_create_file("prefix_len", 0644, root,
206 &lpriv->ctx.table[id], 206 &ldev->ctx.table[id],
207 &lowpan_ctx_plen_fops); 207 &lowpan_ctx_plen_fops);
208 if (!dentry) 208 if (!dentry)
209 return -EINVAL; 209 return -EINVAL;
@@ -247,21 +247,21 @@ static const struct file_operations lowpan_context_fops = {
247 247
248int lowpan_dev_debugfs_init(struct net_device *dev) 248int lowpan_dev_debugfs_init(struct net_device *dev)
249{ 249{
250 struct lowpan_priv *lpriv = lowpan_priv(dev); 250 struct lowpan_dev *ldev = lowpan_dev(dev);
251 struct dentry *contexts, *dentry; 251 struct dentry *contexts, *dentry;
252 int ret, i; 252 int ret, i;
253 253
254 /* creating the root */ 254 /* creating the root */
255 lpriv->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs); 255 ldev->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs);
256 if (!lpriv->iface_debugfs) 256 if (!ldev->iface_debugfs)
257 goto fail; 257 goto fail;
258 258
259 contexts = debugfs_create_dir("contexts", lpriv->iface_debugfs); 259 contexts = debugfs_create_dir("contexts", ldev->iface_debugfs);
260 if (!contexts) 260 if (!contexts)
261 goto remove_root; 261 goto remove_root;
262 262
263 dentry = debugfs_create_file("show", 0644, contexts, 263 dentry = debugfs_create_file("show", 0644, contexts,
264 &lowpan_priv(dev)->ctx, 264 &lowpan_dev(dev)->ctx,
265 &lowpan_context_fops); 265 &lowpan_context_fops);
266 if (!dentry) 266 if (!dentry)
267 goto remove_root; 267 goto remove_root;
@@ -282,7 +282,7 @@ fail:
282 282
283void lowpan_dev_debugfs_exit(struct net_device *dev) 283void lowpan_dev_debugfs_exit(struct net_device *dev)
284{ 284{
285 debugfs_remove_recursive(lowpan_priv(dev)->iface_debugfs); 285 debugfs_remove_recursive(lowpan_dev(dev)->iface_debugfs);
286} 286}
287 287
288int __init lowpan_debugfs_init(void) 288int __init lowpan_debugfs_init(void)
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index 68c80f3c9add..5fb764e45d80 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -207,7 +207,7 @@ static inline void iphc_uncompress_802154_lladdr(struct in6_addr *ipaddr,
207static struct lowpan_iphc_ctx * 207static struct lowpan_iphc_ctx *
208lowpan_iphc_ctx_get_by_id(const struct net_device *dev, u8 id) 208lowpan_iphc_ctx_get_by_id(const struct net_device *dev, u8 id)
209{ 209{
210 struct lowpan_iphc_ctx *ret = &lowpan_priv(dev)->ctx.table[id]; 210 struct lowpan_iphc_ctx *ret = &lowpan_dev(dev)->ctx.table[id];
211 211
212 if (!lowpan_iphc_ctx_is_active(ret)) 212 if (!lowpan_iphc_ctx_is_active(ret))
213 return NULL; 213 return NULL;
@@ -219,7 +219,7 @@ static struct lowpan_iphc_ctx *
219lowpan_iphc_ctx_get_by_addr(const struct net_device *dev, 219lowpan_iphc_ctx_get_by_addr(const struct net_device *dev,
220 const struct in6_addr *addr) 220 const struct in6_addr *addr)
221{ 221{
222 struct lowpan_iphc_ctx *table = lowpan_priv(dev)->ctx.table; 222 struct lowpan_iphc_ctx *table = lowpan_dev(dev)->ctx.table;
223 struct lowpan_iphc_ctx *ret = NULL; 223 struct lowpan_iphc_ctx *ret = NULL;
224 struct in6_addr addr_pfx; 224 struct in6_addr addr_pfx;
225 u8 addr_plen; 225 u8 addr_plen;
@@ -263,7 +263,7 @@ static struct lowpan_iphc_ctx *
263lowpan_iphc_ctx_get_by_mcast_addr(const struct net_device *dev, 263lowpan_iphc_ctx_get_by_mcast_addr(const struct net_device *dev,
264 const struct in6_addr *addr) 264 const struct in6_addr *addr)
265{ 265{
266 struct lowpan_iphc_ctx *table = lowpan_priv(dev)->ctx.table; 266 struct lowpan_iphc_ctx *table = lowpan_dev(dev)->ctx.table;
267 struct lowpan_iphc_ctx *ret = NULL; 267 struct lowpan_iphc_ctx *ret = NULL;
268 struct in6_addr addr_mcast, network_pfx = {}; 268 struct in6_addr addr_mcast, network_pfx = {};
269 int i; 269 int i;
@@ -332,7 +332,7 @@ static int uncompress_addr(struct sk_buff *skb, const struct net_device *dev,
332 case LOWPAN_IPHC_SAM_11: 332 case LOWPAN_IPHC_SAM_11:
333 case LOWPAN_IPHC_DAM_11: 333 case LOWPAN_IPHC_DAM_11:
334 fail = false; 334 fail = false;
335 switch (lowpan_priv(dev)->lltype) { 335 switch (lowpan_dev(dev)->lltype) {
336 case LOWPAN_LLTYPE_IEEE802154: 336 case LOWPAN_LLTYPE_IEEE802154:
337 iphc_uncompress_802154_lladdr(ipaddr, lladdr); 337 iphc_uncompress_802154_lladdr(ipaddr, lladdr);
338 break; 338 break;
@@ -393,7 +393,7 @@ static int uncompress_ctx_addr(struct sk_buff *skb,
393 case LOWPAN_IPHC_SAM_11: 393 case LOWPAN_IPHC_SAM_11:
394 case LOWPAN_IPHC_DAM_11: 394 case LOWPAN_IPHC_DAM_11:
395 fail = false; 395 fail = false;
396 switch (lowpan_priv(dev)->lltype) { 396 switch (lowpan_dev(dev)->lltype) {
397 case LOWPAN_LLTYPE_IEEE802154: 397 case LOWPAN_LLTYPE_IEEE802154:
398 iphc_uncompress_802154_lladdr(ipaddr, lladdr); 398 iphc_uncompress_802154_lladdr(ipaddr, lladdr);
399 break; 399 break;
@@ -657,17 +657,17 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
657 } 657 }
658 658
659 if (iphc1 & LOWPAN_IPHC_SAC) { 659 if (iphc1 & LOWPAN_IPHC_SAC) {
660 spin_lock_bh(&lowpan_priv(dev)->ctx.lock); 660 spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
661 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_SCI(cid)); 661 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_SCI(cid));
662 if (!ci) { 662 if (!ci) {
663 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 663 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
664 return -EINVAL; 664 return -EINVAL;
665 } 665 }
666 666
667 pr_debug("SAC bit is set. Handle context based source address.\n"); 667 pr_debug("SAC bit is set. Handle context based source address.\n");
668 err = uncompress_ctx_addr(skb, dev, ci, &hdr.saddr, 668 err = uncompress_ctx_addr(skb, dev, ci, &hdr.saddr,
669 iphc1 & LOWPAN_IPHC_SAM_MASK, saddr); 669 iphc1 & LOWPAN_IPHC_SAM_MASK, saddr);
670 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 670 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
671 } else { 671 } else {
672 /* Source address uncompression */ 672 /* Source address uncompression */
673 pr_debug("source address stateless compression\n"); 673 pr_debug("source address stateless compression\n");
@@ -681,10 +681,10 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
681 681
682 switch (iphc1 & (LOWPAN_IPHC_M | LOWPAN_IPHC_DAC)) { 682 switch (iphc1 & (LOWPAN_IPHC_M | LOWPAN_IPHC_DAC)) {
683 case LOWPAN_IPHC_M | LOWPAN_IPHC_DAC: 683 case LOWPAN_IPHC_M | LOWPAN_IPHC_DAC:
684 spin_lock_bh(&lowpan_priv(dev)->ctx.lock); 684 spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
685 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid)); 685 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid));
686 if (!ci) { 686 if (!ci) {
687 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 687 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
688 return -EINVAL; 688 return -EINVAL;
689 } 689 }
690 690
@@ -693,7 +693,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
693 err = lowpan_uncompress_multicast_ctx_daddr(skb, ci, 693 err = lowpan_uncompress_multicast_ctx_daddr(skb, ci,
694 &hdr.daddr, 694 &hdr.daddr,
695 iphc1 & LOWPAN_IPHC_DAM_MASK); 695 iphc1 & LOWPAN_IPHC_DAM_MASK);
696 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 696 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
697 break; 697 break;
698 case LOWPAN_IPHC_M: 698 case LOWPAN_IPHC_M:
699 /* multicast */ 699 /* multicast */
@@ -701,10 +701,10 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
701 iphc1 & LOWPAN_IPHC_DAM_MASK); 701 iphc1 & LOWPAN_IPHC_DAM_MASK);
702 break; 702 break;
703 case LOWPAN_IPHC_DAC: 703 case LOWPAN_IPHC_DAC:
704 spin_lock_bh(&lowpan_priv(dev)->ctx.lock); 704 spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
705 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid)); 705 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid));
706 if (!ci) { 706 if (!ci) {
707 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 707 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
708 return -EINVAL; 708 return -EINVAL;
709 } 709 }
710 710
@@ -712,7 +712,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
712 pr_debug("DAC bit is set. Handle context based destination address.\n"); 712 pr_debug("DAC bit is set. Handle context based destination address.\n");
713 err = uncompress_ctx_addr(skb, dev, ci, &hdr.daddr, 713 err = uncompress_ctx_addr(skb, dev, ci, &hdr.daddr,
714 iphc1 & LOWPAN_IPHC_DAM_MASK, daddr); 714 iphc1 & LOWPAN_IPHC_DAM_MASK, daddr);
715 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 715 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
716 break; 716 break;
717 default: 717 default:
718 err = uncompress_addr(skb, dev, &hdr.daddr, 718 err = uncompress_addr(skb, dev, &hdr.daddr,
@@ -736,7 +736,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
736 return err; 736 return err;
737 } 737 }
738 738
739 switch (lowpan_priv(dev)->lltype) { 739 switch (lowpan_dev(dev)->lltype) {
740 case LOWPAN_LLTYPE_IEEE802154: 740 case LOWPAN_LLTYPE_IEEE802154:
741 if (lowpan_802154_cb(skb)->d_size) 741 if (lowpan_802154_cb(skb)->d_size)
742 hdr.payload_len = htons(lowpan_802154_cb(skb)->d_size - 742 hdr.payload_len = htons(lowpan_802154_cb(skb)->d_size -
@@ -1033,7 +1033,7 @@ int lowpan_header_compress(struct sk_buff *skb, const struct net_device *dev,
1033 skb->data, skb->len); 1033 skb->data, skb->len);
1034 1034
1035 ipv6_daddr_type = ipv6_addr_type(&hdr->daddr); 1035 ipv6_daddr_type = ipv6_addr_type(&hdr->daddr);
1036 spin_lock_bh(&lowpan_priv(dev)->ctx.lock); 1036 spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
1037 if (ipv6_daddr_type & IPV6_ADDR_MULTICAST) 1037 if (ipv6_daddr_type & IPV6_ADDR_MULTICAST)
1038 dci = lowpan_iphc_ctx_get_by_mcast_addr(dev, &hdr->daddr); 1038 dci = lowpan_iphc_ctx_get_by_mcast_addr(dev, &hdr->daddr);
1039 else 1039 else
@@ -1042,15 +1042,15 @@ int lowpan_header_compress(struct sk_buff *skb, const struct net_device *dev,
1042 memcpy(&dci_entry, dci, sizeof(*dci)); 1042 memcpy(&dci_entry, dci, sizeof(*dci));
1043 cid |= dci->id; 1043 cid |= dci->id;
1044 } 1044 }
1045 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 1045 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
1046 1046
1047 spin_lock_bh(&lowpan_priv(dev)->ctx.lock); 1047 spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
1048 sci = lowpan_iphc_ctx_get_by_addr(dev, &hdr->saddr); 1048 sci = lowpan_iphc_ctx_get_by_addr(dev, &hdr->saddr);
1049 if (sci) { 1049 if (sci) {
1050 memcpy(&sci_entry, sci, sizeof(*sci)); 1050 memcpy(&sci_entry, sci, sizeof(*sci));
1051 cid |= (sci->id << 4); 1051 cid |= (sci->id << 4);
1052 } 1052 }
1053 spin_unlock_bh(&lowpan_priv(dev)->ctx.lock); 1053 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
1054 1054
1055 /* if cid is zero it will be compressed */ 1055 /* if cid is zero it will be compressed */
1056 if (cid) { 1056 if (cid) {
diff --git a/net/6lowpan/nhc_udp.c b/net/6lowpan/nhc_udp.c
index 69537a2eaab1..225d91906dfa 100644
--- a/net/6lowpan/nhc_udp.c
+++ b/net/6lowpan/nhc_udp.c
@@ -91,7 +91,7 @@ static int udp_uncompress(struct sk_buff *skb, size_t needed)
91 * here, we obtain the hint from the remaining size of the 91 * here, we obtain the hint from the remaining size of the
92 * frame 92 * frame
93 */ 93 */
94 switch (lowpan_priv(skb->dev)->lltype) { 94 switch (lowpan_dev(skb->dev)->lltype) {
95 case LOWPAN_LLTYPE_IEEE802154: 95 case LOWPAN_LLTYPE_IEEE802154:
96 if (lowpan_802154_cb(skb)->d_size) 96 if (lowpan_802154_cb(skb)->d_size)
97 uh.len = htons(lowpan_802154_cb(skb)->d_size - 97 uh.len = htons(lowpan_802154_cb(skb)->d_size -