Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1351171
| From | Marcin Wojtas <mw@semihalf.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 net-next 8/9] net: add a hardware buffer management helper API |
| Date | 2016-03-06 20:30 +0100 |
| Message-ID | <r9Mxk-RI-17@gated-at.bofh.it> (permalink) |
| References | <r9t1D-4ml-9@gated-at.bofh.it> <r9t1F-4ml-75@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Gregory,
> +int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
> +{
> + int err, i;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&bm_pool->lock, flags);
> + if (bm_pool->buf_num == bm_pool->size) {
'size' field is used as a 'frag_size' but here it means pool capacity.
I think it's better to keep 'size' for pool capacity and add
'buf_size' field to struct hwbm_pool.
> + pr_warn("pool already filled\n");
> + return bm_pool->buf_num;
> + }
> +
> + if (buf_num + bm_pool->buf_num > bm_pool->size) {
> + pr_warn("cannot allocate %d buffers for pool\n",
> + buf_num);
> + return 0;
> + }
> +
> + if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) {
What is a point of this condition? How possibly after checking if
capacity of pool is not exceeded, this one would ever be true?
> + pr_warn("Adding %d buffers to the %d current buffers will overflow\n",
> + buf_num, bm_pool->buf_num);
> + return 0;
> + }
> +
Best regards,
Marcin
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 net-next 0/9] API set for HW Buffer management Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:40 +0100
[PATCH v4 net-next 9/9] net: mvneta: Use the new hwbm framework Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:40 +0100
[PATCH v4 net-next 4/9] ARM: dts: armada-xp: enable buffer manager support on Armada XP boards Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:40 +0100
[PATCH v4 net-next 3/9] ARM: dts: armada-xp: add buffer manager nodes Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:40 +0100
[PATCH v4 net-next 2/9] ARM: dts: armada-38x: enable buffer manager support on Armada 38x boards Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:40 +0100
Re: [PATCH v4 net-next 2/9] ARM: dts: armada-38x: enable buffer manager support on Armada 38x boards Russell King - ARM Linux <linux@arm.linux.org.uk> - 2016-03-06 21:40 +0100
[PATCH v4 net-next 8/9] net: add a hardware buffer management helper API Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:40 +0100
Re: [PATCH v4 net-next 8/9] net: add a hardware buffer management helper API Marcin Wojtas <mw@semihalf.com> - 2016-03-06 20:30 +0100
Re: [PATCH v4 net-next 8/9] net: add a hardware buffer management helper API Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-07 09:20 +0100
[PATCH v4 net-next 5/9] ARM: dts: armada-xp-openblocks-ax3-4: Add BM support Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:50 +0100
[PATCH v4 net-next 1/9] ARM: dts: armada-38x: add buffer manager nodes Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:50 +0100
[PATCH v4 net-next 6/9] bus: mvebu-mbus: provide api for obtaining IO and DRAM window information Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-03-05 23:50 +0100
csiph-web