All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22
@ 2015-05-22 21:32 Tom Lendacky
  2015-05-22 21:32 ` [PATCH net-next v1 1/3] amd-xgbe: Add setting of a missing hardware feature Tom Lendacky
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tom Lendacky @ 2015-05-22 21:32 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

The following patches are included in this driver update series:

- Retrieve and set an additional hardware feature setting
- Fix the initial mode/speed determination when auto-negotiation is
  disabled
- Add additional netif_dbg support to the driver

This patch series is based on net-next.

---

Tom Lendacky (3):
      amd-xgbe: Add setting of a missing hardware feature
      amd-xgbe: Fix initial mode when auto-negotiation is disabled
      amd-xgbe: Add more netif_dbg output to the driver


 drivers/net/ethernet/amd/xgbe/xgbe-drv.c  |    1 
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c |  113 +++++++++++++++++++++++++++--
 2 files changed, 105 insertions(+), 9 deletions(-)

-- 
Tom Lendacky

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

* [PATCH net-next v1 1/3] amd-xgbe: Add setting of a missing hardware feature
  2015-05-22 21:32 [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 Tom Lendacky
@ 2015-05-22 21:32 ` Tom Lendacky
  2015-05-22 21:32 ` [PATCH net-next v1 2/3] amd-xgbe: Fix initial mode when auto-negotiation is disabled Tom Lendacky
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tom Lendacky @ 2015-05-22 21:32 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

The device private data structure contains all the defined hardware
features for the device. However one of the features is not set. Even
though the feature is not currently used, set it to avoid future
issues of the feature being checked thinking it has been properly set.

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

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index e452179..c752049 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -531,6 +531,7 @@ void xgbe_get_all_hw_features(struct xgbe_prv_data *pdata)
 						RXFIFOSIZE);
 	hw_feat->tx_fifo_size  = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R,
 						TXFIFOSIZE);
+	hw_feat->adv_ts_hi     = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, ADVTHWORD);
 	hw_feat->dma_width     = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, ADDR64);
 	hw_feat->dcb           = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, DCBEN);
 	hw_feat->sph           = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, SPHEN);

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

* [PATCH net-next v1 2/3] amd-xgbe: Fix initial mode when auto-negotiation is disabled
  2015-05-22 21:32 [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 Tom Lendacky
  2015-05-22 21:32 ` [PATCH net-next v1 1/3] amd-xgbe: Add setting of a missing hardware feature Tom Lendacky
