From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0087.outbound.protection.outlook.com [104.47.32.87]) by dpdk.org (Postfix) with ESMTP id 8B090FA74 for ; Fri, 3 Mar 2017 08:14:52 +0100 (CET) Received: from BN3PR03CA0098.namprd03.prod.outlook.com (10.174.66.16) by BN1PR0301MB0724.namprd03.prod.outlook.com (10.160.78.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 3 Mar 2017 07:14:51 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:147) by BN3PR03CA0098.outlook.office365.com (2603:10b6:400:4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12 via Frontend Transport; Fri, 3 Mar 2017 07:14:51 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.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 BN1BFFO11FD044.mail.protection.outlook.com (10.58.144.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.933.11 via Frontend Transport; Fri, 3 Mar 2017 07:14:50 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v237D50b005035; Fri, 3 Mar 2017 00:14:47 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 3 Mar 2017 18:16:51 +0530 Message-ID: <1488545223-25739-35-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> References: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131329988908657096; (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)(336005)(39450400003)(39860400002)(39400400002)(39840400002)(39850400002)(39410400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(106466001)(105606002)(36756003)(38730400002)(110136004)(53936002)(4326008)(104016004)(76176999)(2351001)(81166006)(50986999)(50226002)(8936002)(92566002)(86362001)(33646002)(575784001)(2906002)(5003940100001)(85426001)(47776003)(189998001)(54906002)(6916009)(77096006)(356003)(6666003)(50466002)(48376002)(626004)(2950100002)(305945005)(8676002)(8656002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0724; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD044; 1:sHfUWKBbP9Mep1zJK17CDMUQK5xB4HSrojPztVBxCcIuosMr53a6UhQwr9iJFbujfE10Nec5AybZcVxKlPgtb9LwCfrTtxHRjFfea8hrbFfspIzHoKrOTwMxOD9GI8KSM3fLfNhqRI8T+7xlp4udi5HmWrG4mCEKM2bs5AmgtVVUeIGB7Y8b6laykuUwRw7Bvy24mS2LJCKsNhR5LoIpxWwVy+XblD75sdcUFv09xCtJhuVEJtzA2ma+AQ2wPHgW5v1umzS9IlUoMlxga3B9gLI773ux0iQAIa4sVDLoDP9aCPfQgs/wHSqs44HNcq3AwHPHGQUPcStrEkecYmF9CZahTAphSW6Z7UQb3aesbuoRiqs9V8Q4zvFDB5a3IMefFythJcCJtHsCFCPWzbYxEAGgLoEvLEzzeSoFG42qCpn5VP57TSST7bbb+KCYS2omgv3KGcgKuHyIWESqHkLgkX9PfymYZUlly+tp14iO6W41xFboKs/XN4DgnS8vte13ewhFiDIIAl6I08r452CfK18VUCk57DCkbBtYr+cdEp1Prjdo0K+3NfbfzkJNC4z+AxcpDDDHW4a81V/SCX7YeaUn9+3mE+KpD1XZs/KlX9HPWdGrB0elVsRgII2ufOFc4vUuSayVDcsMN/6ZO7dNLw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9eba7891-c08b-4d98-9ec0-08d46204fba5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0724; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0724; 3:84Ti6yg5lfWNtNW7jldqiPNZdyK0eI3x3zz7ZSV2poFcpk7SuQu44QiBwvCH+vRaQtY8jvunT7+lGt34BQdpHiR7n6HRtP53J2XXBjuWtGfEHs4IWGxut5YosXfseJ/t2eR2mYxTYtGwJupS5bMsxJ3wSDevImPvhvLKUF4lUEY+eJIS+ohxGYebg9/Y9tM4Fuez+2Mm7izmSjmlPuWYJQZgTGxMozEEteFySAghk5S+40zIG3djxA4zorrcIwvifidL9PPTag79OlE6b36nQ72xZhAr+prdurZugg/Dl0aGCZg3YLo0FtI4yr2DCO+4cTNc/wdLE0uhH6/2Y/91sc3bxXol5J2P1tJdP4eUk/S3Z69dTNNFWbc9YEGk7Qxn; 25:fNO9EuSFVdOfbeVt1DUx8MeYqGaR4wrC4KCdZv1bWbOYvHbqyHLqq9N026+IC9No7OFCmWLCUpfgtwFmPkn0FHjfs/eE+9DS9o8c4wOOOC10Mpg7S9KI4is2if7dSx26eTpt3oXLH/tQeTLKHvYsAYbWcA8E5b1tjm289WCdDMwpt4YUSwmHveod1170f4XtZAVLM8/bdsLPGfxyPTe/7BeIqxWJ0Hd7BhW+ud5bil1C+b7dcNc1tR8//7/WnaFgh+lbW2uwYoQqpTNjVh36hX0wOgptiH5/mE0kgBzFeGfgnLYMidx6gKBMraFZ2vKizTPf4BFYEQ4kN1OY95DfzYaVMN1OSjRfyDPgEVn3/kNYu7mAcgIn+knwpeT4FTD086dNrKoSuUTy9FagiPbnJHWGc7NO/yuUV8tK/6bg7liuQESDBfjakEFT1aqfqDgqYOedZRB2nzuV+YJN451oAg== X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0724; 31:It12SPeDSp7q1Wq5Bw8CaQV1XuAaD5BlXMO7WP7PVNMZtSQ34goBSfKCPQh69gC1+VF0tOBQtERtxWvVF3/pffV5OcyfTnb8Mwd0GLz1qtlm/FHeIYdNHooZZc+K08XtPgpJnBiDqWmwk/o9hME+nyGfV3ReRK2ZCPq1QuHfreJIIso5hqQUPVNlOzhdy/7Q8nLBeCDsEWJj0N+pLX8iH5ogLqif83qRg2ENmxaC17GgLfO+sF9SnZKSx8MxjGBMYyQ17hbwVK6RMvuemuAX5w== 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)(8121501046)(5005006)(13015025)(13017025)(13023025)(13024025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123561025)(20161123556025)(20161123563025)(20161123559025); SRVR:BN1PR0301MB0724; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0724; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0724; 4:gqfqvdPJkNW7SmGFdHVCezaTcTNdJmRIOh2SzqENm81Jj+bTrPHhRJwYNjaCQ81KpnmF2qa/YEMuhlLV73p3VJg8MNGm1Uoy30iwusuQABFa00pNZNNGf3I6vhQIc5dQRJUOpC9PUFr171qKgR119JN4Mr7GeaslsVHWwK23VQrUfrga5o0Pd7LYHO6nGBhv6buAMYZmE7CxjpR+sQHvtDMdUUpfCN8PbtYlMGbzaGJv3OMXmsUXktvX0SmYqDFu9IMQfIRjg22RaHwMQItpuPx06a26a4NPNFrUOKZakAMajmNOnQbNM2J7ejB14YEDlLIu+1zjZczgHx98k+DgAexLyAhqM5OI0S6NHhCwuATD1Ipb1oCVobQPXDDdArg65D7/W7ys+loBgeowyqonlD6vieJcF64T51f5KA4xPtus8LU07vtMT3MzNPSrxPgfA3a7//4Z2kRymlBCYOYd9i62/eFUjg+AmeFzSauy3Qvo98c7U3wUOcS1Yt+7UcMIY1hjkWPD8F6zMp+FzUx/wA1P4HweuWzfSVabmQgf7EGOWl8a/O7LSuDnG/2OSl2bvAqYxL5W7KSU04pbcLOmytCGPGMRjpRllfmQOZu8dwbqrjRFjV9oftUyLULDExqT8+9GSWwl1esBmZLQkcKYKfbV5YMcooAvR+KWzTyGVG2VobgA4jtPLo9bc5wDqzRygmwiZG0RdLrzNF83M9xjJtHGdhvfPgd1KySqhWO3f8CJftxLri8Psi9iATQ4bJvB X-Forefront-PRVS: 0235CBE7D0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0724; 23:Opie4LXi0z82nfY3ghO2MaRHf7irdbxZINHe3Mk?= =?us-ascii?Q?EUhFJZT3iPe+0A76xj9hLBX80yL6W/mS3JdhosAQ/toRgYEb8pv02/DYX+mI?= =?us-ascii?Q?HA3mlZgdiHn+ju/n8cMUqEmg6ZPBgnAy0jVeB5/odnfULbYqbInsVJJ82ZHK?= =?us-ascii?Q?hTV3OkIlxm6aLd5QlSecuYLjMvkUv/qGbFfUSAnwa5pCJVc9UbwScJCPVzR+?= =?us-ascii?Q?1CXM470wpbQeBSfgEkcRB+gQetapaC/wkglzZYnuF3+rScvhNVjNaebnWX50?= =?us-ascii?Q?g5K85azZznmpzF847duMwFaup40l0csQxw3rZDpTxsPGgsIQ/zf3h1x6wJt3?= =?us-ascii?Q?JOFDoWqCDv1vsZm7Ws9MBjF4jV9UcioyUDJvXMbPGklRREkP+DXrcmyyeZdv?= =?us-ascii?Q?emCuM+k0xQIYUfbYiMmMy4gwTyRJLobnf6VEZ3bm3Nx6OTHcyoFA6uwx5m0k?= =?us-ascii?Q?L9pa8XA6RP/54QidAH4YQ/sbn+HS6zaaeV2ZoL82p+nNBjXv7o/K0bz/ubg7?= =?us-ascii?Q?BwPaewHWZaH7XD1MvH1Jzy9uMt7BjS3s+I2vIuk+lGCPUtOCoX7Cx5BSSCxe?= =?us-ascii?Q?RBKQWHjQn9jylF/9Bd3wPHrncVA2rNIKBugNMOMZbtjXb82q2xmQCnnD86w+?= =?us-ascii?Q?YBF981ssz6gj4LXCT6Wd8wyPSxnc/o2oPjfyhEzkkVuALgdpbZuma1qxMDWH?= =?us-ascii?Q?u/3hBQGNVkK6LClwIkyOF8rrlonmSBr7yqi23b4U8sB3URGQeEw8Y6fXYuTO?= =?us-ascii?Q?k/qpyn2wYmOGCZZzY4uSRMkr9pjE7sVpx+O63c1d09rworvI8JMgnZQAw33w?= =?us-ascii?Q?i4uTjSqra1ELvTsEaLQCR9wyD88iC6IY8tvLA2+Q8WupDqGlV3XUF+nBy6Ri?= =?us-ascii?Q?tKIwC6IbXhw8RcOfOP06CUBnSbVeN3IRq6vgipupvpeUmsWLY2qjCj3F+zey?= =?us-ascii?Q?fbqAUYKpldxKsxH54AkrTfz3udjQXbTQFt56CMW8CV/4aDy1zkGicAq/Tphp?= =?us-ascii?Q?WhSlrWHludwiH3WqZZrt2bRNlCxMUTHR72m0zpOPiHKZqA+0SumWzjYX1gB7?= =?us-ascii?Q?auJq4URoEl7a8O/9C6sQxnSFe7fNpdg1KDocAoM8mdOjLQgzmhXctYDr6hvp?= =?us-ascii?Q?FeBLs0wqWmM0+17xL1IdhHLu0cxOsd25wWXLxsEfwDCSkVLC6JdKAZBaCEN7?= =?us-ascii?Q?Sjz3EvALmjCLavjz/CektMeGGE5U4ydpWleBgp4kid4CYAjmRBDI72FwvLJ4?= =?us-ascii?Q?xxlemLHLwE94NEs/THulP5q5vH+bluLQJobM3XwCUw2JRRt0Q9W/wiFHNFvY?= =?us-ascii?Q?r8w=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0724; 6:I/rxn+r9dxfE57opiKgL5GotkpEzlznw4b404FUNwgcU5iu4Q3p0Xgq+EB5e1owJz6JXiFLzDfkZrzFKrr7okkihSZfmql67dPacZHLZkt5Rb6J55wwu+MJ8LXjuqaHItTQ2GQphuz1eyjyU8HXyaEZ2bDJv2VaxWTTdfEehOZx1VsHvU7dabNZ6VyIbeQrnkHE2oxqo/x6F/HEpy1MHeBHYzEw7yVMmIfh4JOiG4oBTiYr0r+rymCs9nRAGT56t0aLdMTChlXeIeFr14Zd+fKNoUuZYJB+jGwGjyCmIvJWof3PFidvxBWSJ6AiGMtizTv5rYnaCG/d2Zgrt8lJCNpQU3XalLwF+lDI8kEzvXyK9mVNw7LuwxDQVEf+Jm9RyYqAQ/PbKc2uIZZ6r9GQQ8NpKZsp6KP64IfftjGGB07E=; 5:dICYPR283ckmjGCYfp9y0f9D+N3dBG/3u4/b+9euL102tykrhPxcZp9ZNEXypIPS7J2oPsjt06stJrg9QuiloNws7+dXhT7hZ7qkhMPYQEfnHS4pQvvWa31BRb8o4ZCi0f1VsmlOOvZNZXGN+oSMfjbgBAd0zdlQv4h/QiTjdxOA056DPQKhdYqfor91KZ0y; 24:z/PakkViFl6l6uEVfrzmD/duh32kkzD+AXw9H0AKpE3QLbA/P1X00twA0ajUVwSfzbzqxNFhuRcJ5wB7qJoPyGdvRzMaLI37HS8ZBqn+bbE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0724; 7:Cxr0Q4VLTToVVpyv9acK7h63lkQ/aepKJxta07jLkXUCeySnXa2LohEUnmZod2sEpGHDVDVr5GtVtmMxl3dsXMqNBtOWUkB1kuX+s3QV3hsZcjke3MWjemV9Xj2dKoiA8HpdbNGqH88PIW+LzLE/HJtK2n6AXcTluM/zdAP7X6UcH1RmYlr9LoS47sv8cSX762tHN8iAsxl462Pi6nWR1FGX1wOa96/MEMpkYUzAvNSivG7wN3PDNIW0F55Ay4YDs9hyYbURINQScf6AkoZZVVaCOF5zF/dS/BxY/fRwrBTViJK3mZJG347qXFlwIDQGsbyDSWjbvSutrijkf6/pwQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 07:14:50.5537 (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: BN1PR0301MB0724 Subject: [dpdk-dev] [PATCHv8 34/46] net/dpaa2: support for Rx packet parsing and packet type 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, 03 Mar 2017 07:14:53 -0000 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 93ca0fa..c4131e1 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -310,6 +310,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) { @@ -517,6 +539,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 25574c0..c1ea33a 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 @@ 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_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); -- 1.9.1