[PATCH bluetooth-next 6/7] ieee802154: 6lowpan: cleanup frag dispatch cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is a cleanup because case for LOWPAN_DISPATCH_FRAG1 and
LOWPAN_DISPATCH_FRAGN looks almost the same except the dispatch value
which is stored in a variables before now.

Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
---
 net/ieee802154/6lowpan/rx.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/net/ieee802154/6lowpan/rx.c b/net/ieee802154/6lowpan/rx.c
index 158756f..fc7228c 100644
--- a/net/ieee802154/6lowpan/rx.c
+++ b/net/ieee802154/6lowpan/rx.c
@@ -109,7 +109,9 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 
 		return lowpan_give_skb_to_devices(skb, NULL);
 	} else {
-		switch (*skb_network_header(skb) & 0xe0) {
+		u8 dispatch = *skb_network_header(skb) & 0xe0;
+
+		switch (dispatch) {
 		case LOWPAN_DISPATCH_IPHC:	/* ipv6 datagram */
 			if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
 				goto drop_skb;
@@ -120,18 +122,8 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 
 			return lowpan_give_skb_to_devices(skb, NULL);
 		case LOWPAN_DISPATCH_FRAG1:	/* first fragment header */
-			ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1);
-			if (ret == 1) {
-				ipv6_hdr(skb)->payload_len = htons(skb->len -
-								   sizeof(struct ipv6hdr));
-				return lowpan_give_skb_to_devices(skb, NULL);
-			} else if (ret == -1) {
-				return NET_RX_DROP;
-			} else {
-				return NET_RX_SUCCESS;
-			}
 		case LOWPAN_DISPATCH_FRAGN:	/* next fragments headers */
-			ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN);
+			ret = lowpan_frag_rcv(skb, dispatch);
 			if (ret == 1) {
 				ipv6_hdr(skb)->payload_len = htons(skb->len -
 								   sizeof(struct ipv6hdr));
-- 
2.2.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux