Skip to contentSkip to conversation

trivial changes

PATCH Superseded Alexander Aring 9 participants 14 messages Oct 24, 2013 – Oct 26, 2013 3 messages not in the archive

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover trivial changes

This patch series includes some trivial changes to prepare the 6lowpan stack for upcomming patch-series which mainly fix fragmentation according to rfc4944 and udp handling(which is currently broken).

Alexander Aring (5):
6lowpan: remove unnecessary ret variable 6lowpan: remove unnecessary check on err >= 0 6lowpan: use netdev_alloc_skb instead dev_alloc_skb 6lowpan: remove skb->dev assignment 6lowpan: remove unecessary break

 net/ieee802154/6lowpan.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
Signature · 9 lines
1.8.4.1


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk

A message that is not in the archive (sent off-list or not yet received): 1382647904-11311-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/5 6lowpan: remove unnecessary ret variable

---
 net/ieee802154/6lowpan.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/ieee802154/6lowpan.c +2 -4
index ff41b4d..d288035 100644
@@ -1120,7 +1120,7 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
 			int mlen, int plen, int offset, int type)
 {
 	struct sk_buff *frag;
-	int hlen, ret;
+	int hlen;
 
 	hlen = (type == LOWPAN_DISPATCH_FRAG1) ?
 			LOWPAN_FRAG1_HEAD_SIZE : LOWPAN_FRAGN_HEAD_SIZE;
@@ -1145,9 +1145,7 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
 	lowpan_raw_dump_table(__func__, " raw fragment dump", frag->data,
 								frag->len);
 
-	ret = dev_queue_xmit(frag);
-
-	return ret;
+	return dev_queue_xmit(frag);
 }
 
 static int
Signature · 9 lines
1.8.4.1


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
#3 lore raw

PATCH 3/5 6lowpan: use netdev_alloc_skb instead dev_alloc_skb

In reply to a message not in the archive

This patch uses the netdev_alloc_skb instead dev_alloc_skb function and drops the seperate assignment to skb->dev.

---
 net/ieee802154/6lowpan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/ieee802154/6lowpan.c +2 -2
index 9057f83..7510278 100644
@@ -1127,12 +1127,12 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
 
 	lowpan_raw_dump_inline(__func__, "6lowpan fragment header", head, hlen);
 
-	frag = dev_alloc_skb(hlen + mlen + plen + IEEE802154_MFR_SIZE);
+	frag = netdev_alloc_skb(skb->dev, hlen + mlen +
+			plen + IEEE802154_MFR_SIZE);
 	if (!frag)
 		return -ENOMEM;
 
 	frag->priority = skb->priority;
-	frag->dev = skb->dev;
 
 	/* copy header, MFR and payload */
 	memcpy(skb_put(frag, mlen), skb->data, mlen);
Signature · 9 lines
1.8.4.1


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
maintainer
#4 lore raw

Re: [PATCH net-next 3/5] 6lowpan: use netdev_alloc_skb instead dev_alloc_skb

From: Alexander Aring <[email protected]>
Date: Thu, 24 Oct 2013 22:51:42 +0200

net/ieee802154/6lowpan.c lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, · line 1131

Quoted 7 lines
net/ieee802154/6lowpan.c +2 -1
@@ -1127,12 +1127,12 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
 
 	lowpan_raw_dump_inline(__func__, "6lowpan fragment header", head, hlen);
 
-	frag = dev_alloc_skb(hlen + mlen + plen + IEEE802154_MFR_SIZE);
+	frag = netdev_alloc_skb(skb->dev, hlen + mlen +
+			plen + IEEE802154_MFR_SIZE);

Please indent this properly.

It should be something like:

	frag = netdev_alloc_skb(skb->dev, hlen + mlen +
					  plen + IEEE802154_MFR_SIZE);

A message that is not in the archive (sent off-list or not yet received): 20131026.014214.1636999222808937267.davem-fT/PcQaiUtIeIZ0/[email protected]

#6 lore raw

Re: [PATCH net-next 3/5] 6lowpan: use netdev_alloc_skb instead dev_alloc_skb

Quoted 13 lines · David Miller

From: Alexander Aring <[email protected]>
Date: Thu, 24 Oct 2013 22:51:42 +0200

net/ieee802154/6lowpan.c lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, · line 1131

Quoted 7 lines
net/ieee802154/6lowpan.c +2 -1
@@ -1127,12 +1127,12 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
 
 	lowpan_raw_dump_inline(__func__, "6lowpan fragment header", head, hlen);
 
