From patchwork Wed Jan 10 10:46:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 124068 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5180220qgn; Wed, 10 Jan 2018 03:57:08 -0800 (PST) X-Google-Smtp-Source: ACJfBovELqI19qwLJYF/KmjsDRA7fyl8GiPDTx1l5sxW5U9uUhlD07/U43wjNIKS4bkkXiqN/QUP X-Received: by 10.28.128.136 with SMTP id b130mr1639048wmd.68.1515585428773; Wed, 10 Jan 2018 03:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515585428; cv=none; d=google.com; s=arc-20160816; b=MRWDYQC2NhLBcBZHwecUJ5jM4pgt/g1Hr25PjSoD+l09lxb2amsKze6JjNLj1G8lGl mokUVViT+4PgE3K7fRAD5t4CDmCSRpv6pg+naMBsBIK/t/8HW975GXp3w3vlCcCNFUhM tl4aIgT+DAs+yt6YGFWqmHXo7QPM2D8x9pO8iotrAyh5BEN4mQ1/Ju2kV70ef3w5TymB 4U9u+NqXr3mzcBTPx3WLyN/iKZrIggTEYJT7dz9eNuUo3J7+fR0rUwzCcnBp2VAcC4Gn azlL+SoOW9tQX1pwcMD/fALvo15XgELqgolxOMojfFRnaVfyj2+/Gyjg5y4Y8JUSQcov Chow== 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=VjZEUeZrGZZzcFa8ws8CP1h9zjQRyFslxQaFrqFbZJljhkQ4utdi5nn37toGNypb7a UzrsHzuXEVCwdA9GBxjHD/JpD9UjWWks8O1neayFuoTSNpRb3QRlZiQFFvQEU2XGSbG2 Z/dNlBPeBkyVdCchjen6D3h1+5N1pSsSBKc2RLnkG8qyVBhjOnwaPU1DSMG4OO8pHFOZ epgwMRcGp+JMj45kOhlXgp8to7ePLlBD05KdcmycC2y86Y1+nqajN2vAur4S4YdhAH1g mUf0411sZK5vxkN0SKANaQGm/O9jjd7+2PF3QZakdrmQ9JRy0AbkF9UFG2cKoCIz32Jx d6aQ== 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 b88si7813884wrd.134.2018.01.10.03.57.08; Wed, 10 Jan 2018 03:57:08 -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 9BDC01B2D5; Wed, 10 Jan 2018 12:51:20 +0100 (CET) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0055.outbound.protection.outlook.com [104.47.33.55]) by dpdk.org (Postfix) with ESMTP id 716061B1A3 for ; Wed, 10 Jan 2018 11:48:16 +0100 (CET) Received: from BN6PR03CA0059.namprd03.prod.outlook.com (10.173.137.21) by DM5PR03MB2697.namprd03.prod.outlook.com (10.168.197.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 10:48:14 +0000 Received: from BL2FFO11OLC006.protection.gbl (2a01:111:f400:7c09::158) by BN6PR03CA0059.outlook.office365.com (2603:10b6:404:4c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Wed, 10 Jan 2018 10:48:14 +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 BL2FFO11OLC006.mail.protection.outlook.com (10.173.160.95) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Wed, 10 Jan 2018 10:47:43 +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 w0AAljST007124; Wed, 10 Jan 2018 03:48:11 -0700 From: Hemant Agrawal To: CC: , , Nipun Gupta Date: Wed, 10 Jan 2018 16:16:33 +0530 Message-ID: <1515581201-29784-12-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515581201-29784-1-git-send-email-hemant.agrawal@nxp.com> References: <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> <1515581201-29784-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131600548636251210; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(346002)(396003)(376002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(51234002)(76176011)(68736007)(498600001)(8676002)(81156014)(81166006)(305945005)(8656006)(51416003)(54906003)(106466001)(2351001)(356003)(296002)(316002)(77096006)(105606002)(16586007)(85426001)(4326008)(50226002)(2906002)(5660300001)(86362001)(36756003)(53936002)(8936002)(6916009)(2950100002)(6666003)(48376002)(47776003)(50466002)(104016004)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2697; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC006; 1:AlqGepiBmFlCuKNLul/yRgv3MgrVmBpOC+DeJrcjYEpO1KBO16FTlydbEknXIPrUhEo4pcI/j4sJoGcQlTuAqoX5ih8wfRTDvvDIAxCMJDSg/aFSxo9tioHn0RkeP224 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8fb7012-ec5f-415b-d44a-08d55817942c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603307); SRVR:DM5PR03MB2697; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2697; 3:jkheeB/vV4l6JtsxS5AiWdEOQDHXK8dygqWXh7ImTgcFN7DktRFx7lJktAUodgh4x3BWR6d9Wy38X4QCpzt3xxABDZmTgK9uGqLmt3JoBrH5rLcr9Eoc9RzFy9qGywHuVuVhW0PDxPWcZ9zekJB4pSvjh/AaeiK5H/Un/lTS8CGcXupVPkCW+GzGiOTRmhNy4hj8gAsNV0oM0ZcxQVnexxeDAGesAHOWOZ+lhbH4At+CVLyzVoshzleh09UtJm8oNCb00FOtEy6D2PrirYVRbFYkVfwSHsEElH/cINer3isDsYngzD5AWz/TLneLEFMtgfuQSc4YUerVjFUG3g/CacaZllN4eUko16w1H+UeNig=; 25:NsD54UY6KfO3Vnk5XOsLLyEtp1CV8fK95hMNsthy1rrwN+GkN2AU/ppl9oj/hIs9/4eRlde6OiPS9ciQNpnw56eHJG2om9mgd0oXP0lZdO57pxxJunRtA0NQijaZV0eSqAYe30h4XZioINta/rXONbyTreQEKA98hZwcOah00uYhNEGo2ADmyCa0N4qeRZzLOFCM6YhPXLuTiUxat4LJ7Wk5+6iBcDHqOAlSFbVWWZXPRIFjhBHxk6T8YdY2ZLLaw2dTUh7EQJzCYKBY7b9J68RX32d0IbnFNAHFmFfBTsIVN6IjBK44KsKOoaEzz/IMPKb+dGdIECAD0RCb9n84pw== X-MS-TrafficTypeDiagnostic: DM5PR03MB2697: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2697; 31:550fWNeoWhDrMRRpfcwlh6QHaaRbVihYlxEVkudzEZguqg8s1lv0kw9vpapisYSDZHEViRVPelcll8upAUBFedDrY9jGcAwU6YgBFEtKxS8TvRKctqFdU9P2Qle5G459n+e7aORnfhcR9bA/rMO1nN86ti8fgIGrGyXHVn7anGIKi8VMaMXvn8AN3L4BXOkZ45+cIuxXkDlp90bJa2TGFY2CTQ9BhX55poXy0KTiv6c=; 4:KipdGtfPAswzSFtTUKc+iA560FvIb1821oyQsoSP7AnPAfO8wxd5vbKDR4Oy+Fxx7xOcSvTcir5VT8WYwvwPZsrDuz6zzW1pxLCbM5s910sps2u6+9ry3ER8Dma1akICck+r1CaIFVH2COfTYD/WqmVgvXJBabAF1Ur4OZ31Q9kT6mGHDbJbcG/OjnYFtgqnaTk5luBgPeetix0lOvYMSZF05of8YPDU1GIR5wguKpEiMu7V3BFJ4QFmjhk+9S0gdA0w1yCCp1prJhsDpHez/wIDRKE3S0R5bZt3DE5Wb+gbED2P3gVLkIgqsVCNgwxm 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)(3231023)(944510075)(944921075)(946801075)(946901075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123559100)(20161123561025)(20161123565025)(20161123563025)(20161123556025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(201708071742011); SRVR:DM5PR03MB2697; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2697; X-Forefront-PRVS: 0548586081 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2697; 23:iTeyZvOmAmUkSGYiwnxp9dIw/QyVmkxeI5mTIaeOy?= 7EOKtaMowSfxrS4J4gr6BF1Lcf/Iz3Kp28QJ2JRcTKFWVMpYvVko/wyGxusWdOR8VE1pCOv4nq7ojzFHDtSZABFOqjsdoQdHTKTroyF4HcCNfsZCbGto57X6aWS9crosLHan4x9JGccBCYeQgbkGrk2JJKDV/h5jaQ2+b9IglJCsu48ivHwLf2Dk8HhOOntZFU+en0IMwCwCIR8Oy1Nj6f79kaw6IfMozIXKd2Dc03jjAnoqcbl5dQFclKn+nurhcbONRr1VZGZt2AYeT/MTnLNAepYri4oz1kQXenpc7veKYjjfscS2803gC6e3qA2wU+mGOmwcFTzY1ZGBf1BUbhptzlDA0AITKXSaDcRKmZa8/QyW7Z5K8keAB4bcyVyLWeqCJIlMJrXwh68EMd975rYxzWWZL0QmBg2Th4xu93nqkZbDr6LmHd1EIL2WLToFNcue6kynFprBeSHriFm9GvS70nwmbcKuurTmy4rQFlPVWk+BOnKtlJfAasqjZSGlpN+V3EVF1Mnbvqbf0MR7xPAmn7M/BPh+qkKmFPoQGzHAxKtuHLZ6TA5MkvOz9kkasalUr7CWq44DxgeA/hRcf2qFmSqUSuDGeqYqLOqc4W5qc0VN5ajAOMA84WlKIggOuL6HGVtb06ZppuvYLgd9mgejFW7OMV8BjxfuUuTf1y1eQV4LdH9hJfMdlpWEZjOlhwNF+RfdAVLCWpm1cPOIr1ie4Q6aqAq3A7Qi7nKPNCIUzYHeUFz53wdsznpyjTNOthCnQQsu5/0xTu7hkxyR1YjI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fl8W3tlrZ/I9JsR1yH+/wISOnZwxbevebPGAlS1uF9+FlxOquMTBm+QhRyoYkWz6q9o7daKBLut5A3LtIEZu0fzRJnFwZHrZghCV9Kr8IMLtpJxF9zJhpX1ZjRU4ZUHQJLyGKWn2+xH2I2f7krcnu0MsAOedJezSx3iTFx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 10:47:43.4535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e8fb7012-ec5f-415b-d44a-08d55817942c 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 Subject: [dpdk-dev] [PATCH v3 11/19] 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,