Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Nov 2007 06:35:31 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 128729 for review
Message-ID:  <200711060635.lA66ZVfv097592@repoman.freebsd.org>

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

Change 128729 by kmacy@kmacy:storage:toestack on 2007/11/06 06:35:11

	add enqueued_bytes field to toepcb to keep track of socket buf 
	to update credits correctly

Affected files ...

.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#16 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.h#7 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/notes#3 edit

Differences ...

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

@@ -409,21 +409,29 @@
 t3_cleanup_rbuf(struct tcpcb *tp)
 {
 	struct toepcb *toep = tp->t_toe;
+	struct socket *so;
 	struct toedev *dev;
-	int dack_mode, must_send;
+	int dack_mode, must_send, read;
 	u32 thres, credits, dack = 0;
 
 	if (!((tp->t_state == TCPS_ESTABLISHED) || (tp->t_state == TCPS_FIN_WAIT_1) ||
 		(tp->t_state == TCPS_FIN_WAIT_2)))
 		return;
-
-	printf("inaccurately calculating return credits - PLZ FIX\n");
+	
+	so = tp->t_inpcb->inp_socket;
+	read = toep->tp_enqueued_bytes - so->so_rcv.sb_cc;
+	toep->tp_copied_seq += read;
+	toep->tp_enqueued_bytes -= read;
+	credits = toep->tp_copied_seq - toep->tp_rcv_wup;
+	printf("copied_seq=%u rcv_wup=%u credits=%u\n",
+	    toep->tp_copied_seq, toep->tp_rcv_wup, credits);
+	
 	/*
 	 * XXX this won't accurately reflect credit return - we need
 	 * to look at the difference between the amount that has been 
 	 * put in the recv sockbuf and what is there now
 	 */
-	credits = toep->tp_copied_seq - toep->tp_rcv_wup;
+
 	if (__predict_false(!credits))
 		return;
 
@@ -1312,6 +1320,8 @@
 	if (err != EOPNOTSUPP)
 		return (err);
 
+	printf("calling %p\n",  toep->tp_ctloutput);
+	
 	return toep->tp_ctloutput(so, sopt);
 }
 
@@ -1325,7 +1335,7 @@
 	struct tcpcb *tp = sototcpcb(so);
 	struct toepcb *toep = tp->t_toe;
 	int len = be16toh(hdr->len);
-	
+
 #ifdef notyet	
 	if (__predict_false(sk_no_receive(sk))) {
 		handle_excess_rx(so, skb);
@@ -1374,7 +1384,7 @@
 
 	tp->rcv_nxt += m->m_pkthdr.len;
 	tp->t_rcvtime = ticks;
-	
+	toep->tp_enqueued_bytes += m->m_pkthdr.len;
 #ifdef T3_TRACE
 	T3_TRACE2(TIDTB(sk),
 		  "new_rx_data: seq 0x%x len %u",
@@ -1382,6 +1392,7 @@
 #endif
 
 	sbappend(&so->so_rcv, m);
+
 	if (__predict_true((so->so_state & SS_NOFDREF) == 0))
 		sorwakeup(so);
 }

==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.h#7 (text+ko) ====

@@ -112,6 +112,7 @@
 	int tp_mss_clamp;
 	int tp_qset;
 	int tp_flags;
+	int tp_enqueued_bytes;
 	tcp_seq tp_delack_seq;
 	tcp_seq tp_rcv_wup;
 	tcp_seq tp_copied_seq;

==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/notes#3 (text+ko) ====

@@ -2,8 +2,8 @@
  - abort
 
 Currently unimplemented:
- - correct credit return accounting
  - complete listen handling
+
  - close for a subset of states
  - correct ARP failure handling
  - urgent data
@@ -11,5 +11,8 @@
  - connection retry
  - fragment assembly and re-tunneling is not implemented, but may work just 
    using the native stack - not clear how credit accounting will sync up
- - extra setsockopt options for congestion control and nagel
  - DDP
+
+open questions:
+What attributes are inherited from the listen socket. Should we be inheriting more?
+Specifically, should TCP_CONGESTION, TCP_NAGLE, and IP_TOS be inherited? 



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