Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Dec 2008 19:36:50 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r185806 - in releng/7.1/sys/dev/cxgb: . common
Message-ID:  <200812091936.mB9JaoOo099708@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gnn
Date: Tue Dec  9 19:36:50 2008
New Revision: 185806
URL: http://svn.freebsd.org/changeset/base/185806

Log:
  MFC of 3 separate commits.
  
  Bug fix from Chelsio which addresses the issue of the device resetting
  when it sees only received packets.  In some cases where a device only
  recieves data it mistakenly thinks that its transmitting side is broken
  and resets the device.
  
  Fix a bug with the ael1006 PHY.  The bug shows up as persistent but incomplete
  packet loss, of between 10-30%. The fix is to put the PHY into
  and take it out of local loopback mode when resetting the interface.
  
  Bug fix to support N310 version of Chelsio cards (board ID 1088).
  
  Obtained from:	Chelsio Inc.
  Approved by:	re@

Modified:
  releng/7.1/sys/dev/cxgb/   (props changed)
  releng/7.1/sys/dev/cxgb/common/cxgb_ael1002.c
  releng/7.1/sys/dev/cxgb/common/cxgb_t3_hw.c
  releng/7.1/sys/dev/cxgb/common/cxgb_xgmac.c
  releng/7.1/sys/dev/cxgb/cxgb_main.c

Modified: releng/7.1/sys/dev/cxgb/common/cxgb_ael1002.c
==============================================================================
--- releng/7.1/sys/dev/cxgb/common/cxgb_ael1002.c	Tue Dec  9 19:36:04 2008	(r185805)
+++ releng/7.1/sys/dev/cxgb/common/cxgb_ael1002.c	Tue Dec  9 19:36:50 2008	(r185806)
@@ -195,7 +195,31 @@ int t3_ael1002_phy_prep(struct cphy *phy
 
 static int ael1006_reset(struct cphy *phy, int wait)
 {
-	return t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
+	u32 gpio_out;
+	t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
+	/* Hack to reset the phy correctly */
+	/* Read out the current value */
+	gpio_out = t3_read_reg(phy->adapter, A_T3DBG_GPIO_EN);
+	/* Reset the phy */
+	gpio_out &= ~F_GPIO6_OUT_VAL;
+	t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); 
+	msleep(125);
+	/* Take the phy out of reset */
+	gpio_out |= F_GPIO6_OUT_VAL;
+	t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out);
+	msleep(125);
+	t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
+
+       /* Phy loopback work around for ael1006 */
+       /* Soft reset phy by toggling loopback  */
+       msleep(125);
+       /* Put phy into local loopback */
+       t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 0, 1);
+       msleep(125);
+       /* Take phy out of local loopback */
+       t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0);
+
+	return 0;
 }
 
 static int ael1006_power_down(struct cphy *phy, int enable)

Modified: releng/7.1/sys/dev/cxgb/common/cxgb_t3_hw.c
==============================================================================
--- releng/7.1/sys/dev/cxgb/common/cxgb_t3_hw.c	Tue Dec  9 19:36:04 2008	(r185805)
+++ releng/7.1/sys/dev/cxgb/common/cxgb_t3_hw.c	Tue Dec  9 19:36:50 2008	(r185806)
@@ -512,6 +512,12 @@ static struct adapter_info t3_adap_info[
 	  F_GPIO6_OUT_VAL | F_GPIO7_OUT_VAL,
 	  { S_GPIO1, S_GPIO2, S_GPIO3, S_GPIO4 }, SUPPORTED_AUI,
 	  &mi1_mdio_ops, "Chelsio T304" },
