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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YxuHF4UrUEJBKmcu@euler>
Date:   Fri, 9 Sep 2022 11:33:59 -0700
From:   Colin Foster <colin.foster@...advantage.com>
To:     Vladimir Oltean <vladimir.oltean@....com>
Cc:     "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Steen Hegelund <Steen.Hegelund@...rochip.com>,
        Russell King <linux@...linux.org.uk>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        "UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Manoil <claudiu.manoil@....com>
Subject: Re: [RFC v8 net-next 15/16] net: dsa: felix: add phylink_get_caps
 capability

On Mon, May 09, 2022 at 05:58:07PM +0000, Vladimir Oltean wrote:
> On Mon, May 09, 2022 at 05:55:37PM -0700, Colin Foster wrote:
> > Hmm... So the main reason I needed get_caps was because
> > phylink_generic_validate looks at mac_capabilities. I know I'll have to
> > deal with supported_interfaces once I finally get the other four ports
> > working, but for now the main purpose of this patch is to allow me to
> > populate the mac_capabilities entry for phylink_generic_validate.
> > 
> > Aside from ensuring legacy_pre_march2020 = false, I feel like the rest
> > of the patch makes sense.
> 
> But still. Just populate mac_capabilities for everybody in the common
> felix_phylink_get_caps(), and use the generic phylink validation only
> for your driver.

Resurrecting this thread, now that I'm back into the networking stuff. I
removed some people from the CC chain who I think were MFD / GPIO specific.

v1 of my upcoming "add dsa capabilities to the vsc7512" will build off
these suggestions, but these DSA patches were dropped in the MFD set.


Restoring context: my oritinal patch was:

+++ b/drivers/net/dsa/ocelot/felix.c
@@ -982,15 +982,23 @@  static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
 				   struct phylink_config *config)
 {
 	struct ocelot *ocelot = ds->priv;
+	struct felix *felix;

-	/* This driver does not make use of the speed, duplex, pause or the
-	 * advertisement in its mac_config, so it is safe to mark this driver
-	 * as non-legacy.
-	 */
-	config->legacy_pre_march2020 = false;
+	felix = ocelot_to_felix(ocelot);
+
+	if (felix->info->phylink_get_caps) {
+		felix->info->phylink_get_caps(ocelot, port, config);
+	} else {

-	__set_bit(ocelot->ports[port]->phy_mode,
-		  config->supported_interfaces);
+		/* This driver does not make use of the speed, duplex, pause or
+		 * the advertisement in its mac_config, so it is safe to mark
+		 * this driver as non-legacy.
+		 */
+		config->legacy_pre_march2020 = false;
+
+		__set_bit(ocelot->ports[port]->phy_mode,
+			  config->supported_interfaces);
+	}
 }


Regarding felix_phylink_get_caps() - does it make sense that
mac_capabilities would be the same for all ports? This is where I've
currently landed, and I want to make sure it doesn't have adverse
effects on vsc9959 or seville:

static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
                                   struct phylink_config *config)
{
        struct ocelot *ocelot = ds->priv;
        struct felix *felix;
        u32 modes;
        int i;

        felix = ocelot_to_felix(ocelot);
        modes = felix->info->port_modes[port];

        /* This driver does not make use of the speed, duplex, pause or
         * the advertisement in its mac_config, so it is safe to mark
         * this driver as non-legacy.
         */
        config->legacy_pre_march2020 = false;

        for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++)
                if (modes & felix_phy_match_table[i])
                        __set_bit(i, config->supported_interfaces);

        config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | MAC_10 |
                                   MAC_100 | MAC_1000FD;
}

(this might be two patches - one for the match table and one for the
mac_capabilities)

Seemingly because net/dsa/port.c checks for phylink_validate before it
checks for mac_capabilties, it won't make a difference there, but this
seems ... wrong? Or maybe it isn't wrong until I implement the QSGMII
port that supports 2500FD (as in drivers/net/ethernet/mscc/ocelot_net.c
ocelot_port_phylink_create())

Powered by blists - more mailing lists