From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0062.outbound.protection.outlook.com [104.47.40.62]) by dpdk.org (Postfix) with ESMTP id 543B1F934 for ; Thu, 29 Dec 2016 06:15:46 +0100 (CET) Received: from BY2PR03CA059.namprd03.prod.outlook.com (10.141.249.32) by MWHPR03MB2480.namprd03.prod.outlook.com (10.169.200.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Thu, 29 Dec 2016 05:15:44 +0000 Received: from BY2FFO11FD046.protection.gbl (2a01:111:f400:7c0c::104) by BY2PR03CA059.outlook.office365.com (2a01:111:e400:2c5d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10 via Frontend Transport; Thu, 29 Dec 2016 05:15:44 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD046.mail.protection.outlook.com (10.1.15.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Thu, 29 Dec 2016 05:15:41 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBT5DOI8010218; Wed, 28 Dec 2016 22:15:38 -0700 From: Shreyansh Jain To: CC: , , , , , Hemant Agrawal Date: Thu, 29 Dec 2016 10:46:45 +0530 Message-ID: <1482988612-6638-27-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> References: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131274621441465281; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39840400002)(39860400002)(39380400002)(39850400002)(39400400002)(39410400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(68736007)(36756003)(356003)(97736004)(50226002)(626004)(5660300001)(6916009)(47776003)(2950100002)(189998001)(33646002)(8656002)(6666003)(69596002)(48376002)(104016004)(38730400001)(77096006)(105606002)(8936002)(76176999)(50986999)(92566002)(110136003)(50466002)(2351001)(305945005)(4326007)(106466001)(8676002)(5003940100001)(81166006)(81156014)(85426001)(86362001)(2906002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2480; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD046; 1:0ml8h2kqM/DbuuPalGex6c7JBPjKRNSYHZxrILt+74OqROc0x/BdpoeHIKVK9DNQo/Cirr2gtmahuRFWVe586iXjPqIRxD1H/nOA1nJpFjPEfHSrk7bUEj+r4uaqBemKiBxF5HuBvTOqr9mVMfxNz/2TeBknUxkKKC7jtxw3uWZjgiS/zbyy+wYkKbofF9UoEjY9Gso4jN7bHHxX54KB7xjhkvHx9esDp4L9kWlwtcKWem3Vum/759RXBupYf5IHnx26O0YCJzdv5Jb0RRrjYy9zsceurFOoWXWTm/TfGe4isrvUE70gnMSrRx74oXCzdv2Hlnc+dLLRZ+5QPJ/UWs/ygNJdlQRggvqI6MB9atrt6EeyvlVDBZMHRnc7N1nK3uaBaUGfvpKAyXgK4X3zxfI+dvus0v0u+xBE3JDatdiM4MXbAloxna+r6Z8b05FoP3rkrLzsApQ1XGtcyGffr1Qm0q9fKkDoq+gStj/56W/EElbCrXFrtsX0R1Hoc/PfMPUDVVPXHibsd/ce5rDx+9Mle82cd2lYHti0HcDZVr/VbaPiXp2vSUSi82ALiJ/lIeIjuBDCJeBTkJ9+lwrfAAAxKYBbZUZLP5fIrUBXclSicU8Xn3PYZNbIOyttU/gH3HnQsynONpHWfF9k/qi26K/e0mGvT7IpOA+jrL3JyGyGX35+RpoNGeWy8VmmQ7BOizrygS1YCLTnt3qJRoUiogBq3V6iUb5bTRxEsUP8uPwJ7RkJO2Y5YUMmGRKBtCRFBbfFawEcuGQI3j/ilF4nDw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9762a40e-b39f-4184-d0c9-08d42fa9bd6e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2480; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2480; 3:DUwhGOZSpnLXxi974tgj7JC/AXlSqKKV/NyAoj8pmIoqZmomF0ng2BEhQPU7HkicxPL5vxbn1/AltoMUkASBevDdQ4N6iKhy04F1tDyO0fTRyxCwnJ0WkfnJmJM+8EHhRI8OpNBTrxpPGLpRe9JNu0RnYdGtJnwtXkbou1Rc1CZ1rgwVyfayGui9n3jA0r4fj+AQgkceXMmT5Z8RFBTkZMiP1fBf8z6pdja42XLzwVF9aPqQHz3kRW0MT9VKPnDX9seoD2rbQ721M6irgpGV4d+w3EyfMP8ObSoPSL1W9FFJgDI0ARYOlYmsMnWWofWZAt3E9W0+BO983jwp5ldCGDYf91/orFlY2hwpBsZSoMo= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2480; 25:jco1rjAXFuTf/IgJcpTnMMqpa+X5i1mg1c4b2dlfdHhmVeNLFrmtXVprDYp7z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-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:MWHPR03MB2480; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2480; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2480; 4:T+I7qOYu8ER69KqhUUMIT1zpN0EVUWrwqU/x+fZxS7c00hvG7nZST0EeozNsFqR9dgTr4iFzXp9pPfD9ejJCXKFzbQAIvgsN0CO07TWRR0EWrfW9MdwmCv96O+iMiXQqR/bLxylJufe8RB6aD5QKZDzbSxYmGV9qkNW9VgrvqzLJZhpcfw4LJEOStZtJE7fsSEaQnWoZSrLHwRCThTDMtiCJJ/J/fXkVxtJiRxdqjtPXtP/JOLf3n9HzlVcYhH1H+tAMgNwO5bF2QmLeeEhAJtHZ5SsPzLavyy0ZUgTWJZKPQLUPxw++O/edZj0bVE19tTllO70xpo0vwdhT0MUJU4PqOfsRhmfRrjikSazDExgj6fTkhsIe2YiJ6h2o2AzvWTWFUcgI8aK+bC9m5yLSMTVQH2qWORsrlnrgdgHdPsRZNBgQodZ1SwW3Mous4+ykghvemgY/0NsBM4vg8YoseN9mNWPNW0b0VoaJNlFOYEj++FfelJajkQQi0c8Tgel16d0O1ohyaERGf7YUyEb9zmwgat480R40zYJVhEX0mFMV1EehxyXrIHAuIPeV0XT1B6r2IJOglc499GapxyNp3y1RHXu2fl1tNoYDYWdDufPue6XyzcaQ/rABCj+7Jqyzh2e2Qh4sDVLpeBTxVJgMf8d+Xs3cmfZaSDKABztvwDlCogIrTZky3PaUq6XWYGbbZaqjSAYA7VXIwfjjrT9GiXHFOz6z4nK8slfnFUxlKmberpjsPIGq5N5I0vSDILCI X-Forefront-PRVS: 01713B2841 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2480; 23:XirdXaQRvJs+RLqCsBE3s2aSxyJDIRUZCOKW9Kasc?= =?us-ascii?Q?yG25DGcDBjrgB++wAYyFlrJ3j+dsMUXXjO6DxSZQnpm5DQO6okrkXsMx0MDx?= =?us-ascii?Q?3X7t7J7fD8+H1eFjGHr/Rhdtqykyo8Rsl4gxi2/ELe8n4AqaSGk830CAaZW3?= =?us-ascii?Q?w5xfGZsIp822wtmRKCSCGVYEFmKElaA8nXV7FuGS9h+owqBqDJqSuYryslv4?= =?us-ascii?Q?d+pnOynLFD6lxwxweI9n1LrQ+zL/H3XsRxt9dqWdtIyIR2tZiZrQJSOIWO7j?= =?us-ascii?Q?P8oblZeMCxqPOxziYUR8chC88U2gFW4sfHXxp2LSKu9YirrU6IoHcUcCto13?= =?us-ascii?Q?ws1htVbD6qowahE4Te0nYetqIHjsd95yqF9yTOx0poORmGvzAXXdmxBD2s6P?= =?us-ascii?Q?B7QyRLBbvwPFAFNsfTROm6lFg6LMGk7di/Kgx/4L84tmH0HxbFIRs9NyQqkq?= =?us-ascii?Q?n+KGnHn07Q53lhxNqPVO2NpgzHHXlClvoNRFoGzHY2g9Uz6+Bw3kiR/woV/r?= =?us-ascii?Q?sGmNB3VBklHEhPe5QSFib0+NVDNX60KDmtC21TX4nzVqCT4mENFNXkcMxCPZ?= =?us-ascii?Q?5uDJ2oT3k7b074NyVIX6uLu28P6/oyzQ/odX/vaA9l3ToDqr4pOmgjh6N38H?= =?us-ascii?Q?Zwf/CFWjd8F8jVKRbKx5hZdx6seOg9yQZcb45nXc9UQXYggm/eDNcAO6nAsT?= =?us-ascii?Q?IPsms8levqTU1K0hUM0U/2IHA57U/FKvqQZb6qr3svZX7cgWP/f9hiK5TApg?= =?us-ascii?Q?Oc7DWuh77cx2o4V+DFBkbgAQyz6ZQWiuSdr/ldkwJRdpBDra5BuaKN6z2CZH?= =?us-ascii?Q?avxTu49oUrvnNMQFKXo6V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nbAKW9vTAKbbxt0q7xOqZH0UM; 5:G+08+cQFoMAG+Hqv9s4cxpUSaJapSdi2nPiyzry/Lf1Siz7DgrnRCxLVojoiXsk//ditmS5SW4mFLuU5pKYuM36U2QHpAIe1aspnpUTHRPuR545P0dTZvA+vnvFNSDi4+4TsBsj34e/S7sr+Ctjc1MVNHsWsKPUyZ2uhWrkOm6BfmGEqA2oUp5CLaqV9dOg5; 24:UGWcSX1Cc+PS3kBxe1EvKdl5a/eEJAfJnakMZqTVvHcZvrMaHIIfV8L1+v4qIXC++E4JDi4XUWavgt4vKo9aATjjvyUTjJsQyX4xq3ZHhgs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2480; 7:Ba6gTtDEuHp6H82WBvDxvrGNdxBAbzBZlbOh/uUOz86AaCRvqXXb/eaWroCHqNfAL6OHs97rqG8AwlwNlMo/tpsuxz4I9M3zO9m/vHDhhZU5L7qaZW/vwIt9ckJKJV/pKLfcCxWuJj43UZWRmdr5EEUZksnd5DPvReRc7izhA39jBa2TCMSzeuhGue2yWcPt5qNMC38XIbT0R1oRX0zEBth3U8+mP6phkoNMUL5tNZoGEEhHq8TNT+Tyh3p2nAP43aiCC6fmmQDK2NimWB8n1nYxY3F8xr7lTDVzpyKc3oer2XE2xN7q6H40F8wcNt98bCM7zC2GdRNGNCBa27T9ilanulXAPMLyc+lJivxTstkJGh/h49WweJbVY3iGsZs55GfiCH1tmRwAfCCZjnCszMg1tyu1nBWuR+p32OXtRgVAokR9vuuB+gAHY00ssS0/4c8iTaNs7dq4m7EZ2FgYXg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2016 05:15:41.4633 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2480 Subject: [dpdk-dev] [PATCH v3 26/33] 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: Thu, 29 Dec 2016 05:15:47 -0000 From: Hemant Agrawal Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 257 +++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.c | 23 +++ drivers/net/dpaa2/dpaa2_rxtx.c | 91 +++++++++- 4 files changed, 371 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..9324c6a --- /dev/null +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h @@ -0,0 +1,257 @@ +/*- + * 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 3c4ca28..c705014 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -311,6 +311,28 @@ dpaa2_dev_tx_queue_release(void *q __rte_unused) 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) { @@ -518,6 +540,7 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { .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 4b76be5..7d73bde 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -49,6 +49,88 @@ #include #include "dpaa2_ethdev.h" +#include "base/dpaa2_hw_dpni_annot.h" + +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) @@ -66,7 +148,14 @@ eth_fd_to_mbuf(const struct qbman_fd *fd) 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_GET_FD_ADDR(fd)) + + DPAA2_FD_PTA_SIZE); + + dpaa2_dev_rx_offload((uint64_t)(DPAA2_GET_FD_ADDR(fd)) + + DPAA2_FD_PTA_SIZE, mbuf); mbuf->next = NULL; rte_mbuf_refcnt_set(mbuf, 1); -- 2.7.4