Patchwork [08/20] ibmveth: Dont overallocate buffers

login
register
mail settings
Submitter Anton Blanchard
Date Aug. 23, 2010, 12:09 a.m.
Message ID <20100823001239.041525926@samba.org>
Download mbox | patch
Permalink /patch/62406/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Anton Blanchard - Aug. 23, 2010, 12:09 a.m.
We were allocating a page, even though we always want 4k. Use kmalloc
instead of get_zeroed_page.

Signed-off-by: Anton Blanchard <anton@samba.org>
---



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert Jennings - Aug. 23, 2010, 8:49 p.m.
* Anton Blanchard (anton@samba.org) wrote:
> We were allocating a page, even though we always want 4k. Use kmalloc
> instead of get_zeroed_page.

I get a failure during device open when we have a 4k allocation rather
than a 64k page allocation.  This is running on a Power6 LPAR without
AMS.

(drivers/net/ibmveth.c:621 ua:3000000c) ERROR: h_register_logical_lan failed with -4
(drivers/net/ibmveth.c:626 ua:3000000c) ERROR: buffer TCE:0x300 filter TCE:0x2300 rxq desc:0x8000601000004000 MAC:0x763cbdd9d30c

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian King - Aug. 25, 2010, 1:44 p.m.
On 08/23/2010 03:49 PM, Robert Jennings wrote:
> * Anton Blanchard (anton@samba.org) wrote:
>> We were allocating a page, even though we always want 4k. Use kmalloc
>> instead of get_zeroed_page.
> 
> I get a failure during device open when we have a 4k allocation rather
> than a 64k page allocation.  This is running on a Power6 LPAR without
> AMS.
> 
> (drivers/net/ibmveth.c:621 ua:3000000c) ERROR: h_register_logical_lan failed with -4
> (drivers/net/ibmveth.c:626 ua:3000000c) ERROR: buffer TCE:0x300 filter TCE:0x2300 rxq desc:0x8000601000004000 MAC:0x763cbdd9d30c

According to the architecture, these buffers need to be 4k aligned buffers,
which is probably the cause of this failure.

-Brian

Patch

Index: net-next-2.6/drivers/net/ibmveth.c
===================================================================
--- net-next-2.6.orig/drivers/net/ibmveth.c	2010-08-23 08:52:30.633730198 +1000
+++ net-next-2.6/drivers/net/ibmveth.c	2010-08-23 08:52:31.003703934 +1000
@@ -473,7 +473,7 @@  static void ibmveth_cleanup(struct ibmve
 					DMA_BIDIRECTIONAL);
 			adapter->buffer_list_dma = DMA_ERROR_CODE;
 		}
-		free_page((unsigned long)adapter->buffer_list_addr);
+		kfree(adapter->buffer_list_addr);
 		adapter->buffer_list_addr = NULL;
 	}
 
@@ -483,7 +483,7 @@  static void ibmveth_cleanup(struct ibmve
 					DMA_BIDIRECTIONAL);
 			adapter->filter_list_dma = DMA_ERROR_CODE;
 		}
-		free_page((unsigned long)adapter->filter_list_addr);
+		kfree(adapter->filter_list_addr);
 		adapter->filter_list_addr = NULL;
 	}
 
@@ -560,8 +560,8 @@  static int ibmveth_open(struct net_devic
 	for(i = 0; i<IbmVethNumBufferPools; i++)
 		rxq_entries += adapter->rx_buff_pool[i].size;
 
-	adapter->buffer_list_addr = (void*) get_zeroed_page(GFP_KERNEL);
-	adapter->filter_list_addr = (void*) get_zeroed_page(GFP_KERNEL);
+	adapter->buffer_list_addr = kzalloc(4096, GFP_KERNEL);
+	adapter->filter_list_addr = kzalloc(4096, GFP_KERNEL);
 
 	if(!adapter->buffer_list_addr || !adapter->filter_list_addr) {
 		ibmveth_error_printk("unable to allocate filter or buffer list pages\n");