]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/dsa/tag_brcm.c
Merge tag 'trace-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[karo-tx-linux.git] / net / dsa / tag_brcm.c
index 2a9b52c5af86b5308d7d71a3340a0e48768bdb60..c697d981517744fbc523d3bd0e3b8204a3a427f8 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/etherdevice.h>
 #include <linux/list.h>
 #include <linux/slab.h>
-#include <net/dsa.h>
+
 #include "dsa_priv.h"
 
 /* This tag length is 4 bytes, older ones were 6 bytes, we do not
@@ -65,7 +65,7 @@ static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev
        u8 *brcm_tag;
 
        if (skb_cow_head(skb, BRCM_TAG_LEN) < 0)
-               goto out_free;
+               return NULL;
 
        skb_push(skb, BRCM_TAG_LEN);
 
@@ -86,10 +86,6 @@ static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev
        brcm_tag[3] = (1 << p->dp->index) & BRCM_IG_DSTMAP1_MASK;
 
        return skb;
-
-out_free:
-       kfree_skb(skb);
-       return NULL;
 }
 
 static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
@@ -97,34 +93,33 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
                                    struct net_device *orig_dev)
 {
        struct dsa_switch_tree *dst = dev->dsa_ptr;
-       struct dsa_switch *ds;
+       struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
+       struct dsa_switch *ds = cpu_dp->ds;
        int source_port;
        u8 *brcm_tag;
 
-       ds = dst->cpu_switch;
-
        if (unlikely(!pskb_may_pull(skb, BRCM_TAG_LEN)))
-               goto out_drop;
+               return NULL;
 
        /* skb->data points to the EtherType, the tag is right before it */
        brcm_tag = skb->data - 2;
 
        /* The opcode should never be different than 0b000 */
        if (unlikely((brcm_tag[0] >> BRCM_OPCODE_SHIFT) & BRCM_OPCODE_MASK))
-               goto out_drop;
+               return NULL;
 
        /* We should never see a reserved reason code without knowing how to
         * handle it
         */
        if (unlikely(brcm_tag[2] & BRCM_EG_RC_RSVD))
-               goto out_drop;
+               return NULL;
 
        /* Locate which port this is coming from */
        source_port = brcm_tag[3] & BRCM_EG_PID_MASK;
 
        /* Validate port against switch setup, either the port is totally */
        if (source_port >= ds->num_ports || !ds->ports[source_port].netdev)
-               goto out_drop;
+               return NULL;
 
        /* Remove Broadcom tag and update checksum */
        skb_pull_rcsum(skb, BRCM_TAG_LEN);
@@ -137,9 +132,6 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
        skb->dev = ds->ports[source_port].netdev;
 
        return skb;
-
-out_drop:
-       return NULL;
 }
 
 const struct dsa_device_ops brcm_netdev_ops = {