Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Feb 2008 23:51:44 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135131 for review
Message-ID:  <200802092351.m19NpiKI009542@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135131

Change 135131 by kmacy@kmacy:storage:toehead on 2008/02/09 23:50:52

	remove some dead code and substantially reduce debugging noise converting to KTR entries where appropriate

Affected files ...

.. //depot/projects/toehead/sys/dev/cxgb/cxgb_l2t.c#5 edit
.. //depot/projects/toehead/sys/dev/cxgb/cxgb_l2t.h#3 edit
.. //depot/projects/toehead/sys/dev/cxgb/cxgb_main.c#8 edit
.. //depot/projects/toehead/sys/dev/cxgb/cxgb_offload.c#7 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#18 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#19 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_ddp.c#9 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_listen.c#3 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_tom.c#9 edit

Differences ...

==== //depot/projects/toehead/sys/dev/cxgb/cxgb_l2t.c#5 (text+ko) ====

@@ -175,11 +175,8 @@
 	sin.sin_family = AF_INET;
 	sin.sin_len = sizeof(struct sockaddr_in);
 	sin.sin_addr.s_addr = e->addr;
-	
-	
-	
-	printf("send slow on rt=%p eaddr=0x%08x\n", rt, e->addr);
-	
+
+	CTR2(KTR_CXGB, "send slow on rt=%p eaddr=0x%08x\n", rt, e->addr);
 again:
 	switch (e->state) {
 	case L2T_STATE_STALE:     /* entry is stale, kick off revalidation */
@@ -199,8 +196,6 @@
 		}
 		arpq_enqueue(e, m);
 		mtx_unlock(&e->lock);
-		printf("enqueueing arp request\n");
-		
 		/*
 		 * Only the first packet added to the arpq should kick off
 		 * resolution.  However, because the m_gethdr below can fail,
@@ -209,10 +204,9 @@
 		 * A better way would be to use a work request to retry L2T
 		 * entries when there's no memory.
 		 */
