Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753494AbdLHMs3 (ORCPT ); Fri, 8 Dec 2017 07:48:29 -0500 Received: from mail-co1nam03on0080.outbound.protection.outlook.com ([104.47.40.80]:40128 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753370AbdLHMsF (ORCPT ); Fri, 8 Dec 2017 07:48:05 -0500 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Ioana Radulescu To: CC: , , Subject: [PATCH 6/6] staging: fsl-dpaa2/eth: Make Tx buffer alignment optional Date: Fri, 8 Dec 2017 06:47:58 -0600 Message-ID: <20171208124758.2732-7-ruxandra.radulescu@nxp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171208124758.2732-1-ruxandra.radulescu@nxp.com> References: <20171208124758.2732-1-ruxandra.radulescu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131572108902434176;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(7966004)(336005)(39860400002)(39380400002)(376002)(346002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(16586007)(8656006)(54906003)(33646002)(2351001)(106466001)(105606002)(77096006)(97736004)(305945005)(356003)(1076002)(50466002)(47776003)(48376002)(4326008)(76176011)(85426001)(104016004)(51416003)(81156014)(53936002)(81166006)(6916009)(5660300001)(8676002)(50226002)(68736007)(8936002)(36756003)(316002)(2906002)(86362001)(2950100002)(498600001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR03MB2697;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC006;1:88I6+Gt4fKleNZJB1YHZZrYj5e68ZV+jhFWB9k1ITXxKhE4nxh3MkPH75Gy7YnSYvC2uwT2FPjzxzxQLtUl97t13hbhUDWH4Q8hRAmLsJ/oE6DP6z1yWNyAnKOtgoM+6 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 898f6cdc-e4a3-44b2-8580-08d53e39eff1 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307);SRVR:DM5PR03MB2697; X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2697;3:CMi7XDJ+0FeX0CFbIaxmiK2BnTdXzBJ0gzhnt8UEtP+TLQqTBEsjySUqnmEqeQtCL+Y/XRmBWgCAGAK6hK2pMffMNHuz+msKAogWjRTSHJU9gsWRD0fripOJiBI+HeoTimNhJNcbhak/HfFnEf6Vv8oox+UXPfK5e86WdQtfBYkSbsCi7Mx2vE3GlROmx4Ydd+sFZ3e4Waa8dGA1QbXrOqxYCdpz/uC69OMt0MmgT8W7OB8xstLfx4g8ZVIFs5HBJtnCoO3uCCFJ6wG8ViBrjLJ2GCtiKoc8KyPRexLbIY1tNC+2fr++LZqR7B13wOUXLUt9MoDamIHEoy2/Nd412+H6QSNUWaMIaE6/RjpuI8Q=;25:OWiVby3ZeDrKwUmUrr2voFRtrpuYLlW6HnmM05BB5+ca4vONldoBNjRLjZyl1sFMfcxm6W4xX9VBjzsbaby3YwjEAqliB+Mzcyz+KGP1IrLeC3jiVU8gFZajZcHFbAR6MbnxlLOENgpaaWvF2UYmOIuvZOejjJFwXEXfh9p5vX5JcxqkrU8brW/R5p/Rvl1ozMblBXZoK7V6dEcEhaPf8yWVX3TE7yjd5Njto1ZpHjqCAPdWdLGLZIwqdcQlaD/FlomOR/rWILg9lIO9PcMwZvs83csLii0a/aj06ujzPl2csZc6tw3jUbSQ8EhRFbzkKYDSH1sZ8RAxx0aX+gtSow== X-MS-TrafficTypeDiagnostic: DM5PR03MB2697: X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2697;31:cI1J1q4oQFye/M4syg9JgxVAQvE7GVkY5ZdOv7jqj1iuf6IxMR4UXDJcMPqUQ+fskJ60MDAaxeVL+F8H6vXFbduJwcb+AnDKFRV+iH3DM+BPeLREBsu96WSgK3krBH/S3IVyh+M/f7tvg23DjHJjykYlrq/AOad6aNr7vFxDsDLiBcb/7I5vZwWtg2NiifE7UWzNZnZ9tU4sUdP/KK2muvhV3XlsOL1JQxB27YVz1sc=;4:ZFalyZVr5ayjE5JRTCLgHmYHrNZBGTNkkpfarBCMcqLDYKQ5m8WxtBEboMtQNA4bf9SS3PYqbrdB5RGjsyi252KWJ6gj32Hb0m2UVK+3MXKpTRHjOgPfGmr7RRv4C4ZP7mJoS1iNGyVRoQO7xMR4JSO/H9TgFoQSB7X+X/vcAzr6PNWZObWTCVujbKS39p3ePIBPA8W+pYvBfOKIkCFX7rGkuFhJbXvxHgcp0Jc9IQGRLrpMTCH1Fy9h4GXkhx9WHRw4hO/BASV/Kf3C7TJgVvRl5U3peHk+Tt/v9N2rHjirHJEL/jOtCy6ZiJGKG2YU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(2401047)(8121501046)(5005006)(3231022)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123559100)(20161123565025)(20161123556025)(20161123563025)(20161123561025)(201708071742011);SRVR:DM5PR03MB2697;BCL:0;PCL:0;RULEID:(100000803101)(100110400095)(400006);SRVR:DM5PR03MB2697; X-Forefront-PRVS: 0515208626 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR03MB2697;23:foE+EjhrliqnJoz78/3S3ZKJdscvqXHMx2hI9o6lu?= =?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fsPOT1eB/+JpwH4HeedZQoZZVS3xDSIel4lNqLOTYmgvpK8duH0rC00u7fIG7Gndg6U8FXI/R7OXh89nvvwP5inONhzvpy/mP4954rFEw5D2OzLKbHJ97DEw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2017 12:48:08.3246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 898f6cdc-e4a3-44b2-8580-08d53e39eff1 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2697 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2215 Lines: 58 Aligning the Tx buffers at 64B is a performance optimization recommendation, not a hard requirement. Make optional the alignment of Tx FD buffers, without enforcing a reallocation in case there is not enough headroom for it. On Rx, we keep allocating buffers with enough headroom to allow Tx alignment of forwarded frames. Signed-off-by: Ioana Radulescu --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 14 ++++++++++---- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 8edb7c1..7f3e4fa 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -433,13 +433,19 @@ static int build_single_fd(struct dpaa2_eth_priv *priv, struct dpaa2_fd *fd) { struct device *dev = priv->net_dev->dev.parent; - u8 *buffer_start; + u8 *buffer_start, *aligned_start; struct sk_buff **skbh; dma_addr_t addr; - buffer_start = PTR_ALIGN(skb->data - - dpaa2_eth_needed_headroom(priv, skb), - DPAA2_ETH_TX_BUF_ALIGN); + buffer_start = skb->data - dpaa2_eth_needed_headroom(priv, skb); + + /* If there's enough room to align the FD address, do it. + * It will help hardware optimize accesses. + */ + aligned_start = PTR_ALIGN(buffer_start - DPAA2_ETH_TX_BUF_ALIGN, + DPAA2_ETH_TX_BUF_ALIGN); + if (aligned_start >= skb->head) + buffer_start = aligned_start; /* Store a backpointer to the skb at the beginning of the buffer * (in the private data area) such that we can release it diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 4ea41d8..d68ac38 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -370,7 +370,7 @@ unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv, if (skb_is_nonlinear(skb)) return 0; - return DPAA2_ETH_SWA_SIZE + DPAA2_ETH_TX_BUF_ALIGN; + return DPAA2_ETH_SWA_SIZE; } /* Extra headroom space requested to hardware, in order to make sure there's -- 2.7.4