Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2008 07:07:21 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 134282 for review
Message-ID:  <200801280707.m0S77L0V023926@repoman.freebsd.org>

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

Change 134282 by kmacy@kmacy:pandemonium:toehead on 2008/01/28 07:06:49

	add verbose logging to ddp functions
	fix missed unlock in new_rx_data

Affected files ...

.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#9 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#10 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_defs.h#3 edit
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_vm.c#2 edit

Differences ...

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

@@ -1604,7 +1604,7 @@
 	uint64_t t;
 	__be64 *tcb;
 
-
+	TRACE_ENTER;
 	/* Note that we only accout for CPL_GET_TCB issued by the DDP code. We
 	 * really need a cookie in order to dispatch the RPLs.
 	 */
@@ -1621,7 +1621,7 @@
 		m_freem(m);
 		if (__predict_true((so->so_state & SS_NOFDREF) == 0))
 			sorwakeup(so);
-
+		TRACE_EXIT;	
 		return;
 	}
 
@@ -1680,6 +1680,7 @@
 	
 	if (__predict_false(so_no_receive(so) && m->m_pkthdr.len)) {
 		handle_excess_rx(toep, m);
+		TRACE_EXIT;
 		return;
 	}
 
@@ -1719,6 +1720,7 @@
 				q->kbuf_posted--;
 			panic("length not set");
 			m_free(m);
+			TRACE_EXIT;
 			return;
 		}
 	} else {
@@ -1726,6 +1728,7 @@
 		 * but it got here way late and nobody cares anymore.
 		 */
 		m_free(m);
+		TRACE_EXIT;
 		return;
 	}
 
@@ -1746,6 +1749,7 @@
 	sbappend(&so->so_rcv, m);
 	if (__predict_true((so->so_state & SS_NOFDREF) == 0))
 		sorwakeup(so);
+	TRACE_EXIT;
 }
 
 /*
@@ -1779,6 +1783,7 @@
 	if (tp->rcv_nxt == rcv_nxt)
 		return;
 
+	TRACE_ENTER;
 	q = &toep->tp_ddp_state;
 	bsp = &q->buf_state[q->cur_buf];
 	m->m_pkthdr.len = rcv_nxt - tp->rcv_nxt;
@@ -1809,6 +1814,7 @@
 	 * mode.
 	 */
 	q->ubuf_ddp_ready = 0;
