Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

documentation: networking: add 6lowpan documentation

This patch adds a 6lowpan.txt into the networking documentation
directory. Currently this documentation describes how the lowpan
private data of net devices will be handled.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Suggested-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Alexander Aring and committed by
Marcel Holtmann
ea9eb698 4ae935c1

+51
+50
Documentation/networking/6lowpan.txt
··· 1 + 2 + Netdev private dataroom for 6lowpan interfaces: 3 + 4 + All 6lowpan able net devices, means all interfaces with ARPHRD_6LOWPAN, 5 + must have "struct lowpan_priv" placed at beginning of netdev_priv. 6 + 7 + The priv_size of each interface should be calculate by: 8 + 9 + dev->priv_size = LOWPAN_PRIV_SIZE(LL_6LOWPAN_PRIV_DATA); 10 + 11 + Where LL_PRIV_6LOWPAN_DATA is sizeof linklayer 6lowpan private data struct. 12 + To access the LL_PRIV_6LOWPAN_DATA structure you can cast: 13 + 14 + lowpan_priv(dev)-priv; 15 + 16 + to your LL_6LOWPAN_PRIV_DATA structure. 17 + 18 + Before registering the lowpan netdev interface you must run: 19 + 20 + lowpan_netdev_setup(dev, LOWPAN_LLTYPE_FOOBAR); 21 + 22 + wheres LOWPAN_LLTYPE_FOOBAR is a define for your 6LoWPAN linklayer type of 23 + enum lowpan_lltypes. 24 + 25 + Example to evaluate the private usually you can do: 26 + 27 + static inline sturct lowpan_priv_foobar * 28 + lowpan_foobar_priv(struct net_device *dev) 29 + { 30 + return (sturct lowpan_priv_foobar *)lowpan_priv(dev)->priv; 31 + } 32 + 33 + switch (dev->type) { 34 + case ARPHRD_6LOWPAN: 35 + lowpan_priv = lowpan_priv(dev); 36 + /* do great stuff which is ARPHRD_6LOWPAN related */ 37 + switch (lowpan_priv->lltype) { 38 + case LOWPAN_LLTYPE_FOOBAR: 39 + /* do 802.15.4 6LoWPAN handling here */ 40 + lowpan_foobar_priv(dev)->bar = foo; 41 + break; 42 + ... 43 + } 44 + break; 45 + ... 46 + } 47 + 48 + In case of generic 6lowpan branch ("net/6lowpan") you can remove the check 49 + on ARPHRD_6LOWPAN, because you can be sure that these function are called 50 + by ARPHRD_6LOWPAN interfaces.
+1
MAINTAINERS
··· 158 158 S: Maintained 159 159 F: net/6lowpan/ 160 160 F: include/net/6lowpan.h 161 + F: Documentation/networking/6lowpan.txt 161 162 162 163 6PACK NETWORK DRIVER FOR AX.25 163 164 M: Andreas Koensgen <ajk@comnets.uni-bremen.de>