From owner-p4-projects@FreeBSD.ORG Tue Nov 6 06:35:32 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B035416A419; Tue, 6 Nov 2007 06:35:32 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45BC716A418 for ; Tue, 6 Nov 2007 06:35:32 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2987D13C480 for ; Tue, 6 Nov 2007 06:35:32 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lA66ZWBA097595 for ; Tue, 6 Nov 2007 06:35:32 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lA66ZVfv097592 for perforce@freebsd.org; Tue, 6 Nov 2007 06:35:31 GMT (envelope-from kmacy@freebsd.org) Date: Tue, 6 Nov 2007 06:35:31 GMT Message-Id: <200711060635.lA66ZVfv097592@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 128729 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Nov 2007 06:35:33 -0000 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?