Skip to content

Commit

Permalink
linux-mainline 3.7: update to 3.7 final
Browse files Browse the repository at this point in the history
Also add Beagleboard and Pandaboard support.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
  • Loading branch information
koenkooi committed Dec 12, 2012
1 parent 6068696 commit 5ccd377
Show file tree
Hide file tree
Showing 203 changed files with 81,238 additions and 517 deletions.
@@ -0,0 +1,44 @@
From e052d482e1d52a7ff522bd6647efe61105570607 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.cheneau@amnesiak.org>
Date: Mon, 25 Jun 2012 19:45:33 +0000
Subject: [PATCH 01/16] 6lowpan: lowpan_is_iid_16_bit_compressable() does not
detect compressable address correctly

The current test is not RFC6282 compliant. The same issue has been found
out and fixed in Contiki. This patch is basicaly a port of their fix.

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
---
net/ieee802154/6lowpan.h | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
index 8c2251f..efd1a57 100644
--- a/net/ieee802154/6lowpan.h
+++ b/net/ieee802154/6lowpan.h
@@ -87,14 +87,16 @@
#define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE)

/*
- * check whether we can compress the IID to 16 bits,
- * it's possible for unicast adresses with first 49 bits are zero only.
- */
+* check whether we can compress the IID to 16 bits,
+* it's possible for unicast adresses with first 49 bits are zero only.
+*/
#define lowpan_is_iid_16_bit_compressable(a) \
((((a)->s6_addr16[4]) == 0) && \
- (((a)->s6_addr16[5]) == 0) && \
- (((a)->s6_addr16[6]) == 0) && \
- ((((a)->s6_addr[14]) & 0x80) == 0))
+ (((a)->s6_addr[10]) == 0) && \
+ (((a)->s6_addr[11]) == 0xff) && \
+ (((a)->s6_addr[12]) == 0xfe) && \
+ (((a)->s6_addr[13]) == 0))
+

/* multicast address */
#define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)
--
1.7.7.6

@@ -0,0 +1,34 @@
From 970d5a81d7171a41f6cec5a12652e9b8734fbe46 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.cheneau@amnesiak.org>
Date: Mon, 25 Jun 2012 19:45:45 +0000
Subject: [PATCH 02/16] 6lowpan: next header is not properly set upon
decompression of a UDP header.

This causes a drop of the UDP packet.

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
---
net/ieee802154/6lowpan.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 6d42c17..b53a71a4 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -913,9 +913,12 @@ lowpan_process_data(struct sk_buff *skb)
}

/* UDP data uncompression */
- if (iphc0 & LOWPAN_IPHC_NH_C)
+ if (iphc0 & LOWPAN_IPHC_NH_C) {
if (lowpan_uncompress_udp_header(skb))
goto drop;
+ hdr.nexthdr = UIP_PROTO_UDP;
+ }
+

/* Not fragmented package */
hdr.payload_len = htons(skb->len);
--
1.7.7.6

@@ -0,0 +1,34 @@
From 0c4093a367fd1d76beeb45c529c1d60cc04f4547 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.cheneau@amnesiak.org>
Date: Mon, 25 Jun 2012 19:48:12 +0000
Subject: [PATCH 03/16] 6lowpan: always enable link-layer acknowledgments

This feature is especially important when using fragmentation, because
the reassembly mechanism can not recover from the loss of a fragment.

Note that some hardware ignore this flag and not will not transmit any
acknowledgments if this is set.

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
---
net/ieee802154/6lowpan.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index b53a71a4..49d91df 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -589,6 +589,10 @@ static int lowpan_header_create(struct sk_buff *skb,

mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;

+ /* request acknowledgment when possible */
+ if (!lowpan_is_addr_broadcast(daddr))
+ mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ;
+
return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
type, (void *)&da, (void *)&sa, skb->len);
}
--
1.7.7.6