+	{ 0 },
+	{ 1, 0, 0, 0, 0,
+	  F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN |
+	  F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
+	  { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
+	  &mi1_mdio_ext_ops, "Chelsio N310" }
 };
 
 /*

Modified: releng/7.1/sys/dev/cxgb/common/cxgb_xgmac.c
==============================================================================
--- releng/7.1/sys/dev/cxgb/common/cxgb_xgmac.c	Tue Dec  9 19:36:04 2008	(r185805)
+++ releng/7.1/sys/dev/cxgb/common/cxgb_xgmac.c	Tue Dec  9 19:36:50 2008	(r185806)
@@ -637,20 +637,15 @@ int t3b2_mac_watchdog_task(struct cmac *
 	adapter_t *adap = mac->adapter;
 	struct mac_stats *s = &mac->stats;
 	unsigned int tx_mcnt = (unsigned int)s->tx_frames;
-	unsigned int rx_mcnt = (unsigned int)s->rx_frames;
-	unsigned int rx_xcnt;
 
 	if (mac->multiport) {
 	  tx_mcnt = t3_read_reg(adap, A_XGM_STAT_TX_FRAME_LOW);
-	  rx_mcnt = t3_read_reg(adap, A_XGM_STAT_RX_FRAMES_LOW);
 	} else {
 	  tx_mcnt = (unsigned int)s->tx_frames;
-	  rx_mcnt = (unsigned int)s->rx_frames;
 	}
 	status = 0;
 	tx_xcnt = 1; /* By default tx_xcnt is making progress*/
 	tx_tcnt = mac->tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt*/
-	rx_xcnt = 1; /* By default rx_xcnt is making progress*/
 	if (tx_mcnt == mac->tx_mcnt && mac->rx_pause == s->rx_pause) {
 		tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
 						A_XGM_TX_SPI4_SOP_EOP_CNT +
@@ -661,11 +656,11 @@ int t3b2_mac_watchdog_task(struct cmac *
 			tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
 			      	A_TP_PIO_DATA)));
 		} else {
-			goto rxcheck;
+			goto out;
 		}
 	} else {
 		mac->toggle_cnt = 0;
-		goto rxcheck;
+		goto out;
 	}
 
 	if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) {
@@ -678,22 +673,6 @@ int t3b2_mac_watchdog_task(struct cmac *
 		}
 	} else {
 		mac->toggle_cnt = 0;
-		goto rxcheck;
-	}
-
-rxcheck:
-	if (rx_mcnt != mac->rx_mcnt) {
-		rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
-						A_XGM_RX_SPI4_SOP_EOP_CNT +
-						mac->offset))) +
-						(s->rx_fifo_ovfl - mac->rx_ocnt);
-		mac->rx_ocnt = s->rx_fifo_ovfl;
-	} else
-		goto out;
-
-	if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0) {
-		if (!mac->multiport)
-		  status = 2;
 		goto out;
 	}
 
@@ -701,8 +680,6 @@ out:
 	mac->tx_tcnt = tx_tcnt;
 	mac->tx_xcnt = tx_xcnt;
 	mac->tx_mcnt = s->tx_frames;
-	mac->rx_xcnt = rx_xcnt;
-	mac->rx_mcnt = s->rx_frames;
 	mac->rx_pause = s->rx_pause;
 	if (status == 1) {
 		t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);

Modified: releng/7.1/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- releng/7.1/sys/dev/cxgb/cxgb_main.c	Tue Dec  9 19:36:04 2008	(r185805)
+++ releng/7.1/sys/dev/cxgb/cxgb_main.c	Tue Dec  9 19:36:50 2008	(r185806)
@@ -289,6 +289,7 @@ struct cxgb_ident {
 	{PCI_VENDOR_ID_CHELSIO, 0x0031, 3, "T3B20"},
 	{PCI_VENDOR_ID_CHELSIO, 0x0032, 1, "T3B02"},
 	{PCI_VENDOR_ID_CHELSIO, 0x0033, 4, "T3B04"},
+	{PCI_VENDOR_ID_CHELSIO, 0x0035, 6, "N310E"},
 	{0, 0, 0, NULL}
 };
 
@@ -472,12 +473,14 @@ cxgb_controller_attach(device_t dev)
 		return (ENXIO);
 	}
 	sc->udbs_rid = PCIR_BAR(2);
-	if ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
-           &sc->udbs_rid, RF_ACTIVE)) == NULL) {
+	sc->udbs_res = NULL;
+	if (is_offload(sc) &&
+	    ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+		   &sc->udbs_rid, RF_ACTIVE)) == NULL)) {
 		device_printf(dev, "Cannot allocate BAR region 1\n");
 		error = ENXIO;
 		goto out;
-       }
+	}
 
 	snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d",
 	    device_get_unit(dev));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812091936.mB9JaoOo099708>