Lines Matching refs:d
79 static inline void l2t_hold(struct l2t_data *d, struct l2t_entry *e) in l2t_hold() argument
82 atomic_dec(&d->nfree); in l2t_hold()
271 static struct l2t_entry *alloc_l2e(struct l2t_data *d) in alloc_l2e() argument
275 if (!atomic_read(&d->nfree)) in alloc_l2e()
279 for (e = d->rover, end = &d->l2tab[L2T_SIZE]; e != end; ++e) in alloc_l2e()
283 for (e = d->l2tab; atomic_read(&e->refcnt); ++e) in alloc_l2e()
286 d->rover = e + 1; in alloc_l2e()
287 atomic_dec(&d->nfree); in alloc_l2e()
294 for (p = &d->l2tab[e->hash].first; *p; p = &(*p)->next) in alloc_l2e()
310 struct l2t_data *d; in t4_l2e_free() local
328 d = container_of(e, struct l2t_data, l2tab[e->idx]); in t4_l2e_free()
329 atomic_inc(&d->nfree); in t4_l2e_free()
361 struct l2t_entry *cxgb4_l2t_get(struct l2t_data *d, struct neighbour *neigh, in cxgb4_l2t_get() argument
383 write_lock_bh(&d->lock); in cxgb4_l2t_get()
384 for (e = d->l2tab[hash].first; e; e = e->next) in cxgb4_l2t_get()
387 l2t_hold(d, e); in cxgb4_l2t_get()
394 e = alloc_l2e(d); in cxgb4_l2t_get()
408 e->next = d->l2tab[hash].first; in cxgb4_l2t_get()
409 d->l2tab[hash].first = e; in cxgb4_l2t_get()
413 write_unlock_bh(&d->lock); in cxgb4_l2t_get()
480 struct l2t_data *d = adap->l2t; in t4_l2t_update() local
486 read_lock_bh(&d->lock); in t4_l2t_update()
487 for (e = d->l2tab[hash].first; e; e = e->next) in t4_l2t_update()
495 read_unlock_bh(&d->lock); in t4_l2t_update()
499 read_unlock(&d->lock); in t4_l2t_update()
529 struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d) in t4_l2t_alloc_switching() argument
533 write_lock_bh(&d->lock); in t4_l2t_alloc_switching()
534 e = alloc_l2e(d); in t4_l2t_alloc_switching()
541 write_unlock_bh(&d->lock); in t4_l2t_alloc_switching()
560 struct l2t_data *d; in t4_init_l2t() local
562 d = t4_alloc_mem(sizeof(*d)); in t4_init_l2t()
563 if (!d) in t4_init_l2t()
566 d->rover = d->l2tab; in t4_init_l2t()
567 atomic_set(&d->nfree, L2T_SIZE); in t4_init_l2t()
568 rwlock_init(&d->lock); in t4_init_l2t()
571 d->l2tab[i].idx = i; in t4_init_l2t()
572 d->l2tab[i].state = L2T_STATE_UNUSED; in t4_init_l2t()
573 spin_lock_init(&d->l2tab[i].lock); in t4_init_l2t()
574 atomic_set(&d->l2tab[i].refcnt, 0); in t4_init_l2t()
576 return d; in t4_init_l2t()