public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* BUG: Wrong dma queue handling in ixp4 driver
@ 2016-07-19 11:05 Lino Sanfilippo
  2016-07-19 11:31 ` Aw: " Lino Sanfilippo
  0 siblings, 1 reply; 4+ messages in thread
From: Lino Sanfilippo @ 2016-07-19 11:05 UTC (permalink / raw)
  To: khalasa; +Cc: netdev, linux-kernel


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Aw: BUG: Wrong dma queue handling in ixp4 driver
  2016-07-19 11:05 BUG: Wrong dma queue handling in ixp4 driver Lino Sanfilippo
@ 2016-07-19 11:31 ` Lino Sanfilippo
  2016-07-22 10:14   ` Krzysztof Hałasa
  0 siblings, 1 reply; 4+ messages in thread
From: Lino Sanfilippo @ 2016-07-19 11:31 UTC (permalink / raw)
  To: khalasa; +Cc: netdev, linux-kernel


> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Aw: BUG: Wrong dma queue handling in ixp4 driver
  2016-07-19 11:31 ` Aw: " Lino Sanfilippo
@ 2016-07-22 10:14   ` Krzysztof Hałasa
  2016-07-22 11:10     ` Aw: " Lino Sanfilippo
  0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Hałasa @ 2016-07-22 10:14 UTC (permalink / raw)
  To: Lino Sanfilippo; +Cc: netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Aw: Re:  BUG: Wrong dma queue handling in ixp4 driver
  2016-07-22 10:14   ` Krzysztof Hałasa
@ 2016-07-22 11:10     ` Lino Sanfilippo
  0 siblings, 0 replies; 4+ messages in thread
From: Lino Sanfilippo @ 2016-07-22 11:10 UTC (permalink / raw)
  To: "Krzysztof Hałasa"; +Cc: netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-22 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 11:05 BUG: Wrong dma queue handling in ixp4 driver Lino Sanfilippo
2016-07-19 11:31 ` Aw: " Lino Sanfilippo
2016-07-22 10:14   ` Krzysztof Hałasa
2016-07-22 11:10     ` Aw: " Lino Sanfilippo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox