Lines Matching refs:e
63 static inline unsigned int vlan_prio(const struct l2t_entry *e) in vlan_prio() argument
65 return e->vlan >> 13; in vlan_prio()
74 static inline void neigh_replace(struct l2t_entry *e, struct neighbour *n) in neigh_replace() argument
77 if (e->neigh) in neigh_replace()
78 neigh_release(e->neigh); in neigh_replace()
79 e->neigh = n; in neigh_replace()
88 struct l2t_entry *e) in setup_l2e_send_pending() argument
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()
104 V_L2T_W_PRIO(vlan_prio(e))); 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()
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()
123 static inline void arpq_enqueue(struct l2t_entry *e, struct sk_buff *skb) in arpq_enqueue() argument
125 __skb_queue_tail(&e->arpq, skb); in arpq_enqueue()
129 struct l2t_entry *e) in t3_l2t_send_slow() argument
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()
143 spin_lock_bh(&e->lock); in t3_l2t_send_slow()
144 if (e->state != L2T_STATE_RESOLVING) { in t3_l2t_send_slow()
146 spin_unlock_bh(&e->lock); in t3_l2t_send_slow()
149 arpq_enqueue(e, skb); in t3_l2t_send_slow()
150 spin_unlock_bh(&e->lock); in t3_l2t_send_slow()
160 if (!neigh_event_send(e->neigh, NULL)) { in t3_l2t_send_slow()
166 spin_lock_bh(&e->lock); in t3_l2t_send_slow()
167 if (!skb_queue_empty(&e->arpq)) in t3_l2t_send_slow()
168 setup_l2e_send_pending(dev, skb, e); in t3_l2t_send_slow()
171 spin_unlock_bh(&e->lock); in t3_l2t_send_slow()
179 void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e) in t3_l2t_send_event() argument
182 switch (e->state) { in t3_l2t_send_event()
184 neigh_event_send(e->neigh, NULL); in t3_l2t_send_event()
185 spin_lock_bh(&e->lock); in t3_l2t_send_event()
186 if (e->state == L2T_STATE_STALE) { in t3_l2t_send_event()
187 e->state = L2T_STATE_VALID; in t3_l2t_send_event()
189 spin_unlock_bh(&e->lock); in t3_l2t_send_event()
194 spin_lock_bh(&e->lock); in t3_l2t_send_event()
195 if (e->state != L2T_STATE_RESOLVING) { in t3_l2t_send_event()
197 spin_unlock_bh(&e->lock); in t3_l2t_send_event()
200 spin_unlock_bh(&e->lock); in t3_l2t_send_event()
210 neigh_event_send(e->neigh, NULL); in t3_l2t_send_event()
221 struct l2t_entry *end, *e, **p; in alloc_l2e() local
227 for (e = d->rover, end = &d->l2tab[d->nentries]; e != end; ++e) in alloc_l2e()
228 if (atomic_read(&e->refcnt) == 0) in alloc_l2e()
231 for (e = &d->l2tab[1]; atomic_read(&e->refcnt); ++e) ; in alloc_l2e()
233 d->rover = e + 1; in alloc_l2e()
240 if (e->state != L2T_STATE_UNUSED) { in alloc_l2e()
241 int hash = arp_hash(e->addr, e->ifindex, d); in alloc_l2e()
244 if (*p == e) { in alloc_l2e()
245 *p = e->next; in alloc_l2e()
248 e->state = L2T_STATE_UNUSED; in alloc_l2e()
250 return e; in alloc_l2e()
264 void t3_l2e_free(struct l2t_data *d, struct l2t_entry *e) in t3_l2e_free() argument
266 spin_lock_bh(&e->lock); in t3_l2e_free()
267 if (atomic_read(&e->refcnt) == 0) { /* hasn't been recycled */ in t3_l2e_free()
268 if (e->neigh) { in t3_l2e_free()
269 neigh_release(e->neigh); in t3_l2e_free()
270 e->neigh = NULL; in t3_l2e_free()
273 spin_unlock_bh(&e->lock); in t3_l2e_free()
283 static inline void reuse_entry(struct l2t_entry *e, struct neighbour *neigh) in reuse_entry() argument
287 spin_lock(&e->lock); /* avoid race with t3_l2t_free */ in reuse_entry()
289 if (neigh != e->neigh) in reuse_entry()
290 neigh_replace(e, neigh); in reuse_entry()
292 if (memcmp(e->dmac, neigh->ha, sizeof(e->dmac)) || in reuse_entry()
294 e->state = L2T_STATE_RESOLVING; in reuse_entry()
296 e->state = L2T_STATE_VALID; in reuse_entry()
298 e->state = L2T_STATE_STALE; in reuse_entry()
299 spin_unlock(&e->lock); in reuse_entry()
305 struct l2t_entry *e = NULL; in t3_l2t_get() local
334 for (e = d->l2tab[hash].first; e; e = e->next) in t3_l2t_get()
335 if (e->addr == addr && e->ifindex == ifidx && in t3_l2t_get()
336 e->smt_idx == smt_idx) { in t3_l2t_get()
337 l2t_hold(d, e); in t3_l2t_get()
338 if (atomic_read(&e->refcnt) == 1) in t3_l2t_get()
339 reuse_entry(e, neigh); in t3_l2t_get()
344 e = alloc_l2e(d); in t3_l2t_get()
345 if (e) { in t3_l2t_get()
346 spin_lock(&e->lock); /* avoid race with t3_l2t_free */ in t3_l2t_get()
347 e->next = d->l2tab[hash].first; in t3_l2t_get()
348 d->l2tab[hash].first = e; in t3_l2t_get()
349 e->state = L2T_STATE_RESOLVING; in t3_l2t_get()
350 e->addr = addr; in t3_l2t_get()
351 e->ifindex = ifidx; in t3_l2t_get()
352 e->smt_idx = smt_idx; in t3_l2t_get()
353 atomic_set(&e->refcnt, 1); in t3_l2t_get()
354 neigh_replace(e, neigh); in t3_l2t_get()
356 e->vlan = vlan_dev_vlan_id(neigh->dev); in t3_l2t_get()
358 e->vlan = VLAN_NONE; in t3_l2t_get()
359 spin_unlock(&e->lock); in t3_l2t_get()
367 return e; in t3_l2t_get()
402 struct l2t_entry *e; in t3_l2t_update() local
409 for (e = d->l2tab[hash].first; e; e = e->next) in t3_l2t_update()
410 if (e->addr == addr && e->ifindex == ifidx) { in t3_l2t_update()
411 spin_lock(&e->lock); in t3_l2t_update()
421 if (atomic_read(&e->refcnt)) { in t3_l2t_update()
422 if (neigh != e->neigh) in t3_l2t_update()
423 neigh_replace(e, neigh); in t3_l2t_update()
425 if (e->state == L2T_STATE_RESOLVING) { in t3_l2t_update()
427 skb_queue_splice_init(&e->arpq, &arpq); in t3_l2t_update()
429 setup_l2e_send_pending(dev, NULL, e); in t3_l2t_update()
431 e->state = neigh->nud_state & NUD_CONNECTED ? in t3_l2t_update()
433 if (!ether_addr_equal(e->dmac, neigh->ha)) in t3_l2t_update()
434 setup_l2e_send_pending(dev, NULL, e); in t3_l2t_update()
437 spin_unlock_bh(&e->lock); in t3_l2t_update()