From owner-svn-src-head@freebsd.org Sat Dec 30 19:49:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A3F0EA9597; Sat, 30 Dec 2017 19:49:42 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8A4269B7E; Sat, 30 Dec 2017 19:49:41 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBUJnemB099422; Sat, 30 Dec 2017 19:49:40 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBUJnecg099421; Sat, 30 Dec 2017 19:49:40 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201712301949.vBUJnecg099421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sat, 30 Dec 2017 19:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327386 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: bryanv X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 327386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Dec 2017 19:49:42 -0000 Author: bryanv Date: Sat Dec 30 19:49:40 2017 New Revision: 327386 URL: https://svnweb.freebsd.org/changeset/base/327386 Log: Add macro for vxlan list mutex lock and unlock This will simplify some later VNET support. Submitted by: hrs MFC after: 2 weeks Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c ============================================================================== --- head/sys/net/if_vxlan.c Sat Dec 30 19:35:12 2017 (r327385) +++ head/sys/net/if_vxlan.c Sat Dec 30 19:49:40 2017 (r327386) @@ -381,7 +381,11 @@ static const char vxlan_name[] = "vxlan"; static MALLOC_DEFINE(M_VXLAN, vxlan_name, "Virtual eXtensible LAN Interface"); static struct if_clone *vxlan_cloner; + static struct mtx vxlan_list_mtx; +#define VXLAN_LIST_LOCK() mtx_lock(&vxlan_list_mtx) +#define VXLAN_LIST_UNLOCK() mtx_unlock(&vxlan_list_mtx) + static LIST_HEAD(, vxlan_socket) vxlan_socket_list; static eventhandler_tag vxlan_ifdetach_event_tag; @@ -890,11 +894,11 @@ vxlan_socket_release(struct vxlan_socket *vso) { int destroy; - mtx_lock(&vxlan_list_mtx); + VXLAN_LIST_LOCK(); destroy = VXLAN_SO_RELEASE(vso); if (destroy != 0) LIST_REMOVE(vso, vxlso_entry); - mtx_unlock(&vxlan_list_mtx); + VXLAN_LIST_UNLOCK(); if (destroy != 0) vxlan_socket_destroy(vso); @@ -905,14 +909,14 @@ vxlan_socket_lookup(union vxlan_sockaddr *vxlsa) { struct vxlan_socket *vso; - mtx_lock(&vxlan_list_mtx); + VXLAN_LIST_LOCK(); LIST_FOREACH(vso, &vxlan_socket_list, vxlso_entry) { if (vxlan_sockaddr_cmp(&vso->vxlso_laddr, &vxlsa->sa) == 0) { VXLAN_SO_ACQUIRE(vso); break; } } - mtx_unlock(&vxlan_list_mtx); + VXLAN_LIST_UNLOCK(); return (vso); } @@ -921,10 +925,10 @@ static void vxlan_socket_insert(struct vxlan_socket *vso) { - mtx_lock(&vxlan_list_mtx); + VXLAN_LIST_LOCK(); VXLAN_SO_ACQUIRE(vso); LIST_INSERT_HEAD(&vxlan_socket_list, vso, vxlso_entry); - mtx_unlock(&vxlan_list_mtx); + VXLAN_LIST_UNLOCK(); } static int @@ -3116,10 +3120,10 @@ vxlan_ifdetach_event(void *arg __unused, struct ifnet if ((ifp->if_flags & IFF_MULTICAST) == 0) return; - mtx_lock(&vxlan_list_mtx); + VXLAN_LIST_LOCK(); LIST_FOREACH(vso, &vxlan_socket_list, vxlso_entry) vxlan_socket_ifdetach(vso, ifp, &list); - mtx_unlock(&vxlan_list_mtx); + VXLAN_LIST_UNLOCK(); LIST_FOREACH_SAFE(sc, &list, vxl_ifdetach_list, tsc) { LIST_REMOVE(sc, vxl_ifdetach_list);