From: Steve Douthit <stephend@silicom-usa.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"intel-wired-lan@lists.osuosl.org"
<intel-wired-lan@lists.osuosl.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Steve Douthit <stephend@silicom-usa.com>
Subject: [PATCH net-next v4 2/2] ixgbe: use mii_bus to handle MII related ioctls
Date: Mon, 3 Dec 2018 20:15:24 +0000 [thread overview]
Message-ID: <20181203201432.18252-3-stephend@silicom-usa.com> (raw)
In-Reply-To: <20181203201432.18252-1-stephend@silicom-usa.com>
Use the mii_bus callbacks to address the entire clause 22/45 address
space. Enables userspace to poke switch registers instead of a single
PHY address.
The ixgbe firmware may be polling PHYs in a way that is not protected by
the mii_bus lock. This isn't new behavior, but as Andrew Lunn pointed
out there are more addresses available for conflicts.
Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index b7907674c565..caa64afdedfb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8790,6 +8790,15 @@ ixgbe_mdio_read(struct net_device *netdev, int prtad, int devad, u16 addr)
u16 value;
int rc;
+ if (adapter->mii_bus) {
+ int regnum = addr;
+
+ if (devad != MDIO_DEVAD_NONE)
+ regnum |= (devad << 16) | MII_ADDR_C45;
+
+ return mdiobus_read(adapter->mii_bus, prtad, regnum);
+ }
+
if (prtad != hw->phy.mdio.prtad)
return -EINVAL;
rc = hw->phy.ops.read_reg(hw, addr, devad, &value);
@@ -8804,6 +8813,15 @@ static int ixgbe_mdio_write(struct net_device *netdev, int prtad, int devad,
struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_hw *hw = &adapter->hw;
+ if (adapter->mii_bus) {
+ int regnum = addr;
+
+ if (devad != MDIO_DEVAD_NONE)
+ regnum |= (devad << 16) | MII_ADDR_C45;
+
+ return mdiobus_write(adapter->mii_bus, prtad, regnum, value);
+ }
+
if (prtad != hw->phy.mdio.prtad)
return -EINVAL;
return hw->phy.ops.write_reg(hw, addr, devad, value);
--
2.17.2
next prev parent reply other threads:[~2018-12-03 20:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 16:32 [PATCH net-next v2 0/2] Add mii_bus to ixgbe driver for dsa devs Steve Douthit
2018-12-03 16:32 ` [PATCH net-next v2 1/2] ixgbe: register a mdiobus Steve Douthit
2018-12-03 16:54 ` Andrew Lunn
2018-12-03 17:02 ` Steve Douthit
2018-12-03 17:21 ` Andrew Lunn
2018-12-03 17:59 ` Steve Douthit
2018-12-03 18:18 ` Andrew Lunn
2018-12-03 18:38 ` Steve Douthit
2018-12-03 18:54 ` Andrew Lunn
2018-12-03 16:33 ` [PATCH net-next v2 2/2] ixgbe: use mii_bus to handle MII related ioctls Steve Douthit
2018-12-03 18:55 ` [PATCH net-next v3 0/2] Add mii_bus to ixgbe driver for dsa devs Steve Douthit
2018-12-03 18:55 ` [PATCH net-next v3 1/2] ixgbe: register a mdiobus Steve Douthit
2018-12-03 19:00 ` Andrew Lunn
2018-12-03 19:07 ` Florian Fainelli
2018-12-03 19:44 ` Steve Douthit
2018-12-03 19:45 ` Florian Fainelli
2018-12-03 18:55 ` [PATCH net-next v3 2/2] ixgbe: use mii_bus to handle MII related ioctls Steve Douthit
2018-12-03 19:01 ` Andrew Lunn
2018-12-03 19:07 ` Florian Fainelli
2018-12-03 20:14 ` [PATCH net-next v4 0/2] Add mii_bus to ixgbe driver for dsa devs Steve Douthit
2018-12-03 20:15 ` [PATCH net-next v4 1/2] ixgbe: register a mdiobus Steve Douthit
2018-12-04 16:58 ` Bowers, AndrewX
2018-12-03 20:15 ` Steve Douthit [this message]
2018-12-04 16:59 ` [PATCH net-next v4 2/2] ixgbe: use mii_bus to handle MII related ioctls Bowers, AndrewX
2018-12-03 20:51 ` [PATCH net-next v4 0/2] Add mii_bus to ixgbe driver for dsa devs Florian Fainelli
2018-12-03 23:42 ` Steve Douthit
2018-12-03 23:46 ` Florian Fainelli
2018-12-04 10:40 ` Andrew Lunn
2018-12-04 16:02 ` Steve Douthit
2018-12-06 15:50 ` [PATCH net-next v5 " Steve Douthit
2018-12-06 15:50 ` [PATCH net-next v5 1/2] ixgbe: register a mdiobus Steve Douthit
2018-12-06 15:50 ` [PATCH net-next v5 2/2] ixgbe: use mii_bus to handle MII related ioctls Steve Douthit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181203201432.18252-3-stephend@silicom-usa.com \
--to=stephend@silicom-usa.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).