if_llatbl.h (225698) | if_llatbl.h (232054) |
---|---|
1/* 2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. 3 * Copyright (c) 2004-2008 Qing Li. All rights reserved. 4 * Copyright (c) 2008 Kip Macy. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. 3 * Copyright (c) 2004-2008 Qing Li. All rights reserved. 4 * Copyright (c) 2008 Kip Macy. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.h 225698 2011-09-20 20:27:26Z kmacy $"); | 28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.h 232054 2012-02-23 18:21:37Z kmacy $"); |
29 30#ifndef _NET_IF_LLATBL_H_ 31#define _NET_IF_LLATBL_H_ 32 33#include "opt_ofed.h" 34 35#include <sys/_rwlock.h> 36#include <netinet/in.h> --- 64 unchanged lines hidden (view full) --- 101#define LLE_IS_VALID(lle) (((lle) != NULL) && ((lle) != (void *)-1)) 102 103#define LLE_ADDREF(lle) do { \ 104 LLE_WLOCK_ASSERT(lle); \ 105 KASSERT((lle)->lle_refcnt >= 0, \ 106 ("negative refcnt %d", (lle)->lle_refcnt)); \ 107 (lle)->lle_refcnt++; \ 108} while (0) | 29 30#ifndef _NET_IF_LLATBL_H_ 31#define _NET_IF_LLATBL_H_ 32 33#include "opt_ofed.h" 34 35#include <sys/_rwlock.h> 36#include <netinet/in.h> --- 64 unchanged lines hidden (view full) --- 101#define LLE_IS_VALID(lle) (((lle) != NULL) && ((lle) != (void *)-1)) 102 103#define LLE_ADDREF(lle) do { \ 104 LLE_WLOCK_ASSERT(lle); \ 105 KASSERT((lle)->lle_refcnt >= 0, \ 106 ("negative refcnt %d", (lle)->lle_refcnt)); \ 107 (lle)->lle_refcnt++; \ 108} while (0) |
109 | |
110#define LLE_REMREF(lle) do { \ 111 LLE_WLOCK_ASSERT(lle); \ 112 KASSERT((lle)->lle_refcnt > 1, \ 113 ("bogus refcnt %d", (lle)->lle_refcnt)); \ 114 (lle)->lle_refcnt--; \ 115} while (0) 116 117#define LLE_FREE_LOCKED(lle) do { \ 118 if ((lle)->lle_refcnt <= 1) \ | 109#define LLE_REMREF(lle) do { \ 110 LLE_WLOCK_ASSERT(lle); \ 111 KASSERT((lle)->lle_refcnt > 1, \ 112 ("bogus refcnt %d", (lle)->lle_refcnt)); \ 113 (lle)->lle_refcnt--; \ 114} while (0) 115 116#define LLE_FREE_LOCKED(lle) do { \ 117 if ((lle)->lle_refcnt <= 1) \ |
119 (lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\ | 118 (lle)->lle_free((lle)->lle_tbl, (lle));\ |
120 else { \ 121 (lle)->lle_refcnt--; \ 122 LLE_WUNLOCK(lle); \ 123 } \ 124 /* guard against invalid refs */ \ 125 lle = NULL; \ 126} while (0) 127 --- 19 unchanged lines hidden (view full) --- 147#endif 148 149struct lltable { 150 SLIST_ENTRY(lltable) llt_link; 151 struct llentries lle_head[LLTBL_HASHTBL_SIZE]; 152 int llt_af; 153 struct ifnet *llt_ifp; 154 | 119 else { \ 120 (lle)->lle_refcnt--; \ 121 LLE_WUNLOCK(lle); \ 122 } \ 123 /* guard against invalid refs */ \ 124 lle = NULL; \ 125} while (0) 126 --- 19 unchanged lines hidden (view full) --- 146#endif 147 148struct lltable { 149 SLIST_ENTRY(lltable) llt_link; 150 struct llentries lle_head[LLTBL_HASHTBL_SIZE]; 151 int llt_af; 152 struct ifnet *llt_ifp; 153 |
155 void (*llt_free)(struct lltable *, struct llentry *); | |
156 void (*llt_prefix_free)(struct lltable *, 157 const struct sockaddr *prefix, 158 const struct sockaddr *mask, 159 u_int flags); 160 struct llentry * (*llt_lookup)(struct lltable *, u_int flags, 161 const struct sockaddr *l3addr); 162 int (*llt_dump)(struct lltable *, 163 struct sysctl_req *); --- 43 unchanged lines hidden --- | 154 void (*llt_prefix_free)(struct lltable *, 155 const struct sockaddr *prefix, 156 const struct sockaddr *mask, 157 u_int flags); 158 struct llentry * (*llt_lookup)(struct lltable *, u_int flags, 159 const struct sockaddr *l3addr); 160 int (*llt_dump)(struct lltable *, 161 struct sysctl_req *); --- 43 unchanged lines hidden --- |