Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Dec 2008 00:23:12 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r185498 - in stable/7/sys/dev/cxgb: . common ulp/tom
Message-ID:  <200812010023.mB10NCY8006640@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Mon Dec  1 00:23:12 2008
New Revision: 185498
URL: http://svn.freebsd.org/changeset/base/185498

Log:
  MFC 183967, 184861, 185157
  
  183967:
  Track number of packets transmitted and number of packets received
  PR:   125806
  
  184861:
  Update firmware version check
   make ddp a tunable
  
   Obtained from:        Chelsio Inc.
  
  185157:
   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.
  
  Approved by:	re

Modified:
  stable/7/sys/dev/cxgb/common/cxgb_ael1002.c
  stable/7/sys/dev/cxgb/common/cxgb_common.h
  stable/7/sys/dev/cxgb/common/cxgb_ctl_defs.h
  stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c
  stable/7/sys/dev/cxgb/cxgb_main.c
  stable/7/sys/dev/cxgb/cxgb_sge.c
  stable/7/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
  stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom.c
  stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c

Modified: stable/7/sys/dev/cxgb/common/cxgb_ael1002.c
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_ael1002.c	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/common/cxgb_ael1002.c	Mon Dec  1 00:23:12 2008	(r185498)
@@ -195,7 +195,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: stable/7/sys/dev/cxgb/common/cxgb_common.h
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_common.h	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/common/cxgb_common.h	Mon Dec  1 00:23:12 2008	(r185498)
@@ -41,6 +41,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 */
@@ -342,6 +343,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: stable/7/sys/dev/cxgb/common/cxgb_ctl_defs.h
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_ctl_defs.h	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/common/cxgb_ctl_defs.h	Mon Dec  1 00:23:12 2008	(r185498)
@@ -85,7 +85,7 @@ struct ddp_params {
 
 struct adap_ports {
 	unsigned int nports;     /* number of ports on this adapter */
-	struct net_device *lldevs[2];
+	struct net_device *lldevs[MAX_NPORTS];
 };
 
 /*

Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c	Mon Dec  1 00:23:12 2008	(r185498)
@@ -554,7 +554,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 */
@@ -699,6 +699,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]) {
@@ -743,7 +744,8 @@ enum {
 	SF_ERASE_SECTOR = 0xd8,    /* erase sector */
 
 	FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */
-	FW_VERS_ADDR = 0x77ffc,    /* flash address holding FW version */
+	OLD_FW_VERS_ADDR = 0x77ffc,   /* flash address holding FW version */
+	FW_VERS_ADDR = 0x7fffc,    /* flash address holding FW version */
 	FW_MIN_SIZE = 8,           /* at least version and csum */
 	FW_MAX_SIZE = FW_VERS_ADDR - FW_FLASH_BOOT_ADDR,
 
@@ -1030,7 +1032,12 @@ enum fw_version_type {
  */
 int t3_get_fw_version(adapter_t *adapter, u32 *vers)
 {
-	return t3_read_flash(adapter, FW_VERS_ADDR, 1, vers, 0);
+	int ret = t3_read_flash(adapter, FW_VERS_ADDR, 1, vers, 0);
+
+	if (!ret && *vers != 0xffffffff)
+		return 0;
+	else
+		return t3_read_flash(adapter, OLD_FW_VERS_ADDR, 1, vers, 0);
 }
 
 /**

Modified: stable/7/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- stable/7/sys/dev/cxgb/cxgb_main.c	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/cxgb_main.c	Mon Dec  1 00:23:12 2008	(r185498)
@@ -232,6 +232,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,
@@ -375,7 +384,8 @@ cxgb_controller_probe(device_t dev)
 	const struct adapter_info *ai;
 	char *ports, buf[80];
 	int nports;
-	
+	struct adapter *sc = device_get_softc(dev);
+
 	ai = cxgb_get_adapter_info(dev);
 	if (ai == NULL)
 		return (ENXIO);
@@ -386,7 +396,9 @@ cxgb_controller_probe(device_t dev)
 	else
 		ports = "ports";
 
-	snprintf(buf, sizeof(buf), "%s RNIC, %d %s", ai->desc, nports, ports);
+	snprintf(buf, sizeof(buf), "%s %sNIC, rev: %d nports: %d %s",
+		 ai->desc, is_offload(sc) ? "R" : "",
+		 sc->params.rev, nports, ports);
 	device_set_desc_copy(dev, buf);
 	return (BUS_PROBE_DEFAULT);
 }
@@ -432,6 +444,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;
@@ -644,6 +658,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);
@@ -954,7 +973,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);
 

Modified: stable/7/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- stable/7/sys/dev/cxgb/cxgb_sge.c	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/cxgb_sge.c	Mon Dec  1 00:23:12 2008	(r185498)
@@ -1889,7 +1889,11 @@ t3_free_tx_desc(struct sge_txq *q, int r
 			m_freem_iovec(&txsd->mi);	
 			buf_ring_scan(&q->txq_mr, txsd->mi.mi_base, __FILE__, __LINE__);
 			txsd->mi.mi_base = NULL;
-
+			/*
+			 * XXX check for cache hit rate here
+			 *
+			 */
+			q->port->ifp->if_opackets++;
 #if defined(DIAGNOSTIC) && 0
 			if (m_get_priority(txsd->m[0]) != cidx) 
 				printf("pri=%d cidx=%d\n",
@@ -2511,6 +2515,7 @@ t3_rx_eth(struct adapter *adap, struct s
 	
 	m->m_pkthdr.rcvif = ifp;
 	m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad;
+	ifp->if_ipackets++;
 #ifndef DISABLE_MBUF_IOVEC
 	m_explode(m);
 #endif	

Modified: stable/7/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
==============================================================================
--- stable/7/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c	Mon Dec  1 00:23:12 2008	(r185498)
@@ -3448,9 +3448,7 @@ process_pass_accept_req(struct socket *s
 				V_TF_DDP_OFF(1) |
 		    TP_DDP_TIMER_WORKAROUND_VAL, 1);
 	} else
-		printf("not offloading\n");
-	
-	
+		DPRINTF("no DDP\n");
 
 	return;
 reject:

Modified: stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom.c
==============================================================================
--- stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom.c	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom.c	Mon Dec  1 00:23:12 2008	(r185498)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/condvar.h>
 #include <sys/mutex.h>
 #include <sys/socket.h>
-#include <sys/sysctl.h>
 #include <sys/syslog.h>
 #include <sys/taskqueue.h>
 
@@ -90,17 +89,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/cxgb/ulp/tom/cxgb_toepcb.h>
 #include <dev/cxgb/ulp/tom/cxgb_tcp.h>
 
-
-
-
-
-static int activated = 1;
-TUNABLE_INT("hw.t3toe.activated", &activated);
-SYSCTL_NODE(_hw, OID_AUTO, t3toe, CTLFLAG_RD, 0, "T3 toe driver parameters");
-SYSCTL_UINT(_hw_t3toe, OID_AUTO, activated, CTLFLAG_RDTUN, &activated, 0,
-    "enable TOE at init time");
-
-
 TAILQ_HEAD(, adapter) adapter_list;
 static struct rwlock adapter_list_lock;
 
@@ -913,7 +901,7 @@ do_act_establish(struct t3cdev *dev, str
 	} else {
 	
 		log(LOG_ERR, "%s: received clientless CPL command 0x%x\n",
-			dev->name, CPL_PASS_ACCEPT_REQ);
+			dev->name, CPL_ACT_ESTABLISH);
 		return CPL_RET_BUF_DONE | CPL_RET_BAD_MSG;
 	}
 }
@@ -1335,8 +1323,6 @@ t3_toe_attach(struct toedev *dev, const 
 	t3_init_tunables(t);
 	mtx_init(&t->listen_lock, "tom data listeners", NULL, MTX_DEF);
 	CTR2(KTR_TOM, "t3_toe_attach dev=%p entry=%p", dev, entry);
-	/* Adjust TOE activation for this module */
-	t->conf.activated = activated;
 
 	dev->tod_can_offload = can_offload;
 	dev->tod_connect = t3_connect;

Modified: stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c
==============================================================================
--- stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c	Mon Dec  1 00:07:17 2008	(r185497)
+++ stable/7/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c	Mon Dec  1 00:23:12 2008	(r185498)
@@ -76,6 +76,10 @@ __FBSDID("$FreeBSD$");
 #include <dev/cxgb/ulp/tom/cxgb_defs.h>
 #include <dev/cxgb/ulp/tom/cxgb_t3_ddp.h>
 
+/* Avoid clutter in the hw.* space, keep all toe tunables within hw.cxgb */
+SYSCTL_DECL(_hw_cxgb);
+SYSCTL_NODE(_hw_cxgb, OID_AUTO, toe, CTLFLAG_RD, 0, "TOE parameters");
+
 static struct tom_tunables default_tunable_vals = {
 	.max_host_sndbuf = 32 * 1024,
 	.tx_hold_thres = 0,
@@ -100,11 +104,24 @@ static struct tom_tunables default_tunab
 	.activated = 1,
 };
 
+static int activated = 1;
+TUNABLE_INT("hw.cxgb.toe.activated", &activated);
+SYSCTL_UINT(_hw_cxgb_toe, OID_AUTO, activated, CTLFLAG_RDTUN, &activated, 0,
+    "enable TOE at init time");
+
+static int ddp = 1;
+TUNABLE_INT("hw.cxgb.toe.ddp", &ddp);
+SYSCTL_UINT(_hw_cxgb_toe, OID_AUTO, ddp, CTLFLAG_RDTUN, &ddp, 0, "enable DDP");
+
 void
 t3_init_tunables(struct tom_data *t)
 {
 	t->conf = default_tunable_vals;
 
+	/* Adjust tunables */
+	t->conf.activated = activated;
+	t->conf.ddp = ddp;
+
 	/* Now apply device specific fixups. */
 	t->conf.mss = T3C_DATA(t->cdev)->tx_max_chunk;
 	t->conf.max_wrs = T3C_DATA(t->cdev)->max_wrs;



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