All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28
@ 2017-02-28 21:02 Tom Lendacky
  2017-02-28 21:02 ` [PATCH net v1 1/3] amd-xgbe: Stop the PHY before releasing interrupts Tom Lendacky
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Tom Lendacky @ 2017-02-28 21:02 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

This patch series addresses some issues in the AMD XGBE driver.

The following fixes are included in this driver update series:

- Stop the PHY before disabling and releasing device interrupts so that
  MDIO requests issued by the device can be properly handled
- Set the MDIO communication mode on device startup, not just device
  probe
- Do not overwrite SFP settings when mod_absent is detected

This patch series is based on net.

---

Tom Lendacky (3):
      amd-xgbe: Stop the PHY before releasing interrupts
      amd-xgbe: Be sure to set MDIO modes on device (re)start
      amd-xgbe: Don't overwrite SFP PHY mod_absent settings


 drivers/net/ethernet/amd/xgbe/xgbe-dev.c    |    2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c    |    4 ++--
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c |   24 ++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)

-- 
Tom Lendacky

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net v1 1/3] amd-xgbe: Stop the PHY before releasing interrupts
  2017-02-28 21:02 [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 Tom Lendacky
@ 2017-02-28 21:02 ` Tom Lendacky
  2017-02-28 21:03 ` [PATCH net v1 2/3] amd-xgbe: Be sure to set MDIO modes on device (re)start Tom Lendacky
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Tom Lendacky @ 2017-02-28 21:02 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

Some configurations require the use of the hardware's MDIO support to
communicate with external PHYs. The MDIO commands indicate completion
through the device interrupt. When bringing down the device the interrupts
were released before stopping the external PHY, resulting in MDIO command
timeouts. Move the stopping of the PHY to before the releasing of the
interrupts.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 3aa457c..248f60d 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1131,12 +1131,12 @@ static void xgbe_stop(struct xgbe_prv_data *pdata)
 	hw_if->disable_tx(pdata);
 	hw_if->disable_rx(pdata);
 
+	phy_if->phy_stop(pdata);
+
 	xgbe_free_irqs(pdata);
 
 	xgbe_napi_disable(pdata, 1);
 
-	phy_if->phy_stop(pdata);
-
 	hw_if->exit(pdata);
 
 	channel = pdata->channel;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net v1 2/3] amd-xgbe: Be sure to set MDIO modes on device (re)start
  2017-02-28 21:02 [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 Tom Lendacky
  2017-02-28 21:02 ` [PATCH net v1 1/3] amd-xgbe: Stop the PHY before releasing interrupts Tom Lendacky
