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.
This commit is contained in:
Andrew Gallatin 2007-06-08 12:43:25 +00:00
parent 3b7917d766
commit 0bb6a7159d

View File

@ -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)