aboutsummaryrefslogtreecommitdiff
path: root/sys/netpfil/pf
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-09-07 12:41:37 +0000
committerKristof Provost <kp@FreeBSD.org>2021-09-10 15:07:57 +0000
commitb64f7ce98f5286721a38b31fa2180313f800fb1d (patch)
tree5a76ad2f2cded155c23deef7cf8bb1d751ea05fc /sys/netpfil/pf
parent6d042d7c861a8fffd1784c720720c3b89c7c0883 (diff)
downloadsrc-b64f7ce98f5286721a38b31fa2180313f800fb1d.tar.gz
src-b64f7ce98f5286721a38b31fa2180313f800fb1d.zip
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
Diffstat (limited to 'sys/netpfil/pf')
-rw-r--r--sys/netpfil/pf/pf_altq.h2
-rw-r--r--sys/netpfil/pf/pf_ioctl.c14
-rw-r--r--sys/netpfil/pf/pf_mtag.h2
3 files changed, 9 insertions, 9 deletions
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 08a2946ae484..6d240326361e 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -112,8 +112,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(const char *);
-static void pf_qid_unref(u_int32_t);
+static uint16_t pf_qname2qid(const 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 *);
@@ -653,23 +653,23 @@ tag_unref(struct pf_tagset *ts, u_int16_t tag)
}
}
-static u_int16_t
+static uint16_t
pf_tagname2tag(const char *tagname)
{
return (tagname2tag(&V_pf_tags, tagname));
}
#ifdef ALTQ
-static u_int32_t
+static uint16_t
pf_qname2qid(const 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 2135c9e69dbd..e3f6f85f21d0 100644
--- a/sys/netpfil/pf/pf_mtag.h
+++ b/sys/netpfil/pf/pf_mtag.h
@@ -47,7 +47,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;