From owner-dev-commits-src-branches@freebsd.org Fri Sep 17 17:53:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 591486B70EE; Fri, 17 Sep 2021 17:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB1m41HHhz4mq4; Fri, 17 Sep 2021 17:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02CDB19BA3; Fri, 17 Sep 2021 17:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HHrteh061279; Fri, 17 Sep 2021 17:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HHrtvk061278; Fri, 17 Sep 2021 17:53:55 GMT (envelope-from git) Date: Fri, 17 Sep 2021 17:53:55 GMT Message-Id: <202109171753.18HHrtvk061278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4ef480e600b9 - stable/12 - pf: qid and pqid can be uint16_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4ef480e600b9f48217e58ea688527362846d5982 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 17:53:57 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4ef480e600b9f48217e58ea688527362846d5982 commit 4ef480e600b9f48217e58ea688527362846d5982 Author: Kristof Provost AuthorDate: 2021-09-07 12:41:37 +0000 Commit: Kristof Provost CommitDate: 2021-09-17 15:54:38 +0000 pf: qid and pqid can be uint16_t tag2name() returns a uint16_t, so we don't need to use uint32_t for the qid (or pqid). This reduces the size of struct pf_kstate slightly. That in turn buys us space to add extra fields for dummynet later. Happily these fields are not exposed to user space (there are user space versions of them, but they can just stay uint32_t), so there's no ABI breakage in modifying this. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31873 (cherry picked from commit b64f7ce98f5286721a38b31fa2180313f800fb1d) --- sys/net/pfvar.h | 12 ++++++------ sys/netpfil/pf/pf_altq.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 12 ++++++------ sys/netpfil/pf/pf_mtag.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index ffa90555c52e..57d19c6c6018 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -558,8 +558,8 @@ struct pf_kpool { }; struct pf_rule_actions { - u_int32_t qid; - u_int32_t pqid; + uint16_t qid; + uint16_t pqid; }; union pf_krule_ptr { @@ -603,8 +603,8 @@ struct pf_krule { u_int32_t limit; u_int32_t seconds; } max_src_conn_rate; - u_int32_t qid; - u_int32_t pqid; + u_int16_t qid; + u_int16_t pqid; u_int32_t nr; u_int32_t prob; uid_t cuid; @@ -853,8 +853,8 @@ struct pf_kstate { u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; - u_int32_t qid; - u_int32_t pqid; + u_int16_t qid; + u_int16_t pqid; u_int16_t tag; u_int8_t log; }; diff --git a/sys/netpfil/pf/pf_altq.h b/sys/netpfil/pf/pf_altq.h index 35d2d5cb8bbe..0b913a19c2ff 100644 --- a/sys/netpfil/pf/pf_altq.h +++ b/sys/netpfil/pf/pf_altq.h @@ -220,7 +220,7 @@ struct pf_kaltq { struct fairq_opts fairq_opts; } pq_u; - uint32_t qid; /* return value */ + uint16_t qid; /* return value */ }; #endif /* _KERNEL */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e3d194f92c61..cf17d67cc894 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -113,8 +113,8 @@ static int pf_rollback_altq(u_int32_t); static int pf_commit_altq(u_int32_t); static int pf_enable_altq(struct pf_altq *); static int pf_disable_altq(struct pf_altq *); -static u_int32_t pf_qname2qid(char *); -static void pf_qid_unref(u_int32_t); +static uint16_t pf_qname2qid(char *); +static void pf_qid_unref(uint16_t); #endif /* ALTQ */ static int pf_begin_rules(u_int32_t *, int, const char *); static int pf_rollback_rules(u_int32_t, int, char *); @@ -655,16 +655,16 @@ pf_tagname2tag(char *tagname) } #ifdef ALTQ -static u_int32_t +static uint16_t pf_qname2qid(char *qname) { - return ((u_int32_t)tagname2tag(&V_pf_qids, qname)); + return (tagname2tag(&V_pf_qids, qname)); } static void -pf_qid_unref(u_int32_t qid) +pf_qid_unref(uint16_t qid) { - tag_unref(&V_pf_qids, (u_int16_t)qid); + tag_unref(&V_pf_qids, qid); } static int diff --git a/sys/netpfil/pf/pf_mtag.h b/sys/netpfil/pf/pf_mtag.h index b1402e1ac77f..9f556e262b07 100644 --- a/sys/netpfil/pf/pf_mtag.h +++ b/sys/netpfil/pf/pf_mtag.h @@ -46,7 +46,7 @@ struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ - u_int32_t qid; /* queue id */ + u_int16_t qid; /* queue id */ u_int32_t qid_hash; /* queue hashid used by WFQ like algos */ u_int16_t tag; /* tag id */ u_int8_t flags;