Lines Matching defs:ln
54 struct llentry *ln = arg;
64 LLE_WLOCK(ln);
66 if (!(ln->la_flags & LLE_LINKED))
68 if (ln->ln_ntick > 0) {
69 nd_set_timer(ln, ND_TIMER_TICK);
73 nd = nd_find_domain(ln->lle_tbl->llt_af);
74 ifp = ln->lle_tbl->llt_ifp;
78 memcpy(&taddr, &ln->r_l3addr, sizeof(taddr));
80 switch (ln->ln_state) {
82 LLE_REMREF(ln);
83 nd->nd_free(ln, 0);
84 ln = NULL;
88 if (ln->ln_asked < nd->nd_mmaxtries) {
89 ln->ln_asked++;
94 if (ln->ln_hold) {
101 m = ln->ln_hold;
109 ln->ln_hold = NULL;
110 ln->la_numheld = 0;
113 KASSERTMSG(ln->la_numheld == 0, "la_numheld=%d",
114 ln->la_numheld);
117 ln->ln_state = ND_LLINFO_WAITDELETE;
121 if (!ND_IS_LLINFO_PERMANENT(ln))
122 ln->ln_state = ND_LLINFO_STALE;
127 if (!ND_IS_LLINFO_PERMANENT(ln)) {
128 LLE_REMREF(ln);
129 nd->nd_free(ln, 1);
130 ln = NULL;
136 ln->ln_asked = 1;
137 ln->ln_state = ND_LLINFO_PROBE;
141 ln->ln_state = ND_LLINFO_STALE;
146 if (ln->ln_asked++ < nd->nd_umaxtries) {
149 ln->ln_state = ND_LLINFO_UNREACHABLE;
150 ln->ln_asked = 1;
172 if (ln->ln_asked++ < nd->nd_mmaxtries)
176 ln->ln_state = ND_LLINFO_WAITDELETE;
177 ln->la_flags &= ~LLE_VALID;
181 if (ln != NULL) {
183 if (ln->ln_state == ND_LLINFO_WAITDELETE)
185 else if (ln->ln_state == ND_LLINFO_STALE)
187 nd_set_timer(ln, type);
193 if (ln->ln_state > ND_LLINFO_INCOMPLETE &&
194 ln->la_flags & LLE_VALID)
197 memcpy(lladdr, &ln->ll_addr, ifp->if_addrlen);
201 psrc = nd->nd_holdsrc(ln, &src);
202 LLE_FREE_LOCKED(ln);
203 ln = NULL;
208 if (ln != NULL)
209 LLE_FREE_LOCKED(ln);
219 nd_set_timertick(struct llentry *ln, time_t xtick)
232 if (callout_pending(&ln->la_timer)) {
235 expired = callout_stop(&ln->la_timer);
237 LLE_REMREF(ln);
240 ln->ln_expire = time_uptime + xtick / hz;
241 LLE_ADDREF(ln);
243 ln->ln_ntick = xtick - INT_MAX;
246 ln->ln_ntick = 0;
248 callout_reset(&ln->ln_timer_ch, xtick, nd_timer, ln);
252 nd_set_timer(struct llentry *ln, int type)
258 LLE_WLOCK_ASSERT(ln);
260 ifp = ln->lle_tbl->llt_ifp;
261 nd = nd_find_domain(ln->lle_tbl->llt_af);
268 xtick = ln->ln_ntick;
276 unsigned int attempts = ln->ln_asked - nd->nd_mmaxtries;
293 if (ln->ln_expire > time_uptime)
294 xtick = (ln->ln_expire - time_uptime) * hz;
308 nd_set_timertick(ln, xtick);
312 nd_resolve(struct llentry *ln, const struct rtentry *rt, struct mbuf *m,
319 LLE_WLOCK_ASSERT(ln);
321 ifp = ln->lle_tbl->llt_ifp;
322 nd = nd_find_domain(ln->lle_tbl->llt_af);
326 ln->ln_state < ND_LLINFO_REACHABLE)
328 ln->ln_state = ND_LLINFO_STALE;
329 nd_set_timer(ln, ND_TIMER_GC);
339 if (ln->ln_state == ND_LLINFO_STALE) {
340 ln->ln_asked = 0;
341 ln->ln_state = ND_LLINFO_DELAY;
342 nd_set_timer(ln, ND_TIMER_DELAY);
350 if (ln->ln_state > ND_LLINFO_INCOMPLETE) {
351 KASSERT((ln->la_flags & LLE_VALID) != 0);
352 memcpy(lldst, &ln->ll_addr, MIN(dstsize, ifp->if_addrlen));
353 LLE_WUNLOCK(ln);
364 if (ln->ln_state == ND_LLINFO_NOSTATE ||
365 ln->ln_state == ND_LLINFO_WAITDELETE)
366 ln->ln_state = ND_LLINFO_INCOMPLETE;
369 m_claimm(m, ln->lle_tbl->llt_mowner);
371 if (ln->ln_hold != NULL) {
376 for (m_hold = ln->ln_hold; m_hold; m_hold = m_hold->m_nextpkt) {
383 KASSERTMSG(ln->la_numheld == i, "la_numheld=%d i=%d",
384 ln->la_numheld, i);
386 m_hold = ln->ln_hold;
387 ln->ln_hold = ln->ln_hold->m_nextpkt;
390 ln->la_numheld--;
393 KASSERTMSG(ln->la_numheld == 0, "la_numheld=%d",
394 ln->la_numheld);
395 ln->ln_hold = m;
398 KASSERTMSG(ln->la_numheld < nd->nd_maxqueuelen,
400 ln->la_numheld, nd->nd_maxqueuelen);
401 ln->la_numheld++;
403 if (ln->ln_asked >= nd->nd_mmaxtries)
413 if (!ND_IS_LLINFO_PERMANENT(ln) && ln->ln_asked == 0) {
417 ln->ln_asked++;
418 nd_set_timer(ln, ND_TIMER_RETRANS);
419 memcpy(&dst, &ln->r_l3addr, sizeof(dst));
420 psrc = nd->nd_holdsrc(ln, &src);
422 LLE_WUNLOCK(ln);
427 LLE_WUNLOCK(ln);
433 nd_nud_hint(struct llentry *ln)
437 if (ln == NULL)
440 LLE_WLOCK_ASSERT(ln);
442 if (ln->ln_state < ND_LLINFO_REACHABLE)
445 nd = nd_find_domain(ln->lle_tbl->llt_af);
451 ln->ln_byhint++;
452 if (ln->ln_byhint > nd->nd_maxnudhint)
455 ln->ln_state = ND_LLINFO_REACHABLE;
456 if (!ND_IS_LLINFO_PERMANENT(ln))
457 nd_set_timer(ln, ND_TIMER_REACHABLE);
460 LLE_WUNLOCK(ln);