-		printf("doing arpresolve on 0x%x \n", e->addr);
 		if (arpresolve(rt->rt_ifp, rt, NULL,
 		     (struct sockaddr *)&sin, e->dmac) == 0) {
-			printf("mac=%x:%x:%x:%x:%x:%x\n",
+			CTR6(KTR_CXGB, "mac=%x:%x:%x:%x:%x:%x\n",
 			    e->dmac[0], e->dmac[1], e->dmac[2], e->dmac[3], e->dmac[4], e->dmac[5]);
 			
 			if ((m = m_gethdr(M_NOWAIT, MT_DATA)) == NULL)
@@ -396,8 +390,6 @@
 	/* Need to allocate a new entry */
 	e = alloc_l2e(d);
 	if (e) {
-		printf("initializing new entry\n");
-		
 		mtx_lock(&e->lock);          /* avoid race with t3_l2t_free */
 		e->next = d->l2tab[hash].first;
 		d->l2tab[hash].first = e;
@@ -472,8 +464,6 @@
 	int hash = arp_hash(addr, ifidx, d);
 	struct llinfo_arp *la;
 
-	printf("t3_l2t_update called with arp info\n");
-	
 	rw_rlock(&d->lock);
 	for (e = d->l2tab[hash].first; e; e = e->next)
 		if (e->addr == addr && e->ifindex == ifidx) {
@@ -481,7 +471,7 @@
 			goto found;
 		}
 	rw_runlock(&d->lock);
-	printf("addr=0x%08x not found\n", addr);
+	CTR1(KTR_CXGB, "t3_l2t_update: addr=0x%08x not found", addr);
 	return;
 
 found:

==== //depot/projects/toehead/sys/dev/cxgb/cxgb_l2t.h#3 (text+ko) ====

@@ -143,8 +143,6 @@
 	if (__predict_true(e->state == L2T_STATE_VALID)) {
 		return cxgb_ofld_send(dev, (struct mbuf *)m);
 	}
-	printf("send slow\n");
-	
 	return t3_l2t_send_slow(dev, (struct mbuf *)m, e);
 }
 

==== //depot/projects/toehead/sys/dev/cxgb/cxgb_main.c#8 (text+ko) ====

@@ -825,8 +825,6 @@
 				return (EINVAL);
 			}
 			sc->msix_irq_rid[k] = rid;
-			printf("setting up interrupt for port=%d\n",
-			    qs->port->port_id);
 			if (bus_setup_intr(sc->dev, sc->msix_irq_res[k],
 				INTR_MPSAFE|INTR_TYPE_NET,
 #ifdef INTR_FILTERS
@@ -1536,7 +1534,6 @@
 	t3_intr_enable(sc);
 
 	if (!(sc->flags & QUEUES_BOUND)) {
-		printf("bind qsets\n");
 		bind_qsets(sc);
 		sc->flags |= QUEUES_BOUND;		
 	}
@@ -1601,7 +1598,7 @@
 	int adap_up = adapter->open_device_map & PORT_MASK;
 	int err = 0;
 
-	printf("device_map=0x%x\n", adapter->open_device_map); 
+	CTR1(KTR_CXGB, "device_map=0x%x", adapter->open_device_map); 
 	if (atomic_cmpset_int(&adapter->open_device_map,
 		(adapter->open_device_map & ~(1<<OFFLOAD_DEVMAP_BIT)),
 		(adapter->open_device_map | (1<<OFFLOAD_DEVMAP_BIT))) == 0)
@@ -1707,8 +1704,6 @@
 		if (err)
 			log(LOG_WARNING,
 			    "Could not initialize offload capabilities\n");
-		else
-			printf("offload opened\n");
 	}
 	cxgb_link_start(p);
 	t3_link_changed(sc, p->port_id);

==== //depot/projects/toehead/sys/dev/cxgb/cxgb_offload.c#7 (text+ko) ====

@@ -105,16 +105,12 @@
 	TAILQ_INSERT_TAIL(&client_list, client, client_entry);
 
 	if (client->add) {
-		printf("client->add set\n");
-		
 		TAILQ_FOREACH(tdev, &ofld_dev_list, entry) {
 			if (offload_activated(tdev)) {
-				printf("calling add=%p on %p\n",
-				    client->add, tdev);
-				
 				client->add(tdev);
 			} else
-				printf("%p not activated\n", tdev);
+				CTR1(KTR_CXGB,
+				    "cxgb_register_client: %p not activated\n", tdev);
 			
 		}
 	}
@@ -635,7 +631,7 @@
 		m = m_get(M_NOWAIT, MT_DATA);
 		if (__predict_true(m != NULL)) {
 			mk_tid_release(m, tid);
-			printf("sending tid release\n");
+			CTR1(KTR_CXGB, "releasing tid=%u", tid);
 			
 			cxgb_ofld_send(tdev, m);
 			t->tid_tab[tid].ctx = NULL;
@@ -1302,7 +1298,7 @@
 			log(LOG_ERR, "Unable to set offload capabilities\n");
 #endif
 	}
-	printf("adding adapter %p\n", adapter); 
+	CTR1(KTR_CXGB, "adding adapter %p", adapter); 
 	add_adapter(adapter);
 	device_printf(adapter->dev, "offload started\n");
 #if 0

==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#18 (text+ko) ====

@@ -3187,23 +3187,12 @@
 	newtoep->tp_toedev = tdev;
 	tp->rcv_wnd = select_rcv_wnd(tdev, so);
 	
-	printf("inserting tid=%d rcv_wnd=%ld\n", tid, tp->rcv_wnd);
 	cxgb_insert_tid(cdev, d->client, newtoep, tid);
 	SOCK_LOCK(so);
 	LIST_INSERT_HEAD(&lctx->synq_head, newtoep, synq_entry);
 	SOCK_UNLOCK(so);
 	
-#ifdef notyet	
-	if (lctx->ulp_mode) {
-		ddp_mbuf = m_gethdr(M_NOWAIT, MT_DATA);
-		
-		if (!ddp_mbuf)
-			newtoep->tp_ulp_mode = 0;
-		else
-			newtoep->tp_ulp_mode = lctx->ulp_mode;
-	}
-#else
-	newtoep->tp_ulp_mode = TOM_TUNABLE(tdev, ddp) && /* !sock_flag(sk, NO_DDP) && */
+	newtoep->tp_ulp_mode = TOM_TUNABLE(tdev, ddp) && !(so->so_options & SO_NO_DDP) &&
 		       tp->rcv_wnd >= MIN_DDP_RCV_WIN ? ULP_MODE_TCPDDP : 0;
 
 	if (newtoep->tp_ulp_mode) {
@@ -3213,15 +3202,9 @@
 			newtoep->tp_ulp_mode = 0;
 	}
 	
-	printf("ddp=%d rcv_wnd=%ld min_win=%d ulp_mode=%d\n",
+	CTR4(KTR_TOM, "ddp=%d rcv_wnd=%ld min_win=%d ulp_mode=%d\n",
 	    TOM_TUNABLE(tdev, ddp), tp->rcv_wnd, MIN_DDP_RCV_WIN, newtoep->tp_ulp_mode);
-
-#endif
-
 	set_arp_failure_handler(reply_mbuf, pass_accept_rpl_arp_failure);
-
-	DPRINTF("adding request to syn cache\n");
-
 	/*
 	 * XXX workaround for lack of syncache drop
 	 */
@@ -3237,11 +3220,9 @@
 	rpl->rsvd = rpl->opt2;                /* workaround for HW bug */
 	rpl->peer_ip = req->peer_ip;	// req->peer_ip is not overwritten
 
-	DPRINTF("accept smt_idx=%d\n", e->smt_idx);
-	
 	rpl->opt0h = htonl(calc_opt0h(so, select_mss(td, NULL, dst->rt_ifp->if_mtu)) |
 	    V_L2T_IDX(e->idx) | V_TX_CHANNEL(e->smt_idx));
-	rpl->opt0l_status = htonl(calc_opt0l(so, lctx->ulp_mode) |
+	rpl->opt0l_status = htonl(calc_opt0l(so, newtoep->tp_ulp_mode) |
 				  CPL_PASS_OPEN_ACCEPT);
 
 	DPRINTF("opt0l_status=%08x\n", rpl->opt0l_status);

==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#19 (text+ko) ====

@@ -878,7 +878,7 @@
 			p->kbuf_posted++;
 		} else if (so_should_ddp(toep, copied)
 		    && !IS_NONBLOCKING(so)) {
-			printf("entering ddp\n");
+			CTR1(KTR_TOM ,"entering ddp on tid=%u", toep->tp_tid);
 			t3_enter_ddp(so, TOM_TUNABLE(TOE_DEV(so),
 						     ddp_copy_limit), 0);
 			p->kbuf_posted = 1;

==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_ddp.c#9 (text+ko) ====

@@ -406,20 +406,14 @@
 		if (p->get_tcb_count == 0)
 			t3_cancel_ddpbuf(toep, p->cur_buf);
 		else {
-			int err = 0, timeo, flags, count=0;
-			timeo = so->so_rcv.sb_timeo;
-			flags = so->so_rcv.sb_flags;
-			
-			so->so_rcv.sb_timeo = 30*hz;
+			int err = 0, count=0;
 			while (p->get_tcb_count && !(so->so_state & (SS_ISDISCONNECTING|SS_ISDISCONNECTED))) {
-				if (count & 0xffffff)
+				if (count & 0xffff)
 					CTR4(KTR_TCB, "waiting err=%d get_tcb_count=%d timeo=%d so=%p\n",
 					    err, p->get_tcb_count, so->so_rcv.sb_timeo, so);
 				count++;
 				err = sbwait(&so->so_rcv);
 			}
-			so->so_rcv.sb_timeo = timeo;
-			so->so_rcv.sb_flags = flags;
 		}
 
 		ubuf_pending = t3_ddp_ubuf_pending(toep);

==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_listen.c#3 (text+ko) ====

@@ -244,8 +244,7 @@
 	if (!TOM_TUNABLE(dev, activated))
 		return;
 
-	printf("start listen\n");
-	
+	CTR1(KTR_TOM, "start listen on port %u", ntohs(inp->inp_lport));
 	ctx = malloc(sizeof(*ctx), M_CXGB, M_NOWAIT|M_ZERO);
 
 	if (!ctx)

==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_tom.c#9 (text+ko) ====

@@ -179,8 +179,6 @@
 static void
 t3cdev_add(struct tom_data *t)
 {
-	printf("t3cdev_add\n");
-	
 	mtx_lock(&cxgb_list_lock);
 	TAILQ_INSERT_TAIL(&cxgb_list, t, entry);
 	mtx_unlock(&cxgb_list_lock);
@@ -201,7 +199,6 @@
 	struct adap_ports *port_info;
 
 	t = malloc(sizeof(*t), M_CXGB, M_NOWAIT|M_ZERO);
-	
 	if (t == NULL)
 		return;
 
@@ -231,13 +228,11 @@
 	}
 	TOM_DATA(tdev) = t;
 
-	printf("nports=%d\n", port_info->nports);
 	for (i = 0; i < port_info->nports; i++) {
 		struct ifnet *ifp = port_info->lldevs[i];
 		TOEDEV(ifp) = tdev;
 
-		printf("enabling toe on %p\n", ifp);
-		
+		CTR1(KTR_TOM, "enabling toe on %p", ifp);
 		ifp->if_capabilities |= IFCAP_TOE4;
 		ifp->if_capenable |= IFCAP_TOE4;
 	}
@@ -346,11 +341,7 @@
 #endif
 	t3_init_tunables(t);
 	mtx_init(&t->listen_lock, "tom data listeners", NULL, MTX_DEF);
-
-
-	printf("KTR_TOM=0x%x ktr_mask=0x%x KTR_COMPILE=0x%x doing test KTR entry now\n", KTR_TOM, ktr_mask, KTR_COMPILE);
 	CTR2(KTR_TOM, "t3_toe_attach dev=%p entry=%p", dev, entry);
-	
 	/* Adjust TOE activation for this module */
 	t->conf.activated = activated;
 
@@ -407,11 +398,8 @@
 	
 	mtx_lock(&cxgb_list_lock);
 	TAILQ_FOREACH(p, &cxgb_list, entry) {
-		if (tp->t_state == TCPS_LISTEN) {
-			printf("stopping listen on port=%d\n",
-			    ntohs(tp->t_inpcb->inp_lport));
+		if (tp->t_state == TCPS_LISTEN)
 			t3_listen_stop(&p->tdev, so, p->cdev);
-		}
 	}
 	mtx_unlock(&cxgb_list_lock);
 }
@@ -432,13 +420,9 @@
 	INP_INFO_RUNLOCK(&tcbinfo);
 }
 
-
-
 static int
 t3_tom_init(void)
 {
-
-
 	init_cpl_handlers();
 	if (t3_init_cpl_io() < 0)
 		return -1;
@@ -462,7 +446,6 @@
 	TAILQ_INIT(&cxgb_list);
 	
 	/* Register to offloading devices */
-	printf("setting add to %p\n", t3c_tom_add);
 	t3c_tom_client.add = t3c_tom_add;
 	cxgb_register_client(&t3c_tom_client);
 	cxgb_register_listeners();
@@ -476,8 +459,6 @@
 
 	switch (cmd) {
 	case MOD_LOAD:
-		printf("wheeeeee ...\n");
-		
 		t3_tom_init();
 		break;
 	case MOD_QUIESCE:



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