From owner-svn-src-all@FreeBSD.ORG Wed Oct 19 10:16:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F04F1065672; Wed, 19 Oct 2011 10:16:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34A1C8FC12; Wed, 19 Oct 2011 10:16:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9JAGhD0015722; Wed, 19 Oct 2011 10:16:43 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9JAGhZd015716; Wed, 19 Oct 2011 10:16:43 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110191016.p9JAGhZd015716@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 19 Oct 2011 10:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226535 - head/sys/contrib/pf/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2011 10:16:43 -0000 Author: bz Date: Wed Oct 19 10:16:42 2011 New Revision: 226535 URL: http://svn.freebsd.org/changeset/base/226535 Log: Adjust the PF_ASSERT() macro to what we usually use in the network stack: PF_LOCK_ASSERT() and PF_UNLOCK_ASSERT(). MFC after: 3 days Modified: head/sys/contrib/pf/net/if_pfsync.c head/sys/contrib/pf/net/pf_ioctl.c head/sys/contrib/pf/net/pf_table.c head/sys/contrib/pf/net/pfvar.h Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Wed Oct 19 10:09:01 2011 (r226534) +++ head/sys/contrib/pf/net/if_pfsync.c Wed Oct 19 10:16:42 2011 (r226535) @@ -2143,7 +2143,7 @@ pfsync_sendout(void) int q, count = 0; #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #else splassert(IPL_NET); #endif @@ -2378,7 +2378,7 @@ pfsync_insert_state(struct pf_state *st) #endif #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #else splassert(IPL_SOFTNET); #endif @@ -2430,7 +2430,7 @@ pfsync_defer(struct pf_state *st, struct struct pfsync_deferral *pd; #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #else splassert(IPL_SOFTNET); #endif @@ -2477,7 +2477,7 @@ pfsync_undefer(struct pfsync_deferral *p int s; #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #else splassert(IPL_SOFTNET); #endif @@ -2560,7 +2560,7 @@ pfsync_update_state(struct pf_state *st) int sync = 0; #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #else splassert(IPL_SOFTNET); #endif @@ -2710,7 +2710,7 @@ pfsync_delete_state(struct pf_state *st) #endif #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #else splassert(IPL_SOFTNET); #endif @@ -2771,7 +2771,7 @@ pfsync_clear_states(u_int32_t creatorid, #endif #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #else splassert(IPL_SOFTNET); #endif Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 19 10:09:01 2011 (r226534) +++ head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 19 10:16:42 2011 (r226535) @@ -4259,7 +4259,7 @@ hook_pf(void) struct pfil_head *pfh_inet6; #endif - PF_ASSERT(MA_NOTOWNED); + PF_UNLOCK_ASSERT(); if (V_pf_pfil_hooked) return (0); @@ -4300,7 +4300,7 @@ dehook_pf(void) struct pfil_head *pfh_inet6; #endif - PF_ASSERT(MA_NOTOWNED); + PF_UNLOCK_ASSERT(); if (V_pf_pfil_hooked == 0) return (0); Modified: head/sys/contrib/pf/net/pf_table.c ============================================================================== --- head/sys/contrib/pf/net/pf_table.c Wed Oct 19 10:09:01 2011 (r226534) +++ head/sys/contrib/pf/net/pf_table.c Wed Oct 19 10:16:42 2011 (r226535) @@ -906,7 +906,7 @@ pfr_lookup_addr(struct pfr_ktable *kt, s pfr_prepare_network(&mask, ad->pfra_af, ad->pfra_net); s = splsoftnet(); /* rn_lookup makes use of globals */ #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #endif ke = (struct pfr_kentry *)rn_lookup(&sa, &mask, head); splx(s); @@ -1127,7 +1127,7 @@ pfr_route_kentry(struct pfr_ktable *kt, s = splsoftnet(); #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #endif if (KENTRY_NETWORK(ke)) { pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net); @@ -1166,7 +1166,7 @@ pfr_unroute_kentry(struct pfr_ktable *kt s = splsoftnet(); #ifdef __FreeBSD__ - PF_ASSERT(MA_OWNED); + PF_LOCK_ASSERT(); #endif if (KENTRY_NETWORK(ke)) { pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net); Modified: head/sys/contrib/pf/net/pfvar.h ============================================================================== --- head/sys/contrib/pf/net/pfvar.h Wed Oct 19 10:09:01 2011 (r226534) +++ head/sys/contrib/pf/net/pfvar.h Wed Oct 19 10:16:42 2011 (r226535) @@ -240,18 +240,20 @@ struct pfi_dynaddr { VNET_DECLARE(struct mtx, pf_task_mtx); #define V_pf_task_mtx VNET(pf_task_mtx) -#define PF_ASSERT(h) mtx_assert(&V_pf_task_mtx, (h)) +#define PF_LOCK_ASSERT() mtx_assert(&V_pf_task_mtx, MA_OWNED) +#define PF_UNLOCK_ASSERT() mtx_assert(&V_pf_task_mtx, MA_NOTOWNED) #define PF_LOCK() do { \ - PF_ASSERT(MA_NOTOWNED); \ + PF_UNLOCK_ASSERT(); \ mtx_lock(&V_pf_task_mtx); \ } while(0) #define PF_UNLOCK() do { \ - PF_ASSERT(MA_OWNED); \ + PF_LOCK_ASSERT(); \ mtx_unlock(&V_pf_task_mtx); \ } while(0) #else -#define PF_ASSERT(h) +#define PF_LOCK_ASSERT() +#define PF_UNLOCK_ASSERT() #define PF_LOCK() #define PF_UNLOCK() #endif /* __FreeBSD__ */