git: 0aa120d52f3c - main - inpcb: allow to provide protocol specific pcb size
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 Dec 2022 22:11:05 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0aa120d52f3cec0bdc42441e3d3866b47a97a095 commit 0aa120d52f3cec0bdc42441e3d3866b47a97a095 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-12-02 22:10:55 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2022-12-02 22:10:55 +0000 inpcb: allow to provide protocol specific pcb size The protocol specific structure shall start with inpcb. Differential revision: https://reviews.freebsd.org/D37126 --- sys/netinet/in_pcb.c | 2 +- sys/netinet/in_pcb.h | 4 +++- sys/netinet/raw_ip.c | 2 +- sys/netinet/tcp_subr.c | 2 +- sys/netinet/udp_usrreq.c | 6 +++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index c33d06566b44..3a83682b711f 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -551,7 +551,7 @@ in_pcbstorage_init(void *arg) struct inpcbstorage *pcbstor = arg; pcbstor->ips_zone = uma_zcreate(pcbstor->ips_zone_name, - sizeof(struct inpcb), NULL, inpcb_dtor, pcbstor->ips_pcbinit, + pcbstor->ips_size, NULL, inpcb_dtor, pcbstor->ips_pcbinit, inpcb_fini, UMA_ALIGN_PTR, UMA_ZONE_SMR); pcbstor->ips_portzone = uma_zcreate(pcbstor->ips_portzone_name, sizeof(struct inpcbport), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index e8e6fbd86708..2f9cebb5ef15 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -464,13 +464,14 @@ struct inpcbstorage { uma_zone_t ips_zone; uma_zone_t ips_portzone; uma_init ips_pcbinit; + size_t ips_size; const char * ips_zone_name; const char * ips_portzone_name; const char * ips_infolock_name; const char * ips_hashlock_name; }; -#define INPCBSTORAGE_DEFINE(prot, lname, zname, iname, hname) \ +#define INPCBSTORAGE_DEFINE(prot, ppcb, lname, zname, iname, hname) \ static int \ prot##_inpcb_init(void *mem, int size __unused, int flags __unused) \ { \ @@ -480,6 +481,7 @@ prot##_inpcb_init(void *mem, int size __unused, int flags __unused) \ return (0); \ } \ static struct inpcbstorage prot = { \ + .ips_size = sizeof(struct ppcb), \ .ips_pcbinit = prot##_inpcb_init, \ .ips_zone_name = zname, \ .ips_portzone_name = zname " ports", \ diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 2065b47883bb..7278f9711cec 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -182,7 +182,7 @@ rip_delhash(struct inpcb *inp) } #endif /* INET */ -INPCBSTORAGE_DEFINE(ripcbstor, "rawinp", "ripcb", "rip", "riphash"); +INPCBSTORAGE_DEFINE(ripcbstor, inpcb, "rawinp", "ripcb", "rip", "riphash"); static void rip_init(void *arg __unused) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 58e410edf0bb..6e85d5a77340 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1148,7 +1148,7 @@ static struct mtx isn_mtx; #define ISN_LOCK() mtx_lock(&isn_mtx) #define ISN_UNLOCK() mtx_unlock(&isn_mtx) -INPCBSTORAGE_DEFINE(tcpcbstor, "tcpinp", "tcp_inpcb", "tcp", "tcphash"); +INPCBSTORAGE_DEFINE(tcpcbstor, inpcb, "tcpinp", "tcp_inpcb", "tcp", "tcphash"); /* * Take a value and get the next power of 2 that doesn't overflow. diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 719b39985a0f..5110d63e1092 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -170,9 +170,9 @@ static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct thread *, int); #endif -INPCBSTORAGE_DEFINE(udpcbstor, "udpinp", "udp_inpcb", "udp", "udphash"); -INPCBSTORAGE_DEFINE(udplitecbstor, "udpliteinp", "udplite_inpcb", "udplite", - "udplitehash"); +INPCBSTORAGE_DEFINE(udpcbstor, inpcb, "udpinp", "udp_inpcb", "udp", "udphash"); +INPCBSTORAGE_DEFINE(udplitecbstor, inpcb, "udpliteinp", "udplite_inpcb", + "udplite", "udplitehash"); static void udp_vnet_init(void *arg __unused)