From patchwork Mon Dec 17 13:01:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 1887131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 3AF503FCA5 for ; Mon, 17 Dec 2012 13:05:39 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TkaLS-0001t6-5q; Mon, 17 Dec 2012 13:02:58 +0000 Received: from eusmtp01.atmel.com ([212.144.249.242]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TkaL5-0001mx-0c for linux-arm-kernel@lists.infradead.org; Mon, 17 Dec 2012 13:02:41 +0000 Received: from tenerife.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.2.318.4; Mon, 17 Dec 2012 14:02:59 +0100 From: Nicolas Ferre To: "David S. Miller" , Subject: [PATCH 3/3 v2] net/macb: Try to optimize struct macb layout Date: Mon, 17 Dec 2012 14:01:59 +0100 Message-ID: X-Mailer: git-send-email 1.8.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121217_080237_718519_D6484B4E X-CRM114-Status: GOOD ( 10.41 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Joachim Eastwood , Nicolas Ferre , linux-kernel@vger.kernel.org, Havard Skinnemoen , Jean-Christophe PLAGNIOL-VILLARD , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Havard Skinnemoen Move TX-related fields to the top of the struct so that they end up on the same cache line. Move the NAPI struct below that since it is used from the interrupt handler. RX-related fields go below those. Move the spinlock before regs since they are usually used together. Signed-off-by: Havard Skinnemoen [nicolas.ferre@atmel.com: adapt to newer kernel] Signed-off-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index cef146f..aeeb729 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -548,38 +548,39 @@ struct macb_or_gem_ops { }; struct macb { + spinlock_t lock; void __iomem *regs; + unsigned int tx_head; + unsigned int tx_tail; + struct macb_dma_desc *tx_ring; + struct macb_tx_skb *tx_skb; + dma_addr_t tx_ring_dma; + struct work_struct tx_error_task; + + struct napi_struct napi; + unsigned int rx_tail; unsigned int rx_prepared_head; struct macb_dma_desc *rx_ring; struct sk_buff **rx_skbuff; void *rx_buffers; size_t rx_buffer_size; + dma_addr_t rx_ring_dma; + dma_addr_t rx_buffers_dma; - unsigned int tx_head, tx_tail; - struct macb_dma_desc *tx_ring; - struct macb_tx_skb *tx_skb; + struct macb_or_gem_ops macbgem_ops; - spinlock_t lock; struct platform_device *pdev; struct clk *pclk; struct clk *hclk; struct net_device *dev; - struct napi_struct napi; - struct work_struct tx_error_task; struct net_device_stats stats; union { struct macb_stats macb; struct gem_stats gem; } hw_stats; - dma_addr_t rx_ring_dma; - dma_addr_t tx_ring_dma; - dma_addr_t rx_buffers_dma; - - struct macb_or_gem_ops macbgem_ops; - struct mii_bus *mii_bus; struct phy_device *phy_dev; unsigned int link;