Date: Mon, 26 Jan 2015 16:29:15 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277761 - head/sys/dev/cxgbe/tom Message-ID: <201501261629.t0QGTFfA033405@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Jan 26 16:29:14 2015 New Revision: 277761 URL: https://svnweb.freebsd.org/changeset/base/277761 Log: - Update a disabled KASSERT() to use sbused() instead of accessing the no-longer existant sb_cc sockbuf member. - Use sbavail() instead of sbused() in t4_soreceive_ddp() to match the usage in soreceive_stream() on which it is based. Discussed with: glebius (2) Modified: head/sys/dev/cxgbe/tom/t4_ddp.c Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Mon Jan 26 16:29:07 2015 (r277760) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Mon Jan 26 16:29:14 2015 (r277761) @@ -852,9 +852,9 @@ handle_ddp(struct socket *so, struct uio SOCKBUF_LOCK_ASSERT(sb); #if 0 - if (sb->sb_cc + sc->tt.ddp_thres > uio->uio_resid) { + if (sbused(sb) + sc->tt.ddp_thres > uio->uio_resid) { CTR4(KTR_CXGBE, "%s: sb_cc %d, threshold %d, resid %d", - __func__, sb->sb_cc, sc->tt.ddp_thres, uio->uio_resid); + __func__, sbused(sb), sc->tt.ddp_thres, uio->uio_resid); } #endif @@ -1081,8 +1081,8 @@ restart: /* uio should be just as it was at entry */ KASSERT(oresid == uio->uio_resid, - ("%s: oresid = %d, uio_resid = %zd, sbused = %d", - __func__, oresid, uio->uio_resid, sbused(sb))); + ("%s: oresid = %d, uio_resid = %zd, sbavail = %d", + __func__, oresid, uio->uio_resid, sbavail(sb))); error = handle_ddp(so, uio, flags, 0); ddp_handled = 1; @@ -1092,7 +1092,7 @@ restart: /* Abort if socket has reported problems. */ if (so->so_error) { - if (sbused(sb)) + if (sbavail(sb)) goto deliver; if (oresid > uio->uio_resid) goto out; @@ -1104,32 +1104,32 @@ restart: /* Door is closed. Deliver what is left, if any. */ if (sb->sb_state & SBS_CANTRCVMORE) { - if (sbused(sb)) + if (sbavail(sb)) goto deliver; else goto out; } /* Socket buffer is empty and we shall not block. */ - if (sbused(sb) == 0 && + if (sbavail(sb) == 0 && ((so->so_state & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)))) { error = EAGAIN; goto out; } /* Socket buffer got some data that we shall deliver now. */ - if (sbused(sb) && !(flags & MSG_WAITALL) && + if (sbavail(sb) > 0 && !(flags & MSG_WAITALL) && ((so->so_state & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)) || - sbused(sb) >= sb->sb_lowat || - sbused(sb) >= uio->uio_resid || - sbused(sb) >= sb->sb_hiwat) ) { + sbavail(sb) >= sb->sb_lowat || + sbavail(sb) >= uio->uio_resid || + sbavail(sb) >= sb->sb_hiwat) ) { goto deliver; } /* On MSG_WAITALL we must wait until all data or error arrives. */ if ((flags & MSG_WAITALL) && - (sbused(sb) >= uio->uio_resid || sbused(sb) >= sb->sb_lowat)) + (sbavail(sb) >= uio->uio_resid || sbavail(sb) >= sb->sb_lowat)) goto deliver; /* @@ -1148,7 +1148,7 @@ restart: deliver: SOCKBUF_LOCK_ASSERT(&so->so_rcv); - KASSERT(sbused(sb) > 0, ("%s: sockbuf empty", __func__)); + KASSERT(sbavail(sb) > 0, ("%s: sockbuf empty", __func__)); KASSERT(sb->sb_mb != NULL, ("%s: sb_mb == NULL", __func__)); if (sb->sb_flags & SB_DDP_INDICATE && !ddp_handled) @@ -1159,7 +1159,7 @@ deliver: uio->uio_td->td_ru.ru_msgrcv++; /* Fill uio until full or current end of socket buffer is reached. */ - len = min(uio->uio_resid, sbused(sb)); + len = min(uio->uio_resid, sbavail(sb)); if (mp0 != NULL) { /* Dequeue as many mbufs as possible. */ if (!(flags & MSG_PEEK) && len >= sb->sb_mb->m_len) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501261629.t0QGTFfA033405>