aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac802154.h
diff options
context:
space:
mode:
authoralex.bluesman.smirnov@gmail.com <alex.bluesman.smirnov@gmail.com>2012-05-15 16:50:19 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-16 15:16:14 -0400
commit0afd7ad9de6b85c0f7ad9edf787de854c8e2fbb5 (patch)
tree9b3322cc4ba8c923b6334b70b71674d39a8d9fe3 /include/net/mac802154.h
parentd584515fbb59d65bd307f7a453e7849489f62986 (diff)
mac802154: basic ieee802.15.4 device structures
The IEEE 802.15.4 Working Group focuses on the standardization of the bottom two layers of ISO/OSI protocol stack: Physical (PHY) and MAC. The MAC layer provides access control to a shared channel and reliable data delivery. The main functions performed by the MAC sublayer are: association and disassociation, security control, optional star network topology functions, such as beacon generation and Guaranteed Time Slots (GTSs) management, generation of ACK frames (if used), and, finally, application support for the two possible network topologies described in the standard. This is an initial commit which describes main data structures needed for ieee802.15.4 compatible devices representation in the MAC layer. Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/mac802154.h')
-rw-r--r--include/net/mac802154.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
new file mode 100644
index 00000000000..941c4e170b0
--- /dev/null
+++ b/include/net/mac802154.h
@@ -0,0 +1,126 @@
1/*
2 * IEEE802.15.4-2003 specification
3 *
4 * Copyright (C) 2007-2012 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#ifndef NET_MAC802154_H
20#define NET_MAC802154_H
21
22#include <net/af_ieee802154.h>
23
24/* The following flags are used to indicate changed address settings from
25 * the stack to the hardware.
26 */
27
28/* indicates that the Short Address changed */
29#define IEEE802515_AFILT_SADDR_CHANGED 0x00000001
30/* indicates that the IEEE Address changed */
31#define IEEE802515_AFILT_IEEEADDR_CHANGED 0x00000002
32/* indicates that the PAN ID changed */
33#define IEEE802515_AFILT_PANID_CHANGED 0x00000004
34/* indicates that PAN Coordinator status changed */
35#define IEEE802515_AFILT_PANC_CHANGED 0x00000008
36
37struct ieee802154_hw_addr_filt {
38 __le16 pan_id; /* Each independent PAN selects a unique
39 * identifier. This PAN id allows communication
40 * between devices within a network using short
41 * addresses and enables transmissions between
42 * devices across independent networks.
43 */
44 __le16 short_addr;
45 u8 ieee_addr[IEEE802154_ADDR_LEN];
46 u8 pan_coord;
47};
48
49struct ieee802154_dev {
50 /* filled by the driver */
51 int extra_tx_headroom;
52 u32 flags;
53 struct device *parent;
54
55 /* filled by mac802154 core */
56 struct ieee802154_hw_addr_filt hw_filt;
57 void *priv;
58 struct wpan_phy *phy;
59};
60
61/* Checksum is in hardware and is omitted from a packet
62 *
63 * These following flags are used to indicate hardware capabilities to
64 * the stack. Generally, flags here should have their meaning
65 * done in a way that the simplest hardware doesn't need setting
66 * any particular flags. There are some exceptions to this rule,
67 * however, so you are advised to review these flags carefully.
68 */
69
70/* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
71#define IEEE802154_HW_OMIT_CKSUM 0x00000001
72/* Indicates that receiver will autorespond with ACK frames. */
73#define IEEE802154_HW_AACK 0x00000002
74
75/* struct ieee802154_ops - callbacks from mac802154 to the driver
76 *
77 * This structure contains various callbacks that the driver may
78 * handle or, in some cases, must handle, for example to transmit
79 * a frame.
80 *
81 * start: Handler that 802.15.4 module calls for device initialization.
82 * This function is called before the first interface is attached.
83 *
84 * stop: Handler that 802.15.4 module calls for device cleanup.
85 * This function is called after the last interface is removed.
86 *
87 * xmit: Handler that 802.15.4 module calls for each transmitted frame.
88 * skb cntains the buffer starting from the IEEE 802.15.4 header.
89 * The low-level driver should send the frame based on available
90 * configuration.
91 * This function should return zero or negative errno. Called with
92 * pib_lock held.
93 *
94 * ed: Handler that 802.15.4 module calls for Energy Detection.
95 * This function should place the value for detected energy
96 * (usually device-dependant) in the level pointer and return
97 * either zero or negative errno. Called with pib_lock held.
98 *
99 * set_channel:
100 * Set radio for listening on specific channel.
101 * Set the device for listening on specified channel.
102 * Returns either zero, or negative errno. Called with pib_lock held.
103 *
104 * set_hw_addr_filt:
105 * Set radio for listening on specific address.
106 * Set the device for listening on specified address.
107 * Returns either zero, or negative errno.
108 */
109struct ieee802154_ops {
110 struct module *owner;
111 int (*start)(struct ieee802154_dev *dev);
112 void (*stop)(struct ieee802154_dev *dev);
113 int (*xmit)(struct ieee802154_dev *dev,
114 struct sk_buff *skb);
115 int (*ed)(struct ieee802154_dev *dev, u8 *level);
116 int (*set_channel)(struct ieee802154_dev *dev,
117 int page,
118 int channel);
119 int (*set_hw_addr_filt)(struct ieee802154_dev *dev,
120 struct ieee802154_hw_addr_filt *filt,
121 unsigned long changed);
122 int (*ieee_addr)(struct ieee802154_dev *dev,
123 u8 addr[IEEE802154_ADDR_LEN]);
124};
125
126#endif /* NET_MAC802154_H */