@ 2015-05-22 21:32 ` Tom Lendacky
  2015-05-22 21:32 ` [PATCH net-next v1 3/3] amd-xgbe: Add more netif_dbg output to the driver Tom Lendacky
  2015-05-25  4:14 ` [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Tom Lendacky @ 2015-05-22 21:32 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

When the ethtool command is used to set the speed of the device while
the device is down, the check to set the initial mode may fail when
the device is brought up, causing failure to bring the device up.

Update the code to set the initial mode based on the desired speed if
auto-negotiation is disabled.

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

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index cea19a3..8b86d94 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -376,6 +376,45 @@ static void xgbe_set_mode(struct xgbe_prv_data *pdata,
 		xgbe_switch_mode(pdata);
 }
 
+static bool xgbe_use_xgmii_mode(struct xgbe_prv_data *pdata)
+{
+	if (pdata->phy.autoneg == AUTONEG_ENABLE) {
+		if (pdata->phy.advertising & ADVERTISED_10000baseKR_Full)
+			return true;
+	} else {
+		if (pdata->phy.speed == SPEED_10000)
+			return true;
+	}
+
+	return false;
+}
+
+static bool xgbe_use_gmii_2500_mode(struct xgbe_prv_data *pdata)
+{
+	if (pdata->phy.autoneg == AUTONEG_ENABLE) {
+		if (pdata->phy.advertising & ADVERTISED_2500baseX_Full)
+			return true;
+	} else {
+		if (pdata->phy.speed == SPEED_2500)
+			return true;
+	}
+
+	return false;
+}
+
+static bool xgbe_use_gmii_mode(struct xgbe_prv_data *pdata)
+{
+	if (pdata->phy.autoneg == AUTONEG_ENABLE) {
+		if (pdata->phy.advertising & ADVERTISED_1000baseKX_Full)
+			return true;
+	} else {
+		if (pdata->phy.speed == SPEED_1000)
+			return true;
+	}
+
+	return false;
+}
+
 static void xgbe_set_an(struct xgbe_prv_data *pdata, bool enable, bool restart)
 {
 	unsigned int reg;
@@ -1108,11 +1147,11 @@ static int xgbe_phy_start(struct xgbe_prv_data *pdata)
 	/* Set initial mode - call the mode setting routines
 	 * directly to insure we are properly configured
 	 */
-	if (pdata->phy.advertising & ADVERTISED_10000baseKR_Full) {
+	if (xgbe_use_xgmii_mode(pdata)) {
 		xgbe_xgmii_mode(pdata);
-	} else if (pdata->phy.advertising & ADVERTISED_1000baseKX_Full) {
+	} else if (xgbe_use_gmii_mode(pdata)) {
 		xgbe_gmii_mode(pdata);
-	} else if (pdata->phy.advertising & ADVERTISED_2500baseX_Full) {
+	} else if (xgbe_use_gmii_2500_mode(pdata)) {
 		xgbe_gmii_2500_mode(pdata);
 	} else {
 		ret = -EINVAL;

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

* [PATCH net-next v1 3/3] amd-xgbe: Add more netif_dbg output to the driver
  2015-05-22 21:32 [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 Tom Lendacky
  2015-05-22 21:32 ` [PATCH net-next v1 1/3] amd-xgbe: Add setting of a missing hardware feature Tom Lendacky
  2015-05-22 21:32 ` [PATCH net-next v1 2/3] amd-xgbe: Fix initial mode when auto-negotiation is disabled Tom Lendacky
@ 2015-05-22 21:32 ` Tom Lendacky
  2015-05-25  4:14 ` [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Tom Lendacky @ 2015-05-22 21:32 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

Change more netdev_dbg statements over to netif_dbg and add some new
netif_dbg statements to the driver.

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

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index 8b86d94..9088c3a 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -185,8 +185,8 @@ static void xgbe_serdes_complete_ratechange(struct xgbe_prv_data *pdata)
 			goto rx_reset;
 	}
 
-	netdev_dbg(pdata->netdev, "SerDes rx/tx not ready (%#hx)\n",
-		   status);
+	netif_dbg(pdata, link, pdata->netdev, "SerDes rx/tx not ready (%#hx)\n",
+		  status);
 
 rx_reset:
 	/* Perform Rx reset for the DFE changes */
@@ -238,6 +238,8 @@ static void xgbe_xgmii_mode(struct xgbe_prv_data *pdata)
 		      pdata->serdes_dfe_tap_ena[XGBE_SPEED_10000]);
 
 	xgbe_serdes_complete_ratechange(pdata);
+
+	netif_dbg(pdata, link, pdata->netdev, "10GbE KR mode set\n");
 }
 
 static void xgbe_gmii_2500_mode(struct xgbe_prv_data *pdata)
@@ -284,6 +286,8 @@ static void xgbe_gmii_2500_mode(struct xgbe_prv_data *pdata)
 		      pdata->serdes_dfe_tap_ena[XGBE_SPEED_2500]);
 
 	xgbe_serdes_complete_ratechange(pdata);
+
+	netif_dbg(pdata, link, pdata->netdev, "2.5GbE KX mode set\n");
 }
 
 static void xgbe_gmii_mode(struct xgbe_prv_data *pdata)
@@ -330,6 +334,8 @@ static void xgbe_gmii_mode(struct xgbe_prv_data *pdata)
 		      pdata->serdes_dfe_tap_ena[XGBE_SPEED_1000]);
 
 	xgbe_serdes_complete_ratechange(pdata);
+
+	netif_dbg(pdata, link, pdata->netdev, "1GbE KX mode set\n");
 }
 
 static void xgbe_cur_mode(struct xgbe_prv_data *pdata,
@@ -434,11 +440,15 @@ static void xgbe_set_an(struct xgbe_prv_data *pdata, bool enable, bool restart)
 static void xgbe_restart_an(struct xgbe_prv_data *pdata)
 {
 	xgbe_set_an(pdata, true, true);
+
+	netif_dbg(pdata, link, pdata->netdev, "AN enabled/restarted\n");
 }
 
 static void xgbe_disable_an(struct xgbe_prv_data *pdata)
 {
 	xgbe_set_an(pdata, false, false);
+
+	netif_dbg(pdata, link, pdata->netdev, "AN disabled\n");
 }
 
 static enum xgbe_an xgbe_an_tx_training(struct xgbe_prv_data *pdata,
@@ -473,6 +483,9 @@ static enum xgbe_an xgbe_an_tx_training(struct xgbe_prv_data *pdata,
 			    reg);
 
 		XSIR0_IOWRITE_BITS(pdata, SIR0_KR_RT_1, RESET, 0);
+
+		netif_dbg(pdata, link, pdata->netdev,
+			  "KR training initiated\n");
 	}
 
 	return XGBE_AN_PAGE_RECEIVED;
@@ -551,6 +564,9 @@ static enum xgbe_an xgbe_an_page_received(struct xgbe_prv_data *pdata)
 			pdata->kx_state = XGBE_RX_BPA;
 
 			pdata->an_start = jiffies;
+
+			netif_dbg(pdata, link, pdata->netdev,
+				  "AN timed out, resetting state\n");
 		}
 	}
 
@@ -608,6 +624,8 @@ static irqreturn_t xgbe_an_isr(int irq, void *data)
 {
 	struct xgbe_prv_data *pdata = (struct xgbe_prv_data *)data;
 
+	netif_dbg(pdata, intr, pdata->netdev, "AN interrupt received\n");
+
 	/* Interrupt reason must be read and cleared outside of IRQ context */
 	disable_irq_nosync(pdata->an_irq);
 
@@ -629,6 +647,26 @@ static void xgbe_an_irq_work(struct work_struct *work)
 	queue_work(pdata->an_workqueue, &pdata->an_work);
 }
 
+static const char *xgbe_state_as_string(enum xgbe_an state)
+{
+	switch (state) {
+	case XGBE_AN_READY:
+		return "Ready";
+	case XGBE_AN_PAGE_RECEIVED:
+		return "Page-Received";
+	case XGBE_AN_INCOMPAT_LINK:
+		return "Incompatible-Link";
+	case XGBE_AN_COMPLETE:
+		return "Complete";
+	case XGBE_AN_NO_LINK:
+		return "No-Link";
+	case XGBE_AN_ERROR:
+		return "Error";
+	default:
+		return "Undefined";
+	}
+}
+
 static void xgbe_an_state_machine(struct work_struct *work)
 {
 	struct xgbe_prv_data *pdata = container_of(work,
@@ -666,6 +704,9 @@ next_int:
 	pdata->an_result = pdata->an_state;
 
 again:
+	netif_dbg(pdata, link, pdata->netdev, "AN %s\n",
+		  xgbe_state_as_string(pdata->an_state));
+
 	cur_state = pdata->an_state;
 
 	switch (pdata->an_state) {
@@ -686,9 +727,9 @@ again:
 
 	case XGBE_AN_COMPLETE:
 		pdata->parallel_detect = pdata->an_supported ? 0 : 1;
-		netdev_dbg(pdata->netdev, "%s successful\n",
-			   pdata->an_supported ? "Auto negotiation"
-					       : "Parallel detection");
+		netif_dbg(pdata, link, pdata->netdev, "%s successful\n",
+			  pdata->an_supported ? "Auto negotiation"
+					      : "Parallel detection");
 		break;
 
 	case XGBE_AN_NO_LINK:
@@ -716,6 +757,9 @@ again:
 		pdata->kr_state = XGBE_RX_BPA;
 		pdata->kx_state = XGBE_RX_BPA;
 		pdata->an_start = 0;
+
+		netif_dbg(pdata, link, pdata->netdev, "AN result: %s\n",
+			  xgbe_state_as_string(pdata->an_result));
 	}
 
 	if (cur_state != pdata->an_state)
@@ -774,6 +818,8 @@ static void xgbe_an_init(struct xgbe_prv_data *pdata)
 	reg &= ~XGBE_XNP_NP_EXCHANGE;
 
 	XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg);
+
+	netif_dbg(pdata, link, pdata->netdev, "AN initialized\n");
 }
 
 static const char *xgbe_phy_fc_string(struct xgbe_prv_data *pdata)
@@ -858,6 +904,8 @@ static void xgbe_phy_adjust_link(struct xgbe_prv_data *pdata)
 
 static int xgbe_phy_config_fixed(struct xgbe_prv_data *pdata)
 {
+	netif_dbg(pdata, link, pdata->netdev, "fixed PHY configuration\n");
+
 	/* Disable auto-negotiation */
 	xgbe_disable_an(pdata);
 
@@ -891,6 +939,8 @@ static int __xgbe_phy_config_aneg(struct xgbe_prv_data *pdata)
 	if (pdata->phy.autoneg != AUTONEG_ENABLE)
 		return xgbe_phy_config_fixed(pdata);
 
+	netif_dbg(pdata, link, pdata->netdev, "AN PHY configuration\n");
+
 	/* Disable auto-negotiation interrupt */
 	disable_irq(pdata->an_irq);
 
@@ -955,8 +1005,10 @@ static void xgbe_check_link_timeout(struct xgbe_prv_data *pdata)
 	unsigned long link_timeout;
 
 	link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ);
-	if (time_after(jiffies, link_timeout))
+	if (time_after(jiffies, link_timeout)) {
+		netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n");
 		xgbe_phy_config_aneg(pdata);
+	}
 }
 
 static void xgbe_phy_status_force(struct xgbe_prv_data *pdata)
@@ -1116,6 +1168,8 @@ adjust_link:
 
 static void xgbe_phy_stop(struct xgbe_prv_data *pdata)
 {
+	netif_dbg(pdata, link, pdata->netdev, "stopping PHY\n");
+
 	/* Disable auto-negotiation */
 	xgbe_disable_an(pdata);
 
@@ -1136,6 +1190,8 @@ static int xgbe_phy_start(struct xgbe_prv_data *pdata)
 	struct net_device *netdev = pdata->netdev;
 	int ret;
 
+	netif_dbg(pdata, link, pdata->netdev, "starting PHY\n");
+
 	ret = devm_request_irq(pdata->dev, pdata->an_irq,
 			       xgbe_an_isr, 0, pdata->an_name,
 			       pdata);

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

* Re: [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22
  2015-05-22 21:32 [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 Tom Lendacky
                   ` (2 preceding siblings ...)
  2015-05-22 21:32 ` [PATCH net-next v1 3/3] amd-xgbe: Add more netif_dbg output to the driver Tom Lendacky
@ 2015-05-25  4:14 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-05-25  4:14 UTC (permalink / raw)
  To: thomas.lendacky; +Cc: netdev

From: Tom Lendacky <thomas.lendacky@amd.com>
Date: Fri, 22 May 2015 16:32:03 -0500

> The following patches are included in this driver update series:
> 
> - Retrieve and set an additional hardware feature setting
> - Fix the initial mode/speed determination when auto-negotiation is
>   disabled
> - Add additional netif_dbg support to the driver
> 
> This patch series is based on net-next.

Series applied, thank you.

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

end of thread, other threads:[~2015-05-25  4:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-22 21:32 [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 Tom Lendacky
2015-05-22 21:32 ` [PATCH net-next v1 1/3] amd-xgbe: Add setting of a missing hardware feature Tom Lendacky
2015-05-22 21:32 ` [PATCH net-next v1 2/3] amd-xgbe: Fix initial mode when auto-negotiation is disabled Tom Lendacky
2015-05-22 21:32 ` [PATCH net-next v1 3/3] amd-xgbe: Add more netif_dbg output to the driver Tom Lendacky
2015-05-25  4:14 ` [PATCH net-next v1 0/3] amd-xgbe: AMD XGBE driver updates 2015-05-22 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.