-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These patches represent what is currently in either mainline or net-next. The patches that were in here before were an earlier version of an out-of-tree patch set which has since been merged into net-next. Signed-off-by: Alan Ott <alan@signal11.us>
- Loading branch information
Showing
30 changed files
with
769 additions
and
1,778 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
patches/6lowpan/0001-6lowpan-Refactor-packet-delivery-into-a-function.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
From 4a9aea3cc5119ec41919950f26a8018cdd8e42a8 Mon Sep 17 00:00:00 2001 | ||
From: Alan Ott <alan@signal11.us> | ||
Date: Wed, 16 Jan 2013 19:09:47 +0000 | ||
Subject: [PATCH 01/23] 6lowpan: Refactor packet delivery into a function | ||
|
||
Refactor the handing of the skb's to the individual lowpan devices into a | ||
function. | ||
|
||
Signed-off-by: Alan Ott <alan@signal11.us> | ||
Signed-off-by: David S. Miller <davem@davemloft.net> | ||
--- | ||
net/ieee802154/6lowpan.c | 38 ++++++++++++++++++++++++-------------- | ||
1 file changed, 24 insertions(+), 14 deletions(-) | ||
|
||
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c | ||
index 76c3d0a..9d39f5b 100644 | ||
--- a/net/ieee802154/6lowpan.c | ||
+++ b/net/ieee802154/6lowpan.c | ||
@@ -594,10 +594,32 @@ static int lowpan_header_create(struct sk_buff *skb, | ||
} | ||
} | ||
|
||
+static int lowpan_give_skb_to_devices(struct sk_buff *skb) | ||
+{ | ||
+ struct lowpan_dev_record *entry; | ||
+ struct sk_buff *skb_cp; | ||
+ int stat = NET_RX_SUCCESS; | ||
+ | ||
+ rcu_read_lock(); | ||
+ list_for_each_entry_rcu(entry, &lowpan_devices, list) | ||
+ if (lowpan_dev_info(entry->ldev)->real_dev == skb->dev) { | ||
+ skb_cp = skb_copy(skb, GFP_ATOMIC); | ||
+ if (!skb_cp) { | ||
+ stat = -ENOMEM; | ||
+ break; | ||
+ } | ||
+ | ||
+ skb_cp->dev = entry->ldev; | ||
+ stat = netif_rx(skb_cp); | ||
+ } | ||
+ rcu_read_unlock(); | ||
+ | ||
+ return stat; | ||
+} | ||
+ | ||
static int lowpan_skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr) | ||
{ | ||
struct sk_buff *new; | ||
- struct lowpan_dev_record *entry; | ||
int stat = NET_RX_SUCCESS; | ||
|
||
new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb), | ||
@@ -614,19 +636,7 @@ static int lowpan_skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr) | ||
new->protocol = htons(ETH_P_IPV6); | ||
new->pkt_type = PACKET_HOST; | ||
|
||
- rcu_read_lock(); | ||
- list_for_each_entry_rcu(entry, &lowpan_devices, list) | ||
- if (lowpan_dev_info(entry->ldev)->real_dev == new->dev) { | ||
- skb = skb_copy(new, GFP_ATOMIC); | ||
- if (!skb) { | ||
- stat = -ENOMEM; | ||
- break; | ||
- } | ||
- | ||
- skb->dev = entry->ldev; | ||
- stat = netif_rx(skb); | ||
- } | ||
- rcu_read_unlock(); | ||
+ stat = lowpan_give_skb_to_devices(new); | ||
|
||
kfree_skb(new); | ||
|
||
-- | ||
1.7.11.2 | ||
|
44 changes: 0 additions & 44 deletions
44
patches/6lowpan/0001-6lowpan-lowpan_is_iid_16_bit_compressable-does-not-d.patch
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
patches/6lowpan/0002-6lowpan-Handle-uncompressed-IPv6-packets-over-6LoWPA.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
From 2bc89808f8a361b18ba8b6af39a34b8c9329ee58 Mon Sep 17 00:00:00 2001 | ||
From: Alan Ott <alan@signal11.us> | ||
Date: Wed, 16 Jan 2013 19:09:48 +0000 | ||
Subject: [PATCH 02/23] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN | ||
|
||
Handle the reception of uncompressed packets (dispatch type = IPv6). | ||
|
||
Signed-off-by: Alan Ott <alan@signal11.us> | ||
Signed-off-by: David S. Miller <davem@davemloft.net> | ||
--- | ||
net/ieee802154/6lowpan.c | 41 ++++++++++++++++++++++++++++++++--------- | ||
1 file changed, 32 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c | ||
index 9d39f5b..f62c3b9 100644 | ||
--- a/net/ieee802154/6lowpan.c | ||
+++ b/net/ieee802154/6lowpan.c | ||
@@ -1147,19 +1147,42 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev, | ||
goto drop; | ||
|
||
/* check that it's our buffer */ | ||
- switch (skb->data[0] & 0xe0) { | ||
- case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */ | ||
- case LOWPAN_DISPATCH_FRAG1: /* first fragment header */ | ||
- case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */ | ||
- local_skb = skb_clone(skb, GFP_ATOMIC); | ||
+ if (skb->data[0] == LOWPAN_DISPATCH_IPV6) { | ||
+ /* Copy the packet so that the IPv6 header is | ||
+ * properly aligned. | ||
+ */ | ||
+ local_skb = skb_copy_expand(skb, NET_SKB_PAD - 1, | ||
+ skb_tailroom(skb), GFP_ATOMIC); | ||
if (!local_skb) | ||
goto drop; | ||
- lowpan_process_data(local_skb); | ||
|
||
+ local_skb->protocol = htons(ETH_P_IPV6); | ||
+ local_skb->pkt_type = PACKET_HOST; | ||
+ | ||
+ /* Pull off the 1-byte of 6lowpan header. */ | ||
+ skb_pull(local_skb, 1); | ||
+ skb_reset_network_header(local_skb); | ||
+ skb_set_transport_header(local_skb, sizeof(struct ipv6hdr)); | ||
+ | ||
+ lowpan_give_skb_to_devices(local_skb); | ||
+ | ||
+ kfree_skb(local_skb); | ||
kfree_skb(skb); | ||
- break; | ||
- default: | ||
- break; | ||
+ } else { | ||
+ switch (skb->data[0] & 0xe0) { | ||
+ case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */ | ||
+ case LOWPAN_DISPATCH_FRAG1: /* first fragment header */ | ||
+ case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */ | ||
+ local_skb = skb_clone(skb, GFP_ATOMIC); | ||
+ if (!local_skb) | ||
+ goto drop; | ||
+ lowpan_process_data(local_skb); | ||
+ | ||
+ kfree_skb(skb); | ||
+ break; | ||
+ default: | ||
+ break; | ||
+ } | ||
} | ||
|
||
return NET_RX_SUCCESS; | ||
-- | ||
1.7.11.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From fe9e84e1e8df473ab088b96b7e677c33b2378a66 Mon Sep 17 00:00:00 2001 | ||
From: Alexander Aring <alex.aring@gmail.com> | ||
Date: Tue, 5 Feb 2013 04:25:35 +0000 | ||
Subject: [PATCH 03/23] wpan: whitespace fix | ||
|
||
Signed-off-by: Alexander Aring <alex.aring@gmail.com> | ||
Signed-off-by: David S. Miller <davem@davemloft.net> | ||
--- | ||
net/mac802154/wpan.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c | ||
index 199b922..98c867b 100644 | ||
--- a/net/mac802154/wpan.c | ||
+++ b/net/mac802154/wpan.c | ||
@@ -41,7 +41,7 @@ static inline int mac802154_fetch_skb_u8(struct sk_buff *skb, u8 *val) | ||
return -EINVAL; | ||
|
||
*val = skb->data[0]; | ||
- skb_pull(skb, 1); | ||
+ skb_pull(skb, 1); | ||
|
||
return 0; | ||
} | ||
-- | ||
1.7.11.2 | ||
|
54 changes: 54 additions & 0 deletions
54
patches/6lowpan/0004-6lowpan-use-stack-buffer-instead-of-heap.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From c8631eae148d21d14d48bcfe22e97df172e949eb Mon Sep 17 00:00:00 2001 | ||
From: Alexander Aring <alex.aring@gmail.com> | ||
Date: Tue, 5 Feb 2013 10:23:43 +0000 | ||
Subject: [PATCH 04/23] 6lowpan: use stack buffer instead of heap | ||
|
||
head buffer is only temporary available in lowpan_header_create. | ||
So it's not necessary to put it on the heap. | ||
|
||
Also fixed a comment codestyle issue. | ||
|
||
Signed-off-by: Alexander Aring <alex.aring@gmail.com> | ||
Signed-off-by: David S. Miller <davem@davemloft.net> | ||
--- | ||
net/ieee802154/6lowpan.c | 13 ++++--------- | ||
1 file changed, 4 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c | ||
index f62c3b9..43b95ca 100644 | ||
--- a/net/ieee802154/6lowpan.c | ||
+++ b/net/ieee802154/6lowpan.c | ||
@@ -377,17 +377,14 @@ static int lowpan_header_create(struct sk_buff *skb, | ||
struct ipv6hdr *hdr; | ||
const u8 *saddr = _saddr; | ||
const u8 *daddr = _daddr; | ||
- u8 *head; | ||
+ u8 head[100]; | ||
struct ieee802154_addr sa, da; | ||
|
||
+ /* TODO: | ||
+ * if this package isn't ipv6 one, where should it be routed? | ||
+ */ | ||
if (type != ETH_P_IPV6) | ||
return 0; | ||
- /* TODO: | ||
- * if this package isn't ipv6 one, where should it be routed? | ||
- */ | ||
- head = kzalloc(100, GFP_KERNEL); | ||
- if (head == NULL) | ||
- return -ENOMEM; | ||
|
||
hdr = ipv6_hdr(skb); | ||
hc06_ptr = head + 2; | ||
@@ -561,8 +558,6 @@ static int lowpan_header_create(struct sk_buff *skb, | ||
skb_pull(skb, sizeof(struct ipv6hdr)); | ||
memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head); | ||
|
||
- kfree(head); | ||
- | ||
lowpan_raw_dump_table(__func__, "raw skb data dump", skb->data, | ||
skb->len); | ||
|
||
-- | ||
1.7.11.2 | ||
|
47 changes: 47 additions & 0 deletions
47
patches/6lowpan/0005-wpan-use-stack-buffer-instead-of-heap.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From d9b5d6aa1370429ad0d40504155a670bad20b7ec Mon Sep 17 00:00:00 2001 | ||
From: Alexander Aring <alex.aring@gmail.com> | ||
Date: Tue, 5 Feb 2013 10:23:44 +0000 | ||
Subject: [PATCH 05/23] wpan: use stack buffer instead of heap | ||
|
||
head buffer is only temporary available in mac802154_header_create. | ||
So it's not necessary to put it on the heap. | ||
|
||
Signed-off-by: Alexander Aring <alex.aring@gmail.com> | ||
Signed-off-by: David S. Miller <davem@davemloft.net> | ||
--- | ||
net/mac802154/wpan.c | 7 +------ | ||
1 file changed, 1 insertion(+), 6 deletions(-) | ||
|
||
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c | ||
index 98c867b..d20c6d3 100644 | ||
--- a/net/mac802154/wpan.c | ||
+++ b/net/mac802154/wpan.c | ||
@@ -137,16 +137,12 @@ static int mac802154_header_create(struct sk_buff *skb, | ||
struct ieee802154_addr dev_addr; | ||
struct mac802154_sub_if_data *priv = netdev_priv(dev); | ||
int pos = 2; | ||
- u8 *head; | ||
+ u8 head[MAC802154_FRAME_HARD_HEADER_LEN]; | ||
u16 fc; | ||
|
||
if (!daddr) | ||
return -EINVAL; | ||
|
||
- head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); | ||
- if (head == NULL) | ||
- return -ENOMEM; | ||
- | ||
head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */ | ||
fc = mac_cb_type(skb); | ||
|
||
@@ -210,7 +206,6 @@ static int mac802154_header_create(struct sk_buff *skb, | ||
head[1] = fc >> 8; | ||
|
||
memcpy(skb_push(skb, pos), head, pos); | ||
- kfree(head); | ||
|
||
return pos; | ||
} | ||
-- | ||
1.7.11.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From 804dd2956a4ded9fc9486c3445e991646f61eada Mon Sep 17 00:00:00 2001 | ||
From: Alan Ott <alan@signal11.us> | ||
Date: Mon, 18 Mar 2013 00:39:48 -0400 | ||
Subject: [PATCH 06/23] mrf24j40: pinctrl support | ||
|
||
Activate pinctrl settings when used with a DT system. | ||
|
||
Signed-off-by: Alan Ott <alan@signal11.us> | ||
--- | ||
drivers/net/ieee802154/mrf24j40.c | 7 +++++++ | ||
1 file changed, 7 insertions(+) | ||
|
||
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c | ||
index 3f2c7aa..3106895 100644 | ||
--- a/drivers/net/ieee802154/mrf24j40.c | ||
+++ b/drivers/net/ieee802154/mrf24j40.c | ||
@@ -22,6 +22,7 @@ | ||
#include <linux/spi/spi.h> | ||
#include <linux/interrupt.h> | ||
#include <linux/module.h> | ||
+#include <linux/pinctrl/consumer.h> | ||
#include <net/wpan-phy.h> | ||
#include <net/mac802154.h> | ||
|
||
@@ -623,6 +624,7 @@ static int mrf24j40_probe(struct spi_device *spi) | ||
int ret = -ENOMEM; | ||
u8 val; | ||
struct mrf24j40 *devrec; | ||
+ struct pinctrl *pinctrl; | ||
|
||
printk(KERN_INFO "mrf24j40: probe(). IRQ: %d\n", spi->irq); | ||
|
||
@@ -633,6 +635,11 @@ static int mrf24j40_probe(struct spi_device *spi) | ||
if (!devrec->buf) | ||
goto err_buf; | ||
|
||
+ pinctrl = devm_pinctrl_get_select_default(&spi->dev); | ||
+ if (IS_ERR(pinctrl)) | ||
+ dev_warn(&spi->dev, | ||
+ "pinctrl pins are not configured from the driver"); | ||
+ | ||
spi->mode = SPI_MODE_0; /* TODO: Is this appropriate for right here? */ | ||
if (spi->max_speed_hz > MAX_SPI_SPEED_HZ) | ||
spi->max_speed_hz = MAX_SPI_SPEED_HZ; | ||
-- | ||
1.7.11.2 | ||
|
Oops, something went wrong.