Deleted Added
full compact
if_llatbl.h (191154) if_llatbl.h (192476)
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 191154 2009-04-16 22:04:07Z kmacy $");
28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.h 192476 2009-05-20 21:07:15Z qingli $");
29
30#ifndef _NET_IF_LLATBL_H_
31#define _NET_IF_LLATBL_H_
32
33#include <sys/_rwlock.h>
34#include <netinet/in.h>
35
36struct ifnet;

--- 105 unchanged lines hidden (view full) ---

142struct lltable {
143 SLIST_ENTRY(lltable) llt_link;
144 struct llentries lle_head[LLTBL_HASHTBL_SIZE];
145 int llt_af;
146 struct ifnet *llt_ifp;
147
148 struct llentry * (*llt_new)(const struct sockaddr *, u_int);
149 void (*llt_free)(struct lltable *, struct llentry *);
29
30#ifndef _NET_IF_LLATBL_H_
31#define _NET_IF_LLATBL_H_
32
33#include <sys/_rwlock.h>
34#include <netinet/in.h>
35
36struct ifnet;

--- 105 unchanged lines hidden (view full) ---

142struct lltable {
143 SLIST_ENTRY(lltable) llt_link;
144 struct llentries lle_head[LLTBL_HASHTBL_SIZE];
145 int llt_af;
146 struct ifnet *llt_ifp;
147
148 struct llentry * (*llt_new)(const struct sockaddr *, u_int);
149 void (*llt_free)(struct lltable *, struct llentry *);
150 void (*llt_prefix_free)(struct lltable *,
151 const struct sockaddr *prefix,
152 const struct sockaddr *mask);
150 struct llentry * (*llt_lookup)(struct lltable *, u_int flags,
151 const struct sockaddr *l3addr);
152 int (*llt_rtcheck)(struct ifnet *,
153 const struct sockaddr *);
154 int (*llt_dump)(struct lltable *,
155 struct sysctl_req *);
156};
157MALLOC_DECLARE(M_LLTABLE);

--- 11 unchanged lines hidden (view full) ---

169#define LLE_CREATE 0x8000 /* create on a lookup miss */
170#define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */
171
172#define LLATBL_HASH(key, mask) \
173 (((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask)
174
175struct lltable *lltable_init(struct ifnet *, int);
176void lltable_free(struct lltable *);
153 struct llentry * (*llt_lookup)(struct lltable *, u_int flags,
154 const struct sockaddr *l3addr);
155 int (*llt_rtcheck)(struct ifnet *,
156 const struct sockaddr *);
157 int (*llt_dump)(struct lltable *,
158 struct sysctl_req *);
159};
160MALLOC_DECLARE(M_LLTABLE);

--- 11 unchanged lines hidden (view full) ---

172#define LLE_CREATE 0x8000 /* create on a lookup miss */
173#define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */
174
175#define LLATBL_HASH(key, mask) \
176 (((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask)
177
178struct lltable *lltable_init(struct ifnet *, int);
179void lltable_free(struct lltable *);
180void lltable_prefix_free(int, struct sockaddr *,
181 struct sockaddr *);
177void lltable_drain(int);
178int lltable_sysctl_dumparp(int, struct sysctl_req *);
179
180void llentry_free(struct llentry *);
181int llentry_update(struct llentry **, struct lltable *,
182 struct sockaddr *, struct ifnet *);
183
184/*
185 * Generic link layer address lookup function.
186 */
187static __inline struct llentry *
188lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)
189{
190 return llt->llt_lookup(llt, flags, l3addr);
191}
192
193int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *);
194#endif /* _NET_IF_LLATBL_H_ */
182void lltable_drain(int);
183int lltable_sysctl_dumparp(int, struct sysctl_req *);
184
185void llentry_free(struct llentry *);
186int llentry_update(struct llentry **, struct lltable *,
187 struct sockaddr *, struct ifnet *);
188
189/*
190 * Generic link layer address lookup function.
191 */
192static __inline struct llentry *
193lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)
194{
195 return llt->llt_lookup(llt, flags, l3addr);
196}
197
198int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *);
199#endif /* _NET_IF_LLATBL_H_ */