+	TRACE_EXIT;
 }
 
 /*
@@ -1826,6 +1832,7 @@
 	
 	if (__predict_false(so_no_receive(so))) {
 		handle_excess_rx(toep, m);
+		INP_UNLOCK(tp->t_inpcb);
 		return;
 	}
 
@@ -1843,6 +1850,7 @@
 		    TOE_DEV(toeptoso(toep))->name, toep->tp_tid, m->m_seq,
 		       tp->rcv_nxt);
 		m_freem(m);
+		INP_UNLOCK(tp->t_inpcb);
 		return;
 	}
 #endif
@@ -1882,7 +1890,7 @@
 		DPRINTF("rx_data so=%p flags=0x%x len=%d\n", so, so->so_rcv.sb_flags, m->m_pkthdr.len);
 
 	sbappend_locked(&so->so_rcv, m);
-	KASSERT(so->so_rcv.sb_cc < so->so_rcv.sb_mbmax,
+	KASSERT(so->so_rcv.sb_cc < (so->so_rcv.sb_mbmax << 1),
 
 	    ("so=%p, data contents exceed mbmax, sb_cc=%d sb_mbmax=%d",
 		so, so->so_rcv.sb_cc, so->so_rcv.sb_mbmax));
@@ -1926,7 +1934,8 @@
 		handle_excess_rx(toep, m);
 		return;
 	}
-
+	
+	TRACE_ENTER;
 	tp = sototcpcb(so);
 	q = &toep->tp_ddp_state;
 	hdr = cplhdr(m);
@@ -1996,6 +2005,8 @@
 	
 	if ((so->so_state & SS_NOFDREF) == 0)
 		sorwakeup_locked(so);
+
+	TRACE_EXIT;
 }
 
 #define DDP_ERR (F_DDP_PPOD_MISMATCH | F_DDP_LLIMIT_ERR | F_DDP_ULIMIT_ERR |\
@@ -2040,7 +2051,7 @@
 		handle_excess_rx(toep, m);
 		return;
 	}
-
+	TRACE_ENTER;
 	q = &toep->tp_ddp_state; 
 	hdr = cplhdr(m);
 	ddp_report = ntohl(hdr->ddp_report);
@@ -2083,6 +2094,7 @@
 	if ((so->so_state & SS_NOFDREF) == 0)
 		sorwakeup_locked(so);
 	
+	TRACE_EXIT;
 }
 
 /*
@@ -3703,7 +3715,8 @@
 	unsigned int tid = toep->tp_tid;
 	const struct tom_data *td = TOM_DATA(TOE_DEV(so));
 	unsigned int ppod_addr = tag * PPOD_SIZE + td->ddp_llimit;
-
+	
+	TRACE_ENTER;
 	for (i = 0; i < nppods; ++i) {
 		m = m_gethdr_nofail(sizeof(*req) + PPOD_SIZE);
 		m_set_priority(m, mkprio(CPL_PRIORITY_CONTROL, toep));
@@ -3731,6 +3744,8 @@
 		send_or_defer(toep, m, 0);
 		ppod_addr += PPOD_SIZE;
 	}
+
+	TRACE_EXIT;
 	return (0);
 }
 
@@ -3878,6 +3893,7 @@
 	struct cpl_set_tcb_field *req;
 	struct ddp_state *p = &toep->tp_ddp_state;
 
+	TRACE_ENTER;
 	wrlen = sizeof(*wr) + 3 * sizeof(*req) + sizeof(*getreq);
 	m = m_gethdr_nofail(wrlen);
 	m_set_priority(m, mkprio(CPL_PRIORITY_CONTROL, toep));
@@ -3932,6 +3948,7 @@
 		  bufidx, tag0, tag1, len);
 #endif
 	cxgb_ofld_send(TOEP_T3C_DEV(toep), m);
+	TRACE_EXIT;
 }
 
 /*
@@ -3949,6 +3966,7 @@
 	struct work_request_hdr *wr;
 	struct cpl_set_tcb_field *req;
 
+	TRACE_ENTER;
 	wrlen = sizeof(*wr) + sizeof(*req) + (len0 ? sizeof(*req) : 0) +
 		(len1 ? sizeof(*req) : 0) +
 		(modulate ? sizeof(struct cpl_rx_data_ack) : 0);
@@ -3994,6 +4012,7 @@
 #endif
 
 	cxgb_ofld_send(TOEP_T3C_DEV(toep), m);
+	TRACE_EXIT;
 }
 
 void

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

@@ -526,6 +526,7 @@
 	err = sblock(&so->so_rcv, SBLOCKWAIT(flags));
 	if (err)
 		return (err);
+	TRACE_ENTER;
 restart:
 	SOCKBUF_LOCK(&so->so_rcv);
 	len = uio->uio_resid;
@@ -757,6 +758,7 @@
 	SOCKBUF_UNLOCK(&so->so_rcv);
 	sbunlock(&so->so_rcv);
 
+	TRACE_EXIT;
 	return (err);
 }
 

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

@@ -40,6 +40,11 @@
 #define toeptoso(toep) ((toep)->tp_tp->t_inpcb->inp_socket)
 #define sototoep(so) (sototcpcb((so))->t_toe)
 
+#define TRACE_ENTER printf("%s:%s entered", __FUNCTION__, __FILE__)
+#define TRACE_EXIT printf("%s:%s:%d exited", __FUNCTION__, __FILE__, __LINE__)
+	
+
+
 struct toepcb;
 struct listen_ctx;
 

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

@@ -20,6 +20,9 @@
 #include <vm/pmap.h>
 #include <dev/cxgb/ulp/tom/cxgb_vm.h>
 
+#define TRACE_ENTER printf("%s:%s entered", __FUNCTION__, __FILE__)
+#define TRACE_EXIT printf("%s:%s:%d exited", __FUNCTION__, __FILE__, __LINE__)
+
 /*
  * This routine takes a user address range and does the following:
  *  - validate that the user has access to those pages (flags indicates read or write) - if not fail
@@ -50,10 +53,11 @@
 	 * and user do not share VA - however, it appears that all FreeBSD
 	 * architectures define it
 	 */
-	pageslen =  count * PAGE_SIZE;
+	pageslen = count * PAGE_SIZE;
 	if (addr + pageslen > VM_MAXUSER_ADDRESS)
 		return (EFAULT);
 
+	TRACE_ENTER;
 	td = curthread;
 	map = &td->td_proc->p_vmspace->vm_map;
 	pmap = &td->td_proc->p_vmspace->vm_pmap;
@@ -92,8 +96,11 @@
 	}
 	vm_page_unlock_queues();
 	
-	if (faults == 0) 
+	if (faults == 0) {
+		TRACE_EXIT;	
 		return (0);
+	}
+	
 	/*
 	 * Pages either have insufficient permissions or are not present
 	 * trigger a fault where neccessary
@@ -124,6 +131,7 @@
 		if (*pages)
 			vm_page_unhold(*pages);
 	vm_page_unlock_queues();
+	TRACE_EXIT;
 	return (EFAULT);
 }
 



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