mac802154: rx: move skb->protocol setting
authorAlexander Aring <alex.aring@gmail.com>
Mon, 27 Oct 2014 16:13:35 +0000 (17:13 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 27 Oct 2014 17:07:43 +0000 (18:07 +0100)
This patch moves the skb->protocol setting to the position when it's
needed. It's only needed when frame parsing was successful.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/mac802154/rx.c

index 246a60e8f76a3db9a311529d32130e9f3bdea8c5..c4066b5006f16866f84a01e5569dd03afc7cb041 100644 (file)
@@ -31,6 +31,8 @@
 
 static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
 {
+       skb->protocol = htons(ETH_P_IEEE802154);
+
        return netif_receive_skb(skb);
 }
 
@@ -224,6 +226,8 @@ mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
        u16 crc = crc_ccitt(0, skb->data, skb->len);
        u8 *data;
 
+       skb->protocol = htons(ETH_P_IEEE802154);
+
        rcu_read_lock();
        list_for_each_entry_rcu(sdata, &local->interfaces, list) {
                if (sdata->type != IEEE802154_DEV_MONITOR ||
@@ -248,7 +252,6 @@ void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb)
 
        WARN_ON_ONCE(softirq_count() == 0);
 
-       skb->protocol = htons(ETH_P_IEEE802154);
        skb_reset_mac_header(skb);
 
        if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {