Received: by 10.213.65.68 with SMTP id h4csp384108imn; Fri, 23 Mar 2018 06:46:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELvsHIHllxXgmAz3/B3twEMT7WedSa7WsSdceQCcDLYpbcwvva9iAYPL2iAfMFZ6IV9nCapt X-Received: by 10.101.75.135 with SMTP id t7mr6904193pgq.235.1521812777594; Fri, 23 Mar 2018 06:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521812777; cv=none; d=google.com; s=arc-20160816; b=fVIQk56ld/EyKSo/br75NDh9t+/7wFqPI8KsGqE2TvIO9Mw5zfhec9nH03xxRDZOdA EKQ7VK2/fK/5wVmsYXMlsr5DVX2FWyOv8RG6+5ch6c5vHYiysdKNoFHlz8pcI9xzw2mU 8JEm3n79pdo80OeS+WNurc10953Xe3pS/RW7PJ1FNfzZYs7HPMaIl0B1TcsJTeiw4pjB 18tKZyViz5eNgFAWr9Hu5PDC5Hg7IJXNezBShlZkm/vrEMGaUp/GGhJZ/Jj9SUUbgA39 qnq9TC7U3Woum5kT9C83awnePF48efe0rllYTSnym+MHXllfONOKpAzlElmDYZWm4Ef3 KjtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=FPGHIbxPU5C2rIdFa8RdpSnk1ZyGuMc8Fptta+L4v6I=; b=S/KPTiFcfaRFmmkfL40jYLaZiXvjSs/ui57lQ6wgMQbKooEb0t4aCwS5Z8njDVumOB NLq2G0/a4BsdTb2UgbvjVO6Fx1zowSTzlbLSbhUOEwz8fGJcHZz6JsHqr1mzLhdiXwi7 I920g4sI3xpJHQpJdNtifBHSLFMZPNwdrBMe/tdQ11aVY3Rj9s0QALrDaAmnVht4DFQ+ Uc2rjxItHYPRRRyoWtrTEXU5LVtoz6X6nfgRlfF0ZpohScyn2BBLoLBfxlw6nHhMxShE 0B+aWPOg28Wqsi9OtQBF+404a2jkGRFYK5XbnXN/L6YdxQORlQg8N+GpSJ/fgKruwnAF P4Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=qLIw2Mku; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9-v6si8265629plr.558.2018.03.23.06.46.02; Fri, 23 Mar 2018 06:46:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=qLIw2Mku; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752864AbeCWNor (ORCPT + 99 others); Fri, 23 Mar 2018 09:44:47 -0400 Received: from mail-ve1eur01on0062.outbound.protection.outlook.com ([104.47.1.62]:10935 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752783AbeCWNon (ORCPT ); Fri, 23 Mar 2018 09:44:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FPGHIbxPU5C2rIdFa8RdpSnk1ZyGuMc8Fptta+L4v6I=; b=qLIw2Mku44ZRiRja8wnxnc+WwZKUTNcqNfmlKPZ2r0pqGTmj4vH1fG79v/TakRJwD2mRtzTZa8bPa0qoc5xWrqZ8WgaDAHOThLoTp8rCe8tkz5AGP8AL3jRI45Srjtvre7k35fNcholPtHYe30H9n2giADzAk1QVtFvooT9sZl0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ruxandra.radulescu@nxp.com; Received: from rhuath.am.freescale.net (192.88.168.1) by AM5PR0402MB2690.eurprd04.prod.outlook.com (2603:10a6:203:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Fri, 23 Mar 2018 13:44:35 +0000 From: Ioana Radulescu To: gregkh@linuxfoundation.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/9] staging: fsl-dpaa2/eth: Cleanup TX frame freeing code Date: Fri, 23 Mar 2018 08:44:11 -0500 Message-Id: <20180323134413.1532-8-ruxandra.radulescu@nxp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180323134413.1532-1-ruxandra.radulescu@nxp.com> References: <20180323134413.1532-1-ruxandra.radulescu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.88.168.1] X-ClientProxiedBy: BN6PR05CA0014.namprd05.prod.outlook.com (2603:10b6:405:39::27) To AM5PR0402MB2690.eurprd04.prod.outlook.com (2603:10a6:203:97::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ca077381-e97f-407a-b1f4-08d590c43794 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:AM5PR0402MB2690; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0402MB2690;3:Ulsm90vgN0mPhng1rnnypUBoung5I9qAnkC6EclXPKjocP1/A64JMPGlJ9fVxQuTZT18rbJTAM7AQaCBh/IFoFQco5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fA3FUef58ZZuDWYjfhxeHH2fbxCFGatXW/OQrEBqkaggbEsUh9pF+L4FPMYZRQKQsoeIljXSL8msdE4GJOfJhPFAfZ3mCyQUObDJgX6dQfysqVYTJVUxcPIHYZaLIQQXszxJ1RpbE3WhBNMjpbfsOagpUKxPTSIp8ruUWBO10ky28H9FI1hBj1iUy/HPTcDQ9ejEHZU3lavJQDGZ6aOVggkQlUiZoS82IauLFSOQLCNx0rleOtolb3EWeWnN;4:+ehuOJnY92yD7SkR96HOILP2kjMhcKGWGx/tX4lMUZytBMC3CLTJyOXMZKB/3DCX2iMgCrdYWu+A2jYE9s9BOeND0DrjM4G+u4JhCqEcyHoutdEYGO9EqRxEQGs7Hcs2UZjKY/TBdTlrqKR6KlOJteixZ5fNs51dYJHB54XE1N+hT25nUeedJ5VtmuVUSvU4YAme7mO15CJEPBoPndqzFZTU1bYJvfspLXYTPYR4cA543XvnRzoW85uN/t1ZGIYVknv6Nx3Tf+SIni6MCDviHIhEZx96GkdbgDasK3JLiSGVjNX1njM6A/nEwpORo3Fb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:AM5PR0402MB2690;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0402MB2690; X-Forefront-PRVS: 0620CADDF3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(39380400002)(39860400002)(199004)(189003)(50466002)(25786009)(6512007)(6916009)(6666003)(7736002)(305945005)(5660300001)(386003)(6506007)(81156014)(6116002)(3846002)(8676002)(16526019)(51416003)(50226002)(1076002)(446003)(2906002)(36756003)(81166006)(76176011)(186003)(66066001)(86362001)(8936002)(52116002)(4326008)(316002)(53936002)(68736007)(47776003)(26005)(48376002)(2361001)(478600001)(6486002)(105586002)(2351001)(106356001)(97736004)(16586007)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0402MB2690;H:rhuath.am.freescale.net;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM5PR0402MB2690;23:foeB89V/iyIyCtSRwBFC+5FUqnizJYLUzyZciFK?= =?us-ascii?Q?eO0Web/7WvWK3y4QLyXuOP06NUXNEuBe9WgBbTmNGQEwZ8Q6RZw156Somp+f?= =?us-ascii?Q?Iw1ZuZVp5vGG8o3SEFD0YywSevrmnZHgLp64K2CVcQ/pXmd47K4G7YkgRv5Z?= =?us-ascii?Q?ilkdUgO5FeF7YXzwDT0wIAj4FaYwCeeUBCYwDjMkshiUCmzv5d2IDy8ILdYs?= =?us-ascii?Q?hs7QFGp2JEbL92NooLQxfAxHC2MmolvICZ4v7KzB++CUKNyZBfF/DZN7HXww?= =?us-ascii?Q?/LDxyGrjPI7qq8i/WkLZtaYxvsman79EzTMboklUZi8k93aySYB2jk+gZQtt?= =?us-ascii?Q?MwXE8nb6iG4JjdYBcPdT/JGR8tqUQf4HZ2ZCFfqJoWjQxw8Q1pvQeDry2XTJ?= =?us-ascii?Q?vZplAKC64ShjjP0fe7z+IMUEtFIjs5ffDbAp5UfxywEKMRuCEJnc55wFKHV5?= =?us-ascii?Q?UYzGwPV2CY1lcL0w0LxQ30tHvgnD4NuVshQGAm1Oi0RJXFKrJQoxnL2amnn6?= =?us-ascii?Q?x8twjxU6mhu9tehDdjkJ9baXm1m5aWDZF2/uiRMa5fckdHjIqnX/ody78BgF?= =?us-ascii?Q?yRWABz6G3DVidyQmABsWvctvxxg+kVWZurA+blMgaWinHFrr161cPr1Xmbxm?= =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j5W8hCE8jX3px4D8cMkLrzhErlGR/vU4b8ZVidH067xyfmpJbNdxAGEAah7XC7HY//E6QOfvMoO+v7cpHacAJqSIiPpHbbfhYPq1ql64KZg4wq9WCAMcZv7/bzUI1CYdyFIr7z4KxcmAVLN8H8zSgeyibnJk273/ZpEj3hBhGJ4gAkx8otJKVVrRSoT2kfgwvTpH3r46RtLUIlZpXzYfbaOUIs//Bp9MlDBprXB2t/lNCKPmXBybZ7uz3m1sL+xktzANa4HMCnLTVdIMthy0ruZ5MOyoEzCtrdkk/8Bapch5OwvASQOB8NSmfVdFkrgrPhX7zirtQAjfMFwkA==;5:mhs9NY6lz9awfo/YHJoSOpGMph/7n/OL6GXJjP3KNXo3Dfnx/cJfcMGU4D1aLKcNFNCIDlniNyDvOgAxpRAZ+arhJpMbpOnRnKFYRlIq8Ac6AdHdTNXZ4wRWWtpL6Ahsa1ncZcOBfLVuvkWTAyGG/nQiznysWivNX6QZwmVjYXQ=;24:D9DHVx9v+PK5IT4Wd3A+BRq1BZbA0pYieX8mkvqBMeRVhkoekbpx8KOIuN9JtoiEgWczuYRsdLurJ4Pcr2YmcPy/mktqVFTf3tQToZu1WCU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0402MB2690;7:OvRLLIv92HeCWcBz27GoSpnLM9c4diZcVjgeJGNyLMMxtrmApbzBNQ5PVYpQqP2ZNVj4SfLqqlktAMgLR2HlRO8UJxmXikdmxn5cbKidcelUYFrauPweEMpXoW4CXE/kztpHkZxgtKmcZmdKtGqlnWNv39GW4qiPU/G+JqFvn5vDxJcm3ItiV9kscWk8TwnbUmKVeHyzQ0Tlyxk4Jq0EegZzqeTt3odid0NJnVpHa7+wdcxdsptznVOTAKNl8/+V X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2018 13:44:35.3956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca077381-e97f-407a-b1f4-08d590c43794 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0402MB2690 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cleanup code in free_tx_fd() that deals with S/G frames: - remove local variables that aren't really needed - in the frame sw annotation area, store the actual SG table buffer size, which is needed on free, rather then recompute it based on number of S/G entries Signed-off-by: Ioana Radulescu --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 17 +++++------------ drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index f58c85a..9994922 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -406,7 +406,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, swa->skb = skb; swa->scl = scl; swa->num_sg = num_sg; - swa->num_dma_bufs = num_dma_bufs; + swa->sgt_size = sgt_buf_size; /* Separately map the SGT buffer */ addr = dma_map_single(dev, sgt_buf, sgt_buf_size, DMA_BIDIRECTIONAL); @@ -489,9 +489,6 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, dma_addr_t fd_addr; struct sk_buff **skbh, *skb; unsigned char *buffer_start; - int unmap_size; - struct scatterlist *scl; - int num_sg, num_dma_bufs; struct dpaa2_eth_swa *swa; u8 fd_format = dpaa2_fd_get_format(fd); @@ -510,18 +507,14 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, } else if (fd_format == dpaa2_fd_sg) { swa = (struct dpaa2_eth_swa *)skbh; skb = swa->skb; - scl = swa->scl; - num_sg = swa->num_sg; - num_dma_bufs = swa->num_dma_bufs; /* Unmap the scatterlist */ - dma_unmap_sg(dev, scl, num_sg, DMA_BIDIRECTIONAL); - kfree(scl); + dma_unmap_sg(dev, swa->scl, swa->num_sg, DMA_BIDIRECTIONAL); + kfree(swa->scl); /* Unmap the SGT buffer */ - unmap_size = priv->tx_data_offset + - sizeof(struct dpaa2_sg_entry) * (1 + num_dma_bufs); - dma_unmap_single(dev, fd_addr, unmap_size, DMA_BIDIRECTIONAL); + dma_unmap_single(dev, fd_addr, swa->sgt_size, + DMA_BIDIRECTIONAL); } else { netdev_dbg(priv->net_dev, "Invalid FD format\n"); return; diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 5ac014f..fc9a255 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -108,7 +108,7 @@ struct dpaa2_eth_swa { struct sk_buff *skb; struct scatterlist *scl; int num_sg; - int num_dma_bufs; + int sgt_size; }; /* Annotation valid bits in FD FRC */ -- 2.7.4