Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446334 > unrolled thread

BUG: Wrong dma queue handling in ixp4 driver

Started by"Lino Sanfilippo" <LinoSanfilippo@gmx.de>
First post2016-07-19 13:10 +0200
Last post2016-07-22 13:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  BUG: Wrong dma queue handling in ixp4 driver "Lino Sanfilippo" <LinoSanfilippo@gmx.de> - 2016-07-19 13:10 +0200
    Aw: BUG: Wrong dma queue handling in ixp4 driver "Lino Sanfilippo" <LinoSanfilippo@gmx.de> - 2016-07-19 13:40 +0200
      Re: Aw: BUG: Wrong dma queue handling in ixp4 driver khalasa@piap.pl (Krzysztof Hałasa) - 2016-07-22 12:30 +0200
        Aw: Re:  BUG: Wrong dma queue handling in ixp4 driver "Lino Sanfilippo" <LinoSanfilippo@gmx.de> - 2016-07-22 13:20 +0200

#1446334 — BUG: Wrong dma queue handling in ixp4 driver

From"Lino Sanfilippo" <LinoSanfilippo@gmx.de>
Date2016-07-19 13:10 +0200
SubjectBUG: Wrong dma queue handling in ixp4 driver
Message-ID<rWB4t-3hE-11@gated-at.bofh.it>
Hi,

maybe I miss something, but the ixp4 ethernet driver seems to handle dma pools 
in a wrong way: In init_queues() it creates a dma pool for descriptors and then
 only allocates a single descriptor from this pool. The author seems to assume the whole
table has been allocated already, since after that the complete pool size is zeroed:

<snip> 
static int init_queues(struct port *port)
{
	int i;

	if (!ports_open) {
		dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev,
					   POOL_ALLOC_SIZE, 32, 0);
		if (!dma_pool)
			return -ENOMEM;
	}

	if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
					      &port->desc_tab_phys)))
		return -ENOMEM;
	memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
<snap>

Regards,
Lino

[toc] | [next] | [standalone]


#1446355 — Aw: BUG: Wrong dma queue handling in ixp4 driver

From"Lino Sanfilippo" <LinoSanfilippo@gmx.de>
Date2016-07-19 13:40 +0200
SubjectAw: BUG: Wrong dma queue handling in ixp4 driver
Message-ID<rWBxw-3r9-11@gated-at.bofh.it>
In reply to#1446334
> Hi,
> 
> maybe I miss something, but the ixp4 ethernet driver seems to handle dma pools 
> in a wrong way: In init_queues() it creates a dma pool for descriptors and then
>  only allocates a single descriptor from this pool. The author seems to assume the whole
> table has been allocated already, since after that the complete pool size is zeroed:
> 

Sorry, I indeed missed something. The allocation is correct. A pool is not required, though,
since only one chunk is allocated.

Lino

[toc] | [prev] | [next] | [standalone]


#1448524 — Re: Aw: BUG: Wrong dma queue handling in ixp4 driver

Fromkhalasa@piap.pl (Krzysztof Hałasa)
Date2016-07-22 12:30 +0200
SubjectRe: Aw: BUG: Wrong dma queue handling in ixp4 driver
Message-ID<rXFSq-4xq-17@gated-at.bofh.it>
In reply to#1446355
Hi Lino,

"Lino Sanfilippo" <LinoSanfilippo@gmx.de> writes:

>> maybe I miss something, but the ixp4 ethernet driver seems to handle dma pools 
>> in a wrong way: In init_queues() it creates a dma pool for descriptors and then
>>  only allocates a single descriptor from this pool. The author seems to assume the whole
>> table has been allocated already, since after that the complete pool size is zeroed:
>> 
>
> Sorry, I indeed missed something. The allocation is correct. A pool is not required, though,
> since only one chunk is allocated.

Not really: there is one pool for all ports, but each port uses
a separate desc_tab (allocated from that pool).
-- 
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland

[toc] | [prev] | [next] | [standalone]


#1448539 — Aw: Re: BUG: Wrong dma queue handling in ixp4 driver

From"Lino Sanfilippo" <LinoSanfilippo@gmx.de>
Date2016-07-22 13:20 +0200
SubjectAw: Re: BUG: Wrong dma queue handling in ixp4 driver
Message-ID<rXGEO-55U-15@gated-at.bofh.it>
In reply to#1448524
Hi Krzysztof,

> 
> Not really: there is one pool for all ports, but each port uses
> a separate desc_tab (allocated from that pool).

right, but even then using a dma pool seems to be a bit of overhead
for only a few allocations. As far as I understood those pools are 
meant for hundrets or thousands of rather small chunks.
 
I dont want to criticise it though, since the code at this place is surely
 not wrong. 
My initial post was due to a misunderstanding of mine: I thought the 
third parameter of dma_pool_create() is the total allocation size of all
chunks (dont ask me how I came to this conclusion, I could not explain it now :/ ).

Regards,
Lino

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web