mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
- 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)
This commit is contained in:
parent
4f621933a5
commit
de5a10ecbc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277761
@ -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
|
||||
|
||||
@ -1081,8 +1081,8 @@ t4_soreceive_ddp(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
|
||||
/* 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 @@ t4_soreceive_ddp(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
|
||||
/* 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 @@ t4_soreceive_ddp(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
|
||||
/* 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 @@ t4_soreceive_ddp(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
|
||||
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 @@ t4_soreceive_ddp(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user