]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/net/ieee802154_netdev.h
qlcnic: Bumped up driver version to 5.0.12
[net-next-2.6.git] / include / net / ieee802154_netdev.h
CommitLineData
9ec76716
SL
1/*
2 * An interface between IEEE802.15.4 device and rest of the kernel.
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 * Written by:
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */
25
26#ifndef IEEE802154_NETDEVICE_H
27#define IEEE802154_NETDEVICE_H
28
29/*
30 * A control block of skb passed between the ARPHRD_IEEE802154 device
31 * and other stack parts.
32 */
33struct ieee802154_mac_cb {
34 u8 lqi;
35 struct ieee802154_addr sa;
36 struct ieee802154_addr da;
37 u8 flags;
38 u8 seq;
39};
40
41static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
42{
43 return (struct ieee802154_mac_cb *)skb->cb;
44}
45
46#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1)
47
48#define MAC_CB_FLAG_ACKREQ (1 << 3)
49#define MAC_CB_FLAG_SECEN (1 << 4)
50#define MAC_CB_FLAG_INTRAPAN (1 << 5)
51
52static inline int mac_cb_is_ackreq(struct sk_buff *skb)
53{
54 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
55}
56
57static inline int mac_cb_is_secen(struct sk_buff *skb)
58{
59 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
60}
61
62static inline int mac_cb_is_intrapan(struct sk_buff *skb)
63{
64 return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
65}
66
67static inline int mac_cb_type(struct sk_buff *skb)
68{
69 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
70}
71
72#define IEEE802154_MAC_SCAN_ED 0
73#define IEEE802154_MAC_SCAN_ACTIVE 1
74#define IEEE802154_MAC_SCAN_PASSIVE 2
75#define IEEE802154_MAC_SCAN_ORPHAN 3
76
42723448 77struct wpan_phy;
9ec76716
SL
78/*
79 * This should be located at net_device->ml_priv
42723448
DES
80 *
81 * get_phy should increment the reference counting on returned phy.
82 * Use wpan_wpy_put to put that reference.
9ec76716
SL
83 */
84struct ieee802154_mlme_ops {
85 int (*assoc_req)(struct net_device *dev,
86 struct ieee802154_addr *addr,
16eea493 87 u8 channel, u8 page, u8 cap);
9ec76716
SL
88 int (*assoc_resp)(struct net_device *dev,
89 struct ieee802154_addr *addr,
90 u16 short_addr, u8 status);
91 int (*disassoc_req)(struct net_device *dev,
92 struct ieee802154_addr *addr,
93 u8 reason);
94 int (*start_req)(struct net_device *dev,
95 struct ieee802154_addr *addr,
16eea493 96 u8 channel, u8 page, u8 bcn_ord, u8 sf_ord,
9ec76716
SL
97 u8 pan_coord, u8 blx, u8 coord_realign);
98 int (*scan_req)(struct net_device *dev,
16eea493 99 u8 type, u32 channels, u8 page, u8 duration);
9ec76716 100
42723448
DES
101 struct wpan_phy *(*get_phy)(const struct net_device *dev);
102
9ec76716
SL
103 /*
104 * FIXME: these should become the part of PIB/MIB interface.
105 * However we still don't have IB interface of any kind
106 */
a9966b58
DES
107 u16 (*get_pan_id)(const struct net_device *dev);
108 u16 (*get_short_addr)(const struct net_device *dev);
109 u8 (*get_dsn)(const struct net_device *dev);
110 u8 (*get_bsn)(const struct net_device *dev);
9ec76716
SL
111};
112
113static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops(
a9966b58 114 const struct net_device *dev)
9ec76716
SL
115{
116 return dev->ml_priv;
117}
118
119#endif
120
121