Re: git: 40dbb06fa73c - main - inpcb: retire INP_DROPPED and in_pcbdrop()

From: Herbert J. Skuhra <herbert_at_gojira.at>
Date: Sun, 12 Apr 2026 21:38:22 UTC
On Sun, 12 Apr 2026 20:35:35 +0200, Gleb Smirnoff wrote:
> 
> The branch main has been updated by glebius:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=40dbb06fa73cac37d57563c07e55efd0cabbd488
> 
> commit 40dbb06fa73cac37d57563c07e55efd0cabbd488
> Author:     Gleb Smirnoff <glebius@FreeBSD.org>
> AuthorDate: 2026-04-12 18:33:07 +0000
> Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
> CommitDate: 2026-04-12 18:33:07 +0000
> 
>     inpcb: retire INP_DROPPED and in_pcbdrop()
>     
>     The inpcb flag INP_DROPPED served two purposes.
>     
>     It was used by TCP and subsystems running on top of TCP as a flag that
>     marks a connection that is now in TCPS_CLOSED, but was in some other state
>     before (not a new-born connection). Create a new TCP flag TF_DISCONNECTED
>     for this purpose.
>     
>     The in_pcbdrop() was a TCP's version of in_pcbdisconnect() that also sets
>     INP_DROPPED.  Use in_pcbdisconnect() instead.
>     
>     Second purpose of INP_DROPPED was a negative lookup mask in
>     inp_smr_lock(), as SMR-protected lookup may see inpcbs that had been
>     removed from the hash.  We already have had INP_INHASHLIST that marks
>     inpcb that is in hash.  Convert it into INP_UNCONNECTED with the opposite
>     meaning.  This allows to combine it with INP_FREED for the negative lookup
>     mask.
>     
>     The Chelsio/ToE and kTLS changes are done with some style refactoring,
>     like moving inp/tp assignments up and using macros for that.  However, no
>     deep thinking was taken to check if those checks are really needed, it
>     could be that some are not.
>     
>     Reviewed by:            rrs
>     Differential Revision:  https://reviews.freebsd.org/D56186
> ---
>  sys/dev/cxgbe/crypto/t6_kern_tls.c |   6 +-
>  sys/dev/cxgbe/crypto/t7_kern_tls.c |   2 +-
>  sys/dev/cxgbe/cxgbei/cxgbei.c      |  17 ++--
>  sys/dev/cxgbe/cxgbei/icl_cxgbei.c  |  13 ++-
>  sys/dev/cxgbe/iw_cxgbe/qp.c        |  24 +++--
>  sys/dev/cxgbe/nvmf/nvmf_che.c      |  23 +++--
>  sys/dev/cxgbe/tom/t4_connect.c     |   3 +-
>  sys/dev/cxgbe/tom/t4_cpl_io.c      |  44 ++++-----
>  sys/dev/cxgbe/tom/t4_ddp.c         |  18 ++--
>  sys/dev/cxgbe/tom/t4_listen.c      |  14 ++-
>  sys/dev/cxgbe/tom/t4_tls.c         |  18 ++--
>  sys/dev/cxgbe/tom/t4_tom.c         |  10 +-
>  sys/kern/uipc_ktls.c               |  71 ++++---------
>  sys/netinet/in_pcb.c               |  74 +++++---------
>  sys/netinet/in_pcb.h               |   9 +-
>  sys/netinet/in_pcb_var.h           |   2 +
>  sys/netinet/tcp_hpts.c             |  12 ++-
>  sys/netinet/tcp_hpts_test.c        |   3 +-
>  sys/netinet/tcp_log_buf.c          |  17 ++--
>  sys/netinet/tcp_output.c           |   1 +
>  sys/netinet/tcp_stacks/bbr.c       |   2 +-
>  sys/netinet/tcp_stacks/rack.c      |   4 +-
>  sys/netinet/tcp_subr.c             |   3 +-
>  sys/netinet/tcp_timewait.c         |   5 +-
>  sys/netinet/tcp_usrreq.c           | 198 ++++++++++++++-----------------------
>  sys/netinet/tcp_var.h              |   2 +-
>  sys/netinet/toecore.c              |  10 +-
>  sys/netinet6/in6_pcb.c             |   8 +-
>  sys/netipsec/xform_tcp.c           |   8 +-
>  29 files changed, 258 insertions(+), 363 deletions(-)

This commit seems to break GENERIC-NODEBUG:

cc -target x86_64-unknown-freebsd16.0
--sysroot=/usr/obj/home/herbert/sources/freebsd/main/src/amd64.amd64/tmp
-B/usr/obj/home/herbert/sources/freebsd/main/src/amd64.amd64/tmp/usr/bin
-c -O2 -pipe  -fno-strict-aliasing  -g -nostdinc  -I.
-I/home/herbert/sources/freebsd/main/src/sys
-I/home/herbert/sources/freebsd/main/src/sys/contrib/ck/include
-I/home/herbert/sources/freebsd/main/src/sys/contrib/libfdt -D_KERNEL
-DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common  
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD 
-MF.depend.tcp_usrreq.o -MTtcp_usrreq.o
-fdebug-prefix-map=./machine=/home/herbert/sources/freebsd/main/src/sys/amd64/include
-fdebug-prefix-map=./x86=/home/herbert/sources/freebsd/main/src/sys/x86/include
-fdebug-prefix-map=./i386=/home/herbert/sources/freebsd/main/src/sys/i386/include
-mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float 
-fno-asynchronous-unwind-tables -ffreestanding -fwrapv
-fstack-protector -mretpoline  -gdwarf-4 -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef
-Wno-pointer-sign -D__printf__=__freebsd_kprintf__
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas
-Wswitch -Wno-error=tautological-compare -Wno-error=empty-body
-Wno-error=parentheses-equality -Wno-error=unused-function
-Wno-error=pointer-sign -Wno-error=shift-negative-value
-Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes
-mno-avx  -std=gnu17 -Werror
/home/herbert/sources/freebsd/main/src/sys/netinet/tcp_usrreq.c
/home/herbert/sources/freebsd/main/src/sys/netinet/tcp_usrreq.c:2589:16: error: unused variable 'inp' [-Werror,-Wunused-variable]
 2589 |         struct inpcb *inp = tptoinpcb(tp);
      |                       ^~~