Re: [PATCH net-next 1/5] net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
Hi Florian, [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-dsa-Multi-CPU-ground-work/20170607-164203 config: x86_64-randconfig-s0-06090601 (attached as .config) compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): net//dsa/slave.c: In function 'dsa_slave_netpoll_setup': >> net//dsa/slave.c:686: warning: unused variable 'ds' vim +/ds +686 net//dsa/slave.c 7905288f Florian Fainelli 2014-09-24 670 afdcf151 Vivien Didelot 2017-01-27 671 ret = ds->ops->get_eee(ds, p->dp->index, e); 7905288f Florian Fainelli 2014-09-24 672 if (ret) 7905288f Florian Fainelli 2014-09-24 673 return ret; 7905288f Florian Fainelli 2014-09-24 674 7905288f Florian Fainelli 2014-09-24 675 if (p->phy) 7905288f Florian Fainelli 2014-09-24 676 ret = phy_ethtool_get_eee(p->phy, e); 7905288f Florian Fainelli 2014-09-24 677 7905288f Florian Fainelli 2014-09-24 678 return ret; 7905288f Florian Fainelli 2014-09-24 679 } 7905288f Florian Fainelli 2014-09-24 680 04ff53f9 Florian Fainelli 2015-07-31 681 #ifdef CONFIG_NET_POLL_CONTROLLER 04ff53f9 Florian Fainelli 2015-07-31 682 static int dsa_slave_netpoll_setup(struct net_device *dev, 04ff53f9 Florian Fainelli 2015-07-31 683 struct netpoll_info *ni) 04ff53f9 Florian Fainelli 2015-07-31 684 { 04ff53f9 Florian Fainelli 2015-07-31 685 struct dsa_slave_priv *p = netdev_priv(dev); afdcf151 Vivien Didelot 2017-01-27 @686 struct dsa_switch *ds = p->dp->ds; 6ab303ef Florian Fainelli 2017-06-06 687 struct net_device *master = dsa_master_netdev(p); 04ff53f9 Florian Fainelli 2015-07-31 688 struct netpoll *netpoll; 04ff53f9 Florian Fainelli 2015-07-31 689 int err = 0; 04ff53f9 Florian Fainelli 2015-07-31 690 04ff53f9 Florian Fainelli 2015-07-31 691 netpoll = kzalloc(sizeof(*netpoll), GFP_KERNEL); 04ff53f9 Florian Fainelli 2015-07-31 692 if (!netpoll) 04ff53f9 Florian Fainelli 2015-07-31 693 return -ENOMEM; 04ff53f9 Florian Fainelli 2015-07-31 694 :: The code at line 686 was first introduced by commit :: afdcf151c1f7346207dcee3f8d6d82991dbbb7e5 net: dsa: store a dsa_port in dsa_slave_priv :: TO: Vivien Didelot:: CC: David S. Miller --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
Re: [PATCH net-next 1/5] net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
On 06/06/2017 10:24 AM, Vivien Didelot wrote: > Hi Florian, > > Florian Fainelliwrites: > >> -struct net_device *p = ds->dst[ds->index].master_netdev; >> +struct net_device *p = ds->dst[ds->index].cpu_dp->netdev; > >ds->dst->cpu_dp->netdev > > ds->dst is not an array anymore, lucky sf2 switch index is always 0 ;-) > >> struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); >> struct ethtool_wolinfo pwol; >> >> @@ -829,7 +829,7 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, >> int port, >> static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, >>struct ethtool_wolinfo *wol) >> { >> -struct net_device *p = ds->dst[ds->index].master_netdev; >> +struct net_device *p = ds->dst[ds->index].cpu_dp->netdev; > > same here. It's changed in patch 5, so I did not bother doing an intermediate change considering we ditch this eventually. Thanks! > > Thanks, > > Vivien > -- Florian
Re: [PATCH net-next 1/5] net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
Hi Florian, Florian Fainelliwrites: > - struct net_device *p = ds->dst[ds->index].master_netdev; > + struct net_device *p = ds->dst[ds->index].cpu_dp->netdev; ds->dst->cpu_dp->netdev ds->dst is not an array anymore, lucky sf2 switch index is always 0 ;-) > struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); > struct ethtool_wolinfo pwol; > > @@ -829,7 +829,7 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int > port, > static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, > struct ethtool_wolinfo *wol) > { > - struct net_device *p = ds->dst[ds->index].master_netdev; > + struct net_device *p = ds->dst[ds->index].cpu_dp->netdev; same here. Thanks, Vivien
[PATCH net-next 1/5] net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
In preparation for supporting multiple CPU ports, remove dst->master_netdev and ds->master_netdev and replace them with only one instance of the common object we have for a port: struct dsa_port::netdev. ds->master_netdev is currently write only and would be helpful in the case where we have two switches, both with CPU ports, and also connected within each other, which the multi-CPU port patch series would address. While at it, introduce a helper function used in net/dsa/slave.c to immediately get a reference on the master network device called dsa_master_netdev(). Signed-off-by: Florian Fainelli--- drivers/net/dsa/bcm_sf2.c | 4 ++-- drivers/net/dsa/mt7530.c | 4 ++-- include/net/dsa.h | 5 - net/dsa/dsa.c | 9 ++--- net/dsa/dsa2.c| 18 +++--- net/dsa/dsa_priv.h| 5 + net/dsa/legacy.c | 22 +- net/dsa/slave.c | 20 +--- 8 files changed, 40 insertions(+), 47 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 687a8bae5d73..76e98e8ed315 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -806,7 +806,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, struct ethtool_wolinfo *wol) { - struct net_device *p = ds->dst[ds->index].master_netdev; + struct net_device *p = ds->dst[ds->index].cpu_dp->netdev; struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); struct ethtool_wolinfo pwol; @@ -829,7 +829,7 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, struct ethtool_wolinfo *wol) { - struct net_device *p = ds->dst[ds->index].master_netdev; + struct net_device *p = ds->dst[ds->index].cpu_dp->netdev; struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); s8 cpu_port = ds->dst->cpu_dp->index; struct ethtool_wolinfo pwol; diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 25e00d5e0eec..1e46418a3b74 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -912,11 +912,11 @@ mt7530_setup(struct dsa_switch *ds) struct device_node *dn; struct mt7530_dummy_poll p; - /* The parent node of master_netdev which holds the common system + /* The parent node of cpu_dp->netdev which holds the common system * controller also is the container for two GMACs nodes representing * as two netdev instances. */ - dn = ds->master_netdev->dev.of_node->parent; + dn = ds->dst->cpu_dp->netdev->dev.of_node->parent; priv->ethernet = syscon_node_to_regmap(dn); if (IS_ERR(priv->ethernet)) return PTR_ERR(priv->ethernet); diff --git a/include/net/dsa.h b/include/net/dsa.h index 2effb0af9d7c..b2fb53f5e28e 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -227,11 +227,6 @@ struct dsa_switch { s8 rtable[DSA_MAX_SWITCHES]; /* -* The lower device this switch uses to talk to the host -*/ - struct net_device *master_netdev; - - /* * Slave mii_bus and devices for the individual ports. */ u32 dsa_port_mask; diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index fdc448b30e56..eaab1affeeeb 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -118,10 +118,7 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp) struct net_device *master; struct ethtool_ops *cpu_ops; - master = ds->dst->master_netdev; - if (ds->master_netdev) - master = ds->master_netdev; - + master = ds->dst->cpu_dp->netdev; cpu_ops = devm_kzalloc(ds->dev, sizeof(*cpu_ops), GFP_KERNEL); if (!cpu_ops) return -ENOMEM; @@ -142,9 +139,7 @@ void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp) struct dsa_switch *ds = cpu_dp->ds; struct net_device *master; - master = ds->dst->master_netdev; - if (ds->master_netdev) - master = ds->master_netdev; + master = ds->dst->cpu_dp->netdev; master->ethtool_ops = ds->dst->master_orig_ethtool_ops; } diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index cd13bb54a30c..2674bdf03fef 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -337,7 +337,7 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds) return err; if (ds->ops->set_addr) { - err = ds->ops->set_addr(ds, dst->master_netdev->dev_addr); + err = ds->ops->set_addr(ds, dst->cpu_dp->netdev->dev_addr); if (err < 0) return err; } @@ -444,7 +444,7 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst) * sent to the tag