* [PATCH 0/2] Handle Uncompressed IPv6 on 6LoWPAN
@ 2013-01-16 5:43 Alan Ott
2013-01-16 5:43 ` [PATCH 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Alan Ott @ 2013-01-16 5:43 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: linux-zigbee-devel, netdev, linux-kernel, Tony Cheneau,
Eric Dumazet, Alan Ott
This has been tested by exchanging data with with the Contiki operating
system using a Redwire Econotag. Contiki had to be set to send uncompressed
data, and had to have a #define modified to enable reception and processing
of header-compressed packets when not set to send compressed data.
Alan Ott (2):
6lowpan: Refactor packet delivery into a function
6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
net/ieee802154/6lowpan.c | 79 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 56 insertions(+), 23 deletions(-)
--
1.7.11.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] 6lowpan: Refactor packet delivery into a function
2013-01-16 5:43 [PATCH 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
@ 2013-01-16 5:43 ` Alan Ott
2013-01-16 5:43 ` [PATCH 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
2013-01-17 5:09 ` [PATCH v2 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
2 siblings, 0 replies; 10+ messages in thread
From: Alan Ott @ 2013-01-16 5:43 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: linux-zigbee-devel, netdev, linux-kernel, Tony Cheneau,
Eric Dumazet, Alan Ott
Refactor the handing of the skb's to the individual lowpan devices into a
function.
Signed-off-by: Alan Ott <alan@signal11.us>
---
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 f651da6..1714cfa 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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
2013-01-16 5:43 [PATCH 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
2013-01-16 5:43 ` [PATCH 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
@ 2013-01-16 5:43 ` Alan Ott
2013-01-16 21:22 ` David Miller
2013-01-17 5:09 ` [PATCH v2 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
2 siblings, 1 reply; 10+ messages in thread
From: Alan Ott @ 2013-01-16 5:43 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: linux-zigbee-devel, netdev, linux-kernel, Tony Cheneau,
Eric Dumazet, Alan Ott
Handle the reception of uncompressed packets (dispatch type = IPv6).
Signed-off-by: Alan Ott <alan@signal11.us>
---
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 1714cfa..43bd1c0 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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
2013-01-16 5:43 ` [PATCH 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
@ 2013-01-16 21:22 ` David Miller
2013-01-16 21:53 ` Alan Ott
0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2013-01-16 21:22 UTC (permalink / raw)
To: alan
Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
linux-kernel, tony.cheneau, eric.dumazet
From: Alan Ott <alan@signal11.us>
Date: Wed, 16 Jan 2013 00:43:57 -0500
> + local_skb = skb_copy_expand(skb, NET_SKB_PAD - 1,
> + skb_tailroom(skb), GFP_ATOMIC);
This is not indented properly.
When a function call spans multiple lines, the second and subsequent
lines should be indented to the column right after the openning
parenthesis of the call itself, using a combination of TAB and
SPC characters as needed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
2013-01-16 21:22 ` David Miller
@ 2013-01-16 21:53 ` Alan Ott
0 siblings, 0 replies; 10+ messages in thread
From: Alan Ott @ 2013-01-16 21:53 UTC (permalink / raw)
To: David Miller
Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
linux-kernel, tony.cheneau, eric.dumazet
On 01/16/2013 04:22 PM, David Miller wrote:
> From: Alan Ott <alan@signal11.us>
> Date: Wed, 16 Jan 2013 00:43:57 -0500
>
>> + local_skb = skb_copy_expand(skb, NET_SKB_PAD - 1,
>> + skb_tailroom(skb), GFP_ATOMIC);
> This is not indented properly.
>
> When a function call spans multiple lines, the second and subsequent
> lines should be indented to the column right after the openning
> parenthesis of the call itself, using a combination of TAB and
> SPC characters as needed.
Thanks David, I'll fix and re-submit.
Alan.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 0/2] Handle Uncompressed IPv6 on 6LoWPAN
2013-01-16 5:43 [PATCH 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
2013-01-16 5:43 ` [PATCH 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
2013-01-16 5:43 ` [PATCH 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
@ 2013-01-17 5:09 ` Alan Ott
2013-01-17 5:09 ` [PATCH v2 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
2013-01-17 5:09 ` [PATCH v2 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
2 siblings, 2 replies; 10+ messages in thread
From: Alan Ott @ 2013-01-17 5:09 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: linux-zigbee-devel, netdev, linux-kernel, Tony Cheneau,
Eric Dumazet, Alan Ott
This has been tested by exchanging data with with the Contiki operating
system using a Redwire Econotag. Contiki had to be set to send uncompressed
data, and had to have a #define modified to enable reception and processing
of header-compressed packets when not set to send compressed data.
Version 2 fixes a format issue pointed out by David Miller.
Alan Ott (2):
6lowpan: Refactor packet delivery into a function
6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
net/ieee802154/6lowpan.c | 79 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 56 insertions(+), 23 deletions(-)
--
1.7.11.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] 6lowpan: Refactor packet delivery into a function
2013-01-17 5:09 ` [PATCH v2 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
@ 2013-01-17 5:09 ` Alan Ott
2013-01-18 19:18 ` David Miller
2013-01-17 5:09 ` [PATCH v2 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
1 sibling, 1 reply; 10+ messages in thread
From: Alan Ott @ 2013-01-17 5:09 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: linux-zigbee-devel, netdev, linux-kernel, Tony Cheneau,
Eric Dumazet, Alan Ott
Refactor the handing of the skb's to the individual lowpan devices into a
function.
Signed-off-by: Alan Ott <alan@signal11.us>
---
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 f651da6..1714cfa 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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
2013-01-17 5:09 ` [PATCH v2 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
2013-01-17 5:09 ` [PATCH v2 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
@ 2013-01-17 5:09 ` Alan Ott
2013-01-18 19:18 ` David Miller
1 sibling, 1 reply; 10+ messages in thread
From: Alan Ott @ 2013-01-17 5:09 UTC (permalink / raw)
To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
Cc: linux-zigbee-devel, netdev, linux-kernel, Tony Cheneau,
Eric Dumazet, Alan Ott
Handle the reception of uncompressed packets (dispatch type = IPv6).
Signed-off-by: Alan Ott <alan@signal11.us>
---
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 1714cfa..09cba81 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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] 6lowpan: Refactor packet delivery into a function
2013-01-17 5:09 ` [PATCH v2 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
@ 2013-01-18 19:18 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2013-01-18 19:18 UTC (permalink / raw)
To: alan
Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
linux-kernel, tony.cheneau, eric.dumazet
From: Alan Ott <alan@signal11.us>
Date: Thu, 17 Jan 2013 00:09:47 -0500
> Refactor the handing of the skb's to the individual lowpan devices into a
> function.
>
> Signed-off-by: Alan Ott <alan@signal11.us>
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN
2013-01-17 5:09 ` [PATCH v2 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
@ 2013-01-18 19:18 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2013-01-18 19:18 UTC (permalink / raw)
To: alan
Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
linux-kernel, tony.cheneau, eric.dumazet
From: Alan Ott <alan@signal11.us>
Date: Thu, 17 Jan 2013 00:09:48 -0500
> Handle the reception of uncompressed packets (dispatch type = IPv6).
>
> Signed-off-by: Alan Ott <alan@signal11.us>
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-01-18 19:18 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-16 5:43 [PATCH 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
2013-01-16 5:43 ` [PATCH 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
2013-01-16 5:43 ` [PATCH 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
2013-01-16 21:22 ` David Miller
2013-01-16 21:53 ` Alan Ott
2013-01-17 5:09 ` [PATCH v2 0/2] Handle Uncompressed IPv6 on 6LoWPAN Alan Ott
2013-01-17 5:09 ` [PATCH v2 1/2] 6lowpan: Refactor packet delivery into a function Alan Ott
2013-01-18 19:18 ` David Miller
2013-01-17 5:09 ` [PATCH v2 2/2] 6lowpan: Handle uncompressed IPv6 packets over 6LoWPAN Alan Ott
2013-01-18 19:18 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).