xref: /freebsd/sys/net/if_llatbl.h (revision d18b4bec98f1cf3c51103a22c0c041e6238c44c7)
1fe267a55SPedro F. Giffuni /*-
2fe267a55SPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3fe267a55SPedro F. Giffuni  *
482f39c91SKip Macy  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
582f39c91SKip Macy  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
682f39c91SKip Macy  * Copyright (c) 2008 Kip Macy. All rights reserved.
782f39c91SKip Macy  *
882f39c91SKip Macy  * Redistribution and use in source and binary forms, with or without
982f39c91SKip Macy  * modification, are permitted provided that the following conditions
1082f39c91SKip Macy  * are met:
1182f39c91SKip Macy  * 1. Redistributions of source code must retain the above copyright
1282f39c91SKip Macy  *    notice, this list of conditions and the following disclaimer.
1382f39c91SKip Macy  * 2. Redistributions in binary form must reproduce the above copyright
1482f39c91SKip Macy  *    notice, this list of conditions and the following disclaimer in the
1582f39c91SKip Macy  *    documentation and/or other materials provided with the distribution.
1682f39c91SKip Macy  *
1782f39c91SKip Macy  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1882f39c91SKip Macy  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1982f39c91SKip Macy  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2082f39c91SKip Macy  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
2182f39c91SKip Macy  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2282f39c91SKip Macy  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2382f39c91SKip Macy  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2482f39c91SKip Macy  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2582f39c91SKip Macy  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2682f39c91SKip Macy  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2782f39c91SKip Macy  * SUCH DAMAGE.
2882f39c91SKip Macy  */
2982f39c91SKip Macy #include <sys/cdefs.h>
3082f39c91SKip Macy __FBSDID("$FreeBSD$");
3182f39c91SKip Macy 
3282f39c91SKip Macy #ifndef	_NET_IF_LLATBL_H_
3382f39c91SKip Macy #define	_NET_IF_LLATBL_H_
3482f39c91SKip Macy 
35e2e050c8SConrad Meyer #include <sys/_eventhandler.h>
3682f39c91SKip Macy #include <sys/_rwlock.h>
3782f39c91SKip Macy #include <netinet/in.h>
384f6c66ccSMatt Macy #include <sys/epoch.h>
390f8d79d9SMatt Macy #include <sys/ck.h>
4082f39c91SKip Macy 
4182f39c91SKip Macy struct ifnet;
4282f39c91SKip Macy struct sysctl_req;
4382f39c91SKip Macy struct rt_msghdr;
4482f39c91SKip Macy struct rt_addrinfo;
4582f39c91SKip Macy struct llentry;
460f8d79d9SMatt Macy CK_LIST_HEAD(llentries, llentry);
4782f39c91SKip Macy 
484fb3a820SAlexander V. Chernikov #define	LLE_MAX_LINKHDR		24	/* Full IB header */
4982f39c91SKip Macy /*
5082f39c91SKip Macy  * Code referencing llentry must at least hold
5182f39c91SKip Macy  * a shared lock
5282f39c91SKip Macy  */
5382f39c91SKip Macy struct llentry {
540f8d79d9SMatt Macy 	CK_LIST_ENTRY(llentry)	 lle_next;
55314294deSAlexander V. Chernikov 	union {
56314294deSAlexander V. Chernikov 		struct in_addr	addr4;
57314294deSAlexander V. Chernikov 		struct in6_addr	addr6;
58314294deSAlexander V. Chernikov 	} r_l3addr;
594fb3a820SAlexander V. Chernikov 	char			r_linkdata[LLE_MAX_LINKHDR]; /* L2 data */
604fb3a820SAlexander V. Chernikov 	uint8_t			r_hdrlen;	/* length for LL header */
61c541bd36SAlexander V. Chernikov 	uint8_t			r_family;	/* Upper layer proto family */
62c541bd36SAlexander V. Chernikov 	uint8_t			spare0[2];
63f8aee88fSAlexander V. Chernikov 	uint16_t		r_flags;	/* LLE runtime flags */
64f8aee88fSAlexander V. Chernikov 	uint16_t		r_skip_req;	/* feedback from fast path */
65314294deSAlexander V. Chernikov 
6682f39c91SKip Macy 	struct lltable		 *lle_tbl;
6782f39c91SKip Macy 	struct llentries	 *lle_head;
6811cdad98SAlexander V. Chernikov 	void			(*lle_free)(struct llentry *);
6982f39c91SKip Macy 	struct mbuf		 *la_hold;
70e162ea60SGeorge V. Neville-Neil 	int			 la_numheld;  /* # of packets currently held */
7182f39c91SKip Macy 	time_t			 la_expire;
7282f39c91SKip Macy 	uint16_t		 la_flags;
7382f39c91SKip Macy 	uint16_t		 la_asked;
7482f39c91SKip Macy 	uint16_t		 la_preempt;
7582f39c91SKip Macy 	int16_t			 ln_state;	/* IPv6 has ND6_LLINFO_NOSTATE == -2 */
7682f39c91SKip Macy 	uint16_t		 ln_router;
7782f39c91SKip Macy 	time_t			 ln_ntick;
7812cb7521SAlexander V. Chernikov 	time_t			lle_remtime;	/* Real time remaining */
7912cb7521SAlexander V. Chernikov 	time_t			lle_hittime;	/* Time when r_skip_req was unset */
8082f39c91SKip Macy 	int			 lle_refcnt;
814fb3a820SAlexander V. Chernikov 	char			*ll_addr;	/* link-layer address */
82c541bd36SAlexander V. Chernikov 	CK_SLIST_HEAD(llentry_children_head,llentry)	lle_children;	/* child encaps */
83c541bd36SAlexander V. Chernikov 	CK_SLIST_ENTRY(llentry)	lle_child_next;	/* child encaps */
84c541bd36SAlexander V. Chernikov 	struct llentry		*lle_parent;	/* parent for a child */
8582f39c91SKip Macy 
860f8d79d9SMatt Macy 	CK_LIST_ENTRY(llentry)	lle_chain;	/* chain of deleted items */
870447c136SAlexander V. Chernikov 	struct callout		lle_timer;
88314294deSAlexander V. Chernikov 	struct rwlock		 lle_lock;
89f8aee88fSAlexander V. Chernikov 	struct mtx		req_mtx;
904f6c66ccSMatt Macy 	struct epoch_context lle_epoch_ctx;
9182f39c91SKip Macy };
9282f39c91SKip Macy 
9382f39c91SKip Macy #define	LLE_WLOCK(lle)		rw_wlock(&(lle)->lle_lock)
9482f39c91SKip Macy #define	LLE_RLOCK(lle)		rw_rlock(&(lle)->lle_lock)
9582f39c91SKip Macy #define	LLE_WUNLOCK(lle)	rw_wunlock(&(lle)->lle_lock)
9682f39c91SKip Macy #define	LLE_RUNLOCK(lle)	rw_runlock(&(lle)->lle_lock)
9782f39c91SKip Macy #define	LLE_DOWNGRADE(lle)	rw_downgrade(&(lle)->lle_lock)
9882f39c91SKip Macy #define	LLE_TRY_UPGRADE(lle)	rw_try_upgrade(&(lle)->lle_lock)
9982f39c91SKip Macy #define	LLE_LOCK_INIT(lle)	rw_init_flags(&(lle)->lle_lock, "lle", RW_DUPOK)
1008a61a4eeSKip Macy #define	LLE_LOCK_DESTROY(lle)	rw_destroy(&(lle)->lle_lock)
10182f39c91SKip Macy #define	LLE_WLOCK_ASSERT(lle)	rw_assert(&(lle)->lle_lock, RA_WLOCKED)
10282f39c91SKip Macy 
103f8aee88fSAlexander V. Chernikov #define	LLE_REQ_INIT(lle)	mtx_init(&(lle)->req_mtx, "lle req", \
104f8aee88fSAlexander V. Chernikov 	NULL, MTX_DEF)
105f8aee88fSAlexander V. Chernikov #define	LLE_REQ_DESTROY(lle)	mtx_destroy(&(lle)->req_mtx)
106f8aee88fSAlexander V. Chernikov #define	LLE_REQ_LOCK(lle)	mtx_lock(&(lle)->req_mtx)
107f8aee88fSAlexander V. Chernikov #define	LLE_REQ_UNLOCK(lle)	mtx_unlock(&(lle)->req_mtx)
108f8aee88fSAlexander V. Chernikov 
10982f39c91SKip Macy #define LLE_IS_VALID(lle)	(((lle) != NULL) && ((lle) != (void *)-1))
11082f39c91SKip Macy 
111c541bd36SAlexander V. Chernikov #define	LLE_SF(_fam, _flags)	(((_flags) & 0xFFFF) | ((_fam) << 16))
112c541bd36SAlexander V. Chernikov 
11382f39c91SKip Macy #define	LLE_ADDREF(lle) do {					\
11482f39c91SKip Macy 	LLE_WLOCK_ASSERT(lle);					\
11582f39c91SKip Macy 	KASSERT((lle)->lle_refcnt >= 0,				\
116ea537929SGleb Smirnoff 	    ("negative refcnt %d on lle %p",			\
117ea537929SGleb Smirnoff 	    (lle)->lle_refcnt, (lle)));				\
11882f39c91SKip Macy 	(lle)->lle_refcnt++;					\
11982f39c91SKip Macy } while (0)
120ea50c13eSGleb Smirnoff 
12182f39c91SKip Macy #define	LLE_REMREF(lle)	do {					\
12282f39c91SKip Macy 	LLE_WLOCK_ASSERT(lle);					\
123ea537929SGleb Smirnoff 	KASSERT((lle)->lle_refcnt > 0,				\
124ea537929SGleb Smirnoff 	    ("bogus refcnt %d on lle %p",			\
125ea537929SGleb Smirnoff 	    (lle)->lle_refcnt, (lle)));				\
12682f39c91SKip Macy 	(lle)->lle_refcnt--;					\
12782f39c91SKip Macy } while (0)
12882f39c91SKip Macy 
12982f39c91SKip Macy #define	LLE_FREE_LOCKED(lle) do {				\
130ea537929SGleb Smirnoff 	if ((lle)->lle_refcnt == 1)				\
13111cdad98SAlexander V. Chernikov 		(lle)->lle_free(lle);				\
13282f39c91SKip Macy 	else {							\
133ea537929SGleb Smirnoff 		LLE_REMREF(lle);				\
13482f39c91SKip Macy 		LLE_WUNLOCK(lle);				\
13582f39c91SKip Macy 	}							\
13682f39c91SKip Macy 	/* guard against invalid refs */			\
137ea537929SGleb Smirnoff 	(lle) = NULL;						\
13882f39c91SKip Macy } while (0)
13982f39c91SKip Macy 
14082f39c91SKip Macy #define	LLE_FREE(lle) do {					\
14182f39c91SKip Macy 	LLE_WLOCK(lle);						\
142962be6dfSBjoern A. Zeeb 	LLE_FREE_LOCKED(lle);					\
14382f39c91SKip Macy } while (0)
14482f39c91SKip Macy 
145b4b1367aSAlexander V. Chernikov typedef	struct llentry *(llt_lookup_t)(struct lltable *, u_int flags,
146b4b1367aSAlexander V. Chernikov     const struct sockaddr *l3addr);
1475a255516SAlexander V. Chernikov typedef	struct llentry *(llt_alloc_t)(struct lltable *, u_int flags,
148b4b1367aSAlexander V. Chernikov     const struct sockaddr *l3addr);
1493e7a2321SAlexander V. Chernikov typedef	void (llt_delete_t)(struct lltable *, struct llentry *);
150b4b1367aSAlexander V. Chernikov typedef void (llt_prefix_free_t)(struct lltable *,
1513e7a2321SAlexander V. Chernikov     const struct sockaddr *addr, const struct sockaddr *mask, u_int flags);
15211cdad98SAlexander V. Chernikov typedef int (llt_dump_entry_t)(struct lltable *, struct llentry *,
15311cdad98SAlexander V. Chernikov     struct sysctl_req *);
15411cdad98SAlexander V. Chernikov typedef uint32_t (llt_hash_t)(const struct llentry *, uint32_t);
15511cdad98SAlexander V. Chernikov typedef int (llt_match_prefix_t)(const struct sockaddr *,
15611cdad98SAlexander V. Chernikov     const struct sockaddr *, u_int, struct llentry *);
15711cdad98SAlexander V. Chernikov typedef void (llt_free_entry_t)(struct lltable *, struct llentry *);
15811cdad98SAlexander V. Chernikov typedef void (llt_fill_sa_entry_t)(const struct llentry *, struct sockaddr *);
15941cb42a6SAlexander V. Chernikov typedef void (llt_free_tbl_t)(struct lltable *);
1603818c25aSBjoern A. Zeeb typedef int (llt_link_entry_t)(struct lltable *, struct llentry *);
1613818c25aSBjoern A. Zeeb typedef int (llt_unlink_entry_t)(struct llentry *);
1621435dcd9SAlexander V. Chernikov typedef void (llt_mark_used_t)(struct llentry *);
16377001f9bSKUROSAWA Takahiro typedef void (llt_post_resolved_t)(struct lltable *, struct llentry *);
16411cdad98SAlexander V. Chernikov 
16511cdad98SAlexander V. Chernikov typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *);
16611cdad98SAlexander V. Chernikov typedef int (llt_foreach_entry_t)(struct lltable *, llt_foreach_cb_t *, void *);
167d6cd20ccSKUROSAWA Takahiro typedef bool (llt_match_cb_t)(struct lltable *, struct llentry *, void *);
168b4b1367aSAlexander V. Chernikov 
16982f39c91SKip Macy struct lltable {
17082f39c91SKip Macy 	SLIST_ENTRY(lltable)	llt_link;
1713719dedbSKUROSAWA Takahiro 	sa_family_t		llt_af;
172d6cd20ccSKUROSAWA Takahiro 	uint8_t			llt_flags;
173d6cd20ccSKUROSAWA Takahiro 	uint8_t			llt_spare[2];
17441cb42a6SAlexander V. Chernikov 	int			llt_hsize;
1753818c25aSBjoern A. Zeeb 	int			llt_entries;
1763818c25aSBjoern A. Zeeb 	int			llt_maxentries;
17741cb42a6SAlexander V. Chernikov 	struct llentries	*lle_head;
17882f39c91SKip Macy 	struct ifnet		*llt_ifp;
17982f39c91SKip Macy 
180b4b1367aSAlexander V. Chernikov 	llt_lookup_t		*llt_lookup;
1815a255516SAlexander V. Chernikov 	llt_alloc_t		*llt_alloc_entry;
1823e7a2321SAlexander V. Chernikov 	llt_delete_t		*llt_delete_entry;
183b4b1367aSAlexander V. Chernikov 	llt_prefix_free_t	*llt_prefix_free;
18411cdad98SAlexander V. Chernikov 	llt_dump_entry_t	*llt_dump_entry;
18511cdad98SAlexander V. Chernikov 	llt_hash_t		*llt_hash;
18611cdad98SAlexander V. Chernikov 	llt_match_prefix_t	*llt_match_prefix;
18711cdad98SAlexander V. Chernikov 	llt_free_entry_t	*llt_free_entry;
18811cdad98SAlexander V. Chernikov 	llt_foreach_entry_t	*llt_foreach_entry;
18911cdad98SAlexander V. Chernikov 	llt_link_entry_t	*llt_link_entry;
19011cdad98SAlexander V. Chernikov 	llt_unlink_entry_t	*llt_unlink_entry;
19111cdad98SAlexander V. Chernikov 	llt_fill_sa_entry_t	*llt_fill_sa_entry;
19241cb42a6SAlexander V. Chernikov 	llt_free_tbl_t		*llt_free_tbl;
1931435dcd9SAlexander V. Chernikov 	llt_mark_used_t		*llt_mark_used;
19477001f9bSKUROSAWA Takahiro 	llt_post_resolved_t	*llt_post_resolved;
19582f39c91SKip Macy };
196b4b1367aSAlexander V. Chernikov 
19782f39c91SKip Macy MALLOC_DECLARE(M_LLTABLE);
19882f39c91SKip Macy 
19982f39c91SKip Macy /*
200d6cd20ccSKUROSAWA Takahiro  * LLtable flags
201d6cd20ccSKUROSAWA Takahiro  */
202d6cd20ccSKUROSAWA Takahiro #define	LLT_ADDEDPROXY	0x01	/* added a proxy llentry */
203d6cd20ccSKUROSAWA Takahiro 
204d6cd20ccSKUROSAWA Takahiro /*
205e362cf0eSAlexander V. Chernikov  * LLentry flags
20682f39c91SKip Macy  */
20782f39c91SKip Macy #define	LLE_DELETED	0x0001	/* entry must be deleted */
20882f39c91SKip Macy #define	LLE_STATIC	0x0002	/* entry is static */
20982f39c91SKip Macy #define	LLE_IFADDR	0x0004	/* entry is interface addr */
21082f39c91SKip Macy #define	LLE_VALID	0x0008	/* ll_addr is valid */
21117a03656SEric van Gyzen #define	LLE_REDIRECT	0x0010	/* installed by redirect; has host rtentry */
21282f39c91SKip Macy #define	LLE_PUB		0x0020	/* publish entry ??? */
213ea537929SGleb Smirnoff #define	LLE_LINKED	0x0040	/* linked to lookup structure */
214c541bd36SAlexander V. Chernikov #define	LLE_CHILD	0x0080	/* Child LLE storing different AF encap */
215b4b1367aSAlexander V. Chernikov /* LLE request flags */
216ea50c13eSGleb Smirnoff #define	LLE_EXCLUSIVE	0x2000	/* return lle xlocked  */
217f8aee88fSAlexander V. Chernikov #define	LLE_UNLOCKED	0x4000	/* return lle unlocked */
2184fb3a820SAlexander V. Chernikov #define	LLE_ADDRONLY	0x4000	/* return lladdr instead of full header */
2194fb3a820SAlexander V. Chernikov #define	LLE_CREATE	0x8000	/* hint to avoid lle lookup */
220f8aee88fSAlexander V. Chernikov 
221f8aee88fSAlexander V. Chernikov /* LLE flags used by fastpath code */
222f8aee88fSAlexander V. Chernikov #define	RLLE_VALID	0x0001		/* entry is valid */
223f8aee88fSAlexander V. Chernikov #define	RLLE_IFADDR	LLE_IFADDR	/* entry is ifaddr */
22482f39c91SKip Macy 
22582f39c91SKip Macy #define LLATBL_HASH(key, mask) \
22682f39c91SKip Macy 	(((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask)
22782f39c91SKip Macy 
22841cb42a6SAlexander V. Chernikov struct lltable *lltable_allocate_htbl(uint32_t hsize);
22982f39c91SKip Macy void		lltable_free(struct lltable *);
23041cb42a6SAlexander V. Chernikov void		lltable_link(struct lltable *llt);
231c9d763bfSQing Li void		lltable_prefix_free(int, struct sockaddr *,
2325b84dc78SQing Li 		    struct sockaddr *, u_int);
23382f39c91SKip Macy int		lltable_sysctl_dumparp(int, struct sysctl_req *);
234*d18b4becSArseny Smalyuk size_t		lltable_append_entry_queue(struct llentry *,
235*d18b4becSArseny Smalyuk 		    struct mbuf *, size_t);
23682f39c91SKip Macy 
237ff3a85d3SAlexander V. Chernikov struct lltable *in_lltable_get(struct ifnet *ifp);
238ff3a85d3SAlexander V. Chernikov struct lltable *in6_lltable_get(struct ifnet *ifp);
239ff3a85d3SAlexander V. Chernikov struct lltable *lltable_get(struct ifnet *ifp, int family);
240ff3a85d3SAlexander V. Chernikov 
241e162ea60SGeorge V. Neville-Neil size_t		llentry_free(struct llentry *);
24282f39c91SKip Macy 
24311cdad98SAlexander V. Chernikov /* helper functions */
24411cdad98SAlexander V. Chernikov size_t lltable_drop_entry_queue(struct llentry *);
245ddd208f7SAlexander V. Chernikov void lltable_set_entry_addr(struct ifnet *ifp, struct llentry *lle,
2464fb3a820SAlexander V. Chernikov     const char *linkhdr, size_t linkhdrsize, int lladdr_off);
24712cb7521SAlexander V. Chernikov int lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle,
2484fb3a820SAlexander V. Chernikov     const char *linkhdr, size_t linkhdrsize, int lladdr_off);
24911cdad98SAlexander V. Chernikov 
2504fb3a820SAlexander V. Chernikov int lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr,
2514fb3a820SAlexander V. Chernikov     char *buf, size_t *bufsize, int *lladdr_off);
2524fb3a820SAlexander V. Chernikov void lltable_update_ifaddr(struct lltable *llt);
2535a255516SAlexander V. Chernikov struct llentry *lltable_alloc_entry(struct lltable *llt, u_int flags,
2545a255516SAlexander V. Chernikov     const struct sockaddr *l4addr);
2555a255516SAlexander V. Chernikov void lltable_free_entry(struct lltable *llt, struct llentry *lle);
2563e7a2321SAlexander V. Chernikov int lltable_delete_addr(struct lltable *llt, u_int flags,
2573e7a2321SAlexander V. Chernikov     const struct sockaddr *l3addr);
2583818c25aSBjoern A. Zeeb int lltable_link_entry(struct lltable *llt, struct llentry *lle);
2593818c25aSBjoern A. Zeeb int lltable_unlink_entry(struct lltable *llt, struct llentry *lle);
260c541bd36SAlexander V. Chernikov void lltable_link_child_entry(struct llentry *parent_lle, struct llentry *child_lle);
261c541bd36SAlexander V. Chernikov void lltable_unlink_child_entry(struct llentry *child_lle);
26211cdad98SAlexander V. Chernikov void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa);
26311cdad98SAlexander V. Chernikov struct ifnet *lltable_get_ifp(const struct lltable *llt);
26411cdad98SAlexander V. Chernikov int lltable_get_af(const struct lltable *llt);
26511cdad98SAlexander V. Chernikov 
2660b79b007SAlexander V. Chernikov bool lltable_acquire_wlock(struct ifnet *ifp, struct llentry *lle);
2670b79b007SAlexander V. Chernikov 
26811cdad98SAlexander V. Chernikov int lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f,
26911cdad98SAlexander V. Chernikov     void *farg);
270d6cd20ccSKUROSAWA Takahiro void lltable_delete_conditional(struct lltable *llt, llt_match_cb_t *func,
271d6cd20ccSKUROSAWA Takahiro     void *farg);
272d6cd20ccSKUROSAWA Takahiro 
27382f39c91SKip Macy /*
27482f39c91SKip Macy  * Generic link layer address lookup function.
27582f39c91SKip Macy  */
27682f39c91SKip Macy static __inline struct llentry *
27782f39c91SKip Macy lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)
27882f39c91SKip Macy {
279b4b1367aSAlexander V. Chernikov 
280e362cf0eSAlexander V. Chernikov 	return (llt->llt_lookup(llt, flags, l3addr));
28182f39c91SKip Macy }
28282f39c91SKip Macy 
283f3a3b061SAlexander V. Chernikov void llentry_request_feedback(struct llentry *lle);
284f3a3b061SAlexander V. Chernikov void llentry_mark_used(struct llentry *lle);
285f3a3b061SAlexander V. Chernikov time_t llentry_get_hittime(struct llentry *lle);
28663f7f392SAlexander V. Chernikov int llentry_get_upper_family(const struct llentry *lle, int default_family);
287f3a3b061SAlexander V. Chernikov 
2881435dcd9SAlexander V. Chernikov /*
2891435dcd9SAlexander V. Chernikov  * Notify the LLE code that the entry was used by datapath.
2901435dcd9SAlexander V. Chernikov  */
2911435dcd9SAlexander V. Chernikov static __inline void
292f3a3b061SAlexander V. Chernikov llentry_provide_feedback(struct llentry *lle)
2931435dcd9SAlexander V. Chernikov {
2941435dcd9SAlexander V. Chernikov 
295f3a3b061SAlexander V. Chernikov 	if (__predict_true(lle->r_skip_req == 0))
2961435dcd9SAlexander V. Chernikov 		return;
297f3a3b061SAlexander V. Chernikov 	llentry_mark_used(lle);
2981435dcd9SAlexander V. Chernikov }
299c541bd36SAlexander V. Chernikov struct llentry *llentry_lookup_family(struct llentry *lle, int family);
3001435dcd9SAlexander V. Chernikov 
30182f39c91SKip Macy int		lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *);
3024364ec08SNavdeep Parhar 
3034364ec08SNavdeep Parhar enum {
3044364ec08SNavdeep Parhar 	LLENTRY_RESOLVED,
3054364ec08SNavdeep Parhar 	LLENTRY_TIMEDOUT,
3064364ec08SNavdeep Parhar 	LLENTRY_DELETED,
3074364ec08SNavdeep Parhar 	LLENTRY_EXPIRED,
3084364ec08SNavdeep Parhar };
3094364ec08SNavdeep Parhar typedef void (*lle_event_fn)(void *, struct llentry *, int);
3104364ec08SNavdeep Parhar EVENTHANDLER_DECLARE(lle_event, lle_event_fn);
31182f39c91SKip Macy #endif  /* _NET_IF_LLATBL_H_ */
312