@@ -0,0 +1,27 @@
From ffff73ce841abc0330965efa428d2080d16b0ee4 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.cheneau@amnesiak.org>
Date: Tue, 17 Jul 2012 17:59:39 -0400
Subject: [PATCH 04/16] mac802154: turn on ACK when enabled by the upper
layers

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
---
net/mac802154/wpan.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index f30f6d4..d6aea7f 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -149,6 +149,8 @@ static int mac802154_header_create(struct sk_buff *skb,

head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */
fc = mac_cb_type(skb);
+ if (mac_cb_is_ackreq(skb))
+ fc |= IEEE802154_FC_ACK_REQ;

if (!saddr) {
spin_lock_bh(&priv->mib_lock);
--
1.7.7.6

@@ -0,0 +1,56 @@
From 2100e90d03ae61a84f3f67029e9fb83a13caa580 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.cheneau@amnesiak.org>
Date: Tue, 4 Sep 2012 23:48:13 -0400
Subject: [PATCH 05/16] 6lowpan: use short IEEE 802.15.4 addresses for
broadcast destination

It is intended that the IEEE 802.15.4 standard uses the 0xFFFF short address (2
bytes) for message broadcasting.

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
---
net/ieee802154/6lowpan.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 49d91df..8a2ee95 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -577,21 +577,26 @@ static int lowpan_header_create(struct sk_buff *skb,
* this isn't implemented in mainline yet, so currently we assign 0xff
*/
{
+ mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
+
/* prepare wpan address data */
sa.addr_type = IEEE802154_ADDR_LONG;
sa.pan_id = 0xff;
-
- da.addr_type = IEEE802154_ADDR_LONG;
- da.pan_id = 0xff;
-
- memcpy(&(da.hwaddr), daddr, 8);
memcpy(&(sa.hwaddr), saddr, 8);

- mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
+ da.pan_id = 0xff;
+ /* if the destination address is the broadcast address,
+ use short address */
+ if (lowpan_is_addr_broadcast(daddr)) {
+ da.addr_type = IEEE802154_ADDR_SHORT;
+ da.short_addr = IEEE802154_ADDR_BROADCAST;
+ } else {
+ da.addr_type = IEEE802154_ADDR_LONG;
+ memcpy(&(da.hwaddr), daddr, 8);

- /* request acknowledgment when possible */
- if (!lowpan_is_addr_broadcast(daddr))
+ /* request acknowledgment */
mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ;
+ }

return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
type, (void *)&da, (void *)&sa, skb->len);
--
1.7.7.6

@@ -0,0 +1,140 @@
From 1852144adc2c41c0f86b01b63f127aea616a19f7 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.cheneau@amnesiak.org>
Date: Sat, 8 Sep 2012 00:15:54 -0400
Subject: [PATCH 06/16] 6lowpan: fix first fragment (FRAG1) handling

The first fragment, FRAG1, must contain some payload according to the
specs. However, as it is currently written, the first fragment will
remain empty and only contain the 6lowpan headers.

This patch also extract the transport layer information from the first
fragment. This information is later on use when uncompressing UDP
header.

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
---
net/ieee802154/6lowpan.c | 54 +++++++++++++++++++++++++++++++++++----------
1 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 8a2ee95..38cecaf 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -654,7 +654,7 @@ static void lowpan_fragment_timer_expired(unsigned long entry_addr)
}

static struct lowpan_fragment *
-lowpan_alloc_new_frame(struct sk_buff *skb, u8 len, u16 tag)
+lowpan_alloc_new_frame(struct sk_buff *skb, u16 len, u16 tag)
{
struct lowpan_fragment *frame;

@@ -735,6 +735,18 @@ lowpan_process_data(struct sk_buff *skb)
/* adds the 3 MSB to the 8 LSB to retrieve the 11 bits length */
len = ((iphc0 & 7) << 8) | slen;

+ if ((iphc0 & LOWPAN_DISPATCH_MASK) == LOWPAN_DISPATCH_FRAG1) {
+ pr_debug("%s received a FRAG1 packet (tag: %d, "
+ "size of the entire IP packet: %d)"
+ , __func__, tag, len);
+ } else { /* FRAGN */
+ if (lowpan_fetch_skb_u8(skb, &offset))
+ goto unlock_and_drop;
+ pr_debug("%s received a FRAGN packet (tag: %d, "
+ "size of the entire IP packet: %d, "
+ "offset: %d)", __func__, tag, len, offset * 8);
+ }
+
/*
* check if frame assembling with the same tag is
* already in progress
@@ -749,17 +761,13 @@ lowpan_process_data(struct sk_buff *skb)

/* alloc new frame structure */
if (!found) {
+ pr_debug("%s first fragment received for tag %d, "
+ "begin packet reassembly", __func__, tag);
frame = lowpan_alloc_new_frame(skb, len, tag);
if (!frame)
goto unlock_and_drop;
}

- if ((iphc0 & LOWPAN_DISPATCH_MASK) == LOWPAN_DISPATCH_FRAG1)
- goto unlock_and_drop;
-
- if (lowpan_fetch_skb_u8(skb, &offset)) /* fetch offset */
- goto unlock_and_drop;
-
/* if payload fits buffer, copy it */
if (likely((offset * 8 + skb->len) <= frame->length))
skb_copy_to_linear_data_offset(frame->skb, offset * 8,
@@ -777,6 +785,10 @@ lowpan_process_data(struct sk_buff *skb)
list_del(&frame->list);
spin_unlock_bh(&flist_lock);

+ pr_debug("%s successfully reassembled fragment "
+ "(tag %d)", __func__, tag);
+
+
dev_kfree_skb(skb);
skb = frame->skb;
kfree(frame);
@@ -976,13 +988,13 @@ static int lowpan_get_mac_header_length(struct sk_buff *skb)

static int
lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
- int mlen, int plen, int offset)
+ int mlen, int plen, int offset, int type)
{
struct sk_buff *frag;
int hlen, ret;

- /* if payload length is zero, therefore it's a first fragment */
- hlen = (plen == 0 ? LOWPAN_FRAG1_HEAD_SIZE : LOWPAN_FRAGN_HEAD_SIZE);
+ hlen = (type == LOWPAN_DISPATCH_FRAG1 ? LOWPAN_FRAG1_HEAD_SIZE :
+ LOWPAN_FRAGN_HEAD_SIZE);

lowpan_raw_dump_inline(__func__, "6lowpan fragment header", head, hlen);

@@ -1025,7 +1037,18 @@ lowpan_skb_fragmentation(struct sk_buff *skb)
head[2] = tag >> 8;
head[3] = tag & 0xff;

- err = lowpan_fragment_xmit(skb, head, header_length, 0, 0);
+ err = lowpan_fragment_xmit(skb, head, header_length, LOWPAN_FRAG_SIZE,
+ 0, LOWPAN_DISPATCH_FRAG1);
+
+ if (err) {
+#if DEBUG
+ pr_debug("%s unable to send FRAG1 packet (tag: %d)",
+ __func__, tag);
+#endif /* DEBUG */
+ goto exit;
+ }
+
+ offset = LOWPAN_FRAG_SIZE;

/* next fragment header */
head[0] &= ~LOWPAN_DISPATCH_FRAG1;
@@ -1040,10 +1063,17 @@ lowpan_skb_fragmentation(struct sk_buff *skb)
len = payload_length - offset;

err = lowpan_fragment_xmit(skb, head, header_length,
- len, offset);
+ len, offset, LOWPAN_DISPATCH_FRAGN);
+ if (err) {
+ pr_debug("%s unable to send a subsequent FRAGN packet "
+ "(tag: %d, offset: %d", __func__, tag, offset);
+ goto exit;
+ }
+
offset += len;
}

+exit:
return err;
}

--
1.7.7.6

0 comments on commit 5ccd377

Please sign in to comment.