Lines Matching +full:fail +full:- +full:fast

2  * Copyright (c) 2003-2008 Chelsio, Inc. All rights reserved.
14 * - Redistributions of source code must retain the above
18 * - Redistributions in binary form must reproduce the above
65 return e->vlan >> 13; in vlan_prio()
71 return jhash_2words(key, ifindex, 0) & (d->nentries - 1); in arp_hash()
77 if (e->neigh) in neigh_replace()
78 neigh_release(e->neigh); in neigh_replace()
79 e->neigh = n; in neigh_replace()
96 return -ENOMEM; in setup_l2e_send_pending()
100 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); in setup_l2e_send_pending()
101 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, e->idx)); in setup_l2e_send_pending()
102 req->params = htonl(V_L2T_W_IDX(e->idx) | V_L2T_W_IFF(e->smt_idx) | in setup_l2e_send_pending()
103 V_L2T_W_VLAN(e->vlan & VLAN_VID_MASK) | in setup_l2e_send_pending()
105 memcpy(e->dmac, e->neigh->ha, sizeof(e->dmac)); in setup_l2e_send_pending()
106 memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac)); in setup_l2e_send_pending()
107 skb->priority = CPL_PRIORITY_CONTROL; in setup_l2e_send_pending()
110 skb_queue_walk_safe(&e->arpq, skb, tmp) { in setup_l2e_send_pending()
111 __skb_unlink(skb, &e->arpq); in setup_l2e_send_pending()
114 e->state = L2T_STATE_VALID; in setup_l2e_send_pending()
125 __skb_queue_tail(&e->arpq, skb); in arpq_enqueue()
132 switch (e->state) { in t3_l2t_send_slow()
134 neigh_event_send(e->neigh, NULL); in t3_l2t_send_slow()
135 spin_lock_bh(&e->lock); in t3_l2t_send_slow()
136 if (e->state == L2T_STATE_STALE) in t3_l2t_send_slow()
137 e->state = L2T_STATE_VALID; in t3_l2t_send_slow()
138 spin_unlock_bh(&e->lock); in t3_l2t_send_slow()
139 case L2T_STATE_VALID: /* fast-path, send the packet on */ in t3_l2t_send_slow()
142 spin_lock_bh(&e->lock); in t3_l2t_send_slow()
143 if (e->state != L2T_STATE_RESOLVING) { in t3_l2t_send_slow()
145 spin_unlock_bh(&e->lock); in t3_l2t_send_slow()
149 spin_unlock_bh(&e->lock); in t3_l2t_send_slow()
153 * resolution. However, because the alloc_skb below can fail, in t3_l2t_send_slow()
159 if (!neigh_event_send(e->neigh, NULL)) { in t3_l2t_send_slow()
165 spin_lock_bh(&e->lock); in t3_l2t_send_slow()
166 if (!skb_queue_empty(&e->arpq)) in t3_l2t_send_slow()
170 spin_unlock_bh(&e->lock); in t3_l2t_send_slow()
181 switch (e->state) { in t3_l2t_send_event()
183 neigh_event_send(e->neigh, NULL); in t3_l2t_send_event()
184 spin_lock_bh(&e->lock); in t3_l2t_send_event()
185 if (e->state == L2T_STATE_STALE) { in t3_l2t_send_event()
186 e->state = L2T_STATE_VALID; in t3_l2t_send_event()
188 spin_unlock_bh(&e->lock); in t3_l2t_send_event()
190 case L2T_STATE_VALID: /* fast-path, send the packet on */ in t3_l2t_send_event()
193 spin_lock_bh(&e->lock); in t3_l2t_send_event()
194 if (e->state != L2T_STATE_RESOLVING) { in t3_l2t_send_event()
196 spin_unlock_bh(&e->lock); in t3_l2t_send_event()
199 spin_unlock_bh(&e->lock); in t3_l2t_send_event()
203 * resolution. However, because the alloc_skb below can fail, in t3_l2t_send_event()
209 neigh_event_send(e->neigh, NULL); in t3_l2t_send_event()
222 if (!atomic_read(&d->nfree)) in alloc_l2e()
226 for (e = d->rover, end = &d->l2tab[d->nentries]; e != end; ++e) in alloc_l2e()
227 if (atomic_read(&e->refcnt) == 0) in alloc_l2e()
230 for (e = &d->l2tab[1]; atomic_read(&e->refcnt); ++e) ; in alloc_l2e()
232 d->rover = e + 1; in alloc_l2e()
233 atomic_dec(&d->nfree); in alloc_l2e()
239 if (e->state != L2T_STATE_UNUSED) { in alloc_l2e()
240 int hash = arp_hash(e->addr, e->ifindex, d); in alloc_l2e()
242 for (p = &d->l2tab[hash].first; *p; p = &(*p)->next) in alloc_l2e()
244 *p = e->next; in alloc_l2e()
247 e->state = L2T_STATE_UNUSED; in alloc_l2e()
265 spin_lock_bh(&e->lock); in t3_l2e_free()
266 if (atomic_read(&e->refcnt) == 0) { /* hasn't been recycled */ in t3_l2e_free()
267 if (e->neigh) { in t3_l2e_free()
268 neigh_release(e->neigh); in t3_l2e_free()
269 e->neigh = NULL; in t3_l2e_free()
272 spin_unlock_bh(&e->lock); in t3_l2e_free()
273 atomic_inc(&d->nfree); in t3_l2e_free()
286 spin_lock(&e->lock); /* avoid race with t3_l2t_free */ in reuse_entry()
288 if (neigh != e->neigh) in reuse_entry()
290 nud_state = neigh->nud_state; in reuse_entry()
291 if (memcmp(e->dmac, neigh->ha, sizeof(e->dmac)) || in reuse_entry()
293 e->state = L2T_STATE_RESOLVING; in reuse_entry()
295 e->state = L2T_STATE_VALID; in reuse_entry()
297 e->state = L2T_STATE_STALE; in reuse_entry()
298 spin_unlock(&e->lock); in reuse_entry()
318 addr = *(u32 *) neigh->primary_key; in t3_l2t_get()
319 ifidx = neigh->dev->ifindex; in t3_l2t_get()
322 dev = neigh->dev; in t3_l2t_get()
324 smt_idx = p->port_id; in t3_l2t_get()
332 write_lock_bh(&d->lock); in t3_l2t_get()
333 for (e = d->l2tab[hash].first; e; e = e->next) in t3_l2t_get()
334 if (e->addr == addr && e->ifindex == ifidx && in t3_l2t_get()
335 e->smt_idx == smt_idx) { in t3_l2t_get()
337 if (atomic_read(&e->refcnt) == 1) in t3_l2t_get()
345 spin_lock(&e->lock); /* avoid race with t3_l2t_free */ in t3_l2t_get()
346 e->next = d->l2tab[hash].first; in t3_l2t_get()
347 d->l2tab[hash].first = e; in t3_l2t_get()
348 e->state = L2T_STATE_RESOLVING; in t3_l2t_get()
349 e->addr = addr; in t3_l2t_get()
350 e->ifindex = ifidx; in t3_l2t_get()
351 e->smt_idx = smt_idx; in t3_l2t_get()
352 atomic_set(&e->refcnt, 1); in t3_l2t_get()
354 if (neigh->dev->priv_flags & IFF_802_1Q_VLAN) in t3_l2t_get()
355 e->vlan = vlan_dev_vlan_id(neigh->dev); in t3_l2t_get()
357 e->vlan = VLAN_NONE; in t3_l2t_get()
358 spin_unlock(&e->lock); in t3_l2t_get()
361 write_unlock_bh(&d->lock); in t3_l2t_get()
385 if (cb->arp_failure_handler) in handle_failed_resolution()
386 cb->arp_failure_handler(dev, skb); in handle_failed_resolution()
401 u32 addr = *(u32 *) neigh->primary_key; in t3_l2t_update()
402 int ifidx = neigh->dev->ifindex; in t3_l2t_update()
405 read_lock_bh(&d->lock); in t3_l2t_update()
406 for (e = d->l2tab[hash].first; e; e = e->next) in t3_l2t_update()
407 if (e->addr == addr && e->ifindex == ifidx) { in t3_l2t_update()
408 spin_lock(&e->lock); in t3_l2t_update()
411 read_unlock_bh(&d->lock); in t3_l2t_update()
417 read_unlock(&d->lock); in t3_l2t_update()
418 if (atomic_read(&e->refcnt)) { in t3_l2t_update()
419 if (neigh != e->neigh) in t3_l2t_update()
422 if (e->state == L2T_STATE_RESOLVING) { in t3_l2t_update()
423 if (neigh->nud_state & NUD_FAILED) { in t3_l2t_update()
424 skb_queue_splice_init(&e->arpq, &arpq); in t3_l2t_update()
425 } else if (neigh->nud_state & (NUD_CONNECTED|NUD_STALE)) in t3_l2t_update()
428 e->state = neigh->nud_state & NUD_CONNECTED ? in t3_l2t_update()
430 if (memcmp(e->dmac, neigh->ha, 6)) in t3_l2t_update()
434 spin_unlock_bh(&e->lock); in t3_l2t_update()
449 d->nentries = l2t_capacity; in t3_init_l2t()
450 d->rover = &d->l2tab[1]; /* entry 0 is not used */ in t3_init_l2t()
451 atomic_set(&d->nfree, l2t_capacity - 1); in t3_init_l2t()
452 rwlock_init(&d->lock); in t3_init_l2t()
455 d->l2tab[i].idx = i; in t3_init_l2t()
456 d->l2tab[i].state = L2T_STATE_UNUSED; in t3_init_l2t()
457 __skb_queue_head_init(&d->l2tab[i].arpq); in t3_init_l2t()
458 spin_lock_init(&d->l2tab[i].lock); in t3_init_l2t()
459 atomic_set(&d->l2tab[i].refcnt, 0); in t3_init_l2t()