summaryrefslogtreecommitdiffstats
path: root/sys/dev/cxgbe/tom/t4_ddp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cxgbe/tom/t4_ddp.c')
-rw-r--r--sys/dev/cxgbe/tom/t4_ddp.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c
index e89eb70..6908de9 100644
--- a/sys/dev/cxgbe/tom/t4_ddp.c
+++ b/sys/dev/cxgbe/tom/t4_ddp.c
@@ -852,9 +852,9 @@ handle_ddp(struct socket *so, struct uio *uio, int flags, int error)
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
@@ -1057,9 +1057,9 @@ t4_soreceive_ddp(struct socket *so, struct sockaddr **psa, struct uio *uio,
/* Prevent other readers from entering the socket. */
error = sblock(sb, SBLOCKWAIT(flags));
+ SOCKBUF_LOCK(sb);
if (error)
goto out;
- SOCKBUF_LOCK(sb);
/* Easy one, no space to copyout anything. */
if (uio->uio_resid == 0) {
@@ -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) {
OpenPOWER on IntegriCloud