Lines Matching refs:cnt
33 struct efx_tc_counter *cnt = ptr; in efx_tc_counter_free() local
35 WARN_ON(!list_empty(&cnt->users)); in efx_tc_counter_free()
42 flush_work(&cnt->work); in efx_tc_counter_free()
43 EFX_WARN_ON_PARANOID(spin_is_locked(&cnt->lock)); in efx_tc_counter_free()
44 kfree(cnt); in efx_tc_counter_free()
89 struct efx_tc_counter *cnt = container_of(work, struct efx_tc_counter, work); in efx_tc_counter_work() local
95 spin_lock_bh(&cnt->lock); in efx_tc_counter_work()
96 touched = READ_ONCE(cnt->touched); in efx_tc_counter_work()
98 list_for_each_entry(act, &cnt->users, count_user) { in efx_tc_counter_work()
127 spin_unlock_bh(&cnt->lock); in efx_tc_counter_work()
135 struct efx_tc_counter *cnt; in efx_tc_flower_allocate_counter() local
138 cnt = kzalloc(sizeof(*cnt), GFP_USER); in efx_tc_flower_allocate_counter()
139 if (!cnt) in efx_tc_flower_allocate_counter()
142 spin_lock_init(&cnt->lock); in efx_tc_flower_allocate_counter()
143 INIT_WORK(&cnt->work, efx_tc_counter_work); in efx_tc_flower_allocate_counter()
144 cnt->touched = jiffies; in efx_tc_flower_allocate_counter()
145 cnt->type = type; in efx_tc_flower_allocate_counter()
147 rc = efx_mae_allocate_counter(efx, cnt); in efx_tc_flower_allocate_counter()
150 INIT_LIST_HEAD(&cnt->users); in efx_tc_flower_allocate_counter()
151 rc = rhashtable_insert_fast(&efx->tc->counter_ht, &cnt->linkage, in efx_tc_flower_allocate_counter()
155 return cnt; in efx_tc_flower_allocate_counter()
162 rc2 = efx_mae_free_counter(efx, cnt); in efx_tc_flower_allocate_counter()
166 cnt->fw_id, rc2); in efx_tc_flower_allocate_counter()
168 kfree(cnt); in efx_tc_flower_allocate_counter()
173 struct efx_tc_counter *cnt) in efx_tc_flower_release_counter() argument
177 rhashtable_remove_fast(&efx->tc->counter_ht, &cnt->linkage, in efx_tc_flower_release_counter()
179 rc = efx_mae_free_counter(efx, cnt); in efx_tc_flower_release_counter()
183 cnt->fw_id, rc); in efx_tc_flower_release_counter()
184 WARN_ON(!list_empty(&cnt->users)); in efx_tc_flower_release_counter()
192 flush_work(&cnt->work); in efx_tc_flower_release_counter()
193 EFX_WARN_ON_PARANOID(spin_is_locked(&cnt->lock)); in efx_tc_flower_release_counter()
194 kfree(cnt); in efx_tc_flower_release_counter()
218 efx_tc_flower_release_counter(efx, ctr->cnt); in efx_tc_flower_put_counter_index()
227 struct efx_tc_counter *cnt; in efx_tc_flower_get_counter_index() local
246 cnt = efx_tc_flower_allocate_counter(efx, type); in efx_tc_flower_get_counter_index()
247 if (IS_ERR(cnt)) { in efx_tc_flower_get_counter_index()
252 return (void *)cnt; /* it's an ERR_PTR */ in efx_tc_flower_get_counter_index()
254 ctr->cnt = cnt; in efx_tc_flower_get_counter_index()
328 struct efx_tc_counter *cnt; in efx_tc_counter_update() local
331 cnt = efx_tc_flower_find_counter_by_fw_id(efx, counter_type, counter_idx); in efx_tc_counter_update()
332 if (!cnt) { in efx_tc_counter_update()
344 spin_lock_bh(&cnt->lock); in efx_tc_counter_update()
345 if ((s32)mark - (s32)cnt->gen < 0) { in efx_tc_counter_update()
357 cnt->gen = mark; in efx_tc_counter_update()
359 cnt->packets += packets; in efx_tc_counter_update()
360 cnt->bytes += bytes; in efx_tc_counter_update()
361 cnt->touched = jiffies; in efx_tc_counter_update()
363 spin_unlock_bh(&cnt->lock); in efx_tc_counter_update()
364 schedule_work(&cnt->work); in efx_tc_counter_update()