Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754961Ab2KZKoH (ORCPT ); Mon, 26 Nov 2012 05:44:07 -0500 Received: from eusmtp01.atmel.com ([212.144.249.243]:54667 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754710Ab2KZKoE (ORCPT ); Mon, 26 Nov 2012 05:44:04 -0500 Message-ID: <50B347F3.7050109@atmel.com> Date: Mon, 26 Nov 2012 11:44:03 +0100 From: Nicolas Ferre Organization: atmel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Joachim Eastwood CC: "David S. Miller" , , , , Jean-Christophe PLAGNIOL-VILLARD , Havard Skinnemoen Subject: Re: [PATCH] net/macb: Use non-coherent memory for rx buffers References: <1353678601-26888-1-git-send-email-nicolas.ferre@atmel.com> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.161.30.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3481 Lines: 91 On 11/23/2012 05:12 PM, Joachim Eastwood : > Hi Nicolas, > > On 23 November 2012 14:50, Nicolas Ferre wrote: >> From: Havard Skinnemoen >> >> Allocate regular pages to use as backing for the RX ring and use the >> DMA API to sync the caches. This should give a bit better performance >> since it allows the CPU to do burst transfers from memory. It is also >> a necessary step on the way to reduce the amount of copying done by >> the driver. >> >> Signed-off-by: Havard Skinnemoen >> [nicolas.ferre@atmel.com: adapt to newer kernel] >> Signed-off-by: Nicolas Ferre >> --- >> drivers/net/ethernet/cadence/macb.c | 206 +++++++++++++++++++++++------------- >> drivers/net/ethernet/cadence/macb.h | 20 +++- >> 2 files changed, 148 insertions(+), 78 deletions(-) > > > >> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h >> index 570908b..74e68a3 100644 >> --- a/drivers/net/ethernet/cadence/macb.h >> +++ b/drivers/net/ethernet/cadence/macb.h >> @@ -453,6 +453,23 @@ struct macb_dma_desc { >> #define MACB_TX_USED_SIZE 1 >> >> /** >> + * struct macb_rx_page - data associated with a page used as RX buffers >> + * @page: Physical page used as storage for the buffers >> + * @phys: DMA address of the page >> + * >> + * Each page is used to provide %MACB_RX_BUFFERS_PER_PAGE RX buffers. >> + * The page gets an initial reference when it is inserted into the >> + * ring, and an additional reference each time it is passed up the >> + * stack as a fragment. When all the buffers have been used, we drop >> + * the initial reference and allocate a new page. Any additional >> + * references are dropped when the higher layers free the skb. >> + */ >> +struct macb_rx_page { >> + struct page *page; >> + dma_addr_t phys; >> +}; >> + >> +/** >> * struct macb_tx_skb - data about an skb which is being transmitted >> * @skb: skb currently being transmitted >> * @mapping: DMA address of the skb's data buffer >> @@ -543,7 +560,7 @@ struct macb { >> >> unsigned int rx_tail; >> struct macb_dma_desc *rx_ring; >> - void *rx_buffers; >> + struct macb_rx_page *rx_page; >> >> unsigned int tx_head, tx_tail; >> struct macb_dma_desc *tx_ring; >> @@ -564,7 +581,6 @@ struct macb { >> >> dma_addr_t rx_ring_dma; >> dma_addr_t tx_ring_dma; >> - dma_addr_t rx_buffers_dma; >> >> struct mii_bus *mii_bus; >> struct phy_device *phy_dev; >> -- > > struct macb is shared between at91_ether and macb. Removing > rx_buffers_dma and rx_buffers will break compilation on at91_ether. OMG, you are absolutely right. > So please either leave the two struct members alone, for now, or fix > up at91_ether at the same time. Well, I do not plan to touch at91_ether driver for the moment, so I certainly will keep the two struct members for now. I will wait a little more feedback before sending a v2 patch with these changes. Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/