aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-07-27 14:29:31 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-27 14:29:31 -0400
commitf004ec728bff3cf924ffc19387baca503cd73b01 (patch)
treed70d86b6697002cf4d71642185003d5e1bbf16f5
parentc685bfc6c6bcb9bcc42d1345a3650d3ce5185c52 (diff)
parent987b8816661332978efd0f85bedf9866fe2e3232 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan
-rw-r--r--Documentation/networking/00-INDEX2
-rw-r--r--Documentation/networking/ieee802154.txt2
-rw-r--r--drivers/ieee802154/fakehard.c130
-rw-r--r--include/net/af_ieee802154.h (renamed from include/net/ieee802154/af_ieee802154.h)0
-rw-r--r--include/net/ieee802154.h (renamed from include/net/ieee802154/mac_def.h)4
-rw-r--r--include/net/ieee802154/nl802154.h41
-rw-r--r--include/net/ieee802154_netdev.h (renamed from include/net/ieee802154/netdevice.h)0
-rw-r--r--include/net/nl802154.h117
-rw-r--r--net/ieee802154/af_ieee802154.c4
-rw-r--r--net/ieee802154/dgram.c6
-rw-r--r--net/ieee802154/netlink.c6
-rw-r--r--net/ieee802154/raw.c2
12 files changed, 256 insertions, 58 deletions
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX
index 1634c6dcecae..50189bf07d53 100644
--- a/Documentation/networking/00-INDEX
+++ b/Documentation/networking/00-INDEX
@@ -60,6 +60,8 @@ framerelay.txt
60 - info on using Frame Relay/Data Link Connection Identifier (DLCI). 60 - info on using Frame Relay/Data Link Connection Identifier (DLCI).
61generic_netlink.txt 61generic_netlink.txt
62 - info on Generic Netlink 62 - info on Generic Netlink
63ieee802154.txt
64 - Linux IEEE 802.15.4 implementation, API and drivers
63ip-sysctl.txt 65ip-sysctl.txt
64 - /proc/sys/net/ipv4/* variables 66 - /proc/sys/net/ipv4/* variables
65ip_dynaddr.txt 67ip_dynaddr.txt
diff --git a/Documentation/networking/ieee802154.txt b/Documentation/networking/ieee802154.txt
index a0280ad2edc9..1d4ed66b1b1c 100644
--- a/Documentation/networking/ieee802154.txt
+++ b/Documentation/networking/ieee802154.txt
@@ -69,7 +69,7 @@ We provide an example of simple HardMAC driver at drivers/ieee802154/fakehard.c
69SoftMAC 69SoftMAC
70======= 70=======
71 71
72We are going to provide intermediate layer impelementing IEEE 802.15.4 MAC 72We are going to provide intermediate layer implementing IEEE 802.15.4 MAC
73in software. This is currently WIP. 73in software. This is currently WIP.
74 74
75See header include/net/ieee802154/mac802154.h and several drivers in 75See header include/net/ieee802154/mac802154.h and several drivers in
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
index 14045a7ba388..c94d2c24c352 100644
--- a/drivers/ieee802154/fakehard.c
+++ b/drivers/ieee802154/fakehard.c
@@ -26,11 +26,17 @@
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <linux/if_arp.h> 27#include <linux/if_arp.h>
28 28
29#include <net/ieee802154/af_ieee802154.h> 29#include <net/af_ieee802154.h>
30#include <net/ieee802154/netdevice.h> 30#include <net/ieee802154_netdev.h>
31#include <net/ieee802154/mac_def.h> 31#include <net/ieee802154.h>
32#include <net/ieee802154/nl802154.h> 32#include <net/nl802154.h>
33 33
34/**
35 * fake_get_pan_id - Retrieve the PAN ID of the device.
36 * @dev: The network device to retrieve the PAN of.
37 *
38 * Return the ID of the PAN from the PIB.
39 */
34static u16 fake_get_pan_id(struct net_device *dev) 40static u16 fake_get_pan_id(struct net_device *dev)
35{ 41{
36 BUG_ON(dev->type != ARPHRD_IEEE802154); 42 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -38,6 +44,14 @@ static u16 fake_get_pan_id(struct net_device *dev)
38 return 0xeba1; 44 return 0xeba1;
39} 45}
40 46
47/**
48 * fake_get_short_addr - Retrieve the short address of the device.
49 * @dev: The network device to retrieve the short address of.
50 *
51 * Returns the IEEE 802.15.4 short-form address cached for this
52 * device. If the device has not yet had a short address assigned
53 * then this should return 0xFFFF to indicate a lack of association.
54 */
41static u16 fake_get_short_addr(struct net_device *dev) 55static u16 fake_get_short_addr(struct net_device *dev)
42{ 56{
43 BUG_ON(dev->type != ARPHRD_IEEE802154); 57 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -45,6 +59,19 @@ static u16 fake_get_short_addr(struct net_device *dev)
45 return 0x1; 59 return 0x1;
46} 60}
47 61
62/**
63 * fake_get_dsn - Retrieve the DSN of the device.
64 * @dev: The network device to retrieve the DSN for.
65 *
66 * Returns the IEEE 802.15.4 DSN for the network device.
67 * The DSN is the sequence number which will be added to each
68 * packet or MAC command frame by the MAC during transmission.
69 *
70 * DSN means 'Data Sequence Number'.
71 *
72 * Note: This is in section 7.2.1.2 of the IEEE 802.15.4-2006
73 * document.
74 */
48static u8 fake_get_dsn(struct net_device *dev) 75static u8 fake_get_dsn(struct net_device *dev)
49{ 76{
50 BUG_ON(dev->type != ARPHRD_IEEE802154); 77 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -52,6 +79,19 @@ static u8 fake_get_dsn(struct net_device *dev)
52 return 0x00; /* DSN are implemented in HW, so return just 0 */ 79 return 0x00; /* DSN are implemented in HW, so return just 0 */
53} 80}
54 81
82/**
83 * fake_get_bsn - Retrieve the BSN of the device.
84 * @dev: The network device to retrieve the BSN for.
85 *
86 * Returns the IEEE 802.15.4 BSN for the network device.
87 * The BSN is the sequence number which will be added to each
88 * beacon frame sent by the MAC.
89 *
90 * BSN means 'Beacon Sequence Number'.
91 *
92 * Note: This is in section 7.2.1.2 of the IEEE 802.15.4-2006
93 * document.
94 */
55static u8 fake_get_bsn(struct net_device *dev) 95static u8 fake_get_bsn(struct net_device *dev)
56{ 96{
57 BUG_ON(dev->type != ARPHRD_IEEE802154); 97 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -59,6 +99,19 @@ static u8 fake_get_bsn(struct net_device *dev)
59 return 0x00; /* BSN are implemented in HW, so return just 0 */ 99 return 0x00; /* BSN are implemented in HW, so return just 0 */
60} 100}
61 101
102/**
103 * fake_assoc_req - Make an association request to the HW.
104 * @dev: The network device which we are associating to a network.
105 * @addr: The coordinator with which we wish to associate.
106 * @channel: The channel on which to associate.
107 * @cap: The capability information field to use in the association.
108 *
109 * Start an association with a coordinator. The coordinator's address
110 * and PAN ID can be found in @addr.
111 *
112 * Note: This is in section 7.3.1 and 7.5.3.1 of the IEEE
113 * 802.15.4-2006 document.
114 */
62static int fake_assoc_req(struct net_device *dev, 115static int fake_assoc_req(struct net_device *dev,
63 struct ieee802154_addr *addr, u8 channel, u8 cap) 116 struct ieee802154_addr *addr, u8 channel, u8 cap)
64{ 117{
@@ -67,18 +120,70 @@ static int fake_assoc_req(struct net_device *dev,
67 IEEE802154_SUCCESS); 120 IEEE802154_SUCCESS);
68} 121}
69 122
123/**
124 * fake_assoc_resp - Send an association response to a device.
125 * @dev: The network device on which to send the response.
126 * @addr: The address of the device to respond to.
127 * @short_addr: The assigned short address for the device (if any).
128 * @status: The result of the association request.
129 *
130 * Queue the association response of the coordinator to another
131 * device's attempt to associate with the network which we
132 * coordinate. This is then added to the indirect-send queue to be
133 * transmitted to the end device when it polls for data.
134 *
135 * Note: This is in section 7.3.2 and 7.5.3.1 of the IEEE
136 * 802.15.4-2006 document.
137 */
70static int fake_assoc_resp(struct net_device *dev, 138static int fake_assoc_resp(struct net_device *dev,
71 struct ieee802154_addr *addr, u16 short_addr, u8 status) 139 struct ieee802154_addr *addr, u16 short_addr, u8 status)
72{ 140{
73 return 0; 141 return 0;
74} 142}
75 143
144/**
145 * fake_disassoc_req - Disassociate a device from a network.
146 * @dev: The network device on which we're disassociating a device.
147 * @addr: The device to disassociate from the network.
148 * @reason: The reason to give to the device for being disassociated.
149 *
150 * This sends a disassociation notification to the device being
151 * disassociated from the network.
152 *
153 * Note: This is in section 7.5.3.2 of the IEEE 802.15.4-2006
154 * document, with the reason described in 7.3.3.2.
155 */
76static int fake_disassoc_req(struct net_device *dev, 156static int fake_disassoc_req(struct net_device *dev,
77 struct ieee802154_addr *addr, u8 reason) 157 struct ieee802154_addr *addr, u8 reason)
78{ 158{
79 return ieee802154_nl_disassoc_confirm(dev, IEEE802154_SUCCESS); 159 return ieee802154_nl_disassoc_confirm(dev, IEEE802154_SUCCESS);
80} 160}
81 161
162/**
163 * fake_start_req - Start an IEEE 802.15.4 PAN.
164 * @dev: The network device on which to start the PAN.
165 * @addr: The coordinator address to use when starting the PAN.
166 * @channel: The channel on which to start the PAN.
167 * @bcn_ord: Beacon order.
168 * @sf_ord: Superframe order.
169 * @pan_coord: Whether or not we are the PAN coordinator or just
170 * requesting a realignment perhaps?
171 * @blx: Battery Life Extension feature bitfield.
172 * @coord_realign: Something to realign something else.
173 *
174 * If pan_coord is non-zero then this starts a network with the
175 * provided parameters, otherwise it attempts a coordinator
176 * realignment of the stated network instead.
177 *
178 * Note: This is in section 7.5.2.3 of the IEEE 802.15.4-2006
179 * document, with 7.3.8 describing coordinator realignment.
180 *
181 * Note: There is currently no way to notify the coordinator userland
182 * program of whether or not the PAN has started successfully. As
183 * such, the coordinator program cannot know when the MAC has
184 * completed starting the network and will simply have to assume
185 * completeness based on some form of time delay.
186 */
82static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr, 187static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr,
83 u8 channel, 188 u8 channel,
84 u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx, 189 u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx,
@@ -87,6 +192,21 @@ static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr,
87 return 0; 192 return 0;
88} 193}
89 194
195/**
196 * fake_scan_req - Start a channel scan.
197 * @dev: The network device on which to perform a channel scan.
198 * @type: The type of scan to perform.
199 * @channels: The channel bitmask to scan.
200 * @duration: How long to spend on each channel.
201 *
202 * This starts either a passive (energy) scan or an active (PAN) scan
203 * on the channels indicated in the @channels bitmask. The duration of
204 * the scan is measured in terms of superframe duration. Specifically,
205 * the scan will spend aBaseSuperFrameDuration * ((2^n) + 1) on each
206 * channel.
207 *
208 * Note: This is in section 7.5.2.1 of the IEEE 802.15.4-2006 document.
209 */
90static int fake_scan_req(struct net_device *dev, u8 type, u32 channels, 210static int fake_scan_req(struct net_device *dev, u8 type, u32 channels,
91 u8 duration) 211 u8 duration)
92{ 212{
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/af_ieee802154.h
index 0d78605fb1a6..0d78605fb1a6 100644
--- a/include/net/ieee802154/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154.h
index 8cb684635650..d52685defb11 100644
--- a/include/net/ieee802154/mac_def.h
+++ b/include/net/ieee802154.h
@@ -23,8 +23,8 @@
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */ 24 */
25 25
26#ifndef IEEE802154_MAC_DEF_H 26#ifndef NET_IEEE802154_H
27#define IEEE802154_MAC_DEF_H 27#define NET_IEEE802154_H
28 28
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h
deleted file mode 100644
index 78efcdf52b59..000000000000
--- a/include/net/ieee802154/nl802154.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27int ieee802154_nl_assoc_indic(struct net_device *dev,
28 struct ieee802154_addr *addr, u8 cap);
29int ieee802154_nl_assoc_confirm(struct net_device *dev,
30 u16 short_addr, u8 status);
31int ieee802154_nl_disassoc_indic(struct net_device *dev,
32 struct ieee802154_addr *addr, u8 reason);
33int ieee802154_nl_disassoc_confirm(struct net_device *dev,
34 u8 status);
35int ieee802154_nl_scan_confirm(struct net_device *dev,
36 u8 status, u8 scan_type, u32 unscanned,
37 u8 *edl/*, struct list_head *pan_desc_list */);
38int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
39 u16 coord_addr);
40
41#endif
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154_netdev.h
index e2506af3e7c8..e2506af3e7c8 100644
--- a/include/net/ieee802154/netdevice.h
+++ b/include/net/ieee802154_netdev.h
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
new file mode 100644
index 000000000000..6096096f6d7d
--- /dev/null
+++ b/include/net/nl802154.h
@@ -0,0 +1,117 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27/**
28 * ieee802154_nl_assoc_indic - Notify userland of an association request.
29 * @dev: The network device on which this association request was
30 * received.
31 * @addr: The address of the device requesting association.
32 * @cap: The capability information field from the device.
33 *
34 * This informs a userland coordinator of a device requesting to
35 * associate with the PAN controlled by the coordinator.
36 *
37 * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
38 */
39int ieee802154_nl_assoc_indic(struct net_device *dev,
40 struct ieee802154_addr *addr, u8 cap);
41
42/**
43 * ieee802154_nl_assoc_confirm - Notify userland of association.
44 * @dev: The device which has completed association.
45 * @short_addr: The short address assigned to the device.
46 * @status: The status of the association.
47 *
48 * Inform userland of the result of an association request. If the
49 * association request included asking the coordinator to allocate
50 * a short address then it is returned in @short_addr.
51 *
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status);
56
57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
59 * @dev: The device on which disassociation was indicated.
60 * @addr: The device which is disassociating.
61 * @reason: The reason for the disassociation.
62 *
63 * Inform userland that a device has disassociated from the network.
64 *
65 * Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
66 */
67int ieee802154_nl_disassoc_indic(struct net_device *dev,
68 struct ieee802154_addr *addr, u8 reason);
69
70/**
71 * ieee802154_nl_disassoc_confirm - Notify userland of disassociation
72 * completion.
73 * @dev: The device on which disassociation was ordered.
74 * @status: The result of the disassociation.
75 *
76 * Inform userland of the result of requesting that a device
77 * disassociate, or the result of requesting that we disassociate from
78 * a PAN managed by another coordinator.
79 *
80 * Note: This is in section 7.1.4.3 of the IEEE 802.15.4 document.
81 */
82int ieee802154_nl_disassoc_confirm(struct net_device *dev,
83 u8 status);
84
85/**
86 * ieee802154_nl_scan_confirm - Notify userland of completion of scan.
87 * @dev: The device which was instructed to scan.
88 * @status: The status of the scan operation.
89 * @scan_type: What type of scan was performed.
90 * @unscanned: Any channels that the device was unable to scan.
91 * @edl: The energy levels (if a passive scan).
92 *
93 *
94 * Note: This is in section 7.1.11 of the IEEE 802.15.4 document.
95 * Note: This API does not permit the return of an active scan result.
96 */
97int ieee802154_nl_scan_confirm(struct net_device *dev,
98 u8 status, u8 scan_type, u32 unscanned,
99 u8 *edl/*, struct list_head *pan_desc_list */);
100
101/**
102 * ieee802154_nl_beacon_indic - Notify userland of a received beacon.
103 * @dev: The device on which a beacon was received.
104 * @panid: The PAN of the coordinator.
105 * @coord_addr: The short address of the coordinator on that PAN.
106 *
107 * Note: This is in section 7.1.5 of the IEEE 802.15.4 document.
108 * Note: This API does not provide extended information such as what
109 * channel the PAN is on or what the LQI of the beacon frame was on
110 * receipt.
111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode.
113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
115 u16 coord_addr);
116
117#endif
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index 3bb6bdb1dac1..69c8d9207aa7 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -34,8 +34,8 @@
34#include <net/tcp_states.h> 34#include <net/tcp_states.h>
35#include <net/route.h> 35#include <net/route.h>
36 36
37#include <net/ieee802154/af_ieee802154.h> 37#include <net/af_ieee802154.h>
38#include <net/ieee802154/netdevice.h> 38#include <net/ieee802154_netdev.h>
39 39
40#include "af802154.h" 40#include "af802154.h"
41 41
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
index 14d39840dd62..53dd912d52b4 100644
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -26,9 +26,9 @@
26#include <linux/if_arp.h> 26#include <linux/if_arp.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/sock.h> 28#include <net/sock.h>
29#include <net/ieee802154/af_ieee802154.h> 29#include <net/af_ieee802154.h>
30#include <net/ieee802154/mac_def.h> 30#include <net/ieee802154.h>
31#include <net/ieee802154/netdevice.h> 31#include <net/ieee802154_netdev.h>
32 32
33#include <asm/ioctls.h> 33#include <asm/ioctls.h>
34 34
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index 27eda9fdf3c2..a615b9d13212 100644
--- a/net/ieee802154/netlink.c
+++ b/net/ieee802154/netlink.c
@@ -27,9 +27,9 @@
27#include <net/netlink.h> 27#include <net/netlink.h>
28#include <net/genetlink.h> 28#include <net/genetlink.h>
29#include <linux/nl802154.h> 29#include <linux/nl802154.h>
30#include <net/ieee802154/af_ieee802154.h> 30#include <net/af_ieee802154.h>
31#include <net/ieee802154/nl802154.h> 31#include <net/nl802154.h>
32#include <net/ieee802154/netdevice.h> 32#include <net/ieee802154_netdev.h>
33 33
34static unsigned int ieee802154_seq_num; 34static unsigned int ieee802154_seq_num;
35 35
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c
index fca44d59f97e..ea8d1f15206e 100644
--- a/net/ieee802154/raw.c
+++ b/net/ieee802154/raw.c
@@ -26,7 +26,7 @@
26#include <linux/if_arp.h> 26#include <linux/if_arp.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/sock.h> 28#include <net/sock.h>
29#include <net/ieee802154/af_ieee802154.h> 29#include <net/af_ieee802154.h>
30 30
31#include "af802154.h" 31#include "af802154.h"
32 32