net: dsa: rename dsa_master_get_slave
[linux-2.6-block.git] / net / dsa / tag_mtk.c
index ec8ee5f43255e7d95ace5b44f3c04860bd0b8507..8475434af7d5886fcec4219bfcc4d0339127ce59 100644 (file)
@@ -23,7 +23,7 @@
 static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
                                    struct net_device *dev)
 {
-       struct dsa_slave_priv *p = netdev_priv(dev);
+       struct dsa_port *dp = dsa_slave_to_port(dev);
        u8 *mtk_tag;
 
        if (skb_cow_head(skb, MTK_HDR_LEN) < 0)
@@ -36,7 +36,7 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
        /* Build the tag after the MAC Source Address */
        mtk_tag = skb->data + 2 * ETH_ALEN;
        mtk_tag[0] = 0;
-       mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
+       mtk_tag[1] = (1 << dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
        mtk_tag[2] = 0;
        mtk_tag[3] = 0;
 
@@ -46,8 +46,6 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
 static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
                                   struct packet_type *pt)
 {
-       struct dsa_switch_tree *dst = dev->dsa_ptr;
-       struct dsa_switch *ds;
        int port;
        __be16 *phdr, hdr;
 
@@ -68,20 +66,12 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
                skb->data - ETH_HLEN - MTK_HDR_LEN,
                2 * ETH_ALEN);
 
-       /* This protocol doesn't support cascading multiple
-        * switches so it's safe to assume the switch is first
-        * in the tree.
-        */
-       ds = dst->ds[0];
-       if (!ds)
-               return NULL;
-
        /* Get source port information */
        port = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);
-       if (!ds->ports[port].netdev)
-               return NULL;
 
-       skb->dev = ds->ports[port].netdev;
+       skb->dev = dsa_master_find_slave(dev, 0, port);
+       if (!skb->dev)
+               return NULL;
 
        return skb;
 }