From 0bb6a7159d3ad414d384ab010d06e7b9ced1c37e Mon Sep 17 00:00:00 2001 From: Andrew Gallatin Date: Fri, 8 Jun 2007 12:43:25 +0000 Subject: [PATCH] Correct the definition of PFIL_HOOKED() so that it compares the value of ph_nhooks to zero, not the address. This removes extranious calls to pfil_run_hooks (and an rw lock) from the network stack's critical path when no pfil hooks are active. Reviewed by: csjp Sponsored by: Myricom Inc. --- sys/net/pfil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/pfil.h b/sys/net/pfil.h index 6b00e5c5f0d9..d2308fdbee57 100644 --- a/sys/net/pfil.h +++ b/sys/net/pfil.h @@ -92,7 +92,7 @@ int pfil_head_unregister(struct pfil_head *); struct pfil_head *pfil_head_get(int, u_long); -#define PFIL_HOOKED(p) (&(p)->ph_nhooks > 0) +#define PFIL_HOOKED(p) ((p)->ph_nhooks > 0) #define PFIL_RLOCK(p) rw_rlock(&(p)->ph_mtx) #define PFIL_WLOCK(p) rw_wlock(&(p)->ph_mtx) #define PFIL_RUNLOCK(p) rw_runlock(&(p)->ph_mtx)