aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-02-22 03:13:54 -0500
committerMarcel Holtmann <marcel@holtmann.org>2016-02-23 14:29:40 -0500
commit5609c185f24dffca5f6a9c127106869da150be03 (patch)
tree709e278dc1463646bf0db64b2f03511e3e4ec934 /include/net
parentaef00c15b8c503083a703900a755fdb1cf2436e0 (diff)
6lowpan: iphc: add support for stateful compression
This patch introduce support for IPHC stateful address compression. It will offer the context table via one debugfs entry. This debugfs has and directory for each cid entry for the context table. Inside each cid directory there exists the following files: - "active": If the entry is added or deleted. The context table is original a list implementation, this flag will indicate if the context is part of list or not. - "prefix": The ipv6 prefix. - "prefix_length": The prefix length for the prefix. - "compression": The compression flag according RFC6775. This part should be moved into sysfs after some testing time. Also the debugfs entry contains a "show" file which is a pretty-printout for the current context table information. Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <aar@pengutronix.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/6lowpan.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index 2f6a3f2233ed..da3a77d25fcb 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -75,6 +75,8 @@
75#define LOWPAN_IPHC_MAX_HC_BUF_LEN (sizeof(struct ipv6hdr) + \ 75#define LOWPAN_IPHC_MAX_HC_BUF_LEN (sizeof(struct ipv6hdr) + \
76 LOWPAN_IPHC_MAX_HEADER_LEN + \ 76 LOWPAN_IPHC_MAX_HEADER_LEN + \
77 LOWPAN_NHC_MAX_HDR_LEN) 77 LOWPAN_NHC_MAX_HDR_LEN)
78/* SCI/DCI is 4 bit width, so we have maximum 16 entries */
79#define LOWPAN_IPHC_CTX_TABLE_SIZE (1 << 4)
78 80
79#define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */ 81#define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */
80#define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */ 82#define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */
@@ -98,9 +100,39 @@ enum lowpan_lltypes {
98 LOWPAN_LLTYPE_IEEE802154, 100 LOWPAN_LLTYPE_IEEE802154,
99}; 101};
100 102
103enum lowpan_iphc_ctx_flags {
104 LOWPAN_IPHC_CTX_FLAG_ACTIVE,
105 LOWPAN_IPHC_CTX_FLAG_COMPRESSION,
106};
107
108struct lowpan_iphc_ctx {
109 u8 id;
110 struct in6_addr pfx;
111 u8 plen;
112 unsigned long flags;
113};
114
115struct lowpan_iphc_ctx_table {
116 spinlock_t lock;
117 const struct lowpan_iphc_ctx_ops *ops;
118 struct lowpan_iphc_ctx table[LOWPAN_IPHC_CTX_TABLE_SIZE];
119};
120
121static inline bool lowpan_iphc_ctx_is_active(const struct lowpan_iphc_ctx *ctx)
122{
123 return test_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE, &ctx->flags);
124}
125
126static inline bool
127lowpan_iphc_ctx_is_compression(const struct lowpan_iphc_ctx *ctx)
128{
129 return test_bit(LOWPAN_IPHC_CTX_FLAG_COMPRESSION, &ctx->flags);
130}
131
101struct lowpan_priv { 132struct lowpan_priv {
102 enum lowpan_lltypes lltype; 133 enum lowpan_lltypes lltype;
103 struct dentry *iface_debugfs; 134 struct dentry *iface_debugfs;
135 struct lowpan_iphc_ctx_table ctx;
104 136
105 /* must be last */ 137 /* must be last */
106 u8 priv[0] __aligned(sizeof(void *)); 138 u8 priv[0] __aligned(sizeof(void *));