@ 2017-02-28 21:03 ` Tom Lendacky
  2017-02-28 21:03 ` [PATCH net v1 3/3] amd-xgbe: Don't overwrite SFP PHY mod_absent settings Tom Lendacky
  2017-03-02 21:02 ` [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Tom Lendacky @ 2017-02-28 21:03 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

The MDIO register mode is set when the device is probed. But when the
device is brought down and then back up, the MDIO register mode has been
reset.  Be sure to reset the mode during device startup and only change
the mode of the address specified.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-dev.c    |    2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index a7d16db..937f37a 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -1323,7 +1323,7 @@ static int xgbe_read_ext_mii_regs(struct xgbe_prv_data *pdata, int addr,
 static int xgbe_set_ext_mii_mode(struct xgbe_prv_data *pdata, unsigned int port,
 				 enum xgbe_mdio_mode mode)
 {
-	unsigned int reg_val = 0;
+	unsigned int reg_val = XGMAC_IOREAD(pdata, MAC_MDIOCL22R);
 
 	switch (mode) {
 	case XGBE_MDIO_MODE_CL22:
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 9d8c9530..04804cb 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -875,6 +875,16 @@ static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata)
 	    !phy_data->sfp_phy_avail)
 		return 0;
 
+	/* Set the proper MDIO mode for the PHY */
+	ret = pdata->hw_if.set_ext_mii_mode(pdata, phy_data->mdio_addr,
+					    phy_data->phydev_mode);
+	if (ret) {
+		netdev_err(pdata->netdev,
+			   "mdio port/clause not compatible (%u/%u)\n",
+			   phy_data->mdio_addr, phy_data->phydev_mode);
+		return ret;
+	}
+
 	/* Create and connect to the PHY device */
 	phydev = get_phy_device(phy_data->mii, phy_data->mdio_addr,
 				(phy_data->phydev_mode == XGBE_MDIO_MODE_CL45));
@@ -2722,6 +2732,18 @@ static int xgbe_phy_start(struct xgbe_prv_data *pdata)
 	if (ret)
 		return ret;
 
+	/* Set the proper MDIO mode for the re-driver */
+	if (phy_data->redrv && !phy_data->redrv_if) {
+		ret = pdata->hw_if.set_ext_mii_mode(pdata, phy_data->redrv_addr,
+						    XGBE_MDIO_MODE_CL22);
+		if (ret) {
+			netdev_err(pdata->netdev,
+				   "redriver mdio port not compatible (%u)\n",
+				   phy_data->redrv_addr);
+			return ret;
+		}
+	}
+
 	/* Start in highest supported mode */
 	xgbe_phy_set_mode(pdata, phy_data->start_mode);
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net v1 3/3] amd-xgbe: Don't overwrite SFP PHY mod_absent settings
  2017-02-28 21:02 [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 Tom Lendacky
  2017-02-28 21:02 ` [PATCH net v1 1/3] amd-xgbe: Stop the PHY before releasing interrupts Tom Lendacky
  2017-02-28 21:03 ` [PATCH net v1 2/3] amd-xgbe: Be sure to set MDIO modes on device (re)start Tom Lendacky
@ 2017-02-28 21:03 ` Tom Lendacky
  2017-03-02 21:02 ` [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Tom Lendacky @ 2017-02-28 21:03 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

If an SFP module is not present, xgbe_phy_sfp_phy_settings() should
return after applying the default settings. Currently there is no return
statement and the default settings are overwritten.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 04804cb..e707c49 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -716,6 +716,8 @@ static void xgbe_phy_sfp_phy_settings(struct xgbe_prv_data *pdata)
 		pdata->phy.duplex = DUPLEX_UNKNOWN;
 		pdata->phy.autoneg = AUTONEG_ENABLE;
 		pdata->phy.advertising = pdata->phy.supported;
+
+		return;
 	}
 
 	pdata->phy.advertising &= ~ADVERTISED_Autoneg;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28
  2017-02-28 21:02 [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 Tom Lendacky
                   ` (2 preceding siblings ...)
  2017-02-28 21:03 ` [PATCH net v1 3/3] amd-xgbe: Don't overwrite SFP PHY mod_absent settings Tom Lendacky
@ 2017-03-02 21:02 ` David Miller
  2017-03-02 21:32   ` Tom Lendacky
  3 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2017-03-02 21:02 UTC (permalink / raw)
  To: thomas.lendacky; +Cc: netdev

From: Tom Lendacky <thomas.lendacky@amd.com>
Date: Tue, 28 Feb 2017 15:02:42 -0600

> This patch series addresses some issues in the AMD XGBE driver.
> 
> The following fixes are included in this driver update series:
> 
> - Stop the PHY before disabling and releasing device interrupts so that
>   MDIO requests issued by the device can be properly handled
> - Set the MDIO communication mode on device startup, not just device
>   probe
> - Do not overwrite SFP settings when mod_absent is detected
> 
> This patch series is based on net.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28
  2017-03-02 21:02 ` [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 David Miller
@ 2017-03-02 21:32   ` Tom Lendacky
  2017-03-02 22:01     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Lendacky @ 2017-03-02 21:32 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On 3/2/2017 3:02 PM, David Miller wrote:
> From: Tom Lendacky <thomas.lendacky@amd.com>
> Date: Tue, 28 Feb 2017 15:02:42 -0600
>
>> This patch series addresses some issues in the AMD XGBE driver.
>>
>> The following fixes are included in this driver update series:
>>
>> - Stop the PHY before disabling and releasing device interrupts so that
>>   MDIO requests issued by the device can be properly handled
>> - Set the MDIO communication mode on device startup, not just device
>>   probe
>> - Do not overwrite SFP settings when mod_absent is detected
>>
>> This patch series is based on net.
>
> Series applied, thanks.

Thanks David!

Could you queue these fixes up against 4.10 stable. Nothing early than
that is needed.

Thanks,
Tom

>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28
  2017-03-02 21:32   ` Tom Lendacky
@ 2017-03-02 22:01     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2017-03-02 22:01 UTC (permalink / raw)
  To: thomas.lendacky; +Cc: netdev

From: Tom Lendacky <thomas.lendacky@amd.com>
Date: Thu, 2 Mar 2017 15:32:29 -0600

> On 3/2/2017 3:02 PM, David Miller wrote:
>> From: Tom Lendacky <thomas.lendacky@amd.com>
>> Date: Tue, 28 Feb 2017 15:02:42 -0600
>>
>>> This patch series addresses some issues in the AMD XGBE driver.
>>>
>>> The following fixes are included in this driver update series:
>>>
>>> - Stop the PHY before disabling and releasing device interrupts so that
>>>   MDIO requests issued by the device can be properly handled
>>> - Set the MDIO communication mode on device startup, not just device
>>>   probe
>>> - Do not overwrite SFP settings when mod_absent is detected
>>>
>>> This patch series is based on net.
>>
>> Series applied, thanks.
> 
> Thanks David!
> 
> Could you queue these fixes up against 4.10 stable. Nothing early than
> that is needed.

Ok, done.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-02 22:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28 21:02 [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 Tom Lendacky
2017-02-28 21:02 ` [PATCH net v1 1/3] amd-xgbe: Stop the PHY before releasing interrupts Tom Lendacky
2017-02-28 21:03 ` [PATCH net v1 2/3] amd-xgbe: Be sure to set MDIO modes on device (re)start Tom Lendacky
2017-02-28 21:03 ` [PATCH net v1 3/3] amd-xgbe: Don't overwrite SFP PHY mod_absent settings Tom Lendacky
2017-03-02 21:02 ` [PATCH net v1 0/3] amd-xgbe: AMD XGBE driver fixes 2017-02-28 David Miller
2017-03-02 21:32   ` Tom Lendacky
2017-03-02 22:01     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.