lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 24 Nov 2021 23:25:17 +0000
From:   "Russell King (Oracle)" <linux@...linux.org.uk>
To:     Vladimir Oltean <vladimir.oltean@....com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        George McCollister <george.mccollister@...il.com>,
        Hauke Mehrtens <hauke@...ke-m.de>,
        Kurt Kanzenbach <kurt@...utronix.de>,
        Woojung Huh <woojung.huh@...rochip.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH RFC net-next 01/12] net: dsa: consolidate phylink creation

On Wed, Nov 24, 2021 at 06:11:57PM +0000, Vladimir Oltean wrote:
> On Wed, Nov 24, 2021 at 05:52:28PM +0000, Russell King (Oracle) wrote:
> > The code in port.c and slave.c creating the phylink instance is very
> > similar - let's consolidate this into a single function.
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> > ---
> >  net/dsa/dsa_priv.h |  2 +-
> >  net/dsa/port.c     | 44 ++++++++++++++++++++++++++++----------------
> >  net/dsa/slave.c    | 19 +++----------------
> >  3 files changed, 32 insertions(+), 33 deletions(-)
> > 
> > diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> > index a5c9bc7b66c6..3fb2c37c9b88 100644
> > --- a/net/dsa/dsa_priv.h
> > +++ b/net/dsa/dsa_priv.h
> > @@ -258,13 +258,13 @@ int dsa_port_mrp_add_ring_role(const struct dsa_port *dp,
> >  			       const struct switchdev_obj_ring_role_mrp *mrp);
> >  int dsa_port_mrp_del_ring_role(const struct dsa_port *dp,
> >  			       const struct switchdev_obj_ring_role_mrp *mrp);
> > +int dsa_port_phylink_create(struct dsa_port *dp);
> >  int dsa_port_link_register_of(struct dsa_port *dp);
> >  void dsa_port_link_unregister_of(struct dsa_port *dp);
> >  int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr);
> >  void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr);
> >  int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast);
> >  void dsa_port_tag_8021q_vlan_del(struct dsa_port *dp, u16 vid, bool broadcast);
> > -extern const struct phylink_mac_ops dsa_port_phylink_mac_ops;
> >  
> >  static inline bool dsa_port_offloads_bridge_port(struct dsa_port *dp,
> >  						 const struct net_device *dev)
> > diff --git a/net/dsa/port.c b/net/dsa/port.c
> > index f6f12ad2b525..eaa66114924b 100644
> > --- a/net/dsa/port.c
> > +++ b/net/dsa/port.c
> > @@ -1072,7 +1072,7 @@ static void dsa_port_phylink_mac_link_up(struct phylink_config *config,
> >  				     speed, duplex, tx_pause, rx_pause);
> >  }
> >  
> > -const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
> > +static const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
> >  	.validate = dsa_port_phylink_validate,
> >  	.mac_pcs_get_state = dsa_port_phylink_mac_pcs_get_state,
> >  	.mac_config = dsa_port_phylink_mac_config,
> > @@ -1081,6 +1081,30 @@ const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
> >  	.mac_link_up = dsa_port_phylink_mac_link_up,
> >  };
> >  
> > +int dsa_port_phylink_create(struct dsa_port *dp)
> > +{
> > +	struct dsa_switch *ds = dp->ds;
> > +	phy_interface_t mode;
> > +	int err;
> > +
> > +	err = of_get_phy_mode(dp->dn, &mode);
> > +	if (err)
> > +		mode = PHY_INTERFACE_MODE_NA;
> > +
> > +	if (ds->ops->phylink_get_interfaces)
> > +		ds->ops->phylink_get_interfaces(ds, dp->index,
> > +					dp->pl_config.supported_interfaces);
> 
> Can you please save dp->pl_config to a struct phylink_config *config
> temporary variable, and pass that here and to phylink_create() while
> preserving the alignment of that argument to the open brace? Thanks.

There is no point; first, this is how the original code was formatted
that is moved here, and second, this code is deleted in patch 3.
Making it a local variable, and then deleting it in patch 3 is pointless
churn.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