From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0088.outbound.protection.outlook.com [104.47.32.88]) by dpdk.org (Postfix) with ESMTP id 57B74FA49 for ; Sun, 4 Dec 2016 13:44:52 +0100 (CET) Received: from CY1PR03CA0012.namprd03.prod.outlook.com (10.174.128.22) by CY1PR0301MB1577.namprd03.prod.outlook.com (10.162.166.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.13; Sun, 4 Dec 2016 12:44:49 +0000 Received: from BN1BFFO11FD043.protection.gbl (2a01:111:f400:7c10::1:163) by CY1PR03CA0012.outlook.office365.com (2603:10b6:600::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Sun, 4 Dec 2016 12:44:49 +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;nxp.com; dkim=none (message not signed) header.d=none; 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 BN1BFFO11FD043.mail.protection.outlook.com (10.58.144.106) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.734.4 via Frontend Transport; Sun, 4 Dec 2016 12:44:48 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:727; Count:10 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uB4ChXbW032240; Sun, 4 Dec 2016 05:44:46 -0700 From: Hemant Agrawal To: CC: , , , Hemant Agrawal Date: Sun, 4 Dec 2016 23:47:24 +0530 Message-ID: <1480875447-23680-30-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131253290891166374; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(336004)(339900001)(189002)(199003)(626004)(4326007)(5660300001)(8936002)(104016004)(50226002)(8666005)(50986999)(5003940100001)(68736007)(76176999)(356003)(33646002)(36756003)(48376002)(2906002)(305945005)(110136003)(50466002)(47776003)(2950100002)(6916009)(6666003)(7846002)(97736004)(8676002)(81156014)(81166006)(86362001)(2351001)(39450400002)(85426001)(77096006)(39410400001)(39400400001)(39380400001)(189998001)(38730400001)(92566002)(105606002)(106466001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1577; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD043; 1:AbA9aooJkshyKBhx0iOokK5Lyxp87L/2y36s09rms5U7FhIlMmyShTokpDxgP0Gt7BETwYqwtPIdaTJxybHvdV8F9O+7xm2FVjGL6fFDzRC406qcJAax1r6BzZVV9BlncJTLsnKtZzHgILDIjagvJLgfvIFoCdB112TPD69Hlcswx6ZSwIIZ8ilV8lokPiiftcdppwvhbkt0kwnDHuMoS8J+0DEfMczTdLqzrBTJe/baFvYQZC0cftEreZs1kNMP2L0kW+oRPTbsvGFx+Gpf0Gc38ukEh9I9JaOeM/r1ptkLs+pwmP4Ci0P2250wAbXqvx9Q7p+T8NXb12tT/+cVCELo1JSK5JwME/FrH8qwgexpIlUmzx0R1U44ZqmV7+FHVveDY1hQrRmWz/do/sK9kFXXNtk0Fasf4gNliuBi9l6+T8/32BEqoonGpPBR/Tq7crrLj6e4FyWWE6+aieIjmtuTmBV4bsvah0mLOtfwC/LeteYfixD3S7oGQ64Lg6Y34TSgKBzz/WsqKwZ2UnXcRNf3mFbRQTeJD9TqiPhyWICOinvVKATKQdQnnN1NTjnzpGsV20O1jv6rMNqujTF5h0JrusSPJnoFwbjE0XsptmWl7/AWpI1ovqCAXDu2u/eoHOAv/fDyBC0ZwsJ+kRGLIuwrrX9UFttgOHWXvomjr1QE8PqSZlb5cjfucjljjIRM85aU+0awz36/zfqCqWK7PvwUVYodFbAhWDVjDQ4d6Z5R35nPBEqcfUqdsOWEO5rweUNvRGuPwyjO4NSSPxWCtQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: dccda612-dc6b-4efc-e144-08d41c43559f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB1577; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1577; 3:32mAHAU01EqOSUs4U4YiEW9JJP93Rdqzaxt74BEzN6YnlncFLPSytGi6zHFy7sQ+3TzASqE/4fIsakNgeXmvTvS6CGHWWtz/f2rCW5X1ZHSbvArrHekilMWQSf2t5bIWIy1JefQedw+zvtwE4Wal/ZV9hhiZK3BodCELUNw2Q9YLHwcOKk+xIeISd6ldv6+G9cuf27cRC9sw8jxk9AUVAviXCYpBg1IC9GO8mwqTj5BUIv3MsrKJK9od9ke9uME2DlqoBG6CdR7x7IPgu/zJGHshVOhyOn0C6mT2kLOUapxyyWhgTTanBNn5sRkXMZKKaUYI85OwZJYmOKDBxOn/5ok9CjVgnlgc5nZA9GAmdB5FpaDA1CsI3PL3kfbuJwe1 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1577; 25:yOoKcz8lclFSfYvDI47xC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8/fudWrg7uWL4NWQFC/20r20E75kWrz9g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13017025)(13015025)(13023025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123563025)(20161123565025); SRVR:CY1PR0301MB1577; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1577; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1577; 4:+zWfCAAx1Zuky+O7XJi5YDyYFm8fYieCJf89eVr6fNGGWVA1FgQKxoLDC6QW0k0z58RGOH3oVV6DvPFGFGb9icn539qC/eIRIlI1fQdiYOLqgkkKCzHbVwyMKvGZIuzowutuD/F3y+j2vJHIagyqYeV7iV0KO/rPKryhanMXU6OBYaPJxwbcLK1r1sA9PLGrlZmgdBzRQgpgEiD4V6KImIFg//SSNjSN+iTMn5ltdI7BcKkW/kg3bgV+x2v7kHPrM2qQp4IrJIKUUufjugC8ZZnHk91Bj0QBpCYTK2TW4WEGksTzXb7+E/daGM+F3ikDLE9YnSVEbpEmHnJfk5IVq4Ly8rmYQ+yY6fuRJOjOAJYaxKpxLyz4UCvzcvqUhWvGjKdEBJfDValBFz3DZLpyH3Jqxrq7Hi3VWuEM13/Wh4Dgpqevq5eigR0svQwY5kTPjOMF2cTA624srsRMCFRiissm7TdwWjoBGyVMjzi8vky4Su9bJob7Is/kpjUUmDM6bDeUIV1FC63Elf9z+Kg1oIdSfg+Dge6nMNWtq1nlMzwhNui6gUrw3saF8YGsPe4r4UdCxBUxXAVUQa0p0FYQiMw7I6zG/Pg4wVlf0jaPxL7Y4bo1aoknl+pyb3XHzieyKJTfILCLktA85iL9Gs+f4jKfdYkhQMMLCEkxnvjNhi9Xmwd/qfMHsu+KOVn8v1424ys22LiIi5ks7lQeH9XbSmuxBP7z4YR7D8ySPi5VDvB2ZzCexnA5MjYZIChWf/rC X-Forefront-PRVS: 014617085B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1577; 23:x+J/uace1dt+ldbXnRGBzTbdWZxJuEhtdVRTFUE?= =?us-ascii?Q?uMyL4+21knfY4FPN4DPxIAW26+feMduWxbCZyJ5uwfZkv7M1vzX0tbLlO2sM?= =?us-ascii?Q?X7HzBBnNtkZhAzy6sf8eDlwWy+9rE7kCCEVIbLw8jzRR1h9pK8nqIkoGg9vP?= =?us-ascii?Q?SuAUVCqPbSFGES9PWdPxzu4mBP8FWPzcfx7lUXjZGAFPSVcDMRUF9FWmU/rJ?= =?us-ascii?Q?+stWFIoOKa4OXK6S9u1PGgpAXTpehrHgehFk0WWTpWrw+G+gcc8diyj2tClo?= =?us-ascii?Q?eQ9f7TOjuXOlDDJPVlxYebtFyLDyo8mI2T+cET6WXRosSUBKUWqFRdBtWf6/?= =?us-ascii?Q?sRYmCsZvMrRksRLfBsDsNVWkGVly/7p+WrMxbDqzJRiWnFf3F1fMrEUdmdLg?= =?us-ascii?Q?sNpbEayeLixQPI99oFNz1dgQq69TpWcYxgGsu9hsRBc37ofMopZIRYvpWwYb?= =?us-ascii?Q?cMnIs0xBIkaH19SGc5QNmkI21huhaf0jh/47lFAxGDixw7c+3Cc6qE4d/Z8f?= =?us-ascii?Q?G5FJQaAywiE9KMbNgMoD8HX4SIZg7wunG7IgBBF+s1QniPfqtxOEIxPNGQSn?= =?us-ascii?Q?hzNryASnxh11KgG/Kp7E3oi0gSkEUzVwZTX/g3GU+3rGWcOyP2ZETd/uGFyU?= =?us-ascii?Q?e7bs1LAharbXA+fniEW7owJUG9+TK2cvp0obOIuQUeN723boBlHInBOGI2Vf?= =?us-ascii?Q?QQLe2wLmye3WaINAEAgIMwkvIipLr2DMNPAtQMqRLs+4zq7QiOjqDbNdjnJk?= =?us-ascii?Q?zkNFGseTFwacYwlzWkZiYk+e10Q8Ka0qsztIR01kYA8X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8cJbc3WXv3m+0xl1p8g7b0ziW4SguQibhqGtj7Z+wjeFhsyWUyg9pA2Y0oXU2UHNY5klxa0BreL/4o34e26o5hDxKrY1FSsDZIvZoV7ff0uKhZzFCSADCdHRsV9FHhYX55SQBNNa5ebRl3vecx6gqw9New+Fuq3c1f9; 24:Pkd7FGo6M/jP7xwXoyFu9LYtmX1xPfvM5Nd5Xylau+yo73HHG6sjqWey1WsBW61Gc9YpYCeNNT9ic/41Ivvy6PbbtrEsZwhxrCZb3WJzJUc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1577; 7:wTA/eSps6hZyi+9RMcnhx3Wz2rZs3aYldfuLlQVP0rHfX0VWnXsQPZhzgzomx4gwFEvUmjjKEhcl4ZoSx2iTu2Ws0lp/1bmEW3g9c+4qYpeGYHsvlQ6OD/S3dcAtdRljj7RG2+2Ku6HQ4lohQFoCz/jz12X+HsFB1Ew5pd1ySOwJPXoFcepYa6aySbseYBhWrPY4nBQPO2chFTr4lIwcFzFtBSw3stu8oPUg2TeibYdrEQlM+lbgIw9bbSR4HDCeg7OGPQsch6Tfle6WixqAfcqSq+oKSdVodjfLY72Bv0NmgAXeeQzPML1WO5qi3+AZ9gKevppR2SfbB4+E+M8xCSYNMlGVFSyU0T6eq79sQmoPCTomTveNDawi2Cr1sRrLzyL+YGylY6/f9+xfE9Lue1XyPEkbEYLMRW6xZSMNEXQmCuElnZpcqyVai4QVf9XmncOM+Vfmkm1f/jjlj/1b0A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 12:44:48.9294 (UTC) 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: CY1PR0301MB1577 Subject: [dpdk-dev] [PATCH 29/32] net/dpaa2: rx packet parsing and packet type support 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: Sun, 04 Dec 2016 12:44:53 -0000 Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 256 +++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.c | 23 +++ drivers/net/dpaa2/dpaa2_rxtx.c | 91 +++++++++- 4 files changed, 370 insertions(+), 1 deletion(-) create mode 100644 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini index a6b7964..0746d4b 100644 --- a/doc/guides/nics/features/dpaa2.ini +++ b/doc/guides/nics/features/dpaa2.ini @@ -10,6 +10,7 @@ Promiscuous mode = Y RSS hash = Y L3 checksum offload = Y L4 checksum offload = Y +Packet type parsing = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h new file mode 100644 index 0000000..fdbd12e --- /dev/null +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h @@ -0,0 +1,256 @@ +/*- + * BSD LICENSE + * + * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. + * Copyright (c) 2016 NXP. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Freescale Semiconductor, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * + * DPNI packet parse results - implementation internal + */ + +#ifndef _DPAA2_HW_DPNI_ANNOT_H_ +#define _DPAA2_HW_DPNI_ANNOT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Annotation valid bits in FD FRC */ +#define DPAA2_FD_FRC_FASV 0x8000 +#define DPAA2_FD_FRC_FAEADV 0x4000 +#define DPAA2_FD_FRC_FAPRV 0x2000 +#define DPAA2_FD_FRC_FAIADV 0x1000 +#define DPAA2_FD_FRC_FASWOV 0x0800 +#define DPAA2_FD_FRC_FAICFDV 0x0400 + +/* Annotation bits in FD CTRL */ +#define DPAA2_FD_CTRL_ASAL 0x00020000 /* ASAL = 128 */ +#define DPAA2_FD_CTRL_PTA 0x00800000 +#define DPAA2_FD_CTRL_PTV1 0x00400000 + +/* Frame annotation status */ +struct dpaa2_fas { + uint8_t reserved; + uint8_t ppid; + __le16 ifpid; + __le32 status; +} __packed; + +/** + * HW Packet Annotation Register structures + */ +struct dpaa2_annot_hdr { + /**< word1: Frame Annotation Status (8 bytes)*/ + uint64_t word1; + + /**< word2: Time Stamp (8 bytes)*/ + uint64_t word2; + + /**< word3: Next Hdr + FAF Extension + FAF (2 + 2 + 4 bytes)*/ + uint64_t word3; + + /**< word4: Frame Annotation Flags-FAF (8 bytes) */ + uint64_t word4; + + /**< word5: + ShimOffset_1 + ShimOffset_2 + IPPIDOffset + EthOffset + + LLC+SNAPOffset + VLANTCIOffset_1 + VLANTCIOffset_n + + LastETypeOffset (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 bytes) + */ + uint64_t word5; + + /**< word6: + PPPoEOffset + MPLSOffset_1 + MPLSOffset_n + ARPorIPOffset_1 + + IPOffset_norMInEncapO + GREOffset + L4Offset + + GTPorESPorIPSecOffset(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 bytes) + */ + uint64_t word6; + + /**< word7: + RoutingHdrOfset1 + RoutingHdrOfset2 + NxtHdrOffset + IPv6FragOffset + + GrossRunningSum + RunningSum(1 + 1 + 1 + 1 + 2 + 2 bytes) + */ + uint64_t word7; + + /**< word8: + ParseErrorcode + Soft Parsing Context (1 + 7 bytes) + */ + uint64_t word8; +}; + +/** + * Internal Macros to get/set Packet annotation header + */ + +/** General Macro to define a particular bit position*/ +#define BIT_POS(x) ((uint64_t)1 << ((x))) +/** Set a bit in the variable */ +#define BIT_SET_AT_POS(var, pos) (var |= (pos)) +/** Reset the bit in the variable */ +#define BIT_RESET_AT_POS(var, pos) (var &= ~(pos)) +/** Check the bit is set in the variable */ +#define BIT_ISSET_AT_POS(var, pos) ((var & (pos)) ? 1 : 0) +/** + * Macrso to define bit position in word3 + */ +#define NEXT_HDR(var) ((uint64_t)var & 0xFFFF000000000000) +#define FAF_EXTN_IPV6_ROUTE_HDR_PRESENT(var) BIT_POS(16) +#define FAF_EXTN_RESERVED(var) ((uint64_t)var & 0x00007FFF00000000) +#define FAF_USER_DEFINED_RESERVED(var) ((uint64_t)var & 0x00000000FF000000) +#define SHIM_SHELL_SOFT_PARSING_ERRROR BIT_POS(23) +#define PARSING_ERROR BIT_POS(22) +#define L2_ETH_MAC_PRESENT BIT_POS(21) +#define L2_ETH_MAC_UNICAST BIT_POS(20) +#define L2_ETH_MAC_MULTICAST BIT_POS(19) +#define L2_ETH_MAC_BROADCAST BIT_POS(18) +#define L2_ETH_FRAME_IS_BPDU BIT_POS(17) +#define L2_ETH_FCOE_PRESENT BIT_POS(16) +#define L2_ETH_FIP_PRESENT BIT_POS(15) +#define L2_ETH_PARSING_ERROR BIT_POS(14) +#define L2_LLC_SNAP_PRESENT BIT_POS(13) +#define L2_UNKNOWN_LLC_OUI BIT_POS(12) +#define L2_LLC_SNAP_ERROR BIT_POS(11) +#define L2_VLAN_1_PRESENT BIT_POS(10) +#define L2_VLAN_N_PRESENT BIT_POS(9) +#define L2_VLAN_CFI_BIT_PRESENT BIT_POS(8) +#define L2_VLAN_PARSING_ERROR BIT_POS(7) +#define L2_PPPOE_PPP_PRESENT BIT_POS(6) +#define L2_PPPOE_PPP_PARSING_ERROR BIT_POS(5) +#define L2_MPLS_1_PRESENT BIT_POS(4) +#define L2_MPLS_N_PRESENT BIT_POS(3) +#define L2_MPLS_PARSING_ERROR BIT_POS(2) +#define L2_ARP_PRESENT BIT_POS(1) +#define L2_ARP_PARSING_ERROR BIT_POS(0) +/** + * Macrso to define bit position in word4 + */ +#define L2_UNKNOWN_PROTOCOL BIT_POS(63) +#define L2_SOFT_PARSING_ERROR BIT_POS(62) +#define L3_IPV4_1_PRESENT BIT_POS(61) +#define L3_IPV4_1_UNICAST BIT_POS(60) +#define L3_IPV4_1_MULTICAST BIT_POS(59) +#define L3_IPV4_1_BROADCAST BIT_POS(58) +#define L3_IPV4_N_PRESENT BIT_POS(57) +#define L3_IPV4_N_UNICAST BIT_POS(56) +#define L3_IPV4_N_MULTICAST BIT_POS(55) +#define L3_IPV4_N_BROADCAST BIT_POS(54) +#define L3_IPV6_1_PRESENT BIT_POS(53) +#define L3_IPV6_1_UNICAST BIT_POS(52) +#define L3_IPV6_1_MULTICAST BIT_POS(51) +#define L3_IPV6_N_PRESENT BIT_POS(50) +#define L3_IPV6_N_UNICAST BIT_POS(49) +#define L3_IPV6_N_MULTICAST BIT_POS(48) +#define L3_IP_1_OPT_PRESENT BIT_POS(47) +#define L3_IP_1_UNKNOWN_PROTOCOL BIT_POS(46) +#define L3_IP_1_MORE_FRAGMENT BIT_POS(45) +#define L3_IP_1_FIRST_FRAGMENT BIT_POS(44) +#define L3_IP_1_PARSING_ERROR BIT_POS(43) +#define L3_IP_N_OPT_PRESENT BIT_POS(42) +#define L3_IP_N_UNKNOWN_PROTOCOL BIT_POS(41) +#define L3_IP_N_MORE_FRAGMENT BIT_POS(40) +#define L3_IP_N_FIRST_FRAGMENT BIT_POS(39) +#define L3_PROTO_ICMP_PRESENT BIT_POS(38) +#define L3_PROTO_IGMP_PRESENT BIT_POS(37) +#define L3_PROTO_ICMPV6_PRESENT BIT_POS(36) +#define L3_PROTO_UDP_LIGHT_PRESENT BIT_POS(35) +#define L3_IP_N_PARSING_ERROR BIT_POS(34) +#define L3_MIN_ENCAP_PRESENT BIT_POS(33) +#define L3_MIN_ENCAP_SBIT_PRESENT BIT_POS(32) +#define L3_MIN_ENCAP_PARSING_ERROR BIT_POS(31) +#define L3_PROTO_GRE_PRESENT BIT_POS(30) +#define L3_PROTO_GRE_RBIT_PRESENT BIT_POS(29) +#define L3_PROTO_GRE_PARSING_ERROR BIT_POS(28) +#define L3_IP_UNKNOWN_PROTOCOL BIT_POS(27) +#define L3_SOFT_PARSING_ERROR BIT_POS(26) +#define L3_PROTO_UDP_PRESENT BIT_POS(25) +#define L3_PROTO_UDP_PARSING_ERROR BIT_POS(24) +#define L3_PROTO_TCP_PRESENT BIT_POS(23) +#define L3_PROTO_TCP_OPT_PRESENT BIT_POS(22) +#define L3_PROTO_TCP_CTRL_BIT_6_TO_11_PRESENT BIT_POS(21) +#define L3_PROTO_TCP_CTRL_BIT_3_TO_5_PRESENT BIT_POS(20) +#define L3_PROTO_TCP_PARSING_ERROR BIT_POS(19) +#define L3_PROTO_IPSEC_PRESENT BIT_POS(18) +#define L3_PROTO_IPSEC_ESP_PRESENT BIT_POS(17) +#define L3_PROTO_IPSEC_AH_PRESENT BIT_POS(16) +#define L3_PROTO_IPSEC_PARSING_ERROR BIT_POS(15) +#define L3_PROTO_SCTP_PRESENT BIT_POS(14) +#define L3_PROTO_SCTP_PARSING_ERROR BIT_POS(13) +#define L3_PROTO_DCCP_PRESENT BIT_POS(12) +#define L3_PROTO_DCCP_PARSING_ERROR BIT_POS(11) +#define L4_UNKNOWN_PROTOCOL BIT_POS(10) +#define L4_SOFT_PARSING_ERROR BIT_POS(9) +#define L3_PROTO_GTP_PRESENT BIT_POS(8) +#define L3_PROTO_GTP_PARSING_ERROR BIT_POS(7) +#define L3_PROTO_ESP_PRESENT BIT_POS(6) +#define L3_PROTO_ESP_PARSING_ERROR BIT_POS(5) +#define L3_PROTO_ISCSI_PRESENT BIT_POS(4) +#define L3_PROTO_CAPWAN__CTRL_PRESENT BIT_POS(3) +#define L3_PROTO_CAPWAN__DATA_PRESENT BIT_POS(2) +#define L5_SOFT_PARSING_ERROR BIT_POS(1) +#define L3_IPV6_ROUTE_HDR_PRESENT BIT_POS(0) + +/* Debug frame, otherwise supposed to be discarded */ +#define DPAA2_ETH_FAS_DISC 0x80000000 +/* MACSEC frame */ +#define DPAA2_ETH_FAS_MS 0x40000000 +#define DPAA2_ETH_FAS_PTP 0x08000000 +/* Ethernet multicast frame */ +#define DPAA2_ETH_FAS_MC 0x04000000 +/* Ethernet broadcast frame */ +#define DPAA2_ETH_FAS_BC 0x02000000 +#define DPAA2_ETH_FAS_KSE 0x00040000 +#define DPAA2_ETH_FAS_EOFHE 0x00020000 +#define DPAA2_ETH_FAS_MNLE 0x00010000 +#define DPAA2_ETH_FAS_TIDE 0x00008000 +#define DPAA2_ETH_FAS_PIEE 0x00004000 +/* Frame length error */ +#define DPAA2_ETH_FAS_FLE 0x00002000 +/* Frame physical error; our favourite pastime */ +#define DPAA2_ETH_FAS_FPE 0x00001000 +#define DPAA2_ETH_FAS_PTE 0x00000080 +#define DPAA2_ETH_FAS_ISP 0x00000040 +#define DPAA2_ETH_FAS_PHE 0x00000020 +#define DPAA2_ETH_FAS_BLE 0x00000010 +/* L3 csum validation performed */ +#define DPAA2_ETH_FAS_L3CV 0x00000008 +/* L3 csum error */ +#define DPAA2_ETH_FAS_L3CE 0x00000004 +/* L4 csum validation performed */ +#define DPAA2_ETH_FAS_L4CV 0x00000002 +/* L4 csum error */ +#define DPAA2_ETH_FAS_L4CE 0x00000001 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index b3c2229..2603a08 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -315,6 +315,28 @@ PMD_INIT_FUNC_TRACE(); } +static const uint32_t * +dpaa2_supported_ptypes_get(struct rte_eth_dev *dev) +{ + static const uint32_t ptypes[] = { + /*todo -= add more types */ + RTE_PTYPE_L2_ETHER, + RTE_PTYPE_L3_IPV4, + RTE_PTYPE_L3_IPV4_EXT, + RTE_PTYPE_L3_IPV6, + RTE_PTYPE_L3_IPV6_EXT, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_UDP, + RTE_PTYPE_L4_SCTP, + RTE_PTYPE_L4_ICMP, + RTE_PTYPE_UNKNOWN + }; + + if (dev->rx_pkt_burst == dpaa2_dev_rx) + return ptypes; + return NULL; +} + static int dpaa2_dev_start(struct rte_eth_dev *dev) { @@ -521,6 +543,7 @@ .promiscuous_enable = dpaa2_dev_promiscuous_enable, .promiscuous_disable = dpaa2_dev_promiscuous_disable, .dev_infos_get = dpaa2_dev_info_get, + .dev_supported_ptypes_get = dpaa2_supported_ptypes_get, .mtu_set = dpaa2_dev_mtu_set, .rx_queue_setup = dpaa2_dev_rx_queue_setup, .rx_queue_release = dpaa2_dev_rx_queue_release, diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index ba002be..2fe902f 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -50,9 +50,90 @@ #include #include #include +#include /* DPDP Interfaces */ #include +static inline uint32_t __attribute__((hot)) +dpaa2_dev_rx_parse(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; + } else if (BIT_ISSET_AT_POS(annotation->word3, L2_ETH_MAC_PRESENT)) { + pkt_type = RTE_PTYPE_L2_ETHER; + } else { + goto parse_done; + } + + if (BIT_ISSET_AT_POS(annotation->word4, L3_IPV4_1_PRESENT | + L3_IPV4_N_PRESENT)) { + pkt_type |= RTE_PTYPE_L3_IPV4; + if (BIT_ISSET_AT_POS(annotation->word4, L3_IP_1_OPT_PRESENT | + L3_IP_N_OPT_PRESENT)) + pkt_type |= RTE_PTYPE_L3_IPV4_EXT; + + } else if (BIT_ISSET_AT_POS(annotation->word4, L3_IPV6_1_PRESENT | + L3_IPV6_N_PRESENT)) { + pkt_type |= RTE_PTYPE_L3_IPV6; + if (BIT_ISSET_AT_POS(annotation->word4, L3_IP_1_OPT_PRESENT | + L3_IP_N_OPT_PRESENT)) + pkt_type |= RTE_PTYPE_L3_IPV6_EXT; + } else { + goto parse_done; + } + + if (BIT_ISSET_AT_POS(annotation->word4, L3_IP_1_FIRST_FRAGMENT | + L3_IP_1_MORE_FRAGMENT | + L3_IP_N_FIRST_FRAGMENT | + L3_IP_N_MORE_FRAGMENT)) { + pkt_type |= RTE_PTYPE_L4_FRAG; + goto parse_done; + } else { + pkt_type |= RTE_PTYPE_L4_NONFRAG; + } + + if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_UDP_PRESENT)) + pkt_type |= RTE_PTYPE_L4_UDP; + + else if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_TCP_PRESENT)) + pkt_type |= RTE_PTYPE_L4_TCP; + + else if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_SCTP_PRESENT)) + pkt_type |= RTE_PTYPE_L4_SCTP; + + else if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_ICMP_PRESENT)) + pkt_type |= RTE_PTYPE_L4_ICMP; + + else if (BIT_ISSET_AT_POS(annotation->word4, L3_IP_UNKNOWN_PROTOCOL)) + pkt_type |= RTE_PTYPE_UNKNOWN; + +parse_done: + return pkt_type; +} + +static inline void __attribute__((hot)) +dpaa2_dev_rx_offload(uint64_t hw_annot_addr, struct rte_mbuf *mbuf) +{ + struct dpaa2_annot_hdr *annotation = + (struct dpaa2_annot_hdr *)hw_annot_addr; + + if (BIT_ISSET_AT_POS(annotation->word3, + L2_VLAN_1_PRESENT | L2_VLAN_N_PRESENT)) + mbuf->ol_flags |= PKT_RX_VLAN_PKT; + + if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L3CE)) + mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD; + + if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L4CE)) + mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD; +} static inline struct rte_mbuf *__attribute__((hot)) eth_fd_to_mbuf(const struct qbman_fd *fd) @@ -69,7 +150,15 @@ static inline struct rte_mbuf *__attribute__((hot)) mbuf->data_len = DPAA2_GET_FD_LEN(fd); mbuf->pkt_len = mbuf->data_len; - mbuf->packet_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4; + /* Parse the packet */ + /* parse results are after the private - sw annotation area */ + mbuf->packet_type = dpaa2_dev_rx_parse( + (uint64_t)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) + + DPAA2_FD_PTA_SIZE); + + dpaa2_dev_rx_offload((uint64_t)DPAA2_IOVA_TO_VADDR( + DPAA2_GET_FD_ADDR(fd)) + + DPAA2_FD_PTA_SIZE, mbuf); mbuf->next = NULL; rte_mbuf_refcnt_set(mbuf, 1); -- 1.9.1