From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0067.outbound.protection.outlook.com [104.47.36.67]) by dpdk.org (Postfix) with ESMTP id 0BD681B1E6 for ; Fri, 8 Dec 2017 06:22:53 +0100 (CET) Received: from MWHPR03CA0031.namprd03.prod.outlook.com (10.174.173.148) by CY4PR03MB2693.namprd03.prod.outlook.com (10.173.43.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Fri, 8 Dec 2017 05:22:51 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::173) by MWHPR03CA0031.outlook.office365.com (2603:10b6:301:3b::20) 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:51 +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 BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) 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:47 +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 vB85MKGj013022; Thu, 7 Dec 2017 22:22:48 -0700 From: Hemant Agrawal To: CC: , , Nipun Gupta Date: Fri, 8 Dec 2017 10:51:25 +0530 Message-ID: <1512710487-32388-13-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: 131571841678613071; (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)(39380400002)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(6916009)(498600001)(316002)(77096006)(8676002)(81166006)(81156014)(356003)(5660300001)(33646002)(8656006)(53936002)(54906003)(16586007)(2351001)(2950100002)(50466002)(296002)(105606002)(6666003)(4326008)(305945005)(104016004)(47776003)(85426001)(106466001)(36756003)(76176011)(86362001)(97736004)(68736007)(51416003)(8936002)(50226002)(48376002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2693; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD009; 1:uFgMXm8lPsP5SWMPmZ6b+gQAuxQNAOCurmNzhc/K0FgKs5WVBxedKmS0a3Qqv6UZdX88iaNyz+phFnQPlUmGi8kotBRSLzrKe9QSLtvw+3t0c7Vu4qH8b+fT+vsPQ/do MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44573c57-43b1-49a8-9a4f-08d53dfbb829 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CY4PR03MB2693; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2693; 3:/TbmlNJVN7hYtvSpoFIJajPqA3/jsXDBicOJDyV+/cytuojLsprq2YLWq6j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FYekS355DI9zz378yCFgeSqkpp7XFjN0fTWZUj+u8wWFjcAjXW+gdaClAVtgwDfNugTMrtNlgqJLWPvjRx3oMmiEWOAV5S5ZLnjoMKYiAKY6lGwFZPS4NCaZ6HTALm9Av7hpkRd4FAYoPvVshy1Z6z7WQLdc39OQsSG1I9DJKUwfgKEAJRgsivkZeXDGHwBuwzYtz5wzPM X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3231022)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123561025)(201703131430075)(201703131520075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123563025)(20161123559100)(20161123565025)(20161123556025)(201708071742011); SRVR:CY4PR03MB2693; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY4PR03MB2693; X-Forefront-PRVS: 0515208626 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2693; 23:ieqgr4HKdK7+nOOTxjp21PctdLZNKIBWt9/blhqQD?= =?us-ascii?Q?10NzYO456YyZ7LdClxeVRJIEl8Kf12B9XQuEiHm4OceWC4DZuuBDL54nOaFV?= =?us-ascii?Q?OKmbt60FcMKyy7Db9u6Sf+4JVP98ZEeI6k9HWs6s2hU6APXeuS3lDg9N6HU4?= =?us-ascii?Q?rNSgLKBiUls4mO7qZhg1ci1urOWe6Iwce2fvGo4AvYA9EoppgXmQb969O02s?= =?us-ascii?Q?ajP92LlGHCYly1/MF8U18X3CYn2tTUIz0T0cw3LCzt4oPv/9YJFirayUCVNe?= =?us-ascii?Q?oIozmTZpYXWi4BLDWK9yWPIUZGp/lNBZ4m8J2HLRl2D69n2VXKKCx/CyUW2f?= =?us-ascii?Q?SojPcAlwTu1ke65QHrm2r/N80haxdo1ismroWKSC8CFv70ZWrHYfTnwEp0bE?= =?us-ascii?Q?0BY9aVZ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stMrqnACGOZA6wYGgpQJSZS8ZRWUwoxT/YrIDBxP1Fs5PjrBcycmHvpanvjJthDWBDqzziBQ5MtQATHNpLv06BdOURMNNb9AFTEm1IQFvAX3JtLvGcP1dYeioYapzuiAMQXGSix6atp1xVhRTFD13xgCuUxXWzvZQwRyK80lrpYkaB6+iYCCjfpkM6/3BKMvpKHlbl8uZnuBUsQ4hA0t8E=; 5:49NFjHBuQAXzXiPgTmBJjS3qqfJRWxQxIVn/BqynYZmy9Qx6bmkkqVSncORWS/Zcia+LAw/pkHfO3UMyV73TXnbfyIAKZ7rHtmR60SBAZVCoKK1XefZfAvT7mRv8dSdXjGzXA4Ij23IbRyE/a2u51VXhcENaWkWkRpqSj/k83gE=; 24:AehQSzN78x6+LlZgLtiEuRkvbiVRjjOcApWjdYMziXJBgTJRvGDq7gamCrwg4SbemAs/XmuLzLrHT5EGd/mTFF3MD4H420L25QJ80MiwyhU=; 7:uOzNbshe4ktrQTlHtX0wXvlw9Q8Wn1H4eBglTvB1zT7AYY+2rabhUgOvpCUO07uKH6Cx/XZ5mYA9VQyNE9kTpPDHbBxpus826UVBwFXhVI+FyXAMLNb8B2ziOYHj7WD284oTTqeAPiEGn7r4GEyXbg4wK90WrBtRmFjWXuFEktRA6xxYnPz7WdnOAsqLXbxj4PRkUWMcLebCNf2GL8QnngtNCqx3f1gifbhwGVFM2IJpiTFEStgx27EZS7rpEsIL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2017 05:22:47.6741 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44573c57-43b1-49a8-9a4f-08d53dfbb829 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: CY4PR03MB2693 Subject: [dpdk-dev] [PATCH 12/14] net/dpaa2: optimize Rx path packet parsing 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:53 -0000 From: Nipun Gupta Parsing the annotation has multiple if checks in the data path. These are reduced for common cases like IPv4/IPv6 and UDP/TCP packets to enhance performance of these generic cases. Signed-off-by: Nipun Gupta --- drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 20 +++++++++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 43 ++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h index e68febf..88a9d49 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h @@ -219,6 +219,26 @@ struct dpaa2_annot_hdr { #define L5_SOFT_PARSING_ERROR BIT_POS(1) #define L3_IPV6_ROUTE_HDR_PRESENT BIT_POS(0) +#define DPAA2_L3_IPv4 (L3_IPV4_1_PRESENT | L3_IPV4_1_UNICAST | \ + L3_IP_1_UNKNOWN_PROTOCOL | L3_IP_UNKNOWN_PROTOCOL) + +#define DPAA2_L3_IPv6 (L3_IPV6_1_PRESENT | L3_IPV6_1_UNICAST | \ + L3_IP_1_UNKNOWN_PROTOCOL | L3_IP_UNKNOWN_PROTOCOL) + +#define DPAA2_L3_IPv4_TCP (L3_IPV4_1_PRESENT | L3_IPV4_1_UNICAST | \ + L3_PROTO_TCP_PRESENT | L3_PROTO_TCP_CTRL_BIT_6_TO_11_PRESENT | \ + L4_UNKNOWN_PROTOCOL) + +#define DPAA2_L3_IPv4_UDP (L3_IPV4_1_PRESENT | L3_IPV4_1_UNICAST | \ + L3_PROTO_UDP_PRESENT | L4_UNKNOWN_PROTOCOL) + +#define DPAA2_L3_IPv6_TCP (L3_IPV6_1_PRESENT | L3_IPV6_1_UNICAST | \ + L3_PROTO_TCP_PRESENT | L3_PROTO_TCP_CTRL_BIT_6_TO_11_PRESENT | \ + L4_UNKNOWN_PROTOCOL) + +#define DPAA2_L3_IPv6_UDP (L3_IPV6_1_PRESENT | L3_IPV6_1_UNICAST | \ + L3_PROTO_UDP_PRESENT | L4_UNKNOWN_PROTOCOL) + /* Debug frame, otherwise supposed to be discarded */ #define DPAA2_ETH_FAS_DISC 0x80000000 /* MACSEC frame */ diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 3b58a48..5c75cfa 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -120,14 +120,13 @@ dpaa2_dev_rx_parse_frc(struct rte_mbuf *m, uint16_t frc) } static inline uint32_t __attribute__((hot)) -dpaa2_dev_rx_parse(uint64_t hw_annot_addr) +dpaa2_dev_rx_parse_slow(uint64_t hw_annot_addr) { uint32_t pkt_type = RTE_PTYPE_UNKNOWN; struct dpaa2_annot_hdr *annotation = (struct dpaa2_annot_hdr *)hw_annot_addr; PMD_RX_LOG(DEBUG, "annotation = 0x%lx ", annotation->word4); - if (BIT_ISSET_AT_POS(annotation->word3, L2_ARP_PRESENT)) { pkt_type = RTE_PTYPE_L2_ETHER_ARP; goto parse_done; @@ -183,6 +182,41 @@ dpaa2_dev_rx_parse(uint64_t hw_annot_addr) return pkt_type; } + +static inline uint32_t __attribute__((hot)) +dpaa2_dev_rx_parse(uint64_t hw_annot_addr) +{ + struct dpaa2_annot_hdr *annotation = + (struct dpaa2_annot_hdr *)hw_annot_addr; + + PMD_RX_LOG(DEBUG, "annotation = 0x%lx ", annotation->word4); + + /* Return some common types from parse processing */ + switch (annotation->word4) { + case DPAA2_L3_IPv4: + return RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4; + case DPAA2_L3_IPv6: + return RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6; + case DPAA2_L3_IPv4_TCP: + return RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | + RTE_PTYPE_L4_TCP; + case DPAA2_L3_IPv4_UDP: + return RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | + RTE_PTYPE_L4_UDP; + case DPAA2_L3_IPv6_TCP: + return RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | + RTE_PTYPE_L4_TCP; + case DPAA2_L3_IPv6_UDP: + return RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | + RTE_PTYPE_L4_UDP; + default: + PMD_RX_LOG(DEBUG, "Slow parse the parsing results\n"); + break; + } + + return dpaa2_dev_rx_parse_slow(hw_annot_addr); +} + static inline void __attribute__((hot)) dpaa2_dev_rx_offload(uint64_t hw_annot_addr, struct rte_mbuf *mbuf) { @@ -279,6 +313,8 @@ eth_fd_to_mbuf(const struct qbman_fd *fd) mbuf->data_off = DPAA2_GET_FD_OFFSET(fd); mbuf->data_len = DPAA2_GET_FD_LEN(fd); mbuf->pkt_len = mbuf->data_len; + mbuf->next = NULL; + rte_mbuf_refcnt_set(mbuf, 1); /* Parse the packet */ /* parse results for LX2 are there in FRC field of FD. @@ -297,9 +333,6 @@ eth_fd_to_mbuf(const struct qbman_fd *fd) DPAA2_FD_PTA_SIZE, mbuf); } - mbuf->next = NULL; - rte_mbuf_refcnt_set(mbuf, 1); - PMD_RX_LOG(DEBUG, "to mbuf - mbuf =%p, mbuf->buf_addr =%p, off = %d," "fd_off=%d fd =%lx, meta = %d bpid =%d, len=%d\n", mbuf, mbuf->buf_addr, mbuf->data_off, -- 2.7.4