Skip to content

Commit 2e4d60c

Browse files
Alexander Aringholtmann
authored andcommitted
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>
1 parent 5a7f97e commit 2e4d60c

9 files changed

Lines changed: 94 additions & 90 deletions

File tree

‎include/net/6lowpan.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static inline bool lowpan_is_iphc(u8 dispatch)
9393
}
9494

9595
#define LOWPAN_PRIV_SIZE(llpriv_size) \
96-
(sizeof(struct lowpan_priv) + llpriv_size)
96+
(sizeof(struct lowpan_dev) + llpriv_size)
9797

9898
enum lowpan_lltypes {
9999
LOWPAN_LLTYPE_BTLE,
@@ -129,7 +129,7 @@ lowpan_iphc_ctx_is_compression(const struct lowpan_iphc_ctx *ctx)
129129
return test_bit(LOWPAN_IPHC_CTX_FLAG_COMPRESSION, &ctx->flags);
130130
}
131131

132-
struct lowpan_priv {
132+
struct lowpan_dev {
133133
enum lowpan_lltypes lltype;
134134
struct dentry *iface_debugfs;
135135
struct lowpan_iphc_ctx_table ctx;
@@ -139,7 +139,7 @@ struct lowpan_priv {
139139
};
140140

141141
static inline
142-
struct lowpan_priv *lowpan_priv(const struct net_device *dev)
142+
struct lowpan_dev *lowpan_dev(const struct net_device *dev)
143143
{
144144
return netdev_priv(dev);
145145
}

‎net/6lowpan/core.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ int lowpan_register_netdevice(struct net_device *dev,
2727
dev->mtu = IPV6_MIN_MTU;
2828
dev->priv_flags |= IFF_NO_QUEUE;
2929

30-
lowpan_priv(dev)->lltype = lltype;
30+
lowpan_dev(dev)->lltype = lltype;
3131

32-
spin_lock_init(&lowpan_priv(dev)->ctx.lock);
32+
spin_lock_init(&lowpan_dev(dev)->ctx.lock);
3333
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;
3535

3636
ret = register_netdevice(dev);
3737
if (ret < 0)
@@ -85,7 +85,7 @@ static int lowpan_event(struct notifier_block *unused,
8585
case NETDEV_DOWN:
8686
for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++)
8787
clear_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE,
88-
&lowpan_priv(dev)->ctx.table[i].flags);
88+
&lowpan_dev(dev)->ctx.table[i].flags);
8989
break;
9090
default:
9191
return NOTIFY_DONE;

‎net/6lowpan/debugfs.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static const struct file_operations lowpan_ctx_pfx_fops = {
172172
static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
173173
struct dentry *ctx, u8 id)
174174
{
175-
struct lowpan_priv *lpriv = lowpan_priv(dev);
175+
struct lowpan_dev *ldev = lowpan_dev(dev);
176176
struct dentry *dentry, *root;
177177
char buf[32];
178178

@@ -185,25 +185,25 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
185185
return -EINVAL;
186186

187187
dentry = debugfs_create_file("active", 0644, root,
188-
&lpriv->ctx.table[id],
188+
&ldev->ctx.table[id],
189189
&lowpan_ctx_flag_active_fops);
190190
if (!dentry)
191191
return -EINVAL;
192192

193193
dentry = debugfs_create_file("compression", 0644, root,
194-
&lpriv->ctx.table[id],
194+
&ldev->ctx.table[id],
195195
&lowpan_ctx_flag_c_fops);
196196
if (!dentry)
197197
return -EINVAL;
198198

199199
dentry = debugfs_create_file("prefix", 0644, root,
200-
&lpriv->ctx.table[id],
200+
&ldev->ctx.table[id],
201201
&lowpan_ctx_pfx_fops);
202202
if (!dentry)
203203
return -EINVAL;
204204

205205
dentry = debugfs_create_file("prefix_len", 0644, root,
206-
&lpriv->ctx.table[id],
206+
&ldev->ctx.table[id],
207207
&lowpan_ctx_plen_fops);
208208
if (!dentry)
209209
return -EINVAL;
@@ -247,21 +247,21 @@ static const struct file_operations lowpan_context_fops = {
247247

248248
int lowpan_dev_debugfs_init(struct net_device *dev)
249249
{
250-
struct lowpan_priv *lpriv = lowpan_priv(dev);
250+
struct lowpan_dev *ldev = lowpan_dev(dev);
251251
struct dentry *contexts, *dentry;
252252
int ret, i;
253253

254254
/* creating the root */
255-
lpriv->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs);
256-
if (!lpriv->iface_debugfs)
255+
ldev->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs);
256+
if (!ldev->iface_debugfs)
257257
goto fail;
258258

259-
contexts = debugfs_create_dir("contexts", lpriv->iface_debugfs);
259+
contexts = debugfs_create_dir("contexts", ldev->iface_debugfs);
260260
if (!contexts)
261261
goto remove_root;
262262

263263
dentry = debugfs_create_file("show", 0644, contexts,
264-
&lowpan_priv(dev)->ctx,
264+
&lowpan_dev(dev)->ctx,
265265
&lowpan_context_fops);
266266
if (!dentry)
267267
goto remove_root;
@@ -282,7 +282,7 @@ int lowpan_dev_debugfs_init(struct net_device *dev)
282282

283283
void lowpan_dev_debugfs_exit(struct net_device *dev)
284284
{
285-
debugfs_remove_recursive(lowpan_priv(dev)->iface_debugfs);
285+
debugfs_remove_recursive(lowpan_dev(dev)->iface_debugfs);
286286
}
287287

288288
int __init lowpan_debugfs_init(void)

‎net/6lowpan/iphc.c‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static inline void iphc_uncompress_802154_lladdr(struct in6_addr *ipaddr,
207207
static struct lowpan_iphc_ctx *
208208
lowpan_iphc_ctx_get_by_id(const struct net_device *dev, u8 id)
209209
{
210-
struct lowpan_iphc_ctx *ret = &lowpan_priv(dev)->ctx.table[id];
210+
struct lowpan_iphc_ctx *ret = &lowpan_dev(dev)->ctx.table[id];
211211

212212
if (!lowpan_iphc_ctx_is_active(ret))
213213
return NULL;
@@ -219,7 +219,7 @@ static struct lowpan_iphc_ctx *
219219
lowpan_iphc_ctx_get_by_addr(const struct net_device *dev,
220220
const struct in6_addr *addr)
221221
{
222-
struct lowpan_iphc_ctx *table = lowpan_priv(dev)->ctx.table;
222+
struct lowpan_iphc_ctx *table = lowpan_dev(dev)->ctx.table;
223223
struct lowpan_iphc_ctx *ret = NULL;
224224
struct in6_addr addr_pfx;
225225
u8 addr_plen;
@@ -263,7 +263,7 @@ static struct lowpan_iphc_ctx *
263263
lowpan_iphc_ctx_get_by_mcast_addr(const struct net_device *dev,
264264
const struct in6_addr *addr)
265265
{
266-
struct lowpan_iphc_ctx *table = lowpan_priv(dev)->ctx.table;
266+
struct lowpan_iphc_ctx *table = lowpan_dev(dev)->ctx.table;
267267
struct lowpan_iphc_ctx *ret = NULL;
268268
struct in6_addr addr_mcast, network_pfx = {};
269269
int i;
@@ -332,7 +332,7 @@ static int uncompress_addr(struct sk_buff *skb, const struct net_device *dev,
332332
case LOWPAN_IPHC_SAM_11:
333333
case LOWPAN_IPHC_DAM_11:
334334
fail = false;
335-
switch (lowpan_priv(dev)->lltype) {
335+
switch (lowpan_dev(dev)->lltype) {
336336
case LOWPAN_LLTYPE_IEEE802154:
337337
iphc_uncompress_802154_lladdr(ipaddr, lladdr);
338338
break;
@@ -393,7 +393,7 @@ static int uncompress_ctx_addr(struct sk_buff *skb,
393393
case LOWPAN_IPHC_SAM_11:
394394
case LOWPAN_IPHC_DAM_11:
395395
fail = false;
396-
switch (lowpan_priv(dev)->lltype) {
396+
switch (lowpan_dev(dev)->lltype) {
397397
case LOWPAN_LLTYPE_IEEE802154:
398398
iphc_uncompress_802154_lladdr(ipaddr, lladdr);
399399
break;
@@ -657,17 +657,17 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
657657
}
658658

659659
if (iphc1 & LOWPAN_IPHC_SAC) {
660-
spin_lock_bh(&lowpan_priv(dev)->ctx.lock);
660+
spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
661661
ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_SCI(cid));
662662
if (!ci) {
663-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
663+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
664664
return -EINVAL;
665665
}
666666

667667
pr_debug("SAC bit is set. Handle context based source address.\n");
668668
err = uncompress_ctx_addr(skb, dev, ci, &hdr.saddr,
669669
iphc1 & LOWPAN_IPHC_SAM_MASK, saddr);
670-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
670+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
671671
} else {
672672
/* Source address uncompression */
673673
pr_debug("source address stateless compression\n");
@@ -681,10 +681,10 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
681681

682682
switch (iphc1 & (LOWPAN_IPHC_M | LOWPAN_IPHC_DAC)) {
683683
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);
685685
ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid));
686686
if (!ci) {
687-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
687+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
688688
return -EINVAL;
689689
}
690690

@@ -693,26 +693,26 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
693693
err = lowpan_uncompress_multicast_ctx_daddr(skb, ci,
694694
&hdr.daddr,
695695
iphc1 & LOWPAN_IPHC_DAM_MASK);
696-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
696+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
697697
break;
698698
case LOWPAN_IPHC_M:
699699
/* multicast */
700700
err = lowpan_uncompress_multicast_daddr(skb, &hdr.daddr,
701701
iphc1 & LOWPAN_IPHC_DAM_MASK);
702702
break;
703703
case LOWPAN_IPHC_DAC:
704-
spin_lock_bh(&lowpan_priv(dev)->ctx.lock);
704+
spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
705705
ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid));
706706
if (!ci) {
707-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
707+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
708708
return -EINVAL;
709709
}
710710

711711
/* Destination address context based uncompression */
712712
pr_debug("DAC bit is set. Handle context based destination address.\n");
713713
err = uncompress_ctx_addr(skb, dev, ci, &hdr.daddr,
714714
iphc1 & LOWPAN_IPHC_DAM_MASK, daddr);
715-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
715+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
716716
break;
717717
default:
718718
err = uncompress_addr(skb, dev, &hdr.daddr,
@@ -736,7 +736,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
736736
return err;
737737
}
738738

739-
switch (lowpan_priv(dev)->lltype) {
739+
switch (lowpan_dev(dev)->lltype) {
740740
case LOWPAN_LLTYPE_IEEE802154:
741741
if (lowpan_802154_cb(skb)->d_size)
742742
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,
10331033
skb->data, skb->len);
10341034

10351035
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);
10371037
if (ipv6_daddr_type & IPV6_ADDR_MULTICAST)
10381038
dci = lowpan_iphc_ctx_get_by_mcast_addr(dev, &hdr->daddr);
10391039
else
@@ -1042,15 +1042,15 @@ int lowpan_header_compress(struct sk_buff *skb, const struct net_device *dev,
10421042
memcpy(&dci_entry, dci, sizeof(*dci));
10431043
cid |= dci->id;
10441044
}
1045-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
1045+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
10461046

1047-
spin_lock_bh(&lowpan_priv(dev)->ctx.lock);
1047+
spin_lock_bh(&lowpan_dev(dev)->ctx.lock);
10481048
sci = lowpan_iphc_ctx_get_by_addr(dev, &hdr->saddr);
10491049
if (sci) {
10501050
memcpy(&sci_entry, sci, sizeof(*sci));
10511051
cid |= (sci->id << 4);
10521052
}
1053-
spin_unlock_bh(&lowpan_priv(dev)->ctx.lock);
1053+
spin_unlock_bh(&lowpan_dev(dev)->ctx.lock);
10541054

10551055
/* if cid is zero it will be compressed */
10561056
if (cid) {

‎net/6lowpan/nhc_udp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int udp_uncompress(struct sk_buff *skb, size_t needed)
9191
* here, we obtain the hint from the remaining size of the
9292
* frame
9393
*/
94-
switch (lowpan_priv(skb->dev)->lltype) {
94+
switch (lowpan_dev(skb->dev)->lltype) {
9595
case LOWPAN_LLTYPE_IEEE802154:
9696
if (lowpan_802154_cb(skb)->d_size)
9797
uh.len = htons(lowpan_802154_cb(skb)->d_size -

0 commit comments

Comments
 (0)