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:   Sun, 10 Nov 2019 12:34:02 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Stefan Wahren <wahrenst@....net>,
        Matthias Brugger <matthias.bgg@...nel.org>,
        Matthias Brugger <mbrugger@...e.com>,
        "David S . Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>
Cc:     Eric Anholt <eric@...olt.net>,
        Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
        Doug Berger <opendmb@...il.com>, netdev@...r.kernel.org,
        bcm-kernel-feedback-list@...adcom.com,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access
 in bcmgenet_mii_config



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The register access in bcmgenet_mii_config() is a little bit opaque and
> not easy to extend. In preparation for the missing RGMII PHY modes
> move the real register access to the end of the function. This make
> the code easier to read and extend.
> 
> Signed-off-by: Stefan Wahren <wahrenst@....net>

You will most likely have to resubmit this patch series after Doug's
recent GENET changes:

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=3a55402c93877d291b0a612d25edb03d1b4b93ac
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=6b6d017fccb4693767d2fcae9ef2fd05243748bb
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=0686bd9d5e6863f60e4bb1e78e6fe7bb217a0890

And while you are at it with this patch, you may even take a step
further and do something like this for the INTERNAL and MOCA PHYs:

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c
b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index dbe18cdf6c1b..e363a824d662 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -218,6 +218,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool
init)

        switch (priv->phy_interface) {
        case PHY_INTERFACE_MODE_INTERNAL:
+               phy_name = "internal PHY";
        case PHY_INTERFACE_MODE_MOCA:
                /* Irrespective of the actually configured PHY speed (100 or
                 * 1000) GENETv4 only has an internal GPHY so we will
just end
@@ -229,14 +230,8 @@ int bcmgenet_mii_config(struct net_device *dev,
bool init)
                else
                        port_ctrl = PORT_MODE_INT_EPHY;

-               bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
-
-               if (priv->internal_phy) {
-                       phy_name = "internal PHY";
-               } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
+               if (!phy_name)
                        phy_name = "MoCA";
-                       bcmgenet_moca_phy_setup(priv);
-               }
                break;

such that all the port_ctrl and the phy_name are set within the same
location and the register write/configuration is done after the mode has
been determined.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