Lines Matching refs:e

64 l2t_hold(struct l2t_data *d, struct l2t_entry *e)  in l2t_hold()  argument
67 if (atomic_fetchadd_int(&e->refcnt, 1) == 0) /* 0 -> 1 transition */ in l2t_hold()
103 l2_cmp(const struct sockaddr *sa, struct l2t_entry *e) in l2_cmp() argument
113 return (e->addr[0] != sin->sin_addr.s_addr); in l2_cmp()
117 return (memcmp(&e->addr[0], &sin6->sin6_addr, sizeof(e->addr))); in l2_cmp()
122 l2_store(const struct sockaddr *sa, struct l2t_entry *e) in l2_store() argument
132 e->addr[0] = sin->sin_addr.s_addr; in l2_store()
133 e->ipv6 = 0; in l2_store()
137 memcpy(&e->addr[0], &sin6->sin6_addr, sizeof(e->addr)); in l2_store()
138 e->ipv6 = 1; in l2_store()
147 arpq_enqueue(struct l2t_entry *e, struct wrqe *wr) in arpq_enqueue() argument
149 mtx_assert(&e->lock, MA_OWNED); in arpq_enqueue()
151 STAILQ_INSERT_TAIL(&e->wr_list, wr, link); in arpq_enqueue()
155 send_pending(struct adapter *sc, struct l2t_entry *e) in send_pending() argument
159 mtx_assert(&e->lock, MA_OWNED); in send_pending()
161 while ((wr = STAILQ_FIRST(&e->wr_list)) != NULL) { in send_pending()
162 STAILQ_REMOVE_HEAD(&e->wr_list, link); in send_pending()
168 resolution_failed(struct adapter *sc, struct l2t_entry *e) in resolution_failed() argument
172 mtx_assert(&e->lock, MA_OWNED); in resolution_failed()
175 STAILQ_CONCAT(&td->unsent_wr_list, &e->wr_list); in resolution_failed()
182 update_entry(struct adapter *sc, struct l2t_entry *e, uint8_t *lladdr, in update_entry() argument
186 mtx_assert(&e->lock, MA_OWNED); in update_entry()
195 (e->state == L2T_STATE_RESOLVING || e->state == L2T_STATE_FAILED)) { in update_entry()
201 e->state = L2T_STATE_FAILED; in update_entry()
202 resolution_failed(sc, e); in update_entry()
209 KASSERT(e->state == L2T_STATE_VALID || in update_entry()
210 e->state == L2T_STATE_STALE, in update_entry()
211 ("%s: lladdr NULL, state %d", __func__, e->state)); in update_entry()
213 e->state = L2T_STATE_STALE; in update_entry()
215 } else if (e->state == L2T_STATE_RESOLVING || in update_entry()
216 e->state == L2T_STATE_FAILED || in update_entry()
217 memcmp(e->dmac, lladdr, ETHER_ADDR_LEN)) { in update_entry()
221 memcpy(e->dmac, lladdr, ETHER_ADDR_LEN); in update_entry()
222 e->vlan = vtag; in update_entry()
223 if (t4_write_l2e(e, 1) == 0) in update_entry()
224 e->state = L2T_STATE_VALID; in update_entry()
226 e->state = L2T_STATE_VALID; in update_entry()
230 resolve_entry(struct adapter *sc, struct l2t_entry *e) in resolve_entry() argument
241 if (e->ipv6 == 0) { in resolve_entry()
244 sin.sin_addr.s_addr = e->addr[0]; in resolve_entry()
249 memcpy(&sin6.sin6_addr, &e->addr[0], sizeof(e->addr)); in resolve_entry()
254 rc = toe_l2_resolve(tod, e->ifp, sa, dmac, &vtag); in resolve_entry()
258 mtx_lock(&e->lock); in resolve_entry()
259 update_entry(sc, e, rc == 0 ? dmac : NULL, vtag); in resolve_entry()
260 mtx_unlock(&e->lock); in resolve_entry()
266 t4_l2t_send_slow(struct adapter *sc, struct wrqe *wr, struct l2t_entry *e) in t4_l2t_send_slow() argument
270 switch (e->state) { in t4_l2t_send_slow()
273 resolve_entry(sc, e); in t4_l2t_send_slow()
285 mtx_lock(&e->lock); in t4_l2t_send_slow()
286 if (e->state != L2T_STATE_SYNC_WRITE && in t4_l2t_send_slow()
287 e->state != L2T_STATE_RESOLVING) { in t4_l2t_send_slow()
289 mtx_unlock(&e->lock); in t4_l2t_send_slow()
295 arpq_enqueue(e, wr); in t4_l2t_send_slow()
296 mtx_unlock(&e->lock); in t4_l2t_send_slow()
298 if (resolve_entry(sc, e) == EWOULDBLOCK) in t4_l2t_send_slow()
301 mtx_lock(&e->lock); in t4_l2t_send_slow()
302 if (e->state == L2T_STATE_VALID && !STAILQ_EMPTY(&e->wr_list)) in t4_l2t_send_slow()
303 send_pending(sc, e); in t4_l2t_send_slow()
304 if (e->state == L2T_STATE_FAILED) in t4_l2t_send_slow()
305 resolution_failed(sc, e); in t4_l2t_send_slow()
306 mtx_unlock(&e->lock); in t4_l2t_send_slow()
338 struct l2t_entry *e = &sc->l2t->l2tab[idx]; in do_l2t_write_rpl2() local
340 mtx_lock(&e->lock); in do_l2t_write_rpl2()
341 if (e->state != L2T_STATE_SWITCHING) { in do_l2t_write_rpl2()
342 send_pending(sc, e); in do_l2t_write_rpl2()
343 e->state = L2T_STATE_VALID; in do_l2t_write_rpl2()
345 mtx_unlock(&e->lock); in do_l2t_write_rpl2()
361 struct l2t_entry *e; in t4_l2t_get() local
385 e = NULL; in t4_l2t_get()
388 for (e = d->l2tab[hash].first; e; e = e->next) { in t4_l2t_get()
389 if (l2_cmp(sa, e) == 0 && e->ifp == ifp && e->vlan == vtag) { in t4_l2t_get()
390 l2t_hold(d, e); in t4_l2t_get()
396 e = t4_alloc_l2e(d); in t4_l2t_get()
397 if (e) { in t4_l2t_get()
398 mtx_lock(&e->lock); /* avoid race with t4_l2t_free */ in t4_l2t_get()
399 e->next = d->l2tab[hash].first; in t4_l2t_get()
400 d->l2tab[hash].first = e; in t4_l2t_get()
402 e->state = L2T_STATE_RESOLVING; in t4_l2t_get()
403 l2_store(sa, e); in t4_l2t_get()
404 e->ifp = ifp; in t4_l2t_get()
405 e->hash = hash; in t4_l2t_get()
406 e->lport = pi->lport; in t4_l2t_get()
407 e->wrq = &sc->sge.ctrlq[pi->port_id]; in t4_l2t_get()
408 e->iqid = sc->sge.ofld_rxq[pi->vi[0].first_ofld_rxq].iq.abs_id; in t4_l2t_get()
409 atomic_store_rel_int(&e->refcnt, 1); in t4_l2t_get()
410 e->vlan = vtag; in t4_l2t_get()
411 mtx_unlock(&e->lock); in t4_l2t_get()
415 return e; in t4_l2t_get()
427 struct l2t_entry *e; in t4_l2_update() local
437 for (e = d->l2tab[hash].first; e; e = e->next) { in t4_l2_update()
438 if (l2_cmp(sa, e) == 0 && e->ifp == ifp) { in t4_l2_update()
439 mtx_lock(&e->lock); in t4_l2_update()
440 if (atomic_load_acq_int(&e->refcnt)) in t4_l2_update()
442 if (e->state == L2T_STATE_VALID) in t4_l2_update()
443 e->state = L2T_STATE_STALE; in t4_l2_update()
444 mtx_unlock(&e->lock); in t4_l2_update()
461 KASSERT(e->state != L2T_STATE_UNUSED, in t4_l2_update()
464 update_entry(sc, e, lladdr, vtag); in t4_l2_update()
465 mtx_unlock(&e->lock); in t4_l2_update()