aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ieee802154_netdev.h
diff options
context:
space:
mode:
authorPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>2014-05-14 11:43:08 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-15 15:51:42 -0400
commit32edc40ae65cf84e1ab69f6f8316ce81559e115d (patch)
treee3e4435e356a0e10038c3a2a16383f6089660c9c /include/net/ieee802154_netdev.h
parent8c84296fd2867118944399ab7e9051515a70d60d (diff)
ieee802154: change _cb handling slightly
The current mac_cb handling of ieee802154 is rather awkward and limited. Decompose the single flags field into multiple fields with the meanings of each subfield of the flags field to make future extensions (for example, link-layer security) easier. Also don't set the frame sequence number in upper layers, since that's a thing the MAC is supposed to set on frame transmit - we set it on header creation, but assuming that upper layers do not blindly duplicate our headers, this is fine. Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ieee802154_netdev.h')
-rw-r--r--include/net/ieee802154_netdev.h25
1 files changed, 7 insertions, 18 deletions
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 6e4d3e1071b5..bc9a7475e57e 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -222,8 +222,9 @@ static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa,
222 */ 222 */
223struct ieee802154_mac_cb { 223struct ieee802154_mac_cb {
224 u8 lqi; 224 u8 lqi;
225 u8 flags; 225 u8 type;
226 u8 seq; 226 bool ackreq;
227 bool secen;
227 struct ieee802154_addr source; 228 struct ieee802154_addr source;
228 struct ieee802154_addr dest; 229 struct ieee802154_addr dest;
229}; 230};
@@ -233,24 +234,12 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
233 return (struct ieee802154_mac_cb *)skb->cb; 234 return (struct ieee802154_mac_cb *)skb->cb;
234} 235}
235 236
236#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1) 237static inline struct ieee802154_mac_cb *mac_cb_init(struct sk_buff *skb)
237
238#define MAC_CB_FLAG_ACKREQ (1 << 3)
239#define MAC_CB_FLAG_SECEN (1 << 4)
240
241static inline bool mac_cb_is_ackreq(struct sk_buff *skb)
242{
243 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
244}
245
246static inline bool mac_cb_is_secen(struct sk_buff *skb)
247{ 238{
248 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN; 239 BUILD_BUG_ON(sizeof(struct ieee802154_mac_cb) > sizeof(skb->cb));
249}
250 240
251static inline int mac_cb_type(struct sk_buff *skb) 241 memset(skb->cb, 0, sizeof(struct ieee802154_mac_cb));
252{ 242 return mac_cb(skb);
253 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
254} 243}
255 244
256#define IEEE802154_MAC_SCAN_ED 0 245#define IEEE802154_MAC_SCAN_ED 0