Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152882554
D14982.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
D14982.diff
View Options
Index: head/sys/kern/subr_witness.c
===================================================================
--- head/sys/kern/subr_witness.c
+++ head/sys/kern/subr_witness.c
@@ -569,7 +569,7 @@
/*
* BPF
*/
- { "bpf global lock", &lock_class_mtx_sleep },
+ { "bpf global lock", &lock_class_sx },
{ "bpf interface lock", &lock_class_rw },
{ "bpf cdev lock", &lock_class_mtx_sleep },
{ NULL, NULL },
Index: head/sys/net/bpf.c
===================================================================
--- head/sys/net/bpf.c
+++ head/sys/net/bpf.c
@@ -159,6 +159,9 @@
#define BIOCSETFNR32 _IOW('B', 130, struct bpf_program32)
#endif
+#define BPF_LOCK() sx_xlock(&bpf_sx)
+#define BPF_UNLOCK() sx_xunlock(&bpf_sx)
+#define BPF_LOCK_ASSERT() sx_assert(&bpf_sx, SA_XLOCKED)
/*
* bpf_iflist is a list of BPF interface structures, each corresponding to a
* specific DLT. The same network interface might have several BPF interface
@@ -166,7 +169,7 @@
* frames, ethernet frames, etc).
*/
static LIST_HEAD(, bpf_if) bpf_iflist, bpf_freelist;
-static struct mtx bpf_mtx; /* bpf global lock */
+static struct sx bpf_sx; /* bpf global lock */
static int bpf_bpfd_cnt;
static void bpf_attachd(struct bpf_d *, struct bpf_if *);
@@ -2821,7 +2824,7 @@
{
struct cdev *dev;
- mtx_init(&bpf_mtx, "bpf global lock", NULL, MTX_DEF);
+ sx_init(&bpf_sx, "bpf global lock");
LIST_INIT(&bpf_iflist);
LIST_INIT(&bpf_freelist);
Index: head/sys/net/bpfdesc.h
===================================================================
--- head/sys/net/bpfdesc.h
+++ head/sys/net/bpfdesc.h
@@ -118,9 +118,6 @@
#define BPF_PID_REFRESH(bd, td) (bd)->bd_pid = (td)->td_proc->p_pid
#define BPF_PID_REFRESH_CUR(bd) (bd)->bd_pid = curthread->td_proc->p_pid
-#define BPF_LOCK() mtx_lock(&bpf_mtx)
-#define BPF_UNLOCK() mtx_unlock(&bpf_mtx)
-#define BPF_LOCK_ASSERT() mtx_assert(&bpf_mtx, MA_OWNED)
/*
* External representation of the bpf descriptor
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 18, 6:10 PM (13 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31701899
Default Alt Text
D14982.diff (1 KB)
Attached To
Mode
D14982: Make BPF global lock an SX to allow NIC drivers to sleep on polling config operations
Attached
Detach File
Event Timeline
Log In to Comment