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