-	frag = dev_alloc_skb(hlen + mlen + plen + IEEE802154_MFR_SIZE);
+	frag = netdev_alloc_skb(skb->dev, hlen + mlen +
+			plen + IEEE802154_MFR_SIZE);

Please indent this properly.

Quoted 4 lines

It should be something like:

	frag = netdev_alloc_skb(skb->dev, hlen + mlen +
					  plen + IEEE802154_MFR_SIZE);

Maybe better as:

	frag = netdev_alloc_skb(skb->dev,
				hlen + mlen + plen + IEEE802154_MFR_SIZE);

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk

#7 lore raw

Re: [PATCH net-next 3/5] 6lowpan: use netdev_alloc_skb instead dev_alloc_skb

From: Joe Perches <[email protected]>
Date: Fri, 25 Oct 2013 23:01:44 -0700

Quoted 16 lines · David Miller
Quoted 15 lines

From: Alexander Aring <[email protected]>
Date: Thu, 24 Oct 2013 22:51:42 +0200

net/ieee802154/6lowpan.c lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, · line 1131

Quoted 7 lines
net/ieee802154/6lowpan.c +2 -1
@@ -1127,12 +1127,12 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
 
 	lowpan_raw_dump_inline(__func__, "6lowpan fragment header", head, hlen);
 
-	frag = dev_alloc_skb(hlen + mlen + plen + IEEE802154_MFR_SIZE);
+	frag = netdev_alloc_skb(skb->dev, hlen + mlen +
+			plen + IEEE802154_MFR_SIZE);

Please indent this properly.

It should be something like:

Quoted 7 lines
Quoted 2 lines
	frag = netdev_alloc_skb(skb->dev, hlen + mlen +
					  plen + IEEE802154_MFR_SIZE);

Maybe better as:

	frag = netdev_alloc_skb(skb->dev,
				hlen + mlen + plen + IEEE802154_MFR_SIZE);

Either is fine with me.

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk

#8 lore raw

PATCH 4/5 6lowpan: remove skb->dev assignment

In reply to a message not in the archive

This patch removes the assignment of skb->dev. We don't need it here because we use the netdev_alloc_skb_ip_align function which already sets the skb->dev.

---
 net/ieee802154/6lowpan.c | 1 -
 1 file changed, 1 deletion(-)
net/ieee802154/6lowpan.c +0 -1
index 7510278..e15b101 100644
@@ -785,7 +785,6 @@ lowpan_alloc_new_frame(struct sk_buff *skb, u16 len, u16 tag)
 		goto skb_err;
 
 	frame->skb->priority = skb->priority;
-	frame->skb->dev = skb->dev;
 
 	/* reserve headroom for uncompressed ipv6 header */
 	skb_reserve(frame->skb, sizeof(struct ipv6hdr));
Signature · 9 lines
1.8.4.1


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
#9 lore raw

PATCH 5/5 6lowpan: remove unecessary break

In reply to a message not in the archive
---
 net/ieee802154/6lowpan.c | 1 -
 1 file changed, 1 deletion(-)
net/ieee802154/6lowpan.c +0 -1
index e15b101..09350f1 100644
@@ -440,7 +440,6 @@ lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
 		default:
 			pr_debug("ERROR: unknown UDP format\n");
 			goto err;
-			break;
 		}
 
 		pr_debug("uncompressed UDP ports: src = %d, dst = %d\n",
Signature · 9 lines
1.8.4.1


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
#10 lore raw

Re: [PATCH net-next 5/5] 6lowpan: remove unecessary break

Quoted 14 lines

25 окт. 2013 г., в 0:51, Alexander Aring <[email protected]> написал(а):

---
net/ieee802154/6lowpan.c | 1 -

1 file changed, 1 deletion(-)
net/ieee802154/6lowpan.c +0 -0
index e15b101..09350f1 100644

net/ieee802154/6lowpan.c lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh) · line 444

Quoted 6 lines
net/ieee802154/6lowpan.c +0 -1
@@ -440,7 +440,6 @@ lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
       default:
           pr_debug("ERROR: unknown UDP format\n");
           goto err;
-            break;
       }
 

It's not an unnecessary, it's let say a "good coding practice" to have a break for every case including default.

Quoted 4 lines
net/ieee802154/6lowpan.c +0 -0
       pr_debug("uncompressed UDP ports: src = %d, dst = %d\n",
Signature · 1 line
1.8.4.1
#11 lore raw

Re: [PATCH net-next 5/5] 6lowpan: remove unecessary break

Quoted 1 line · Alexander Smirnov
Quoted 1 line

25 окт. 2013 г., в 0:51, Alexander Aring <[email protected]> написал(а):

[]

Quoted 1 line

net/ieee802154/6lowpan.c

Quoted 1 line
net/ieee802154/6lowpan.c +0 -0

[]

Quoted 9 lines

net/ieee802154/6lowpan.c lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh) · line 444

