lkml.org 
[lkml]   [2021]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next 2/3] net: prestera: add counter HW API
On Tue, 23 Nov 2021 18:58:01 +0200 Volodymyr Mytnyk wrote:
> + block = prestera_counter_block_lookup_not_full(counter, client);
> + if (!block) {

if (block)
return block;

> + block = kzalloc(sizeof(*block), GFP_KERNEL);
> + if (!block)
> + return ERR_PTR(-ENOMEM);
> +
> + err = prestera_hw_counter_block_get(counter->sw, client,
> + &block->id, &block->offset,
> + &block->num_counters);
> + if (err)
> + goto err_block;
> +
> + block->stats = kcalloc(block->num_counters,
> + sizeof(*block->stats), GFP_KERNEL);
> + if (!block->stats) {
> + err = -ENOMEM;
> + goto err_stats;
> + }
> +
> + block->counter_flag = kcalloc(block->num_counters,
> + sizeof(*block->counter_flag),
> + GFP_KERNEL);
> + if (!block->counter_flag) {
> + err = -ENOMEM;
> + goto err_flag;
> + }
> +
> + block->client = client;
> + mutex_init(&block->mtx);
> + refcount_set(&block->refcnt, 1);
> + idr_init_base(&block->counter_idr, block->offset);
> +
> + err = prestera_counter_block_list_add(counter, block);
> + if (err)
> + goto err_list_add;
> + }
> +
> + return block;

\
 
 \ /
  Last update: 2021-11-25 04:19    [W:0.092 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site