PERFORCE change 135875 for review
Kip Macy
kmacy at FreeBSD.org
Thu Feb 21 06:28:49 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=135875
Change 135875 by kmacy at kmacy:entropy:iwarp on 2008/02/21 06:28:01
- general cleanups
- don't ktr log segments for immediate request
- more connection shutdown cleanups
Affected files ...
.. //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#15 edit
Differences ...
==== //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#15 (text+ko) ====
@@ -64,6 +64,7 @@
#include <netinet/tcp_offload.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_syncache.h>
+#include <netinet/tcp_timer.h>
#include <net/route.h>
#include <dev/cxgb/t3cdev.h>
@@ -145,10 +146,6 @@
static inline void free_atid(struct t3cdev *cdev, unsigned int tid);
static void handle_syncache_event(int event, void *arg);
-#ifndef TCP_USRREQS_OVERLOAD
-#define cxgb_tcp_drop tcp_drop
-#endif
-
static inline void
SBAPPEND(struct sockbuf *sb, struct mbuf *n)
{
@@ -412,7 +409,7 @@
toep->tp_wr_unacked += mbuf_wrs[count];
i = 0;
- while (i < count) {
+ while (i < count && m_get_sgllen(m0)) {
if ((count - i) >= 3) {
CTR6(KTR_TOM,
"t3_push_frames: pa=0x%zx len=%d pa=0x%zx len=%d pa=0x%zx len=%d",
@@ -449,7 +446,6 @@
enqueue_wr(toep, m0);
DPRINTF("sending offload tx with %d bytes in %d segments\n",
bytes, count);
-
l2t_send(cdev, m0, toep->tp_l2t);
}
SOCKBUF_UNLOCK(&so->so_snd);
@@ -1338,7 +1334,7 @@
t3_release_offload_resources(toep);
if (tp) {
INP_LOCK_ASSERT(tp->t_inpcb);
- cxgb_tcp_drop(tp, errno);
+ tcp_drop(tp, errno);
}
#ifdef notyet
@@ -1904,7 +1900,7 @@
rcv_nxt, tp->rcv_nxt));
m->m_len = m->m_pkthdr.len = rcv_nxt - tp->rcv_nxt;
KASSERT(m->m_len > 0, ("%s m_len=%d", __FUNCTION__, m->m_len));
- CTR3(KTR_TOM, "rcv_nxt=0x%x tp->rcv_nxt=0x%x len=%d\n",
+ CTR3(KTR_TOM, "rcv_nxt=0x%x tp->rcv_nxt=0x%x len=%d",
rcv_nxt, tp->rcv_nxt, m->m_pkthdr.len);
#ifdef T3_TRACE
@@ -2451,7 +2447,6 @@
tp = tcp_close(tp);
} else {
enter_timewait(so);
- soisdisconnected(so);
}
break;
default:
@@ -2464,7 +2459,6 @@
INP_UNLOCK(tp->t_inpcb);
DPRINTF("waking up waiters on %p rcv_notify=%d flags=0x%x\n", so, sb_notify(&so->so_rcv), so->so_rcv.sb_flags);
- soisdisconnecting(so);
#ifdef notyet
/* Do not send POLL_HUP for half duplex close. */
@@ -2532,14 +2526,29 @@
tp = tcp_close(tp);
break;
case TCPS_FIN_WAIT_1:
-#ifdef notyet
- dst_confirm(sk->sk_dst_cache);
-#endif
- soisdisconnecting(so);
-
+ /*
+ * If we can't receive any more
+ * data, then closing user can proceed.
+ * Starting the timer is contrary to the
+ * specification, but if we don't get a FIN
+ * we'll hang forever.
+ *
+ * XXXjl:
+ * we should release the tp also, and use a
+ * compressed state.
+ */
+ if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
+ int timeout;
+
+ soisdisconnected(so);
+ timeout = (tcp_fast_finwait2_recycle) ?
+ tcp_finwait2_timeout : tcp_maxidle;
+ tcp_timer_activate(tp, TT_2MSL, timeout);
+ }
+ tp->t_state = TCPS_FIN_WAIT_2;
if ((so->so_options & SO_LINGER) && so->so_linger == 0 &&
(toep->tp_flags & TP_ABORT_SHUTDOWN) == 0) {
- tp = cxgb_tcp_drop(tp, 0);
+ tp = tcp_drop(tp, 0);
}
break;
@@ -3253,7 +3262,7 @@
newtoep->tp_ulp_mode = 0;
}
- CTR4(KTR_TOM, "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",
TOM_TUNABLE(tdev, ddp), tp->rcv_wnd, MIN_DDP_RCV_WIN, newtoep->tp_ulp_mode);
set_arp_failure_handler(reply_mbuf, pass_accept_rpl_arp_failure);
/*
@@ -3413,6 +3422,8 @@
*/
dst_confirm(sk->sk_dst_cache);
#endif
+ soisconnected(so);
+ tp->t_starttime = ticks;
tp->t_state = TCPS_ESTABLISHED;
}
@@ -3535,7 +3546,6 @@
make_established(so, ntohl(req->snd_isn), ntohs(req->tcp_opt));
INP_INFO_WUNLOCK(&tcbinfo);
INP_UNLOCK(tp->t_inpcb);
- soisconnected(so);
CTR1(KTR_TOM, "do_pass_establish tid=%u", toep->tp_tid);
cxgb_log_tcb(cdev->adapter, toep->tp_tid);
@@ -3653,8 +3663,7 @@
sk->sk_write_space(sk);
#endif
- soisconnected(so);
- toep->tp_state = tp->t_state = TCPS_ESTABLISHED;
+ toep->tp_state = tp->t_state;
tcpstat.tcps_connects++;
}
@@ -3728,7 +3737,7 @@
while (credits) {
struct mbuf *p = peek_wr(toep);
CTR2(KTR_TOM,
- "wr_ack: p->credits=%d p->bytes=%d\n", p->m_pkthdr.csum_data, p->m_pkthdr.len);
+ "wr_ack: p->credits=%d p->bytes=%d", p->m_pkthdr.csum_data, p->m_pkthdr.len);
if (__predict_false(!p)) {
log(LOG_ERR, "%u WR_ACK credits for TID %u with "
More information about the p4-projects
mailing list