From patchwork Wed Dec 13 12:05:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 121749 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5384672qgn; Wed, 13 Dec 2017 04:09:11 -0800 (PST) X-Google-Smtp-Source: ACJfBoutDEP4iOmEtNsyJaLGQsuQ6Sz3CPMrSzbDU9Jg8c0O3c2pscrrsJtSF+OWtajhCsLEZ2sY X-Received: by 10.28.0.193 with SMTP id 184mr1916492wma.58.1513166950925; Wed, 13 Dec 2017 04:09:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513166950; cv=none; d=google.com; s=arc-20160816; b=WXmjqefxhjumxjYxefqY0aD6qw8Ad/W3HI+KydF+ti+qNNvyBjV021X1tatI8N8tII uiCZSNtnbuOGwHJqFsNgrywbdW+6O2WsrMpzTmRSpOI+c5LmwvXfywm0RMY8EDdgH412 fwbWrn10BO20R8/I/LsY2lxEfe0DqwytFMUJf0sr/IVPXbqcgC2ulBBWLthJhFH/wHc2 sB1VF2aSif3z4f0DfdnLIg6+03pvWoZF/EtH/JTSfSXNknpO3t98tZlgSOZlFBpf/FW/ X4MYY67U+yRZyi2k7k53ke0b3JBP7k2Cw+OBG20qNOsyotrxAxwOJ/b5rU2dSgm2UKTH 3E9w== 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=MkWCF758WHnegRax+4jrhvMH5PPo9iEyhQMlHn5z26E=; b=IFTu4eEPrp6YWDnDNAaBZMUepsbIEURp3Ez0AtL6xkdQRn+rfu0St0/DAJfBwiLE5M KGg/ZFxCnHysZA0ZtJvJQaNNXOTyQN3WwLYJAByJSXvGUqEMAnmF4smY1Le8jhu8LBM/ 6ywZn1TaazU604gZz51+2RJ4vRlSyokJTHzPShiPT7ztgux4kbCf7oDZ1dait0VI1HOb X0lJ40Fzlfpe2JSYe/kHXKuvPxNMcivc/y5jPOY/2hzFVOvvH0rzwuhQzYeZ5SS0Ocmd eVyMadJaptuBXJZpFC8Jc9TjafQ6CE4sEH9EcwJ32VBq5TVoOvl/fodjVLA/YAcqnMa8 BcYA== 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 s70si1290456wrc.489.2017.12.13.04.09.10; Wed, 13 Dec 2017 04:09:10 -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 E5CDB1B1BD; Wed, 13 Dec 2017 13:07:23 +0100 (CET) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0053.outbound.protection.outlook.com [104.47.40.53]) by dpdk.org (Postfix) with ESMTP id AAADB7CE2 for ; Wed, 13 Dec 2017 13:07:18 +0100 (CET) Received: from MWHPR03CA0016.namprd03.prod.outlook.com (10.175.133.154) by MWHPR03MB2703.namprd03.prod.outlook.com (10.168.207.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 13 Dec 2017 12:07:17 +0000 Received: from BN1AFFO11FD025.protection.gbl (2a01:111:f400:7c10::151) by MWHPR03CA0016.outlook.office365.com (2603:10b6:300:117::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Wed, 13 Dec 2017 12:07:17 +0000 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; 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 BN1AFFO11FD025.mail.protection.outlook.com (10.58.52.85) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.282.5 via Frontend Transport; Wed, 13 Dec 2017 12:07:10 +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 vBDC6t9V008652; Wed, 13 Dec 2017 05:07:15 -0700 From: Hemant Agrawal To: CC: , Nipun Gupta Date: Wed, 13 Dec 2017 17:35:52 +0530 Message-ID: <1513166759-13466-12-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> References: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131576404304122778; (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)(376002)(346002)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(51234002)(81156014)(85426001)(36756003)(2906002)(81166006)(4326008)(77096006)(356003)(50466002)(16586007)(104016004)(316002)(8676002)(305945005)(575784001)(86362001)(54906003)(53936002)(48376002)(68736007)(8936002)(2351001)(97736004)(76176011)(8656006)(47776003)(106466001)(5660300001)(2950100002)(51416003)(50226002)(6666003)(498600001)(6916009)(105606002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2703; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD025; 1:qaEg+9/P1r0zeTrezG6GRNGnJxi5+7/snt51Uu3tcMEFcm+AlQDS/twIIYpVs+UyM58L8w9eY+DrACDduZUFPlfzHfCc5YUaOwrAm5dsafJMtmd+jAuajkQkMQCvdnH4 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: df650bed-5bfe-472a-d39a-08d5422209d5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:MWHPR03MB2703; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 3:+Dn9KVZsx1wdLBEEsn0m/tTPfEaxyqzWnDUs565QsJQA3t1RvowX1UrQ7vNw0oY9x/MMNUn/ehKx9QDrppMEUnYiHrKJD9o8zWj4lacV/SWr1XCRHV0SxncK9BQLAndxvhC7WzI+2O2O1ishQQttZvJqJ6H5g3LuzT5uoJf5SGEJgyeFkxUTcvOFqrxT3goltHMy0gnppB79VSV+ixyluiBEEjoYIk+5fQOi1CV/yijtuaKA8sYfhrJ/QJjW0se4Ik9IyoRUCrnyiBKib0+/EXIqa4tWeiHNmk8mdy6ZFcn0T8e4qkTMzSnP3/9XWOYgZ0EKTaPJovF+NIUM8FmeJjhbJrOAEoaBKgg8rVmKQh0=; 25:p0e5V8cIlYNj7uPKzINU/a4ijScMgUtJgSy4rcyciEhbNo934iuFYNKOCd5yKq11Wb28ct1exXjLMQ8o7SKP3uc/A/rUigwLFzoqr/FEukBOdAHqhGs99riBplfo5hJwELiT8aixqAk/NGyBeeBalzghrLPbk1i96GtRTHAFT5vmEMVfEKswmOkW3EGQdNd6Gl0W4NS/UiZ1nYKNwu5kMW/aJzoKuCOLlsjALtShvcjhi0of/aJ97jKEi+uU88oMxhgMe+RoEHo61oNjKUAjRuN/+BMCGkK3LKqrMkvpWNWUelHX4ekjcpCtiUAB+wDPOnFaVCTStgw7Uwj6o5Z8cQ== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR03MB2703: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 31:il6MLcVLMuMpEJ5UV+dG7viEjujAfun8X2TWTsmD4k16ywlserZIuQOcm+nWphyxq3saUag/+G08FVihmMaukpcl+iFqDwfM5XZ9MDcv/I1wa17aQcoQ+gODFnsoV26k64bPGH133F+glcdSvsCpz89AzbWm57kXFsPdSA6t4D68WSmp2zLsyy3J7D6ovxQpqP3oC5oPf8nJNA1eRllDaJ/kAwzbnB/9pQJUGbYKP1Q=; 4:ekpfzePhZmr7dtxnsYMPLIacCJhtU1NaGalZeNxJduWZuTy7ODhHolxRxsaU9f8HWiPIbuW4PIL4uySBNweTstmJYoq2nORFTgahM7k4ziKvqh7QnJ/cidR+KnaLjgqvJUan2s1Y77GzEsRrWkCS3XHUIjP4cdxgGL6k717YKze9CdYkaeQr40Tac6Shm8KJGnb+KNyqs9ZhuqWfgFqlOA2w9w8lJMESyZkbC9edbNLzSEgzcfuvr9nu6L0FITFX5wgZQXQHtW+Yf7Fa1BoY5QWI5Gb3j7rgCOQpDdfS+1zUMHdRS7g/ImaIf+PM4BRE 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)(3231023)(3002001)(10201501046)(6055026)(6096035)(20161123559100)(20161123561025)(20161123563025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123565025)(20161123556025)(201708071742011); SRVR:MWHPR03MB2703; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2703; X-Forefront-PRVS: 052017CAF1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2703; 23:HCo6SG42ihlU1VUN6kUiAmjtuhnDBI1GSze0fGJqK?= azsAfPlUv1d+YU7O7b/KvwYDY7tz3eKDsf0iDt6jNM6kFchQOVBGguG3L1ngxdu6gC8lj4Od2UQiJjIZglNoniURbb28k3mSe6c6Kgh4J2KH//sG7uCznkHOpSKawUAx3C5QIB+9bZx/NssdWmceSpyAil66SAG7CXM9ytejsR5x6aH7H5lCJ71Vsgu48O1Q7fwzqMVCnmF/HV5TpS7VnJa1OKBzIP2YCQtqeyT4Xe36shZoXfnkbGs355oJ5N5ge4fmWbLqUZ+TLIUevE0mA0jceGf1J9x95xoyuN6y0ezbGx8a5L2wQPxnApNqAP39Qum5xRo1+/ZNPfDKdg7iRjRGP+bGSHpZdnZmKtC/PEWzXDiPPp6AN0//YXWDdAipCInJ+F3Wdrrme/alxeXbtHOAnPR70iaW/A5pzZl3JeYpbB9u249ZkAxTpfSxtgvJCkdHWTFQJWpH1o/40xN2z8MTv56KPjt6WSn/M8gMT9mRCDFhT/YRn+yg7KeDivPWDVAd8V2oL/B8VhzC6iYDOiD7dRXJZpR3yfIeqf7ZMkBwdn499AWVjeqyHle0ISLuc+XPumX4bd5yNuoEiCQ67uFS0YTpVH3mwUsFHO5JYJnnQ92D2Lu5D7f97SPYQCiiGVM8UPrvfTyxuZuyeftl16I2C/TZv+deCc1SmnKNW+76TPUreA9TmY1Yi/WpCIWj/4zpmqSp3Od76txysGUQic8r+iI8ayHHUB/Vd+JnoEPSPnfpO09bOgJRMCRBWiw/ewob21y2kd4cZjVvP0ozbeEbvlBWempTvnva1tyCQOHOX3rC2ZXsicNac43JJfflSFJHVgtkmywF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FUnG7S+NyXmMJceS/18WCa5QJ0F78oTfCjvXB3xCTcYppA3np1Vk4dai8CWStdFM2M0NNrsGZEZLcQ1rkcUNKcDEhrf9eEthYe0VLqUUtsifWHWLhsJHYyDj6u8ns2ZM7xJf6Ci9shkNvXoPM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 12:07:10.2406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df650bed-5bfe-472a-d39a-08d5422209d5 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: MWHPR03MB2703 Subject: [dpdk-dev] [PATCH 11/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 1b0ca9a..33cc412 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -298,6 +298,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) { @@ -620,27 +644,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 */ @@ -696,7 +701,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; @@ -711,10 +716,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; @@ -755,11 +773,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,