Quoted 7 lines
net/ieee802154/6lowpan.c +0 -1
@@ -440,7 +440,6 @@ lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
       default:
           pr_debug("ERROR: unknown UDP format\n");
           goto err;
-            break;
       }
 

It's not an unnecessary, it's let say a "good coding practice" to have a break for every case including default.

Hello Alexanders:

Some would otherwise say it's a poor practice.

maintainer
#12 lore raw

Re: [PATCH net-next 5/5] 6lowpan: remove unecessary break

From: Joe Perches <[email protected]>
Date: Thu, 24 Oct 2013 20:40:51 -0700

Quoted 15 lines · Alexander Smirnov
Quoted 1 line
Quoted 1 line

25 окт. 2013 г., в 0:51, Alexander Aring <[email protected]> написал(а):

[]

Quoted 1 line

net/ieee802154/6lowpan.c

Quoted 1 line
net/ieee802154/6lowpan.c +0 -0

[]

Quoted 9 lines

net/ieee802154/6lowpan.c lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh) · line 444

Quoted 7 lines
net/ieee802154/6lowpan.c +0 -1
@@ -440,7 +440,6 @@ lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
       default:
           pr_debug("ERROR: unknown UDP format\n");
           goto err;
-            break;
       }
 

It's not an unnecessary, it's let say a "good coding practice" to have a break for every case including default.

Quoted 3 lines

Hello Alexanders:

Some would otherwise say it's a poor practice.

I think with a goto there at the end of the case statement, it's redundant and stupid, and thus should be removed.

#13 lore raw

Re: [PATCH net-next 5/5] 6lowpan: remove unecessary break

In reply to Alexander Smirnov

Hello.

Quoted 6 lines · Alexander Smirnov
Quoted 5 lines

---
net/ieee802154/6lowpan.c | 1 -

1 file changed, 1 deletion(-)
Quoted 12 lines

net/ieee802154/6lowpan.c lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh) · line 443

Quoted 10 lines
net/ieee802154/6lowpan.c +0 -1
index e15b101..09350f1 100644
@@ -440,7 +440,6 @@ lowpan_uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
        default:
            pr_debug("ERROR: unknown UDP format\n");
            goto err;
-            break;
        }

It's not an unnecessary, it's let say a "good coding practice" to have a break for every case including default.

Even after *goto*? :-)

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): 526A6CB2.1040007-M4DtvfQ/[email protected]

#15 lore raw

Re: [PATCH net-next 5/5] 6lowpan: remove unecessary break

Quoted 15 lines

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c

Quoted 12 lines

net/ieee802154/6lowpan.c lowpan_uncompress_udp_header(**struct sk_buff *skb, · line 445

Quoted 11 lines

index e15b101..09350f1 100644

net/ieee802154/6lowpan.c +0 -1
@@ -440,7 +440,6 @@ lowpan_uncompress_udp_header(**struct sk_buff *skb,
 struct udphdr *uh)
        default:
            pr_debug("ERROR: unknown UDP format\n");
            goto err;
-            break;
        }
 
Quoted 8 lines

It's not an unnecessary, it's let say a "good coding practice" to have a

Quoted 2 lines

break for every case including default.

   Even after *goto*? :-)

WBR, Sergei

that's my fault, I missed goto here. I already declined my proposal, it's silly.

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk

_______________________________________________
Linux-zigbee-devel mailing list Linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

maintainer
#16 lore raw

PATCH 2/5 6lowpan: remove unnecessary check on err >= 0

In reply to Alexander Aring

The err variable can only be zero in this case.

---
 net/ieee802154/6lowpan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ieee802154/6lowpan.c +1 -1
index d288035..9057f83 100644
@@ -1179,7 +1179,7 @@ lowpan_skb_fragmentation(struct sk_buff *skb, struct net_device *dev)
 	head[0] &= ~LOWPAN_DISPATCH_FRAG1;
 	head[0] |= LOWPAN_DISPATCH_FRAGN;
 
-	while ((payload_length - offset > 0) && (err >= 0)) {
+	while (payload_length - offset > 0) {
 		int len = LOWPAN_FRAG_SIZE;
 
 		head[4] = offset / 8;
Signature · 1 line
1.8.4.1