Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108351323
D36915.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36915.diff
View Options
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1987,7 +1987,7 @@
VNET_DECLARE(struct intr_event *, pf_swi_ie);
#define V_pf_swi_ie VNET(pf_swi_ie)
-VNET_DECLARE(uint64_t, pf_stateid[MAXCPU]);
+VNET_DECLARE(struct unrhdr64, pf_stateid);
#define V_pf_stateid VNET(pf_stateid)
TAILQ_HEAD(pf_altqqueue, pf_altq);
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -249,12 +249,7 @@
VNET_DEFINE(uma_zone_t, pf_state_z);
VNET_DEFINE(uma_zone_t, pf_state_key_z);
-VNET_DEFINE(uint64_t, pf_stateid[MAXCPU]);
-#define PFID_CPUBITS 8
-#define PFID_CPUSHIFT (sizeof(uint64_t) * NBBY - PFID_CPUBITS)
-#define PFID_CPUMASK ((uint64_t)((1 << PFID_CPUBITS) - 1) << PFID_CPUSHIFT)
-#define PFID_MAXID (~PFID_CPUMASK)
-CTASSERT((1 << PFID_CPUBITS) >= MAXCPU);
+VNET_DEFINE(struct unrhdr64, pf_stateid);
static void pf_src_tree_remove_state(struct pf_kstate *);
static void pf_init_threshold(struct pf_threshold *, u_int32_t,
@@ -1416,10 +1411,7 @@
s->orig_kif = orig_kif;
if (s->id == 0 && s->creatorid == 0) {
- /* XXX: should be atomic, but probability of collision low */
- if ((s->id = V_pf_stateid[curcpu]++) == PFID_MAXID)
- V_pf_stateid[curcpu] = 1;
- s->id |= (uint64_t )curcpu << PFID_CPUSHIFT;
+ s->id = alloc_unr64(&V_pf_stateid);
s->id = htobe64(s->id);
s->creatorid = V_pf_status.hostid;
}
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -2595,16 +2595,12 @@
if (V_pf_status.running)
error = EEXIST;
else {
- int cpu;
-
hook_pf();
if (! TAILQ_EMPTY(V_pf_keth->active.rules))
hook_pf_eth();
V_pf_status.running = 1;
V_pf_status.since = time_second;
-
- CPU_FOREACH(cpu)
- V_pf_stateid[cpu] = time_second;
+ new_unrhdr64(&V_pf_stateid, time_second);
DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n"));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 1:56 AM (20 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16118009
Default Alt Text
D36915.diff (1 KB)
Attached To
Mode
D36915: pf: atomically increment state ids
Attached
Detach File
Event Timeline
Log In to Comment