Date: Mon, 11 Feb 2008 05:32:08 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 135195 for review Message-ID: <200802110532.m1B5W8eS041685@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135195 Change 135195 by kmacy@kmacy:storage:toehead on 2008/02/11 05:32:02 work around apparent 32k limitation in T3 in t3_push_frames add debugging info for wr_ack Affected files ... .. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#19 edit Differences ... ==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#19 (text+ko) ==== @@ -299,9 +299,8 @@ struct mbuf *tail, *m0, *last; struct t3cdev *cdev; struct tom_data *d; - int bytes, count, total_bytes; + int i, bytes, count, total_bytes; bus_dma_segment_t segs[TX_MAX_SEGS], *segp; - segp = segs; if (tp->t_state == TCPS_SYN_SENT || tp->t_state == TCPS_CLOSED) { DPRINTF("tcp state=%d\n", tp->t_state); @@ -314,6 +313,7 @@ return (0); } + INP_LOCK_ASSERT(tp->t_inpcb); SOCKBUF_LOCK(&so->so_snd); d = TOM_DATA(TOE_DEV(so)); @@ -337,12 +337,14 @@ toep->tp_m_last = NULL; while (toep->tp_wr_avail && (tail != NULL)) { count = bytes = 0; + segp = segs; if ((m0 = m_gethdr(M_NOWAIT, MT_DATA)) == NULL) { SOCKBUF_UNLOCK(&so->so_snd); return (0); } while ((mbuf_wrs[count + 1] <= toep->tp_wr_avail) - && (tail != NULL) && (count < TX_MAX_SEGS)) { + && (tail != NULL) && (count < TX_MAX_SEGS) && + (bytes + tail->m_len) <= 8*PAGE_SIZE /* XXX the card will wedge with larger requests */) { bytes += tail->m_len; count++; last = tail; @@ -359,27 +361,27 @@ segp++; tail = tail->m_next; } - DPRINTF("wr_avail=%d mbuf_wrs[%d]=%d tail=%p\n", - toep->tp_wr_avail, count, mbuf_wrs[count], tail); if (tail) { so->so_snd.sb_sndptr = tail; toep->tp_m_last = NULL; } else toep->tp_m_last = so->so_snd.sb_sndptr = last; + DPRINTF("toep->tp_m_last=%p\n", toep->tp_m_last); so->so_snd.sb_sndptroff += bytes; total_bytes += bytes; toep->tp_write_seq += bytes; - + CTR6(KTR_TOM, "t3_push_frames: wr_avail=%d mbuf_wrs[%d]=%d tail=%p sndptr=%p sndptroff=%d", + toep->tp_wr_avail, count, mbuf_wrs[count], tail, so->so_snd.sb_sndptr, so->so_snd.sb_sndptroff); + if (tail) + CTR4(KTR_TOM, "t3_push_frames: total_bytes=%d tp_m_last=%p tailbuf=%p snd_una=0x%08x", + total_bytes, toep->tp_m_last, tail->m_data, tp->snd_una); + else + CTR3(KTR_TOM, "t3_push_frames: total_bytes=%d tp_m_last=%p snd_una=0x%08x", + total_bytes, toep->tp_m_last, tp->snd_una); - SOCKBUF_UNLOCK(&so->so_snd); - - /* - * XXX can drop socket buffer lock here - */ - toep->tp_wr_avail -= mbuf_wrs[count]; toep->tp_wr_unacked += mbuf_wrs[count]; @@ -387,7 +389,29 @@ m_set_priority(m0, mkprio(CPL_PRIORITY_DATA, toep)); m_set_sgl(m0, segs); m_set_sgllen(m0, count); - /* + + i = 0; + while (i < count) { + 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", + segs[i].ds_addr, segs[i].ds_len, segs[i + 1].ds_addr, segs[i + 1].ds_len, + segs[i + 2].ds_addr, segs[i + 2].ds_len); + i += 3; + } else if ((count - i) == 2) { + CTR4(KTR_TOM, + "t3_push_frames: pa=0x%zx len=%d pa=0x%zx len=%d", + segs[i].ds_addr, segs[i].ds_len, segs[i + 1].ds_addr, segs[i + 1].ds_len); + i += 2; + } else { + CTR2(KTR_TOM, "t3_push_frames: pa=0x%zx len=%d", + segs[i].ds_addr, segs[i].ds_len); + i++; + } + + } + + /* * remember credits used */ m0->m_pkthdr.csum_data = mbuf_wrs[count]; @@ -406,11 +430,8 @@ bytes, count); l2t_send(cdev, m0, toep->tp_l2t); - if (toep->tp_wr_avail && (tail != NULL)) - SOCKBUF_LOCK(&so->so_snd); } - - SOCKBUF_UNLOCK_ASSERT(&so->so_snd); + SOCKBUF_UNLOCK(&so->so_snd); return (total_bytes); } @@ -1949,8 +1970,8 @@ toep->tp_delack_mode = hdr->dack_mode; toep->tp_delack_seq = tp->rcv_nxt; } - - DPRINTF("appending mbuf=%p pktlen=%d m_len=%d len=%d\n", m, m->m_pkthdr.len, m->m_len, len); + CTR6(KTR_TOM, "appending mbuf=%p pktlen=%d m_len=%d len=%d rcv_nxt=0x%x enqueued_bytes=%d", + m, m->m_pkthdr.len, m->m_len, len, tp->rcv_nxt, toep->tp_enqueued_bytes); if (len < m->m_pkthdr.len) m->m_pkthdr.len = m->m_len = len; @@ -1982,7 +2003,7 @@ #endif - DPRINTF("sb_cc=%d sb_mbcnt=%d\n", + CTR2(KTR_TOM, "sb_cc=%d sb_mbcnt=%d", so->so_rcv.sb_cc, so->so_rcv.sb_mbcnt); if (__predict_true((so->so_state & SS_NOFDREF) == 0)) @@ -3665,7 +3686,7 @@ u32 snd_una = ntohl(hdr->snd_una); int bytes = 0; - DPRINTF("wr_ack: snd_una=%u credits=%d\n", snd_una, credits); + CTR2(KTR_SPARE2, "wr_ack: snd_una=%u credits=%d", snd_una, credits); INP_LOCK(tp->t_inpcb); @@ -3675,7 +3696,8 @@ while (credits) { struct mbuf *p = peek_wr(toep); - DPRINTF("p->credits=%d p->bytes=%d\n", p->m_pkthdr.csum_data, p->m_pkthdr.len) ; + CTR2(KTR_TOM, + "wr_ack: p->credits=%d p->bytes=%d\n", p->m_pkthdr.csum_data, p->m_pkthdr.len); if (__predict_false(!p)) { log(LOG_ERR, "%u WR_ACK credits for TID %u with " @@ -3735,7 +3757,7 @@ toep->tp_flags &= ~TP_TX_WAIT_IDLE; } if (bytes) { - DPRINTF("sbdrop(%d)\n", bytes); + CTR1(KTR_SPARE2, "wr_ack: sbdrop(%d)", bytes); SOCKBUF_LOCK(&so->so_snd); sbdrop_locked(&so->so_snd, bytes); sowwakeup_locked(so); @@ -3757,9 +3779,6 @@ { struct toepcb *toep = (struct toepcb *)ctx; - DPRINTF("do_wr_ack\n"); - dump_toepcb(toep); - VALIDATE_SOCK(so); wr_ack(toep, m);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802110532.m1B5W8eS041685>