From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0059.outbound.protection.outlook.com [104.47.36.59]) by dpdk.org (Postfix) with ESMTP id 3465C1B03F for ; Fri, 8 Dec 2017 06:22:55 +0100 (CET) Received: from MWHPR03CA0043.namprd03.prod.outlook.com (10.174.173.160) by MWHPR03MB2704.namprd03.prod.outlook.com (10.168.207.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Fri, 8 Dec 2017 05:22:54 +0000 Received: from BY2FFO11FD021.protection.gbl (2a01:111:f400:7c0c::193) by MWHPR03CA0043.outlook.office365.com (2603:10b6:301:3b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Fri, 8 Dec 2017 05:22:54 +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 BY2FFO11FD021.mail.protection.outlook.com (10.1.15.210) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.282.5 via Frontend Transport; Fri, 8 Dec 2017 05:22:51 +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 vB85MKGk013022; Thu, 7 Dec 2017 22:22:51 -0700 From: Hemant Agrawal To: CC: , , Nipun Gupta Date: Fri, 8 Dec 2017 10:51:26 +0530 Message-ID: <1512710487-32388-14-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512710487-32388-1-git-send-email-hemant.agrawal@nxp.com> References: <1512710487-32388-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131571841714824542; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(7966004)(376002)(346002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(48376002)(47776003)(8656006)(498600001)(36756003)(2906002)(86362001)(97736004)(51416003)(76176011)(33646002)(50466002)(68736007)(8676002)(2351001)(81156014)(81166006)(305945005)(106466001)(105606002)(356003)(8936002)(296002)(316002)(104016004)(5660300001)(50226002)(4326008)(77096006)(6666003)(2950100002)(54906003)(85426001)(6916009)(16586007)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2704; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD021; 1:4WHOw/Nn7k1B3fMYr2X8fZA3vr7gYxGXtOGT+UwtmBUK4iZoUlxRvzJRRSBSw57AaLIrKe2Rlu7trNJVdAAeQH1IbqYBylx0BTVlrMD8zdHTBX5QJk6WB1xblUqYwl1R MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ca5c67f-ec86-4851-255e-08d53dfbba52 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:MWHPR03MB2704; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 3:tKZIJur6WMrWQ9x+hpKK1QUq1UoFQcGTcohBf32P85D8MTA3XYMZxADhBSbU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XOC2hKVSa+AUk14H7/x2saF97ZTrX5Btqj83YbTqpx69yQmwuvdzm0ZGncZmPZvpsr4z07siFr4yB9O4yf5xIEP8/G6NM6Nz+BVKa6/noGlaxhCuVEz8lUU/LxHRpUaJrjBd+uNTiQnXFHKooH6NWiXgDmXXd3mBfpqOSH0v0gAPfBGeJFLIZCJnPff+7e/lwHQzjuf7KkCTvgeVxAucgXkhjtvD7zWUE96ClhyKp2I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231022)(10201501046)(6055026)(6096035)(20161123559100)(201703131430075)(201703131520075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(20161123565025)(20161123556025)(20161123563025)(201708071742011); SRVR:MWHPR03MB2704; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2704; X-Forefront-PRVS: 0515208626 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2704; 23:W6lzxYYW1bb3g8G2wzIUcRcUlQeN1WLHo/kFOBj81?= =?us-ascii?Q?tNwIkG7EAAdPIRs/M5Y4W1dJLz44BIL8gnuuNN/5J1+PeqA7OsvNDT6eEGxn?= =?us-ascii?Q?VwFQyulbbozofkq9ESHzrySz4gMzFIAl1ShzKdU80PLsJrwz3JgkCKYpXPKt?= =?us-ascii?Q?38Riy9ePfuNrQqgJpjNmmNRuMsxS7vVjhP0ORISRODShIOKi8QAehdbFUusz?= =?us-ascii?Q?n7xs7rCV2fgLQE9BF5egFf+2WXdynU5UdhAmyUJKiSz8vjIONFuE/+XHF/Rv?= =?us-ascii?Q?rfsynYuvwl/QbpQyVJrP/LNGwCTkryr/3Aj7H6OQNAQIc6Gb7lV725ZoZuY6?= =?us-ascii?Q?obBYhEhgSk2pltL36GHj+vk0hUFjXp0bAaUPlTVhCFQ1QmthmzBJLqCNJvJF?= =?us-ascii?Q?tac9L5rPvZhcslRIPUIt0YEXkxcSya4eWDpomaKBMrwtNUtFXkSyrMTZqrU7?= =?us-ascii?Q?HVdtOee23+cozQipM6YBwZpgtvAPQ1MrdIWtHFoGJD6ZBNcpvMxrBs1RTNis?= =?us-ascii?Q?zRlGflhNts4rEAE8OUL1jjudgOIKtF7jt7yB9EJ0uuz3SlFlcUeriwI7XJDM?= =?us-ascii?Q?0LUPyggEDp42HGOsPLaW+7LrSzRN4qoIF8fznHpsWjR9RsI0wGYci2rmzNAT?= =?us-ascii?Q?bv2vycjJy6568aBzRF2SQTCZWDHRdHcHPLJmFZw3Xp3t9pnJ2chYmEE0ttIt?= =?us-ascii?Q?ORtg2FWiqHtO2+g/HmmB2LO2CEwxlL02Fgy17H40ibAMKywunn5YHT+Dqad4?= =?us-ascii?Q?EJHMIXTueC3sICK36HOH/+gfEBo0TQR16lO5CIRkgj60Hwwt1TGPw/lA3qnE?= =?us-ascii?Q?UDypCQfm9NX2kAjgK2gOwQHgwZ8Ie+gDch6+2j7n9OltZAAJ/7y0eWzntlI/?= =?us-ascii?Q?eDGWMntBZ5j65uRfhz7LBcb0ltP6uQVaxPohDWWrLodkuywEvmnPS4zVoRCS?= =?us-ascii?Q?x83jQqf6YxsVKSvRfncfJLieGzwoUc38WhY3ZYUd5HApWO+xHgebdqqNvtIe?= =?us-ascii?Q?omJZIGUtKueYu+rLR0CPsx8P6k41HVuH7/hIGJU31c4trsi6iKxXwtCL7d2c?= =?us-ascii?Q?c2leLeRCZcaRAhWni+JeR8hQ/FL2yKXCya2YR/qyq/V20ZDmphrMxyKpSoKr?= =?us-ascii?Q?MLHUq7Nook=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 6:p4ZzWMydv8AITu3amTBC5wYWXNxSCSbsT1PGKPSXnDhdVX6VvrTNhBcoYnKBtyOAxovFEVFHqYssAv/5prC++IGMn7ydSKRYSXSGowc7Rvbc1Gk94AjCQkuKnJq5L/xV8NByxXuXuxKs32vC6JGeWlHNhjXC2yDzFHuDke9qcu0hNTC1swIGLQe5HvEkWqYnM4CFT+qM6/fA0rRyVNzo/xpkRzaAFLXo1/rhB18RXTedSYS2TmQhOop4fMU4h1pJqrlXpt/XhyZ5Sgblv0rwmOOEVpHwqVoDc3TkHgZ3MFbuwYzFBGgZhkvBIiSEFAdozmb8wN0D5alW7ox91dZs3xjaJcQNKE7lfSrPMu1xNN4=; 5:87vsSSJh/XZuqcCHviuYKeqo72cegZN7V9Qpz3+34xonul1efJZSQt9/XgmKaYyNQ3zxvKs4b1+jG+s067S6bOJKpYlsR8tCFufOqGFRUi17gRJqM3h3cdIdjvRogUtiQcAglbQFNcDHyhNf5vdd4cthuTpIbuCgnaoQEaVWgO0=; 24:jSVbMGCeaVnFPfBOWkTv0GMLmB1aqdfNJbozGWNT6eBekhO6o/MKdDUwRjt/DRhzxxWKDUrxm8Ex5Ac66HCpFz8ZsGYUlO9pyHmb+dImoec=; 7:gMY+FgxnER/g8cOBrmjRbPxDs3ixdIdb6wzURetsaLyg6tR3e8I0BRz4QUD/PPO5lRHiZ54YuXmy+DtpAAxUNrmENtfjcPB6WG+pBDlGK+WdTAYyGiJNXPGjG9DSl5tLUruZ4w6PswSgsrBbTCwH1C6dflHOdxZjBtjCg3sT8rcU2iLdFtnwFgwo7ahcSpGBBwfcIMU8f1EX1PZn7JATwQUu+ksBBp9/4fzK4Ch1m/ibyKqjpd5TbVeN01AnIJNz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2017 05:22:51.2952 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ca5c67f-ec86-4851-255e-08d53dfbba52 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: MWHPR03MB2704 Subject: [dpdk-dev] [PATCH 13/14] net/dpaa2: optimize Tx path for best case 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: , X-List-Received-Date: Fri, 08 Dec 2017 05:22:55 -0000 From: Nipun Gupta This patch handles the non-sg packets in more optimized way. Signed-off-by: Nipun Gupta --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 ++ drivers/net/dpaa2/dpaa2_rxtx.c | 44 +++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index c29d7f3..fd9e656 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -204,6 +204,8 @@ enum qbman_fd_format { } while (0) #define DPAA2_SET_FD_LEN(fd, length) ((fd)->simple.len = length) #define DPAA2_SET_FD_BPID(fd, bpid) ((fd)->simple.bpid_offset |= bpid) +#define DPAA2_SET_ONLY_FD_BPID(fd, bpid) \ + ((fd)->simple.bpid_offset = bpid) #define DPAA2_SET_FD_IVP(fd) (((fd)->simple.bpid_offset |= 0x00004000)) #define DPAA2_SET_FD_OFFSET(fd, offset) \ (((fd)->simple.bpid_offset |= (uint32_t)(offset) << 16)) diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 5c75cfa..e8edc67 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -50,6 +50,14 @@ #include "dpaa2_ethdev.h" #include "base/dpaa2_hw_dpni_annot.h" +#define DPAA2_MBUF_TO_CONTIG_FD(_mbuf, _fd, _bpid) do { \ + DPAA2_SET_FD_ADDR(_fd, DPAA2_MBUF_VADDR_TO_IOVA(_mbuf)); \ + DPAA2_SET_FD_LEN(_fd, _mbuf->data_len); \ + DPAA2_SET_ONLY_FD_BPID(_fd, _bpid); \ + DPAA2_SET_FD_OFFSET(_fd, _mbuf->data_off); \ + DPAA2_SET_FD_ASAL(_fd, DPAA2_ASAL_VAL); \ +} while (0) + static inline void __attribute__((hot)) dpaa2_dev_rx_parse_frc(struct rte_mbuf *m, uint16_t frc) { @@ -436,11 +444,7 @@ eth_mbuf_to_fd(struct rte_mbuf *mbuf, /*Resetting the buffer pool id and offset field*/ fd->simple.bpid_offset = 0; - DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(mbuf)); - DPAA2_SET_FD_LEN(fd, mbuf->data_len); - DPAA2_SET_FD_BPID(fd, bpid); - DPAA2_SET_FD_OFFSET(fd, mbuf->data_off); - DPAA2_SET_FD_ASAL(fd, DPAA2_ASAL_VAL); + DPAA2_MBUF_TO_CONTIG_FD(mbuf, fd, bpid); PMD_TX_LOG(DEBUG, "mbuf =%p, mbuf->buf_addr =%p, off = %d," "fd_off=%d fd =%lx, meta = %d bpid =%d, len=%d\n", @@ -497,11 +501,7 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, /*Resetting the buffer pool id and offset field*/ fd->simple.bpid_offset = 0; - DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(m)); - DPAA2_SET_FD_LEN(fd, mbuf->data_len); - DPAA2_SET_FD_BPID(fd, bpid); - DPAA2_SET_FD_OFFSET(fd, mbuf->data_off); - DPAA2_SET_FD_ASAL(fd, DPAA2_ASAL_VAL); + DPAA2_MBUF_TO_CONTIG_FD(m, fd, bpid); PMD_TX_LOG(DEBUG, " mbuf %p BMAN buf addr %p", (void *)mbuf, mbuf->buf_addr); @@ -721,8 +721,26 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) fd_arr[loop].simple.frc = 0; DPAA2_RESET_FD_CTRL((&fd_arr[loop])); DPAA2_SET_FD_FLC((&fd_arr[loop]), NULL); - if (RTE_MBUF_DIRECT(*bufs)) { + if (likely(RTE_MBUF_DIRECT(*bufs))) { mp = (*bufs)->pool; + /* Check the basic scenario and set + * the FD appropriately here itself. + */ + if (likely(mp && mp->ops_index == + priv->bp_list->dpaa2_ops_index && + (*bufs)->nb_segs == 1 && + rte_mbuf_refcnt_read((*bufs)) == 1)) { + if (unlikely((*bufs)->ol_flags + & PKT_TX_VLAN_PKT)) { + ret = rte_vlan_insert(bufs); + if (ret) + goto send_n_return; + } + DPAA2_MBUF_TO_CONTIG_FD((*bufs), + &fd_arr[loop], mempool_to_bpid(mp)); + bufs++; + continue; + } } else { mi = rte_mbuf_from_indirect(*bufs); mp = mi->pool; @@ -771,9 +789,9 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } num_tx += frames_to_send; - dpaa2_q->tx_pkts += frames_to_send; nb_pkts -= frames_to_send; } + dpaa2_q->tx_pkts += num_tx; return num_tx; send_n_return: @@ -786,9 +804,9 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) &fd_arr[i], loop - i); } num_tx += loop; - dpaa2_q->tx_pkts += loop; } skip_tx: + dpaa2_q->tx_pkts += num_tx; return num_tx; } -- 2.7.4