svn commit: r185157 - in head/sys/dev/cxgb: . common

George V. Neville-Neil gnn at FreeBSD.org
Fri Nov 21 11:22:26 PST 2008


Author: gnn
Date: Fri Nov 21 19:22:25 2008
New Revision: 185157
URL: http://svn.freebsd.org/changeset/base/185157

Log:
  Several small additions to the Chelsio 10G driver.
  
  1) Fix a bug in dealing with the Alerus 1006 PHY which prevented the
  device from ever coming back up once it had been set to down.
  
  2) Add a kernel tunable (hw.cxgb.snd_queue_len) which makes it possible
  to give the device more than IFQ_MAXLEN entries in its send queue.  The
  default remains 50.
  
  3) Add code to place the card'd identification and serial number into
  its description (%desc) so that users can tell which card they have
  installed.

Modified:
  head/sys/dev/cxgb/common/cxgb_ael1002.c
  head/sys/dev/cxgb/common/cxgb_common.h
  head/sys/dev/cxgb/common/cxgb_t3_hw.c
  head/sys/dev/cxgb/cxgb_main.c

Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c
==============================================================================
--- head/sys/dev/cxgb/common/cxgb_ael1002.c	Fri Nov 21 18:15:39 2008	(r185156)
+++ head/sys/dev/cxgb/common/cxgb_ael1002.c	Fri Nov 21 19:22:25 2008	(r185157)
@@ -191,7 +191,21 @@ 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);
+	return 0;
 }
 
 static int ael1006_power_down(struct cphy *phy, int enable)

Modified: head/sys/dev/cxgb/common/cxgb_common.h
==============================================================================
--- head/sys/dev/cxgb/common/cxgb_common.h	Fri Nov 21 18:15:39 2008	(r185156)
+++ head/sys/dev/cxgb/common/cxgb_common.h	Fri Nov 21 19:22:25 2008	(r185157)
@@ -37,6 +37,7 @@ enum {
 	MAX_FRAME_SIZE = 10240, /* max MAC frame size, includes header + FCS */
 	EEPROMSIZE     = 8192,  /* Serial EEPROM size */
 	SERNUM_LEN     = 16,    /* Serial # length */
+	ECNUM_LEN      = 16,    /* EC # length */
 	RSS_TABLE_SIZE = 64,    /* size of RSS lookup and mapping tables */
 	TCB_SIZE       = 128,   /* TCB size */
 	NMTUS          = 16,    /* size of MTU table */
@@ -338,6 +339,7 @@ struct vpd_params {
 	unsigned int mdc;
 	unsigned int mem_timing;
 	u8 sn[SERNUM_LEN + 1];
+	u8 ec[ECNUM_LEN + 1];
 	u8 eth_base[6];
 	u8 port_type[MAX_NPORTS];
 	unsigned short xauicfg[2];

Modified: head/sys/dev/cxgb/common/cxgb_t3_hw.c
==============================================================================
--- head/sys/dev/cxgb/common/cxgb_t3_hw.c	Fri Nov 21 18:15:39 2008	(r185156)
+++ head/sys/dev/cxgb/common/cxgb_t3_hw.c	Fri Nov 21 19:22:25 2008	(r185157)
@@ -551,7 +551,7 @@ struct t3_vpd {
 	u8  vpdr_tag;
 	u8  vpdr_len[2];
 	VPD_ENTRY(pn, 16);                     /* part number */
-	VPD_ENTRY(ec, 16);                     /* EC level */
+	VPD_ENTRY(ec, ECNUM_LEN);              /* EC level */
 	VPD_ENTRY(sn, SERNUM_LEN);             /* serial number */
 	VPD_ENTRY(na, 12);                     /* MAC address base */
 	VPD_ENTRY(cclk, 6);                    /* core clock */
@@ -696,6 +696,7 @@ static int get_vpd_params(adapter_t *ada
 	p->mdc = simple_strtoul(vpd.mdc_data, NULL, 10);
 	p->mem_timing = simple_strtoul(vpd.mt_data, NULL, 10);
 	memcpy(p->sn, vpd.sn_data, SERNUM_LEN);
+	memcpy(p->ec, vpd.ec_data, ECNUM_LEN);
 
 	/* Old eeproms didn't have port information */
 	if (adapter->params.rev == 0 && !vpd.port0_data[0]) {

Modified: head/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_main.c	Fri Nov 21 18:15:39 2008	(r185156)
+++ head/sys/dev/cxgb/cxgb_main.c	Fri Nov 21 19:22:25 2008	(r185157)
@@ -228,6 +228,15 @@ TUNABLE_INT("hw.cxgb.use_16k_clusters", 
 SYSCTL_UINT(_hw_cxgb, OID_AUTO, use_16k_clusters, CTLFLAG_RDTUN,
     &cxgb_use_16k_clusters, 0, "use 16kB clusters for the jumbo queue ");
 
+/*
+ * Tune the size of the output queue.
+ */
+int cxgb_snd_queue_len = IFQ_MAXLEN;
+TUNABLE_INT("hw.cxgb.snd_queue_len", &cxgb_snd_queue_len);
+SYSCTL_UINT(_hw_cxgb, OID_AUTO, snd_queue_len, CTLFLAG_RDTUN,
+    &cxgb_snd_queue_len, 0, "send queue size ");
+
+
 enum {
 	MAX_TXQ_ENTRIES      = 16384,
 	MAX_CTRL_TXQ_ENTRIES = 1024,
@@ -359,8 +368,8 @@ cxgb_controller_probe(device_t dev)
 		ports = "ports";
 
 	snprintf(buf, sizeof(buf), "%s %sNIC, rev: %d nports: %d %s",
-	    ai->desc, is_offload(sc) ? "R" : "",
-	    sc->params.rev, nports, ports);
+		 ai->desc, is_offload(sc) ? "R" : "",
+		 sc->params.rev, nports, ports);
 	device_set_desc_copy(dev, buf);
 	return (BUS_PROBE_DEFAULT);
 }
@@ -406,6 +415,8 @@ cxgb_controller_attach(device_t dev)
 	int msi_needed, reg;
 #endif
 	int must_load = 0;
+	char buf[80];
+
 	sc = device_get_softc(dev);
 	sc->dev = dev;
 	sc->msi_count = 0;
@@ -618,6 +629,11 @@ cxgb_controller_attach(device_t dev)
 	    G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers),
 	    G_FW_VERSION_MICRO(vers));
 
+	snprintf(buf, sizeof(buf), "%s\t E/C: %s S/N: %s", 
+		 ai->desc,
+		 sc->params.vpd.ec, sc->params.vpd.sn);
+	device_set_desc_copy(dev, buf);
+
 	device_printf(sc->dev, "Firmware Version %s\n", &sc->fw_version[0]);
 	callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc);
 	t3_add_attach_sysctls(sc);
@@ -934,7 +950,7 @@ cxgb_port_attach(device_t dev)
 	ifp->if_timer = 0;	/* Disable ifnet watchdog */
 	ifp->if_watchdog = NULL;
 
-	ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
+	ifp->if_snd.ifq_drv_maxlen = cxgb_snd_queue_len;
 	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
 	IFQ_SET_READY(&ifp->if_snd);
 


More information about the svn-src-all mailing list