From patchwork Tue Jan 9 13:22:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 123948 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4020263qgn; Tue, 9 Jan 2018 05:26:04 -0800 (PST) X-Google-Smtp-Source: ACJfBovRmUXGYWnPwrl+UOXyl3eG/VU3UF7e2yIPrREsiH3b3HJbgRlE860jNlHfBZ0cftrsnmpF X-Received: by 10.28.190.7 with SMTP id o7mr12991809wmf.10.1515504364100; Tue, 09 Jan 2018 05:26:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515504364; cv=none; d=google.com; s=arc-20160816; b=QNR2C0lTWavs2wfm85ClBCuriVL/SULwISX+v1SGzOKk6eR9bcbckszk9n7CvFY22S bogz0kWjWyKcW3AKFCUSd5uCc4Z3AzhhnwyTQg3hGz+DAiZ69Vfz4yEl+qe2mVrtLh8B 4oR1ZKKDX2bmns1cIayhAUiMpvJLjfCkV18OJuVzM7Av6L5RdBk1sjPJL4cvXhYI82l9 RRgKcag6YILhKUcrfpRgwxbrUd1KEFbD0UDjGeoK9pDZnOPwP1ZehQl0WurUg8+DSa8H QVaKFtHT0dehNjFF00nxm5oZsxSac785KIeeNhsvrwxIiW2O4QmZ+X6uZ2Rv0gGMnq0Z LqzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=PoSRi0A58oS1uvOfd3wk1JLNZaNyzvnlZYEEDX0iIbE=; b=WdwYc6X2I5mwbs+tnYoiRdPO681oXhZtAFTJZCIAvU1l+pdk22lxWmXf0xriySbk3i i680gvIitmAw5mt6vmepb4oawjpXkOlsP+PCid3g4O0FoEJ+hx56yog8VvAkly0hVeqx RQNMFcQx5y2BdfiaX+9Zdighy8YyJ56EszCdfaXtJkoYEfX7xvsU70dhCJwRfs82N+ZF T5vmjKyFU2VrBB2tum0EdZ4fxsepkrSQ0LvFvKQPugHy3eIRZ/1iu6No4/AULXe2AfSo kUmGzpXHtXM3iuX7fkBQiBbbOVtLAboCDaDKtVY1qGaJs4goPGBr5a5TKvfW1mXyAuDi x8xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id 91si3061366wrh.544.2018.01.09.05.26.03; Tue, 09 Jan 2018 05:26:04 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AAD411B217; Tue, 9 Jan 2018 14:24:39 +0100 (CET) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0077.outbound.protection.outlook.com [104.47.38.77]) by dpdk.org (Postfix) with ESMTP id EFF3C1B20D for ; Tue, 9 Jan 2018 14:24:37 +0100 (CET) Received: from BN3PR03CA0099.namprd03.prod.outlook.com (10.174.66.17) by CY1PR03MB2363.namprd03.prod.outlook.com (10.166.207.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 9 Jan 2018 13:24:36 +0000 Received: from BN1BFFO11FD014.protection.gbl (2a01:111:f400:7c10::1:157) by BN3PR03CA0099.outlook.office365.com (2603:10b6:400:4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Tue, 9 Jan 2018 13:24:36 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD014.mail.protection.outlook.com (10.58.144.77) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 9 Jan 2018 13:24:05 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w09DOAVs017638; Tue, 9 Jan 2018 06:24:33 -0700 From: Hemant Agrawal To: CC: , , Nipun Gupta Date: Tue, 9 Jan 2018 18:52:58 +0530 Message-ID: <1515504186-13587-11-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> References: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131599778453867439; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(346002)(39380400002)(396003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(51234002)(8656006)(356003)(8936002)(76176011)(104016004)(81166006)(77096006)(47776003)(305945005)(86362001)(6916009)(6666003)(498600001)(2950100002)(2906002)(8676002)(85426001)(81156014)(51416003)(5660300001)(50226002)(36756003)(68736007)(4326008)(53936002)(97736004)(106466001)(316002)(2351001)(105606002)(48376002)(16586007)(296002)(54906003)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2363; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD014; 1:mwXzPz1mZ+TgTSeQlZo1RiPRgfOo6pwvGeM3k506G4QqAdUKkV0HbuAoXU9fl9SdNl/MX8DCTlU4joP4FQG8paFiHOVgIOnqFW+a/+H1EbOG1aPppkceAfptkjPRulGk MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23590a10-3c57-4309-4baf-08d5576441ba X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CY1PR03MB2363; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2363; 3:EQxgEV6RT6fAPF+XZwj+J6UIAhVasCtvUhJvS5KACX57ugO+zH7yj2BZ0ZmA2YcosOUpaamQR1wq2AEUHRkmcJBRzWAuXmANaXzDmSDMN8DCbI3oNL/P+udCbEfFjh2yhIrfc1MkfiVlkKi8eC6H2F2iKaA8JRVzcz1aE2zRX7xlCzIx0fBftrINRnUw9JwFNVRIQyaXRG/SnQz0tFD9IS1COIJxN1SWzJHXdCKmtDwRWBdL9ruqBvepIv3PS1EI56jIG8TfFgcwJqSrAmsyOXhNCTT3DOs9Ms2+8b8KvKYKffmRRzt5Gh9Ljy3iDRwggnCfZjg3zdqsl49xsznJmWnI28pAgEuNuU/+no+U2Qo=; 25:x+jkt7flWwm7dDj3hmwcqDT/L6mlXSfdeRkcPmZ4aaPKLDsUxo95KJUX3ZRkPq8BUhJXd4gTfJwKamr7T0Uev1kHAqTsL/UsXktvIsf2sUwWObA6NZCzA/S3j77gXCxGsgqKmYgUlY23JK0Esraa0MPtA6mzEhJlRrjA6Hau7svAZkFDGOxuw8FUMTBxfRoQUX4AoORG3J+peCrALAj1CLSVzHcEj59xAJMnmqqC1xZD5O38SyQbPqqTl4yNBqoFgEQqgeCGDNlvpN9MnrQyC46Bwr2sIirb/eOcYfBQd4Ck2M+C2+8SmJGQVR0q8qdyDwU5jFwGmoZWdBZVt4ronQ== X-MS-TrafficTypeDiagnostic: CY1PR03MB2363: X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2363; 31:QD5/28Bw51NffxV8DoTyfWmlQoCT302Jd8AlrXcDqCiWaKuAnCTPs+VnSv+EDiG4+/lCHxMr7VYbA6sObjPO0mLX0NIo47FhHyGL8T+5cRxfHX5O9qPu/OVR8uAf5DsB4s1F8qmJfW3e8MeINySn9nJIMcQjyilL4xbDLJBEn/E81/Y5QBm0rgpxb0wGPgxnycQEpjo/BLQ+J6bFJ4PwYZJeHxOKDjQZ2hIblWy+fI0=; 4:lxOBVyuwC3SA5C8duOyYP/EwG4uoAqGk+rmj3VkIQGz8hDDDB8WpzkqCe3VVBNRua0nbz8GV59quOoH6Hx/7D+ggw1uNlv2DZcGjL6nXIWgJ0WCcw2XYu6++XUlKLPoy1qIr7v0RPz90kZLBC6IP64eN9tg5tvMGtG/OL7RxpxRMxHKw8NM1BQ5qyU0l7Da4HEEvthgSCAT5cA0fwamQTyJWNaw2AkfvDz9dWIkPtOxPiUsBnKinxCNxbw9y1womukGW/W3U+0Gl5OG7ygzpS/Nhe4HAKsqPxcMyfOojDEPMKR6HZ1/5+OXABRXI6J3/ 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)(93006095)(93001095)(3002001)(3231023)(944510075)(944921075)(946801075)(946901075)(10201501046)(6055026)(6096035)(20161123561025)(20161123563025)(20161123556025)(20161123565025)(20161123559100)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(201708071742011); SRVR:CY1PR03MB2363; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY1PR03MB2363; X-Forefront-PRVS: 0547116B72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2363; 23:lG0qf0+f/kLg/A/0oUzct8Le947blSIetT8vCCDH9?= xFru4iLg+ah50sM0AGowZ0UppbGTaeI0xw2wOJQXV13whqRvgEuNxcIpCbP9ufyrFiNswhAoT48WJknysQ16cbGfF66a1Gy5h0dA4k74ucG1WF2mhqS52pcl/uDLR3L8CgDx40VpBiAGkzZxX/forGFOi0fB5g5mfHiWimfjBBNKqRPZUqdcCE3sCsYqZaploXqM1/nEe+fQAISJswMGuWtRrmAj3qJrkVZTq9JRIXmF0wXxpxiaVJl/gLxBBitI/5rBSU9jF74kbvLmrVKVj1BNjDeMTq3+P0EDeEhJ2nUzK+4khJS6WgIWE4i9jiQ6cYE13Na+EDkeqIj3vRNWBp56Rmvw3Zpy5+w/Bs6aHkv5rk/1Og8zGQYEA53VpDESVm4uFji9qVkqfXyYzB8AdG8w6USpqr/GF483AApDjUpP4g9ZH4r6WrsIJycyKtpBn3Xv5oKyl1ObDsIcX8GC5gwf7yIGRahyeg+J0bnp419HKstR3CVaAzaMMrfRX/c3EWeDMytF8/mq9HJ2ulfNyxv6Nk3bJGWXm1dKxfPePz+Wn+q+k614n7V2fXlUWVKRc4iYTP9LzM7pyZSmIazwBStRGVid8utgkkf3AMYwNb3TVsd5KTubinqhmX7Efu/S9oySlgBuRScoIAVAZ9djm4wMUewxXtmTG6yjx8b5loyx7aut6EisdYc1yVYa1vIBSrscnrCC1rukTWBg1mICyp+Qkez/5uwTZAC4/ENZnbugVfSuIzvU74gd8XJ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KCm0a/3224/gdKo25gdb7lrq98CF4z9Rc/j6QTjOIQsGtjwVrvAXYCzejHBfb9ykuoZmAFF9qK9XTNaWZgzuaOebXJ0kQ37ZAR6BGwaLKIEVyn4Ins9cqQKbtfpw0TFimpuiM689tXn4QYZ04BjQhV2r/kjnLCG3dbHl9sRrOxPAMQ68jOB7lJOagfcg0909pNYP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 13:24:05.2151 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23590a10-3c57-4309-4baf-08d5576441ba 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: CY1PR03MB2363 Subject: [dpdk-dev] [PATCH v2 10/18] net/dpaa: optimize the Tx burst X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Nipun Gupta Optimize it for best case. Create a function for TX offloads to be used in multiple legs. Signed-off-by: Nipun Gupta Acked-by: Hemant Agrawal --- drivers/net/dpaa/dpaa_rxtx.c | 73 ++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 27 deletions(-) -- 2.7.4 diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 565ca50..148f265 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -272,6 +272,30 @@ static inline void dpaa_checksum_offload(struct rte_mbuf *mbuf, fd->cmd = DPAA_FD_CMD_RPD | DPAA_FD_CMD_DTC; } +static inline void +dpaa_unsegmented_checksum(struct rte_mbuf *mbuf, struct qm_fd *fd_arr) +{ + if (!mbuf->packet_type) { + struct rte_net_hdr_lens hdr_lens; + + mbuf->packet_type = rte_net_get_ptype(mbuf, &hdr_lens, + RTE_PTYPE_L2_MASK | RTE_PTYPE_L3_MASK + | RTE_PTYPE_L4_MASK); + mbuf->l2_len = hdr_lens.l2_len; + mbuf->l3_len = hdr_lens.l3_len; + } + if (mbuf->data_off < (DEFAULT_TX_ICEOF + + sizeof(struct dpaa_eth_parse_results_t))) { + DPAA_DP_LOG(DEBUG, "Checksum offload Err: " + "Not enough Headroom " + "space for correct Checksum offload." + "So Calculating checksum in Software."); + dpaa_checksum(mbuf); + } else { + dpaa_checksum_offload(mbuf, fd_arr, mbuf->buf_addr); + } +} + struct rte_mbuf * dpaa_eth_sg_to_mbuf(struct qm_fd *fd, uint32_t ifid) { @@ -594,27 +618,8 @@ tx_on_dpaa_pool_unsegmented(struct rte_mbuf *mbuf, rte_pktmbuf_free(mbuf); } - if (mbuf->ol_flags & DPAA_TX_CKSUM_OFFLOAD_MASK) { - if (!mbuf->packet_type) { - struct rte_net_hdr_lens hdr_lens; - - mbuf->packet_type = rte_net_get_ptype(mbuf, &hdr_lens, - RTE_PTYPE_L2_MASK | RTE_PTYPE_L3_MASK - | RTE_PTYPE_L4_MASK); - mbuf->l2_len = hdr_lens.l2_len; - mbuf->l3_len = hdr_lens.l3_len; - } - if (mbuf->data_off < (DEFAULT_TX_ICEOF + - sizeof(struct dpaa_eth_parse_results_t))) { - DPAA_DP_LOG(DEBUG, "Checksum offload Err: " - "Not enough Headroom " - "space for correct Checksum offload." - "So Calculating checksum in Software."); - dpaa_checksum(mbuf); - } else { - dpaa_checksum_offload(mbuf, fd_arr, mbuf->buf_addr); - } - } + if (mbuf->ol_flags & DPAA_TX_CKSUM_OFFLOAD_MASK) + dpaa_unsegmented_checksum(mbuf, fd_arr); } /* Handle all mbufs on dpaa BMAN managed pool */ @@ -670,7 +675,7 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) struct rte_mempool *mp; struct dpaa_bp_info *bp_info; struct qm_fd fd_arr[DPAA_TX_BURST_SIZE]; - uint32_t frames_to_send, loop, i = 0; + uint32_t frames_to_send, loop, sent = 0; uint16_t state; int ret; @@ -685,10 +690,23 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) while (nb_bufs) { frames_to_send = (nb_bufs > DPAA_TX_BURST_SIZE) ? DPAA_TX_BURST_SIZE : nb_bufs; - for (loop = 0; loop < frames_to_send; loop++, i++) { - mbuf = bufs[i]; - if (RTE_MBUF_DIRECT(mbuf)) { + for (loop = 0; loop < frames_to_send; loop++) { + mbuf = *(bufs++); + if (likely(RTE_MBUF_DIRECT(mbuf))) { mp = mbuf->pool; + bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp); + if (likely(mp->ops_index == + bp_info->dpaa_ops_index && + mbuf->nb_segs == 1 && + rte_mbuf_refcnt_read(mbuf) == 1)) { + DPAA_MBUF_TO_CONTIG_FD(mbuf, + &fd_arr[loop], bp_info->bpid); + if (mbuf->ol_flags & + DPAA_TX_CKSUM_OFFLOAD_MASK) + dpaa_unsegmented_checksum(mbuf, + &fd_arr[loop]); + continue; + } } else { mi = rte_mbuf_from_indirect(mbuf); mp = mi->pool; @@ -729,11 +747,12 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) frames_to_send - loop); } nb_bufs -= frames_to_send; + sent += frames_to_send; } - DPAA_DP_LOG(DEBUG, "Transmitted %d buffers on queue: %p", i, q); + DPAA_DP_LOG(DEBUG, "Transmitted %d buffers on queue: %p", sent, q); - return i; + return sent; } uint16_t dpaa_eth_tx_drop_all(void *q __rte_unused,