MCPcopy Create free account
hub / github.com/F-Stack/f-stack / arptimer

Function arptimer

freebsd/netinet/if_ether.c:205–321  ·  view source on GitHub ↗

* Timeout routine. Age arp_tab entries periodically. */

Source from the content-addressed store, hash-verified

203 * Timeout routine. Age arp_tab entries periodically.
204 */
205static void
206arptimer(void *arg)
207{
208 struct llentry *lle = (struct llentry *)arg;
209 struct ifnet *ifp;
210 int r_skip_req;
211
212 if (lle->la_flags & LLE_STATIC) {
213 return;
214 }
215 LLE_WLOCK(lle);
216 if (callout_pending(&lle->lle_timer)) {
217 /*
218 * Here we are a bit odd here in the treatment of
219 * active/pending. If the pending bit is set, it got
220 * rescheduled before I ran. The active
221 * bit we ignore, since if it was stopped
222 * in ll_tablefree() and was currently running
223 * it would have return 0 so the code would
224 * not have deleted it since the callout could
225 * not be stopped so we want to go through
226 * with the delete here now. If the callout
227 * was restarted, the pending bit will be back on and
228 * we just want to bail since the callout_reset would
229 * return 1 and our reference would have been removed
230 * by arpresolve() below.
231 */
232 LLE_WUNLOCK(lle);
233 return;
234 }
235 ifp = lle->lle_tbl->llt_ifp;
236 CURVNET_SET(ifp->if_vnet);
237
238 switch (lle->ln_state) {
239 case ARP_LLINFO_REACHABLE:
240
241 /*
242 * Expiration time is approaching.
243 * Let's try to refresh entry if it is still
244 * in use.
245 *
246 * Set r_skip_req to get feedback from
247 * fast path. Change state and re-schedule
248 * ourselves.
249 */
250 LLE_REQ_LOCK(lle);
251 lle->r_skip_req = 1;
252 LLE_REQ_UNLOCK(lle);
253 lle->ln_state = ARP_LLINFO_VERIFY;
254 callout_schedule(&lle->lle_timer, hz * V_arpt_rexmit);
255 LLE_WUNLOCK(lle);
256 CURVNET_RESTORE();
257 return;
258 case ARP_LLINFO_VERIFY:
259 LLE_REQ_LOCK(lle);
260 r_skip_req = lle->r_skip_req;
261 LLE_REQ_UNLOCK(lle);
262

Callers

nothing calls this directly

Calls 4

arprequestFunction · 0.85
lltable_unlink_entryFunction · 0.85
llentry_freeFunction · 0.85
callout_scheduleFunction · 0.50

Tested by

no test coverage detected