From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9382AA054A; Wed, 15 Jun 2022 09:14:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7704A4281E; Wed, 15 Jun 2022 09:14:59 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 4452F40220; Wed, 15 Jun 2022 09:14:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655277297; x=1686813297; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Tx9tAB1B7cz38Cg90gjI/vIKyqlokj3VbRGwOdZ7y6k=; b=VcSoxyi7t8+8LU5O2+0D7iiWY4HNm/0oJOC67omcQncamoJDf5GhHsBj v1JkYeQLDtEFGgEHSB8ErQBYOSJWBtLS1f6cu2rj26zR3iwXGVDQYPQqW 3ahmkybb6S+/Qdxt1+FBON2z+rm0s8Wy6Paxl3Hc0XvWc6OYQJKz2miXl fJ7RcJE+NQJoPDabw8rSBg0wO2ctymO5NhSgRlDbJCMj8QIVPfq/8uL9G xguYbKCK3JRRSlE/XQdeBuUo5D/01wGi+OGLB3a5idudwxXG1JR/hthcv 8bwDv025XUCpWNp7ts+4c5lhibXWAfFMvLcDdO6YzKbs0hCDJAZ09K8lY g==; X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="365213751" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="365213751" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 00:14:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="762333504" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga005.jf.intel.com with ESMTP; 15 Jun 2022 00:14:54 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 15 Jun 2022 00:14:53 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 15 Jun 2022 00:14:53 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.173) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 15 Jun 2022 00:14:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ivnyACptEyhBgkURUqbqkuOQWv7y4UBd3eSF0vy+bS3ZqBvPDFEgwDnxvDdpfWkIWe5kOGYIbMMeMDNBXkSlu9HZl191NholxfyznGGRXgjEdwuOEyRGlzFfhBNVicV+lCRAan9mAMgkuzjkdFrrToFLgxEEM+U+6hSXFghqgHsWGnGBlgym7uQCURCDK4I9SLgAMuIPR3YJte8lDK94nzmt9fAISI1qfg0/KKnDfLlOBEKRNqTShbWwP2vgA9maq5Gb1CShjIxF/ExeIOckem3so1GpeolRjhPE+WLyPhxKAlMFfo+5/PmANdHVdS5YpcJ7bxgJLtg4OToJF1qcnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zfDrObOQBNtmfcit09Zi71D+X3h5ICqdtUmcNfbkVlY=; b=GwIZCToyGBcLhTtnMgfH7c0czYBSOANPt7xlTUOL9pLJtNG5ISE6eNgORL6crnkI+Cpi4j2aWZEgCoOHbrG2+uq+W05Rst2wtIF25K+bpYLzYOXqdHjHlJEjEFL0g+gbuxG3oS9k0GhduAOZbHp+TwlHoBozbtmdiETcJzuzwE3TaD460ah/zlmUHDaFBzq99oYA3z01KQcsdmOMqJBUIwZxt5G3stcEoO2nroEaQ5HVnIsza06pyeqCHq8jye9iW6ot607/qFlLlvvfO7Z8Vf4mWKI0GNV/oq3WEuvbeYpqNvTHgGsEdsBk53PWOxgVdnRo0QqWkn3sXGejT1OtkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4252.namprd11.prod.outlook.com (2603:10b6:5:201::26) by BN6PR11MB1681.namprd11.prod.outlook.com (2603:10b6:404:3d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Wed, 15 Jun 2022 07:14:49 +0000 Received: from DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::b9d5:600c:9f13:bc96]) by DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::b9d5:600c:9f13:bc96%7]) with mapi id 15.20.5332.023; Wed, 15 Jun 2022 07:14:49 +0000 From: "Xu, Rosen" To: "Huang, Wei" , "dev@dpdk.org" , "thomas@monjalon.net" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" CC: "stable@dpdk.org" , "Zhang, Tianfei" , "Zhang, Qi Z" Subject: RE: [PATCH v7 5/5] raw/ifpga: add HE-HSSI AFU driver Thread-Topic: [PATCH v7 5/5] raw/ifpga: add HE-HSSI AFU driver Thread-Index: AQHYe9LCewQ+FnY7EUuGpS/FGI02fa1QF3zw Date: Wed, 15 Jun 2022 07:14:49 +0000 Message-ID: References: <1654742650-7214-1-git-send-email-wei.huang@intel.com> <1654760242-7832-1-git-send-email-wei.huang@intel.com> <1654760242-7832-6-git-send-email-wei.huang@intel.com> In-Reply-To: <1654760242-7832-6-git-send-email-wei.huang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTYxNzM0YzgtNzY0ZC00OWYyLThhZDUtYjJiYzZlYzE1MTE0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieVwvMkZaUUI1bUErUEhoejRpQWU2ZXp5ODRaK1NhbFBueTRmdThvK0ViZTErRzhVVnNZRnlud01ScTFmcUg1eEsifQ== x-ctpclassification: CTP_NT authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 93fdff09-29c8-4aa4-cd81-08da4e9ebc64 x-ms-traffictypediagnostic: BN6PR11MB1681:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: y8Y4GSNynulY8ashA7ec0mlQl/jHm/ACGtjZZEwUgZ29/OEoOkGcBs/HPpR/58EdDUIGWA99xNScuxdzQ3NrMk7eO2i6Vfas1JzHbBFr+1dgULJRqmhS8e1ed4GoV8ts3io8RYSyIfF1t0D9UUgb1tFpSKJacIBjBPjEiqNPLR5ZKBfGOWqEpxmG7wwTmdTwpYFwIVqCia/RKrBNyGTkI4JXQQIyMPe0WRf3ceCtxKL0WxhnC8YY3ALmtBzaTCr03ViKAgrnNAKxFipVCi1h+fE2/F/ZH0aq/6GNzSTf3yY3KD32ImS6sF1WC1tRp6S8dXtzfyYgNSxY2whGQanKbmiw4vspBG/xRzEXCXTXYVlOWkMe6HWpH2wdnybVYXwsF5Wjx4/Ij3BFB1vYKeBZ13nujKKW0RrpplGBM4M1BMRwLcIdlpC+RhmL6cJaziGv2HF9NuzJrdZsvjBSRpMEbF6zYwu7XdAB+wEHiSw3NHdJDGC52mAmv5OCEPCmPrCj96iSGb3D5B6l9ayoxlxBHU2bOuiH8W6qtTAUeBZjDnjusr2hZZY5reX+fKyyJXOmAc/kHgfH09fw9GsMU7A7XkjnxMfahTWEw1iRc+bO8HzLVh0UHw8zab58XMaY3gJhxGo3KtoXLarb9a+tUaogEgEPsm54IJcLnU7P3xn387ZnZTMfyeoHGAerOA0yvVJypoVDQU3mTsVPH+CAweBYpiJv2br4vzoiVVNv09RvPos= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4252.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(30864003)(5660300002)(8936002)(52536014)(86362001)(53546011)(55016003)(2906002)(4326008)(8676002)(83380400001)(38070700005)(82960400001)(122000001)(33656002)(38100700002)(66556008)(66446008)(71200400001)(508600001)(64756008)(66946007)(76116006)(54906003)(6506007)(110136005)(316002)(7696005)(186003)(107886003)(26005)(9686003)(66476007)(473944003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QrW2iEk/+bvDa6ctQHxWR+rxFXIjltv2SErH+Fi3XdCeJZQVP4n/wzvsEhBh?= =?us-ascii?Q?GEpNhzMMarJn48UHZaMPm0siE67F9/o7lDv1qLTs9PucFtcVNZSoqn171REY?= =?us-ascii?Q?9PE3dEloQihVUHo590mFuY7NPvHcrcBwxmfvFGiJSKEfSMnYucI9gpETew2Q?= =?us-ascii?Q?rOjL6BNSTM57P5oRL3njZVgjlc8gJC6kT3uf6uVxxQ4592h7upghpAe6M94x?= =?us-ascii?Q?NfEbXS0WB1tlyGnW616SrsjCZiN8YblN3YTH4k4PWcL+dJtorIRA5RJcN4Mo?= =?us-ascii?Q?Gw0zG1vz39RQrZXQwweMAR2AR29rH4Lk+hRfFSFa96PA8R7mN9mmt8HRxh4T?= =?us-ascii?Q?+SrQUw6m8uFw4UHIwIBlptcUbXD46AgXQC3Hzsq6vvSRc8ttwh5xxs5xwkCI?= =?us-ascii?Q?141XQDCHlImhV1iy+Qe35Iocinuj/0roO149+wGt63j2cQoK9Kyn1lyPgqq6?= =?us-ascii?Q?SHwQ6yWb6h0pIYVkXjXvwX1OwICKEnhE7UnvJfFkVgY7Ucy4uDplSNU1lvX/?= =?us-ascii?Q?+YzE0shv0QFVMEP2mHs6MUqsmAUfhr4VG66hg5aznlWpD1eUcRK6k+F1JmLa?= =?us-ascii?Q?FPvqONiHolVcP2VHIDJ9eL2Xcu0MHz0Se9qEGMIxDl8I2cdOMgP8vFyLDznL?= =?us-ascii?Q?CYAPzse6s3PZrBWa/Wxa17HQnpUZvDlTajl11MRFoSFoZwV7eg+SowIr/XsZ?= =?us-ascii?Q?52TgqlwxE4lhBK4XiX3Z474L89Hf9cwebMwli33ykjzRpy8FuEd+jVgKryig?= =?us-ascii?Q?t9dqlpVu6vShj3SmQfSn3MAEn80GoA3rdkypLEKMrpREDLTgZzCl6huSRZqi?= =?us-ascii?Q?6yrqtnQr1NheHYg7HrsfMMR5eO8s/gsclE3NNRy24JuiO/v5YAVSgzhtA7Zy?= =?us-ascii?Q?wF36YsRISTHqLCpZFtFe7NJ3PriZV1fseeAtka83XQVcMMZME1aOa5aeps76?= =?us-ascii?Q?9YrORAiSD/cMOqBLrvgu0fccMiHTEvSx0UbsjQW58HRSqpjbqg4AxJpDRiYV?= =?us-ascii?Q?RRQXezwxohZzhL42g22RglsoTOx8b1Q1WbwUFBB4zKNAxRZFtUPrR6gUdb3k?= =?us-ascii?Q?Uf4l6r2K9qrpY9EpHA5DcZZ4sPJ0/TzuNDk8DE/JoRhQwjCRhiC5OTzd9NUV?= =?us-ascii?Q?P6kp7WDnY7+KMnB/uzN/7yYaBAPJe+pjUuOq+L65BtGi9XtaI7G330TeCMEo?= =?us-ascii?Q?7pnGSrBHMMMCcZ6rCqIz6suZnIyu0xU+vf4cghCqYC7P0E7yvkzb9g+Mo87j?= =?us-ascii?Q?ipFQvQnhR9twpRzaqabmmgKo3ZBKne8RPjo1+Y+NtCeAr6PzXyUn/ki4l4T0?= =?us-ascii?Q?TC94vE2zyELG0RCJY8b1mbweeHNbZSerH4mFWTGqaxDK0waptleC6eUHfhZJ?= =?us-ascii?Q?mwvG6PrqNQaRSwt9qO9Js2b80sUHpRelOrf4dbH5Ur476EzPiEV4sKtphdKD?= =?us-ascii?Q?U3eIqLTVOuaa6cv07jPGEisx7c59sHBpXbK9iQg74z+49umYaVvPsu/zjM8W?= =?us-ascii?Q?4DMifftgzCI/kfDC3wk0QXl2Ea4E2egwddbyHjs96BLVhq+R+uf28AtYnFCM?= =?us-ascii?Q?Cx/YsRs+XK66GdfKv7nqQPHs7mOEgLCzI2sguKMyO/cofk9I4A0YCGc/OfLo?= =?us-ascii?Q?gA8zzDddJ0bB8uO67WuAkSKmTp5QnoOBUoo9IF1siMahFDrFc1JQs0GU5CaO?= =?us-ascii?Q?JWrcpK0mbeu6kqwhCZjwV6cC1xTReb0mZGiTtKMSyc5EnCeG6FXrO3EMuAAr?= =?us-ascii?Q?RuoT5pkGwQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4252.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93fdff09-29c8-4aa4-cd81-08da4e9ebc64 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jun 2022 07:14:49.8243 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7N6p5XavrVKuq1fmZD4H4i1jsBqYynUnm2+bXe7s4kNGrC+kCuS4DNKALSCyYBZHx9VYDjawn8jAHtdXMFeFrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1681 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Wei, > -----Original Message----- > From: Huang, Wei > Sent: Thursday, June 09, 2022 15:37 > To: dev@dpdk.org; thomas@monjalon.net; nipun.gupta@nxp.com; > hemant.agrawal@nxp.com > Cc: stable@dpdk.org; Xu, Rosen ; Zhang, Tianfei > ; Zhang, Qi Z ; Huang, Wei > > Subject: [PATCH v7 5/5] raw/ifpga: add HE-HSSI AFU driver >=20 > HE-HSSI is one of the host exerciser modules in OFS FPGA, which is used t= o > test HSSI (High Speed Serial Interface). > This driver initialize the module and report test result. >=20 > Signed-off-by: Wei Huang > --- > v2: move source files to ifpga and rename, refine code > --- > drivers/raw/ifpga/afu_pmd_he_hssi.c | 371 > ++++++++++++++++++++++++++++++++++++ > drivers/raw/ifpga/afu_pmd_he_hssi.h | 109 +++++++++++ > drivers/raw/ifpga/meson.build | 3 +- > drivers/raw/ifpga/rte_pmd_afu.h | 18 ++ > 4 files changed, 500 insertions(+), 1 deletion(-) create mode 100644 > drivers/raw/ifpga/afu_pmd_he_hssi.c > create mode 100644 drivers/raw/ifpga/afu_pmd_he_hssi.h >=20 > diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c > b/drivers/raw/ifpga/afu_pmd_he_hssi.c > new file mode 100644 > index 0000000..102de50 > --- /dev/null > +++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c > @@ -0,0 +1,371 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2022 Intel Corporation > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "afu_pmd_core.h" > +#include "afu_pmd_he_hssi.h" > + > +static int he_hssi_indirect_write(struct he_hssi_ctx *ctx, uint32_t addr= , > + uint32_t value) > +{ > + struct traffic_ctrl_cmd cmd; > + struct traffic_ctrl_data data; > + uint32_t i =3D 0; > + > + IFPGA_RAWDEV_PMD_DEBUG("Indirect write 0x%x, value 0x%08x", > addr, > +value); > + > + if (!ctx) > + return -EINVAL; > + > + data.write_data =3D value; > + rte_write64(data.csr, ctx->addr + TRAFFIC_CTRL_DATA); > + > + cmd.csr =3D 0; > + cmd.write_cmd =3D 1; > + cmd.afu_cmd_addr =3D addr; > + rte_write64(cmd.csr, ctx->addr + TRAFFIC_CTRL_CMD); > + > + while (i < MAILBOX_TIMEOUT_MS) { > + rte_delay_ms(MAILBOX_POLL_INTERVAL_MS); > + cmd.csr =3D rte_read64(ctx->addr + TRAFFIC_CTRL_CMD); > + if (cmd.ack_trans) > + break; > + i +=3D MAILBOX_POLL_INTERVAL_MS; > + } > + if (i >=3D MAILBOX_TIMEOUT_MS) > + return -ETIMEDOUT; > + > + i =3D 0; > + cmd.csr =3D 0; > + while (i < MAILBOX_TIMEOUT_MS) { > + cmd.ack_trans =3D 1; > + rte_write64(cmd.csr, ctx->addr + TRAFFIC_CTRL_CMD); > + rte_delay_ms(MAILBOX_POLL_INTERVAL_MS); > + cmd.csr =3D rte_read64(ctx->addr + TRAFFIC_CTRL_CMD); > + if (!cmd.ack_trans) > + break; > + i +=3D MAILBOX_POLL_INTERVAL_MS; > + } > + if (i >=3D MAILBOX_TIMEOUT_MS) > + return -ETIMEDOUT; > + > + return 0; > +} > + > +static int he_hssi_indirect_read(struct he_hssi_ctx *ctx, uint32_t addr, > + uint32_t *value) > +{ > + struct traffic_ctrl_cmd cmd; > + struct traffic_ctrl_data data; > + uint32_t i =3D 0; > + > + if (!ctx) > + return -EINVAL; > + > + cmd.csr =3D 0; > + cmd.read_cmd =3D 1; > + cmd.afu_cmd_addr =3D addr; > + rte_write64(cmd.csr, ctx->addr + TRAFFIC_CTRL_CMD); > + > + while (i < MAILBOX_TIMEOUT_MS) { > + rte_delay_ms(MAILBOX_POLL_INTERVAL_MS); > + cmd.csr =3D rte_read64(ctx->addr + TRAFFIC_CTRL_CMD); > + if (cmd.ack_trans) { > + data.csr =3D rte_read64(ctx->addr + > TRAFFIC_CTRL_DATA); > + *value =3D data.read_data; > + break; > + } > + i +=3D MAILBOX_POLL_INTERVAL_MS; > + } > + if (i >=3D MAILBOX_TIMEOUT_MS) > + return -ETIMEDOUT; > + > + i =3D 0; > + cmd.csr =3D 0; > + while (i < MAILBOX_TIMEOUT_MS) { > + cmd.ack_trans =3D 1; > + rte_write64(cmd.csr, ctx->addr + TRAFFIC_CTRL_CMD); > + rte_delay_ms(MAILBOX_POLL_INTERVAL_MS); > + cmd.csr =3D rte_read64(ctx->addr + TRAFFIC_CTRL_CMD); > + if (!cmd.ack_trans) > + break; > + i +=3D MAILBOX_POLL_INTERVAL_MS; > + } > + if (i >=3D MAILBOX_TIMEOUT_MS) > + return -ETIMEDOUT; > + > + IFPGA_RAWDEV_PMD_DEBUG("Indirect read 0x%x, value 0x%08x", > addr, *value); > + return 0; > +} > + > +static void he_hssi_report(struct he_hssi_ctx *ctx) { > + uint32_t val =3D 0; > + uint64_t v64 =3D 0; > + int ret =3D 0; > + > + ret =3D he_hssi_indirect_read(ctx, TM_PKT_GOOD, &val); > + if (ret) > + return; > + printf("Number of good packets received: %u\n", val); > + > + ret =3D he_hssi_indirect_read(ctx, TM_PKT_BAD, &val); > + if (ret) > + return; > + printf("Number of bad packets received: %u\n", val); > + > + ret =3D he_hssi_indirect_read(ctx, TM_BYTE_CNT1, &val); > + if (ret) > + return; > + v64 =3D val; > + ret =3D he_hssi_indirect_read(ctx, TM_BYTE_CNT0, &val); > + if (ret) > + return; > + v64 =3D (v64 << 32) | val; > + printf("Number of bytes received: %"PRIu64"\n", v64); > + > + ret =3D he_hssi_indirect_read(ctx, TM_AVST_RX_ERR, &val); > + if (ret) > + return; > + if (val & ERR_VALID) { > + printf("AVST rx error:"); > + if (val & OVERFLOW_ERR) > + printf(" overflow"); > + if (val & LENGTH_ERR) > + printf(" length"); > + if (val & OVERSIZE_ERR) > + printf(" oversize"); > + if (val & UNDERSIZE_ERR) > + printf(" undersize"); > + if (val & MAC_CRC_ERR) > + printf(" crc"); > + if (val & PHY_ERR) > + printf(" phy"); > + printf("\n"); > + } > + > + ret =3D he_hssi_indirect_read(ctx, LOOPBACK_FIFO_STATUS, &val); > + if (ret) > + return; > + if (val & (ALMOST_EMPTY | ALMOST_FULL)) { > + printf("FIFO status:"); > + if (val & ALMOST_EMPTY) > + printf(" almost empty"); > + if (val & ALMOST_FULL) > + printf(" almost full"); > + printf("\n"); > + } > +} > + > +static int he_hssi_test(struct afu_rawdev *dev) { > + struct he_hssi_priv *priv =3D NULL; > + struct rte_pmd_afu_he_hssi_cfg *cfg =3D NULL; > + struct he_hssi_ctx *ctx =3D NULL; > + struct traffic_ctrl_ch_sel sel; > + uint32_t val =3D 0; > + uint32_t i =3D 0; > + int ret =3D 0; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_hssi_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + cfg =3D &priv->he_hssi_cfg; > + ctx =3D &priv->he_hssi_ctx; > + > + ret =3D he_hssi_indirect_write(ctx, TG_STOP_XFR, 0); > + if (ret) > + return ret; > + > + sel.channel_sel =3D cfg->port; > + rte_write64(sel.csr, ctx->addr + TRAFFIC_CTRL_CH_SEL); > + > + if (cfg->he_loopback >=3D 0) { > + val =3D cfg->he_loopback ? 1 : 0; > + IFPGA_RAWDEV_PMD_INFO("%s HE loopback on port %u", > + val ? "Enable" : "Disable", cfg->port); > + return he_hssi_indirect_write(ctx, LOOPBACK_EN, val); > + } > + > + ret =3D he_hssi_indirect_write(ctx, TG_NUM_PKT, cfg->num_packets); > + if (ret) > + return ret; > + > + ret =3D he_hssi_indirect_write(ctx, TG_PKT_LEN, cfg->packet_length); > + if (ret) > + return ret; > + > + val =3D cfg->src_addr & 0xffffffff; > + ret =3D he_hssi_indirect_write(ctx, TG_SRC_MAC_L, val); > + if (ret) > + return ret; > + val =3D (cfg->src_addr >> 32) & 0xffff; > + ret =3D he_hssi_indirect_write(ctx, TG_SRC_MAC_H, val); > + if (ret) > + return ret; > + > + val =3D cfg->dest_addr & 0xffffffff; > + ret =3D he_hssi_indirect_write(ctx, TG_DST_MAC_L, val); > + if (ret) > + return ret; > + val =3D (cfg->dest_addr >> 32) & 0xffff; > + ret =3D he_hssi_indirect_write(ctx, TG_DST_MAC_H, val); > + if (ret) > + return ret; > + > + val =3D cfg->random_length ? 1 : 0; > + ret =3D he_hssi_indirect_write(ctx, TG_PKT_LEN_TYPE, val); > + if (ret) > + return ret; > + > + val =3D cfg->random_payload ? 1 : 0; > + ret =3D he_hssi_indirect_write(ctx, TG_DATA_PATTERN, val); > + if (ret) > + return ret; > + > + for (i =3D 0; i < TG_NUM_RND_SEEDS; i++) { > + ret =3D he_hssi_indirect_write(ctx, TG_RANDOM_SEED(i), > + cfg->rnd_seed[i]); > + if (ret) > + return ret; > + } > + > + ret =3D he_hssi_indirect_write(ctx, TG_START_XFR, 1); > + if (ret) > + return ret; > + > + while (i++ < cfg->timeout) { > + ret =3D he_hssi_indirect_read(ctx, TG_PKT_XFRD, &val); > + if (ret) > + break; > + if (val =3D=3D cfg->num_packets) > + break; > + sleep(1); > + } > + > + he_hssi_report(ctx); > + > + return ret; > +} > + > +static int he_hssi_init(struct afu_rawdev *dev) { > + struct he_hssi_priv *priv =3D NULL; > + struct he_hssi_ctx *ctx =3D NULL; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_hssi_priv *)dev->priv; > + if (!priv) { > + priv =3D rte_zmalloc(NULL, sizeof(struct he_hssi_priv), 0); > + if (!priv) > + return -ENOMEM; > + dev->priv =3D priv; > + } > + > + ctx =3D &priv->he_hssi_ctx; > + ctx->addr =3D (uint8_t *)dev->addr; > + > + return 0; > +} > + > +static int he_hssi_config(struct afu_rawdev *dev, void *config, > + size_t config_size) > +{ > + struct he_hssi_priv *priv =3D NULL; > + struct rte_pmd_afu_he_hssi_cfg *cfg =3D NULL; > + > + if (!dev || !config || !config_size) > + return -EINVAL; > + > + priv =3D (struct he_hssi_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + if (config_size !=3D sizeof(struct rte_pmd_afu_he_hssi_cfg)) > + return -EINVAL; > + > + cfg =3D (struct rte_pmd_afu_he_hssi_cfg *)config; > + if (cfg->port >=3D NUM_HE_HSSI_PORTS) > + return -EINVAL; > + > + rte_memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg)); > + > + return 0; > +} > + > +static int he_hssi_close(struct afu_rawdev *dev) { > + if (!dev) > + return -EINVAL; > + > + rte_free(dev->priv); > + dev->priv =3D NULL; > + > + return 0; > +} > + > +static int he_hssi_dump(struct afu_rawdev *dev, FILE *f) { > + struct he_hssi_priv *priv =3D NULL; > + struct he_hssi_ctx *ctx =3D NULL; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_hssi_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + if (!f) > + f =3D stdout; > + > + ctx =3D &priv->he_hssi_ctx; > + > + fprintf(f, "addr:\t\t%p\n", (void *)ctx->addr); > + > + return 0; > +} > + > +static struct afu_ops he_hssi_ops =3D { > + .init =3D he_hssi_init, > + .config =3D he_hssi_config, > + .start =3D NULL, > + .stop =3D NULL, > + .test =3D he_hssi_test, > + .close =3D he_hssi_close, > + .dump =3D he_hssi_dump, > + .reset =3D NULL > +}; > + > +struct afu_rawdev_drv he_hssi_drv =3D { > + .uuid =3D { HE_HSSI_UUID_L, HE_HSSI_UUID_H }, > + .ops =3D &he_hssi_ops > +}; > + > +AFU_PMD_REGISTER(he_hssi_drv); > diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.h > b/drivers/raw/ifpga/afu_pmd_he_hssi.h > new file mode 100644 > index 0000000..38b433c > --- /dev/null > +++ b/drivers/raw/ifpga/afu_pmd_he_hssi.h > @@ -0,0 +1,109 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2022 Intel Corporation > + */ > + > +#ifndef _AFU_PMD_HE_HSSI_H_ > +#define _AFU_PMD_HE_HSSI_H_ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include "afu_pmd_core.h" > +#include "rte_pmd_afu.h" > + > +#define HE_HSSI_UUID_L 0xbb370242ac130002 > +#define HE_HSSI_UUID_H 0x823c334c98bf11ea > +#define NUM_HE_HSSI_PORTS 8 > + > +/* HE-HSSI registers definition */ > +#define TRAFFIC_CTRL_CMD 0x30 > +#define TRAFFIC_CTRL_DATA 0x38 > +#define TRAFFIC_CTRL_CH_SEL 0x40 > +#define AFU_SCRATCHPAD 0x48 > + > +#define TG_NUM_PKT 0x3c00 > +#define TG_PKT_LEN_TYPE 0x3c01 > +#define TG_DATA_PATTERN 0x3c02 > +#define TG_START_XFR 0x3c03 > +#define TG_STOP_XFR 0x3c04 > +#define TG_SRC_MAC_L 0x3c05 > +#define TG_SRC_MAC_H 0x3c06 > +#define TG_DST_MAC_L 0x3c07 > +#define TG_DST_MAC_H 0x3c08 > +#define TG_PKT_XFRD 0x3c09 > +#define TG_NUM_RND_SEEDS 3 > +#define TG_RANDOM_SEED(n) (0x3c0a + (n)) > +#define TG_PKT_LEN 0x3c0d > + > +#define TM_NUM_PKT 0x3d00 > +#define TM_PKT_GOOD 0x3d01 > +#define TM_PKT_BAD 0x3d02 > +#define TM_BYTE_CNT0 0x3d03 > +#define TM_BYTE_CNT1 0x3d04 > +#define TM_AVST_RX_ERR 0x3d07 > +#define OVERFLOW_ERR (1 << 9) > +#define LENGTH_ERR (1 << 8) > +#define OVERSIZE_ERR (1 << 7) > +#define UNDERSIZE_ERR (1 << 6) > +#define MAC_CRC_ERR (1 << 5) > +#define PHY_ERR (1 << 4) > +#define ERR_VALID (1 << 3) > + > +#define LOOPBACK_EN 0x3e00 > +#define LOOPBACK_FIFO_STATUS 0x3e01 > +#define ALMOST_EMPTY (1 << 1) > +#define ALMOST_FULL (1 << 0) > + > +#define MAILBOX_TIMEOUT_MS 100 > +#define MAILBOX_POLL_INTERVAL_MS 10 > + > +struct traffic_ctrl_cmd { > + union { > + uint64_t csr; > + struct { > + uint32_t read_cmd:1; > + uint32_t write_cmd:1; > + uint32_t ack_trans:1; > + uint32_t rsvd1:29; > + uint32_t afu_cmd_addr:16; > + uint32_t rsvd2:16; > + }; > + }; > +}; > + > +struct traffic_ctrl_data { > + union { > + uint64_t csr; > + struct { > + uint32_t read_data; > + uint32_t write_data; > + }; > + }; > +}; > + > +struct traffic_ctrl_ch_sel { > + union { > + uint64_t csr; > + struct { > + uint32_t channel_sel:3; > + uint32_t rsvd1:29; > + uint32_t rsvd2; > + }; > + }; > +}; > + > +struct he_hssi_ctx { > + uint8_t *addr; > +}; > + > +struct he_hssi_priv { > + struct rte_pmd_afu_he_hssi_cfg he_hssi_cfg; > + struct he_hssi_ctx he_hssi_ctx; > +}; > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _AFU_PMD_HE_HSSI_H_ */ > diff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.buil= d > index dc6941d..cc30dc8 100644 > --- a/drivers/raw/ifpga/meson.build > +++ b/drivers/raw/ifpga/meson.build > @@ -14,7 +14,8 @@ deps +=3D ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvarg= s', > 'bus_vdev', 'bus_ifpga', 'net', 'net_i40e', 'net_ipn3ke'] >=20 > sources =3D files('ifpga_rawdev.c', 'rte_pmd_ifpga.c', 'afu_pmd_core.c', > - 'afu_pmd_n3000.c', 'afu_pmd_he_lpbk.c', 'afu_pmd_he_mem.c') > + 'afu_pmd_n3000.c', 'afu_pmd_he_lpbk.c', 'afu_pmd_he_mem.c', > + 'afu_pmd_he_hssi.c') >=20 > includes +=3D include_directories('base') includes +=3D > include_directories('../../net/ipn3ke') > diff --git a/drivers/raw/ifpga/rte_pmd_afu.h > b/drivers/raw/ifpga/rte_pmd_afu.h index 213e854..b1cebbe 100644 > --- a/drivers/raw/ifpga/rte_pmd_afu.h > +++ b/drivers/raw/ifpga/rte_pmd_afu.h > @@ -111,6 +111,24 @@ struct rte_pmd_afu_he_mem_tg_cfg { > uint32_t channel_mask; /* mask of traffic generator channel */ > }; >=20 > +#define NUM_RND_SEEDS 3 > + > +/** > + * HE-HSSI AFU configuration data structure. > + */ > +struct rte_pmd_afu_he_hssi_cfg { > + uint32_t port; > + uint32_t timeout; > + uint32_t num_packets; > + uint32_t random_length; > + uint32_t packet_length; > + uint32_t random_payload; > + uint32_t rnd_seed[NUM_RND_SEEDS]; > + uint64_t src_addr; > + uint64_t dest_addr; > + int he_loopback; > +}; > + > #ifdef __cplusplus > } > #endif > -- > 1.8.3.1 Reviewed-by: Rosen Xu