Re: git: a730d82378d3 - main - tcp: fix RACK and BBR when using VIMAGE enabled kernel

From: Daniel O'Connor via freebsd-hackers <freebsd-hackers_at_freebsd.org>
Date: Tue, 20 Jul 2021 00:59:30 UTC

> On 20 Jul 2021, at 08:03, Michael Tuexen <tuexen@freebsd.org> wrote:
> 
> The branch main has been updated by tuexen:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=a730d82378d3cdf5356775ec0c23ad2ca40c5edb
> 
> diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c
> index baa267b43752..bf93359368f9 100644
> --- a/sys/netinet/tcp_stacks/rack_bbr_common.c
> +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c
> @@ -508,16 +508,18 @@ skip_vnet:
> 				m_freem(m);
> 				m = m_save;
> 			}
> -			if (no_vn == 0)
> +			if (no_vn == 0) {
> 				CURVNET_RESTORE();
> +			}
> 			INP_UNLOCK_ASSERT(inp);
> 			return(retval);
> 		}
> skipped_pkt:
> 		m = m_save;
> 	}
> -	if (no_vn == 0)
> +	if (no_vn == 0) {
> 		CURVNET_RESTORE();
> +	}
> 	return(retval);
> }

Not to pick on this particular commit, but does anyone know why CURVNET_RESTORE os not defined such that it doesn't require wrapping with {}?

Looking through vnet.h I see that VNET_ASSERT, VNET_GLOBAL_EVENTHANDLER_REGISTER_TAG, and VNET_GLOBAL_EVENTHANDLER_REGISTER have a do { } while(0) wrapper but CURVNET_SET_QUIET, CURVNET_SET_VERBOSE, CURVNET_RESTORE, VNET_SYSINIT, and VNET_SYSUNINIT don't.

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum