Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbdFFPBC (ORCPT ); Tue, 6 Jun 2017 11:01:02 -0400 Received: from mail-sn1nam01on0046.outbound.protection.outlook.com ([104.47.32.46]:3552 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751410AbdFFPAy (ORCPT ); Tue, 6 Jun 2017 11:00:54 -0400 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 12/18] staging: fsl-dpaa2/eth: Add accessor for FAS field Date: Tue, 6 Jun 2017 10:00:35 -0500 Message-ID: <20170606150041.10955-13-ruxandra.radulescu@nxp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170606150041.10955-1-ruxandra.radulescu@nxp.com> References: <20170606150041.10955-1-ruxandra.radulescu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131412348451163724;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(39410400002)(39400400002)(39380400002)(39850400002)(39860400002)(39840400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(9170700003)(81166006)(110136004)(85426001)(77096006)(8656002)(54906002)(53936002)(8676002)(39060400002)(86362001)(305945005)(2906002)(356003)(7416002)(5003940100001)(1076002)(38730400002)(4326008)(47776003)(5660300001)(36756003)(106466001)(105606002)(189998001)(48376002)(498600001)(33646002)(8936002)(50466002)(76176999)(50986999)(2351001)(104016004)(6666003)(2950100002)(6916009)(50226002);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR03MB175;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;A:1;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD036;1:jjvCqVO0CapTmKu7130Bp28faavZazUR0znTlyyPfT3e+3jtQPA3Q9w1eKZg8AG58Hnkhmfn5FdPeDNOtMM/ZNyUJiREMuxV09tHax/wtcGe/hdTRyOP8LfhYp0HV5cj9ZJPKQ/pvDsvmBCpUdNCMKV+RzEfhpKUHf5Atjil3okO3N5hVZzvYDRtCUKavYNJfpKZglJmFGYkY0haJaWfzHuuZNq+MehPhco0rTz+IbAmKp29y08KwR+p5VyNVhmTOCk0di8fcn88vqqBbNj8c7OVrpg/E6E3vNfNknOLuw7WEDWannMqcZWuDl+flK1MnhUZu/TeRbCxCa9YTJApdlaNot7nJOruBqwAQJSvrrYUyMfhYlf0zYZPZmpFjRy1phoEHaHrHDBI9lRF76mWW0z0F3Kgoy4+81NN5k0phz0IGUyRPv49KDArmGro+I3srSZnrTMzD4di8wB+e34+PUVjNy2xHe3u0ZpVHjrykpB8WBgksuGJaPD78t7vioeU0zVYaQGTTJXiBnbFt1rRdbbitGGi/80eMTFfSi5L2a2YvA5HyPAcVerhn05RJv694bPMDvvCBd01dAfbmap/R5C3247Zawr5ekJvZCXwfAnecMXMjsBR8hKNlbZbKe41maRi2cSydPhVCEZ6B/UHODib3oiJQRESTP5XDeqVQRYonFZ4e3rDAB9vW8/4y0vR MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY2PR03MB175: X-MS-Office365-Filtering-Correlation-Id: f2aeb69b-cb95-43e7-0e4c-08d4acecceff X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131430075)(201703131517081);SRVR:BY2PR03MB175; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB175;3:/uCw81X37O1lSSPQAq+U6a7vTrswsGnLA7qw8fy6GOG2apWZUrDwyOQQMC9GSMg5VqbRI082v5W/TnH/dF7QQV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J7ggEyMB9os2DsEK0glY+b5ab5Vr91nO8SkHQ53Uyd7DQkCz8AIO7TowFuSYXh9LffmDeh0fbGG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13018025)(8121501046)(5005006)(13016025)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123559100)(20161123565025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123561025)(20161123563025)(20161123556025)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR03MB175;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR03MB175; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR03MB175;4:nCXtj6wYhkIOzeHRID3c2h6DcJnIUhxLqDkdhJOtpsV?= =?us-ascii?Q?bxAJD0B+G8KPP9ZmDGLPgk+W1v6nnrmtYVLH8yCahxcqFueX5z1KQWnKwIT/?= =?us-ascii?Q?25PFcCziFlZ7HYDXXqi3jxHzFsdTtXjFevaGXyGpYjHqyV4pOOtq/t3elW65?= =?us-ascii?Q?HotM6eE7hygz7VBMI+PRiPHfh7xMZt1BwOpSmaDm5/euPsJMup5wv5RuO4c5?= =?us-ascii?Q?LJrKBFLStxTKw+fbT0U5fbk5qBAg3nrqzOigOYsK8WJe9vCfE4PQ8PRSSltS?= =?us-ascii?Q?tnvu84t74u5JW6rtAcwtViM9n258+sBaoc2EEV4R7clfX8Ln8HKQohZncsut?= =?us-ascii?Q?bPh1ggQnnVOJHvMKZa6h0kfwl4xjInoBORE/O1BuomYWWeBCP7d7ltTzsYvF?= =?us-ascii?Q?KwSe/rDOU7U0cGNXaYLJ1yrP7NmyxYsO3N2k11cZrEm3t00GlELADyJRW2Vj?= =?us-ascii?Q?gdBbtzu+ZUoSCY5k3yeOS4Tw6gHuOunaUJKV78fL1WTUXVFyDXZXTihOFyhn?= =?us-ascii?Q?GsJgkvQO1wU5Z1h1XYlKqFWE3KxKBbEjF3jF5F/zfMmFp1jaWHfI9fq1TEpz?= =?us-ascii?Q?8x/knlOc0XOJsaVMmqfgludDou2l49TNjWcZuayc9cf5lyclJ40bftD770w9?= =?us-ascii?Q?26HazdTI9mJ5DyFWa9I1LLjMgTmg406kzjnXSQoJULqRUOEHv17qpLATqkHi?= =?us-ascii?Q?hKeDhYyn0GjOvQTFsMCd1zMNVq7Ei7JqvHLKMyezXyr8MpAYHVKmt3Gfo9qE?= =?us-ascii?Q?TFJ8ta8GZaU803k46Cwk4n0vgyU6svABS4KY8lyvHUYWt8no0qFQL9ZCmxE2?= =?us-ascii?Q?LIdlkFLeo9/RIGlueVmn26QnkFGlX7T6JUsIYsoSLRXZXVLS5kK+biRxkN5C?= =?us-ascii?Q?9Txb7tVO41zp8pBmmn5uBryssZGtFl1hw8chXtmPp8mYuEKRVyN2Cy8YSxUc?= =?us-ascii?Q?xpiIpLwRfTjLnqme3NrPgNNMkY5rnWm3w+HkMLFETsgqgdk68piThB9RtwJG?= =?us-ascii?Q?Z3cfvuJuVTFftD8+55sFzw7ETkbIsi7R7YFNDlj2GKaMth7//BaM05IGFmfB?= =?us-ascii?Q?MBAI1Pl3oEEUQXNIPrWerVGBQoBqGpbpjGcufsH0nPWReyqIvoJFtXAuxNSf?= =?us-ascii?Q?x6g153Gp01sRm3lsu/JCW2Os+bWcMtN2ZdJicu6s8EdqJTzR3OKI31FjwTgC?= =?us-ascii?Q?gDTcArSAC6r2rOB3O3/cJmbfpmqtsUq9E84byCBVgncwRHs8lMAr96SKKU0M?= =?us-ascii?Q?qQhlBZCHff6kHZKbYISGU90ZPhL1S8DMo5wPE?= X-Forefront-PRVS: 033054F29A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR03MB175;23:L0SKP9rL4jST2DqNNArdQkDbl7BjeRwnHMRWSW8M+Q?= =?us-ascii?Q?teBKYvnXTA++ars+AktYCBMDWK3CjmmQhHbjeh3YgOn8dI7LcpPlTXIiTbim?= =?us-ascii?Q?JbDQotH6lC76c+9w9z44Dy9vGCyQ8uocdlCLO12BNtSctPwiiIzgflw50djc?= =?us-ascii?Q?0Rway8ZRElC4b9mMVz8cYHg9WpdsqFSP0sME5Rymwv9aBTAEa0wG97pFvRIS?= =?us-ascii?Q?fsVEPQZD6Lua74FUjoKL6pRgbXF1Qx3KJQ1rrTt/yvJGwlA9klTjb4394RG1?= =?us-ascii?Q?GriTiun0DBvnoGjwCQ/J7CC+Vgf0T5h3xck+ceV6+15z9j/mw10M28vH+2kz?= =?us-ascii?Q?x02o5cVhNN97cTR1R0nfuSrBTxtq+rouHODwoe94XN1p52dk1lGLxDL3UEhk?= =?us-ascii?Q?ax1ux8SFRNhsGrUr4TloHYrzX6JBNxZrkOryA9sdt8EVsFgHN9XqMlshmX+v?= =?us-ascii?Q?vY95kLmYeCURn89d1V3/rua99382hel9izq5gadNK1cJOFGTQm8ZTXYk57tp?= =?us-ascii?Q?sIryr/n899DRWhzb+9uN2hjg1ViqZZ1JtsyS0AUmFVqnWP3L+mSpTkzgN2kt?= =?us-ascii?Q?dSAzrwvsFHhY0OxiwDeEt5UI2kaIqe/MZPvolUfo9ExKBc41YLKeBPDViX8a?= =?us-ascii?Q?fHbLmrcZqkZoSsn2z1TflQbyU82Vm+VRwy3XLYfOzZ5/6CEzm09aQzftf2ox?= =?us-ascii?Q?nf3NJQJ5WUj1EMGxvGObGxmVSycp5Nr3+E18b2wMD6gps074EpOBGXvUoCfv?= =?us-ascii?Q?6gMvoatjiKanTqC8m6hZzrYLPZK5QTI2+xpbts0fhPlKvtNMQ4BkhgMg+0Yk?= =?us-ascii?Q?BWTadyVvkbaBvuMQjNSBDNET/XNeYceoVlh7OS9HQMzAdTJAI7v7BzrOR4v9?= =?us-ascii?Q?49BHZBYkUFr3J1iGFk9pZomt5aJhCOveQeMofpT9FP51O26JaFioyLW/t+PU?= =?us-ascii?Q?FagApD5dR6MdE15rGtx5cIk0k/q881CnSeq3pEBDB8q/bReFnHEv+TVg1xkc?= =?us-ascii?Q?TIgbBte/5LB0xqPmbiLemnKtocWmp53EqR1xlyka1lF4dQQELzfdZ0debL0p?= =?us-ascii?Q?5h4x4IALcwfLrtxaLnqt9mAKh57cKNNpUZy7vTEIBBXyv/0RWXdJcLsK5UOB?= =?us-ascii?Q?cWhCLz327cS/R+Zg+SvBoOmC38TZ3gOlDRs3X5valCeDgT4QjwiZCWigPo6I?= =?us-ascii?Q?E03ZNzPFJohy2FSrYP8CkIgMopzEZPNdCkoTdMNzB57WfjLYit7bvheHbDiH?= =?us-ascii?Q?IfpjpF5sH+y8/zCRpSwZiT1b/FInUjEz/3Faatwoa4uWXqy7El6lsclnL9aj?= =?us-ascii?Q?tGo2dEbOxUgVjCqfbafws=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB175;6:4dCJKXKWapUxXUXyyTC2RuNOpvK5TZjdr1N0v0Xl/EbOgfszVGI1wQBsCQtao5jPixGEea0lZeTwGko5MEQICBXKEAhIFnLjMPcX77U72q90tmaDwCnfULClbBdJL4z5xm0MrzrHIidr5dhx8nh+ncCNbH6BdVnNl1t6gQ9ujoF6g8wm6aZxLdsdIxCckQB54wFjl5C4t8mc55KtbmcViz3DitU/1xAJAicZRf/qsdbvcEynilxn2q8F8QfWFDLUuIIAbQgQSzI6LdTIpFUUib7l4Hc8BN6c3wB9dlwWN4UXvYI+I2hO+7Jd/u/CYOPg+ufi/N3jyA87CaMWcCt1oe32s95hK6KiGDu3KLDTnpFNQNxarqKVwW6U/MpkVcTvaoXA87ExyTp3pbhC0C0BrTW/uD2yJQeYqVTgq9TVPrrTDIy63Hzy26/pNiKD8f6aok7wDM74YSSvjn6pvn8Th6oTLsKEZqODr67R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LbkUjfOMwtflEacmNDiqvqtVqgbGUi4DiFi6tpZ5gv3o+OnsITiSd6Cgg3bgZMTiKcYZB98Sgw+OEbzhA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2017 15:00:44.9291 (UTC) 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: BY2PR03MB175 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5479 Lines: 141 Introduce a helper macro for accessing the frame annotation status field in a frame buffer. Signed-off-by: Ioana Radulescu --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 31 ++++++++++++-------------- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 6 +++++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 025b5f6559a4..d81c56f4d859 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -227,6 +227,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, struct dpaa2_eth_drv_stats *percpu_extras; struct device *dev = priv->net_dev->dev.parent; struct dpaa2_fas *fas; + void *buf_data; u32 status = 0; /* Tracing point */ @@ -235,8 +236,10 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); - prefetch(vaddr + priv->buf_layout.private_data_size); - prefetch(vaddr + dpaa2_fd_get_offset(fd)); + fas = dpaa2_get_fas(vaddr); + prefetch(fas); + buf_data = vaddr + dpaa2_fd_get_offset(fd); + prefetch(buf_data); percpu_stats = this_cpu_ptr(priv->percpu_stats); percpu_extras = this_cpu_ptr(priv->percpu_extras); @@ -244,9 +247,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, if (fd_format == dpaa2_fd_single) { skb = build_linear_skb(priv, ch, fd, vaddr); } else if (fd_format == dpaa2_fd_sg) { - struct dpaa2_sg_entry *sgt = - vaddr + dpaa2_fd_get_offset(fd); - skb = build_frag_skb(priv, ch, sgt); + skb = build_frag_skb(priv, ch, buf_data); skb_free_frag(vaddr); percpu_extras->rx_sg_frames++; percpu_extras->rx_sg_bytes += dpaa2_fd_get_len(fd); @@ -262,8 +263,6 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, /* Check if we need to validate the L4 csum */ if (likely(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) { - fas = (struct dpaa2_fas *) - (vaddr + priv->buf_layout.private_data_size); status = le32_to_cpu(fas->status); validate_rx_csum(priv, status, skb); } @@ -327,7 +326,6 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, { struct device *dev = priv->net_dev->dev.parent; void *sgt_buf = NULL; - void *hwa; dma_addr_t addr; int nr_frags = skb_shinfo(skb)->nr_frags; struct dpaa2_sg_entry *sgt; @@ -337,6 +335,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, int num_sg; int num_dma_bufs; struct dpaa2_eth_swa *swa; + struct dpaa2_fas *fas; /* Create and map scatterlist. * We don't advertise NETIF_F_FRAGLIST, so skb_to_sgvec() will not have @@ -373,8 +372,8 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv, * on TX confirmation. We are clearing FAS (Frame Annotation Status) * field from the hardware annotation area */ - hwa = sgt_buf + priv->buf_layout.private_data_size; - memset(hwa + DPAA2_FAS_OFFSET, 0, DPAA2_FAS_SIZE); + fas = dpaa2_get_fas(sgt_buf); + memset(fas, 0, DPAA2_FAS_SIZE); sgt = (struct dpaa2_sg_entry *)(sgt_buf + priv->tx_data_offset); @@ -433,7 +432,7 @@ static int build_single_fd(struct dpaa2_eth_priv *priv, { struct device *dev = priv->net_dev->dev.parent; u8 *buffer_start; - void *hwa; + struct dpaa2_fas *fas; struct sk_buff **skbh; dma_addr_t addr; @@ -446,8 +445,8 @@ static int build_single_fd(struct dpaa2_eth_priv *priv, * on TX confirmation. We are clearing FAS (Frame Annotation Status) * field from the hardware annotation area */ - hwa = buffer_start + priv->buf_layout.private_data_size; - memset(hwa + DPAA2_FAS_OFFSET, 0, DPAA2_FAS_SIZE); + fas = dpaa2_get_fas(buffer_start); + memset(fas, 0, DPAA2_FAS_SIZE); /* Store a backpointer to the skb at the beginning of the buffer * (in the private data area) such that we can release it @@ -498,6 +497,7 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, fd_addr = dpaa2_fd_get_addr(fd); skbh = dpaa2_iova_to_virt(priv->iommu_domain, fd_addr); + fas = dpaa2_get_fas(skbh); if (fd_format == dpaa2_fd_single) { skb = *skbh; @@ -534,11 +534,8 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv, * buffer but before we free it. The caller function is responsible * for checking the status value. */ - if (status && (dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) { - fas = (struct dpaa2_fas *) - ((void *)skbh + priv->buf_layout.private_data_size); + if (status && (dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV)) *status = le32_to_cpu(fas->status); - } /* Free SGT buffer kmalloc'ed on tx */ if (fd_format != dpaa2_fd_single) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 539da71470d9..6462e2cbe4be 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -139,6 +139,12 @@ struct dpaa2_fas { #define DPAA2_FAS_OFFSET 0 #define DPAA2_FAS_SIZE (sizeof(struct dpaa2_fas)) +/* Accessors for the hardware annotation fields that we use */ +#define dpaa2_get_hwa(buf_addr) \ + ((void *)(buf_addr) + DPAA2_ETH_SWA_SIZE) +#define dpaa2_get_fas(buf_addr) \ + (struct dpaa2_fas *)(dpaa2_get_hwa(buf_addr) + DPAA2_FAS_OFFSET) + /* Error and status bits in the frame annotation status word */ /* Debug frame, otherwise supposed to be discarded */ #define DPAA2_FAS_DISC 0x80000000 -- 2.11.0