|
@@ -66,7 +66,7 @@ static int dsa_slave_get_iflink(const struct net_device *dev)
|
|
|
{
|
|
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
|
|
|
- return p->dp->ds->dst->master_netdev->ifindex;
|
|
|
+ return dsa_master_netdev(p)->ifindex;
|
|
|
}
|
|
|
|
|
|
static int dsa_slave_open(struct net_device *dev)
|
|
@@ -74,7 +74,7 @@ static int dsa_slave_open(struct net_device *dev)
|
|
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
struct dsa_port *dp = p->dp;
|
|
|
struct dsa_switch *ds = dp->ds;
|
|
|
- struct net_device *master = ds->dst->master_netdev;
|
|
|
+ struct net_device *master = dsa_master_netdev(p);
|
|
|
u8 stp_state = dp->bridge_dev ? BR_STATE_BLOCKING : BR_STATE_FORWARDING;
|
|
|
int err;
|
|
|
|
|
@@ -127,7 +127,7 @@ out:
|
|
|
static int dsa_slave_close(struct net_device *dev)
|
|
|
{
|
|
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
- struct net_device *master = p->dp->ds->dst->master_netdev;
|
|
|
+ struct net_device *master = dsa_master_netdev(p);
|
|
|
struct dsa_switch *ds = p->dp->ds;
|
|
|
|
|
|
if (p->phy)
|
|
@@ -154,7 +154,7 @@ static int dsa_slave_close(struct net_device *dev)
|
|
|
static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
|
|
|
{
|
|
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
- struct net_device *master = p->dp->ds->dst->master_netdev;
|
|
|
+ struct net_device *master = dsa_master_netdev(p);
|
|
|
|
|
|
if (change & IFF_ALLMULTI)
|
|
|
dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1);
|
|
@@ -165,7 +165,7 @@ static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
|
|
|
static void dsa_slave_set_rx_mode(struct net_device *dev)
|
|
|
{
|
|
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
- struct net_device *master = p->dp->ds->dst->master_netdev;
|
|
|
+ struct net_device *master = dsa_master_netdev(p);
|
|
|
|
|
|
dev_mc_sync(master, dev);
|
|
|
dev_uc_sync(master, dev);
|
|
@@ -174,7 +174,7 @@ static void dsa_slave_set_rx_mode(struct net_device *dev)
|
|
|
static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
|
|
|
{
|
|
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
- struct net_device *master = p->dp->ds->dst->master_netdev;
|
|
|
+ struct net_device *master = dsa_master_netdev(p);
|
|
|
struct sockaddr *addr = a;
|
|
|
int err;
|
|
|
|
|
@@ -375,7 +375,7 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
|
|
|
/* Queue the SKB for transmission on the parent interface, but
|
|
|
* do not modify its EtherType
|
|
|
*/
|
|
|
- nskb->dev = p->dp->ds->dst->master_netdev;
|
|
|
+ nskb->dev = dsa_master_netdev(p);
|
|
|
dev_queue_xmit(nskb);
|
|
|
|
|
|
return NETDEV_TX_OK;
|
|
@@ -520,14 +520,14 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
|
|
|
uint64_t *data)
|
|
|
{
|
|
|
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
|
|
- struct dsa_switch *ds = dst->cpu_dp->ds;
|
|
|
- s8 cpu_port = dst->cpu_dp->index;
|
|
|
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
|
|
|
+ struct dsa_switch *ds = cpu_dp->ds;
|
|
|
+ s8 cpu_port = cpu_dp->index;
|
|
|
int count = 0;
|
|
|
|
|
|
- if (dst->master_ethtool_ops.get_sset_count) {
|
|
|
- count = dst->master_ethtool_ops.get_sset_count(dev,
|
|
|
- ETH_SS_STATS);
|
|
|
- dst->master_ethtool_ops.get_ethtool_stats(dev, stats, data);
|
|
|
+ if (cpu_dp->ethtool_ops.get_sset_count) {
|
|
|
+ count = cpu_dp->ethtool_ops.get_sset_count(dev, ETH_SS_STATS);
|
|
|
+ cpu_dp->ethtool_ops.get_ethtool_stats(dev, stats, data);
|
|
|
}
|
|
|
|
|
|
if (ds->ops->get_ethtool_stats)
|
|
@@ -537,11 +537,12 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
|
|
|
static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset)
|
|
|
{
|
|
|
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
|
|
- struct dsa_switch *ds = dst->cpu_dp->ds;
|
|
|
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
|
|
|
+ struct dsa_switch *ds = cpu_dp->ds;
|
|
|
int count = 0;
|
|
|
|
|
|
- if (dst->master_ethtool_ops.get_sset_count)
|
|
|
- count += dst->master_ethtool_ops.get_sset_count(dev, sset);
|
|
|
+ if (cpu_dp->ethtool_ops.get_sset_count)
|
|
|
+ count += cpu_dp->ethtool_ops.get_sset_count(dev, sset);
|
|
|
|
|
|
if (sset == ETH_SS_STATS && ds->ops->get_sset_count)
|
|
|
count += ds->ops->get_sset_count(ds);
|
|
@@ -553,8 +554,9 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
|
|
|
uint32_t stringset, uint8_t *data)
|
|
|
{
|
|
|
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
|
|
- struct dsa_switch *ds = dst->cpu_dp->ds;
|
|
|
- s8 cpu_port = dst->cpu_dp->index;
|
|
|
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
|
|
|
+ struct dsa_switch *ds = cpu_dp->ds;
|
|
|
+ s8 cpu_port = cpu_dp->index;
|
|
|
int len = ETH_GSTRING_LEN;
|
|
|
int mcount = 0, count;
|
|
|
unsigned int i;
|
|
@@ -565,10 +567,9 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
|
|
|
/* We do not want to be NULL-terminated, since this is a prefix */
|
|
|
pfx[sizeof(pfx) - 1] = '_';
|
|
|
|
|
|
- if (dst->master_ethtool_ops.get_sset_count) {
|
|
|
- mcount = dst->master_ethtool_ops.get_sset_count(dev,
|
|
|
- ETH_SS_STATS);
|
|
|
- dst->master_ethtool_ops.get_strings(dev, stringset, data);
|
|
|
+ if (cpu_dp->ethtool_ops.get_sset_count) {
|
|
|
+ mcount = cpu_dp->ethtool_ops.get_sset_count(dev, ETH_SS_STATS);
|
|
|
+ cpu_dp->ethtool_ops.get_strings(dev, stringset, data);
|
|
|
}
|
|
|
|
|
|
if (stringset == ETH_SS_STATS && ds->ops->get_strings) {
|
|
@@ -684,8 +685,7 @@ static int dsa_slave_netpoll_setup(struct net_device *dev,
|
|
|
struct netpoll_info *ni)
|
|
|
{
|
|
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
- struct dsa_switch *ds = p->dp->ds;
|
|
|
- struct net_device *master = ds->dst->master_netdev;
|
|
|
+ struct net_device *master = dsa_master_netdev(p);
|
|
|
struct netpoll *netpoll;
|
|
|
int err = 0;
|
|
|
|
|
@@ -1141,11 +1141,11 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
|
|
|
struct net_device *master;
|
|
|
struct net_device *slave_dev;
|
|
|
struct dsa_slave_priv *p;
|
|
|
+ struct dsa_port *cpu_dp;
|
|
|
int ret;
|
|
|
|
|
|
- master = ds->dst->master_netdev;
|
|
|
- if (ds->master_netdev)
|
|
|
- master = ds->master_netdev;
|
|
|
+ cpu_dp = ds->dst->cpu_dp;
|
|
|
+ master = cpu_dp->netdev;
|
|
|
|
|
|
slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
|
|
|
NET_NAME_UNKNOWN, ether_setup);
|