[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211124191649.08f7ba14@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 24 Nov 2021 19:16:49 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Volodymyr Mytnyk <volodymyr.mytnyk@...ision.eu>
Cc: netdev@...r.kernel.org, Taras Chornyi <taras.chornyi@...ision.eu>,
Mickey Rachamim <mickeyr@...vell.com>,
Serhiy Pshyk <serhiy.pshyk@...ision.eu>,
Volodymyr Mytnyk <vmytnyk@...vell.com>,
Taras Chornyi <tchornyi@...vell.com>,
"David S. Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org,
Serhiy Boiko <serhiy.boiko@...vell.com>
Subject: Re: [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;
Powered by blists - more mailing lists