mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
net: dsa: Add a ports structure and use it in the switch structure
There are going to be more per-port members added to the switch structure. So add a port structure and move the netdev into it. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
149cafd790
commit
c8b098086b
9 changed files with 38 additions and 29 deletions
|
|
@ -437,10 +437,10 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
|
|||
if (!(ds->enabled_port_mask & (1 << port)))
|
||||
continue;
|
||||
|
||||
if (!ds->ports[port])
|
||||
if (!ds->ports[port].netdev)
|
||||
continue;
|
||||
|
||||
dsa_slave_destroy(ds->ports[port]);
|
||||
dsa_slave_destroy(ds->ports[port].netdev);
|
||||
}
|
||||
|
||||
/* Remove any fixed link PHYs */
|
||||
|
|
@ -469,7 +469,7 @@ static int dsa_switch_suspend(struct dsa_switch *ds)
|
|||
if (!dsa_is_port_initialized(ds, i))
|
||||
continue;
|
||||
|
||||
ret = dsa_slave_suspend(ds->ports[i]);
|
||||
ret = dsa_slave_suspend(ds->ports[i].netdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -495,7 +495,7 @@ static int dsa_switch_resume(struct dsa_switch *ds)
|
|||
if (!dsa_is_port_initialized(ds, i))
|
||||
continue;
|
||||
|
||||
ret = dsa_slave_resume(ds->ports[i]);
|
||||
ret = dsa_slave_resume(ds->ports[i].netdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1183,12 +1183,12 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
|
|||
p->old_link = -1;
|
||||
p->old_duplex = -1;
|
||||
|
||||
ds->ports[port] = slave_dev;
|
||||
ds->ports[port].netdev = slave_dev;
|
||||
ret = register_netdev(slave_dev);
|
||||
if (ret) {
|
||||
netdev_err(master, "error %d registering interface %s\n",
|
||||
ret, slave_dev->name);
|
||||
ds->ports[port] = NULL;
|
||||
ds->ports[port].netdev = NULL;
|
||||
free_netdev(slave_dev);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ static int brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
source_port = brcm_tag[3] & BRCM_EG_PID_MASK;
|
||||
|
||||
/* Validate port against switch setup, either the port is totally */
|
||||
if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
|
||||
if (source_port >= DSA_MAX_PORTS || !ds->ports[source_port].netdev)
|
||||
goto out_drop;
|
||||
|
||||
/* Remove Broadcom tag and update checksum */
|
||||
|
|
@ -140,7 +140,7 @@ static int brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
|
||||
skb_push(skb, ETH_HLEN);
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
skb->dev = ds->ports[source_port];
|
||||
skb->dev = ds->ports[source_port].netdev;
|
||||
skb->protocol = eth_type_trans(skb, skb->dev);
|
||||
|
||||
skb->dev->stats.rx_packets++;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ static int dsa_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
if (!ds)
|
||||
goto out_drop;
|
||||
|
||||
if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
|
||||
if (source_port >= DSA_MAX_PORTS || !ds->ports[source_port].netdev)
|
||||
goto out_drop;
|
||||
|
||||
/*
|
||||
|
|
@ -163,7 +163,7 @@ static int dsa_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
2 * ETH_ALEN);
|
||||
}
|
||||
|
||||
skb->dev = ds->ports[source_port];
|
||||
skb->dev = ds->ports[source_port].netdev;
|
||||
skb_push(skb, ETH_HLEN);
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
skb->protocol = eth_type_trans(skb, skb->dev);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ static int edsa_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
if (!ds)
|
||||
goto out_drop;
|
||||
|
||||
if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
|
||||
if (source_port >= DSA_MAX_PORTS || !ds->ports[source_port].netdev)
|
||||
goto out_drop;
|
||||
|
||||
/*
|
||||
|
|
@ -182,7 +182,7 @@ static int edsa_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
2 * ETH_ALEN);
|
||||
}
|
||||
|
||||
skb->dev = ds->ports[source_port];
|
||||
skb->dev = ds->ports[source_port].netdev;
|
||||
skb_push(skb, ETH_HLEN);
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
skb->protocol = eth_type_trans(skb, skb->dev);
|
||||
|
|
|
|||
|
|
@ -82,12 +82,12 @@ static int trailer_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
goto out_drop;
|
||||
|
||||
source_port = trailer[1] & 7;
|
||||
if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
|
||||
if (source_port >= DSA_MAX_PORTS || !ds->ports[source_port].netdev)
|
||||
goto out_drop;
|
||||
|
||||
pskb_trim_rcsum(skb, skb->len - 4);
|
||||
|
||||
skb->dev = ds->ports[source_port];
|
||||
skb->dev = ds->ports[source_port].netdev;
|
||||
skb_push(skb, ETH_HLEN);
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
skb->protocol = eth_type_trans(skb, skb->dev);
|
||||
|
|
|
|||
Loading…
Reference in a new issue