git: 4940584bbf0b - main - TCP RACK, BBR: cleanup of ctf_process_inbound_raw()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 31 Dec 2024 16:25:10 UTC
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=4940584bbf0b809130f6ac1a7a0c6b00d373af1e commit 4940584bbf0b809130f6ac1a7a0c6b00d373af1e Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2024-12-31 16:22:03 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2024-12-31 16:22:03 +0000 TCP RACK, BBR: cleanup of ctf_process_inbound_raw() Instead of dealing with ifp == NULL, which should never happen, assume that this is not true. Use KASSERT to make this clear. No functional change intended. Reviewed by: glebius, rrs CID: 1523767 MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D48258 --- sys/netinet/tcp_stacks/rack_bbr_common.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c index 156091feeb30..da26b8cb1f9b 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -361,26 +361,15 @@ ctf_process_inbound_raw(struct tcpcb *tp, struct mbuf *m, int has_pkt) int32_t retval, nxt_pkt, tlen, off; int etype = 0; uint16_t drop_hdrlen; - uint8_t iptos, no_vn=0; + uint8_t iptos; inp = tptoinpcb(tp); INP_WLOCK_ASSERT(inp); NET_EPOCH_ASSERT(); - - if (m) - ifp = m_rcvif(m); - else - ifp = NULL; - if (ifp == NULL) { - /* - * We probably should not work around - * but kassert, since lro alwasy sets rcvif. - */ - no_vn = 1; - goto skip_vnet; - } + KASSERT(m != NULL, ("ctf_process_inbound_raw: m == NULL")); + ifp = m_rcvif(m); + KASSERT(ifp != NULL, ("ctf_process_inbound_raw: ifp == NULL")); CURVNET_SET(ifp->if_vnet); -skip_vnet: tcp_get_usecs(&tv); while (m) { m_save = m->m_nextpkt; @@ -466,18 +455,14 @@ skip_vnet: m_freem(m); m = m_save; } - if (no_vn == 0) { - CURVNET_RESTORE(); - } + CURVNET_RESTORE(); INP_UNLOCK_ASSERT(inp); - return(retval); + return (retval); } skipped_pkt: m = m_save; } - if (no_vn == 0) { - CURVNET_RESTORE(); - } + CURVNET_RESTORE(); return (0); }