ieee802154: 6lowpan: change dev vars to wdev and ldev

Inside the IEEE 802.15.4 6LoWPAN subsystem we use two interfaces which
are wpan and lowpan interfaces. Instead of using always the variable
name "dev" for both we rename the "dev" variable to wdev which means the
wpan net_device and ldev which means a lowpan net_device. This avoids
confusing and always looking back to see which net_device is meant by
the variable name "dev".

Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Alexander Aring
2015-09-02 14:21:16 +02:00
committed by Marcel Holtmann
parent 517a5460a9
commit f4606583fd
5 changed files with 81 additions and 83 deletions

View File

@@ -16,9 +16,9 @@
#include "6lowpan_i.h"
static int lowpan_give_skb_to_device(struct sk_buff *skb,
struct net_device *dev)
struct net_device *wdev)
{
skb->dev = dev->ieee802154_ptr->lowpan_dev;
skb->dev = wdev->ieee802154_ptr->lowpan_dev;
skb->protocol = htons(ETH_P_IPV6);
skb->pkt_type = PACKET_HOST;
@@ -61,21 +61,21 @@ iphc_decompress(struct sk_buff *skb, const struct ieee802154_hdr *hdr)
IEEE802154_ADDR_LEN, iphc0, iphc1);
}
static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
static int lowpan_rcv(struct sk_buff *skb, struct net_device *wdev,
struct packet_type *pt, struct net_device *orig_wdev)
{
struct ieee802154_hdr hdr;
int ret;
if (dev->type != ARPHRD_IEEE802154 ||
!dev->ieee802154_ptr->lowpan_dev)
if (wdev->type != ARPHRD_IEEE802154 ||
!wdev->ieee802154_ptr->lowpan_dev)
goto drop;
skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb)
goto drop;
if (!netif_running(dev))
if (!netif_running(wdev))
goto drop_skb;
if (skb->pkt_type == PACKET_OTHERHOST)
@@ -88,7 +88,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
if (skb->data[0] == LOWPAN_DISPATCH_IPV6) {
/* Pull off the 1-byte of 6lowpan header. */
skb_pull(skb, 1);
return lowpan_give_skb_to_device(skb, dev);
return lowpan_give_skb_to_device(skb, wdev);
} else {
switch (skb->data[0] & 0xe0) {
case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */
@@ -96,7 +96,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
if (ret < 0)
goto drop_skb;
return lowpan_give_skb_to_device(skb, dev);
return lowpan_give_skb_to_device(skb, wdev);
case LOWPAN_DISPATCH_FRAG1: /* first fragment header */
ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAG1);
if (ret == 1) {
@@ -104,7 +104,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
if (ret < 0)
goto drop_skb;
return lowpan_give_skb_to_device(skb, dev);
return lowpan_give_skb_to_device(skb, wdev);
} else if (ret == -1) {
return NET_RX_DROP;
} else {
@@ -117,7 +117,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
if (ret < 0)
goto drop_skb;
return lowpan_give_skb_to_device(skb, dev);
return lowpan_give_skb_to_device(skb, wdev);
} else if (ret == -1) {
return NET_RX_DROP;
} else {