1
+ .. SPDX-License-Identifier: GPL-2.0
1
2
2
- Netdev private dataroom for 6lowpan interfaces:
3
+ ==============================================
4
+ Netdev private dataroom for 6lowpan interfaces
5
+ ==============================================
3
6
4
7
All 6lowpan able net devices, means all interfaces with ARPHRD_6LOWPAN,
5
8
must have "struct lowpan_priv" placed at beginning of netdev_priv.
6
9
7
- The priv_size of each interface should be calculate by:
10
+ The priv_size of each interface should be calculate by::
8
11
9
12
dev->priv_size = LOWPAN_PRIV_SIZE(LL_6LOWPAN_PRIV_DATA);
10
13
11
14
Where LL_PRIV_6LOWPAN_DATA is sizeof linklayer 6lowpan private data struct.
12
- To access the LL_PRIV_6LOWPAN_DATA structure you can cast:
15
+ To access the LL_PRIV_6LOWPAN_DATA structure you can cast::
13
16
14
17
lowpan_priv(dev)-priv;
15
18
16
19
to your LL_6LOWPAN_PRIV_DATA structure.
17
20
18
- Before registering the lowpan netdev interface you must run:
21
+ Before registering the lowpan netdev interface you must run::
19
22
20
23
lowpan_netdev_setup(dev, LOWPAN_LLTYPE_FOOBAR);
21
24
22
25
wheres LOWPAN_LLTYPE_FOOBAR is a define for your 6LoWPAN linklayer type of
23
26
enum lowpan_lltypes.
24
27
25
- Example to evaluate the private usually you can do:
28
+ Example to evaluate the private usually you can do::
26
29
27
- static inline struct lowpan_priv_foobar *
28
- lowpan_foobar_priv(struct net_device *dev)
29
- {
30
+ static inline struct lowpan_priv_foobar *
31
+ lowpan_foobar_priv(struct net_device *dev)
32
+ {
30
33
return (struct lowpan_priv_foobar *)lowpan_priv(dev)->priv;
31
- }
34
+ }
32
35
33
- switch (dev->type) {
34
- case ARPHRD_6LOWPAN:
36
+ switch (dev->type) {
37
+ case ARPHRD_6LOWPAN:
35
38
lowpan_priv = lowpan_priv(dev);
36
39
/* do great stuff which is ARPHRD_6LOWPAN related */
37
40
switch (lowpan_priv->lltype) {
@@ -42,8 +45,8 @@ case ARPHRD_6LOWPAN:
42
45
...
43
46
}
44
47
break;
45
- ...
46
- }
48
+ ...
49
+ }
47
50
48
51
In case of generic 6lowpan branch ("net/6lowpan") you can remove the check
49
52
on ARPHRD_6LOWPAN, because you can be sure that these function are called
0 commit comments