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 EE5BDA0557; Fri, 10 Jun 2022 08:12:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE0F3427F6; Fri, 10 Jun 2022 08:12:30 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id BA81B40221; Fri, 10 Jun 2022 08:12:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654841549; x=1686377549; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=aILQaMhqgLSjf/ho1cVhfn2NXQoVPuIQHzlQZhahXpU=; b=W8Co+O28/KiWBX5zJXKpl00R33b3DPUevjxMNGctf3xR0kzEmpOhjcM4 blOgm3tIgwu/Qk4NAulAxXeXr7gTWd8U09MKxurjNR9gY1LJso4ww8ynJ jQSFiDhWVcWpHfK91egCMOActhrjca2jzlkZEKNR+wJ1QQry9osPTaoW1 8hhBUZYD+5wzJ8D4H/RWtfW9n3/9Ib/G5UgrbxH7Fj6j0Xf+upnxksego IC5KHq1nV4Ow6rkEEprdqiyeXtDxHDIAhR+WbC41XmnjwbNmA+xXMqAwl vx4MQbphhvBBb9M+0lWzKueURAXgg0tiD1DJdxAYr3tRPQf94LBWlwbma w==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="276303617" X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="276303617" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 23:12:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="908750410" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 09 Jun 2022 23:12:27 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 9 Jun 2022 23:12:27 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 9 Jun 2022 23:12:27 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 9 Jun 2022 23:12:27 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.171) 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; Thu, 9 Jun 2022 23:12:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GBMBeDe35Abo5Yt/+VfZpYFgScZFleBeRUV6ocpAlfrcSB6/T8d+RWh9B4n8TN6WhhcJ7rri9m4S+gz+5/iufvo9VEcDc0d/xygnjwaRCgDrhFY9b6jwyUraNosQSe29/FvfONhYsvSojPLYOa/jVaRr0/5M+kUWTIlFwce0LFcM87UxwEujjDYfrvS972xUCIn2ztVyprMCqfrnujGzVtswxfTcl0lsQeE9MDs9UVomU527kUYUl26rYAYgI2xB7VNeGchFY4ZFQBjKTNFfgqDgx0hSA4M76M20lMNSdtYc7KSexwbGHCiGcQ5XqTGcRH2DEbiE6/nCqsBRRci7dA== 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=mRKa1eLSUOFW1zVvw4WAAsFEAVv0bcWDq4JWKiu/a7M=; b=WBeWG+itg4IVbP7+vJSQ05ymaBYGaG70VN29t3N3w1UbINS8KlZg9S5WZE/YSAoa4EiyKNJL0HhO2uhWUI8sMjbmADU/vD4tWdrYc09DkmfT/RqJo/UkPN+b967DWOEVwRUPc6sZCClWzySZkRuSz9ACG78gX4ZMUSszTUeKjpAvFJnw+J9xfxjNDE+v7rHR1pM1QFVdx43LXbT1T7DG9FFT9Leox8MDCJgH/F3H5j2Ls+z0A6mTDVDiCIb/9un+g98yPctMh2+u68TcWgQdb0gLH57bLHpdCtlnj9qpJg9pzVFSkOuK8kgAjTX6D17PXJH8NFBkz3goiJlpJi0RIg== 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 BL1PR11MB5477.namprd11.prod.outlook.com (2603:10b6:208:31f::19) by BL0PR11MB3233.namprd11.prod.outlook.com (2603:10b6:208:68::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Fri, 10 Jun 2022 06:12:24 +0000 Received: from BL1PR11MB5477.namprd11.prod.outlook.com ([fe80::d866:27cd:1ae5:db2c]) by BL1PR11MB5477.namprd11.prod.outlook.com ([fe80::d866:27cd:1ae5:db2c%5]) with mapi id 15.20.5332.013; Fri, 10 Jun 2022 06:12:24 +0000 From: "Zhang, Tianfei" To: "Huang, Wei" , "dev@dpdk.org" , "thomas@monjalon.net" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" CC: "stable@dpdk.org" , "Xu, Rosen" , "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: AQHYe9LCih9ZJQPEg0Wnay9jO2ElBa1IKmLw Date: Fri, 10 Jun 2022 06:12:24 +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: zh-CN, 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 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: bf3abff8-a22f-4813-d369-08da4aa83003 x-ms-traffictypediagnostic: BL0PR11MB3233: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: TsRxvWvrVp9Igti/p49ir4V7vkh/iw1ynMlLxoieC/emWiQmZtTTaY5PneHGjdRSavtrfu6eNg88EDcDzGqKE5VXD5T3wuQjgbnvClwB2ctXTxYSienrE44oOzidWplvvAUizrHGSJRxBCOVu9sHwoQn2e+4c+LckGHOLL8Jl59h4nUjg4OrH1YzRi//Y55iTaK937Bq6CXvFyZ/SiB1td+DWAF+HZak1b7Y5OeBPWVlOE6CSxCU+rE9vXNRNDNfHSH0KzSGxFrvalogPzeVxvBLo7WXsEDvQoIjJF9w0K05ioQG3NRZNSR3KqIY7OrxSMhoavjstle2ZwrLiQmU0E28JOlg+CDvVq4RzV61b3MXj3DWz2+eCHUOfH51HHavVme4cCimOrxFf2tXScnOZOvopxmHDGli7R0W1Osd5uFfoMCGjWtw9FpSRHJR/ksdI0lhDxGArbflzHRqgKrjyNZbsUsI5FL8rpXVp4SWbrsYSy83iUZg5wdRnMcIvktytpwCox4M+683Cxlyo/eu8bRZetcmZdbkoy+Uf9p94Y7v0S+Ovz9cmp3exXNk+mdsmN6rttN+OQ8fb3gh+JHz/UEg6I/QiKWG40UMjVj2qGkPn+5PpEoxOJMdfrtSdw8Jgg8YmLzFRnrJhjim3+tNeQOYt3AarZNfyA3PDMLtgJIPLETeS8DBZSKSguHjL85vF+WMjhiEac9oyf+1QTry9Lhh5cGlZ/F0B3DYHLD3Uvw= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL1PR11MB5477.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(86362001)(2906002)(8676002)(4326008)(122000001)(38100700002)(38070700005)(316002)(66446008)(64756008)(66946007)(66476007)(66556008)(76116006)(82960400001)(55016003)(8936002)(52536014)(54906003)(71200400001)(30864003)(110136005)(5660300002)(33656002)(83380400001)(7696005)(6506007)(53546011)(186003)(107886003)(9686003)(473944003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 2 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?AphysbSqve4W2EyxsWzdBbTqxVAzJLFoaAz84P8Yvwgua4hFcKK1ikh/+dnq?= =?us-ascii?Q?/NdP9IUNP7qDXjiuLlECoadAAVpAdjFJqxMLrCFcqZaj6DkhNdukT4hl1pva?= =?us-ascii?Q?i0+90CARsSmyZWBIIltvHSrBp+MvXZGwWb8EmMXZ8MR8mbo8lALexJgYRph7?= =?us-ascii?Q?yUTrtYjQjuVxdGTCLQ54H3E1cNNkoAMX+bRrBgwlHqTOAb7YiF4OofzVWQyu?= =?us-ascii?Q?F2TfgHtYoL8i9SG0ReRrbRbDomG0pjvxtSb+wvS9WLi/0ywLdLBvSffQTrBv?= =?us-ascii?Q?ZAmJRLYkit0Kyi9OdVnYe0shw8OcBSfG54WuqwoTjDGb6TDtOtozrkP9exIB?= =?us-ascii?Q?kR9OCheE5F7or6JQV/3+2xZuJE9IwT4Hcef5SIVj/hrU1PADuTRUpkhORFRK?= =?us-ascii?Q?6rEIOR/TYZxS12kYhjUqEzXyzsZnygaV9k5rV9v0MZEacC8h/EvkZBkLZnZw?= =?us-ascii?Q?+pYQ/Ak32ZuWpbV4lIYbranwrY8KYxCSWBhccSCCKrpqc1MGJnKbthefWW0P?= =?us-ascii?Q?PizSkFAeK/moHdtEVYXH7YRs7sUkkepvKIv6ml3t2dS5X5zcjJCqbAtt5Zk7?= =?us-ascii?Q?rA2MpdnIjSB67j7cbD66CukfeMS7p0+DaMdATA8CAMlMVgJpa1kG8zc7Jpsr?= =?us-ascii?Q?Td2UlCgw6Dq4oT0SU+D6Maddzytzhg2k0xZ0Q2cX9iyXFkdY8xTZuMPABrAe?= =?us-ascii?Q?v0t1S2Fy1lbZIF7axsMY+U3+TxcuslGAU9Hw2wYkWOzTlWN9QZxJ5fI30Tqz?= =?us-ascii?Q?6y37tZ7BLY0ExLbjds/iUJPKGKCd+fQj1qxjG2rqtaugebmKlVKqynOtafoO?= =?us-ascii?Q?DA5RxWVz0VhRUNNbIp39Uz01ADjZtrAyT5rFIoDDHeDhGDK6TpCgpzvXhNL8?= =?us-ascii?Q?yljgdZr7zZiQ8Ub9pJphyY9Qye1nzvyGCFtG1PLFNBLT0ynNY173/nY57r7L?= =?us-ascii?Q?v9uyhmpF//z3bYkrn2Tz2nCkfpUeLQq4PtvxvG/+z/3bHpAAiPploUFhsBch?= =?us-ascii?Q?lfcJA2+4wx80ybABmfoLUIG1/StLp6Dg6V+oYh5gmGXJwZa8/Z189358ljfw?= =?us-ascii?Q?0zrrcQUMK/aY0ai6mHrKi8Z62ugFWXIOyc0z3+YoiXuvEGcUKwhfSvRMN4aD?= =?us-ascii?Q?RNWvmZpm6Xen1/gbWy9KMJ2CDWUjnEHkN2v201EAkSv20yGYH6cvl3pq9p5Z?= =?us-ascii?Q?HA49F2UjXrhPtVFb5agLf/zWxuM29/ZEJdhq+RPOCmKacCUQIObBRWi3nvOu?= =?us-ascii?Q?K1nqij0FmkqnVBw6N5ZCmSQvNdnLAN3G2feJoxqbWXdP4/zA/EXuDfBiRw9t?= =?us-ascii?Q?BCKnSc2txinWoLTGJtCWmKBu20VzkdPy3m6PnbYDLNvyJtYASKtlYMCPlifa?= =?us-ascii?Q?PpYiQTrJdW65f7q/ODTEXAxmeUp+0EpDcMqJt6u0MoxiW9javp/pBR4VcItN?= =?us-ascii?Q?3NAHx+VrjXysPbI1d+LMd1x+RO9vBYNkVq7RofakuC9wnGJwsA2VAduMigPy?= =?us-ascii?Q?QJLIBZzBtCgflUBGeEb824lh85iEioUwysBS2neoESeHk2kA2coSB+mR30CG?= =?us-ascii?Q?j9hvddbzaXO4zjZlJMaRSfOA822v3WGHETGYPj4jnPyqcoiZD/UkHZpJ7Fi5?= =?us-ascii?Q?iLr5ra/0IA44Ng0KnjGTN+UUrzmcK0iGxHmgK3ys9xGGj5VQmHWolcnwO+xQ?= =?us-ascii?Q?LxlRgkNCPdBw7gciJPeViZY9g2AlBDRVA4/MHyGwGBOdLXBm9vZpDz0sjDwW?= =?us-ascii?Q?WAauDSVhevfImdTuQrx3YpvavVIa3Jqp1QjGuv+M4shwL/773BbIAgKj6/JX?= x-ms-exchange-antispam-messagedata-1: 1f4NZyytYtto0r045ui3dU2F2s4dPiocV0o= 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: BL1PR11MB5477.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf3abff8-a22f-4813-d369-08da4aa83003 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jun 2022 06:12:24.6396 (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: 0O6M7h10oVUJRNn1zLg2C0MusnqooWhKY8R46oFBAjmLojVrJmgNWwWyDndv8NS1SZVcfPYEpa/xc4eo7/c70A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3233 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 > -----Original Message----- > From: Huang, Wei > Sent: Thursday, June 9, 2022 3:37 PM > 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 > -- It looks good for me, you can add: Acked-by: Tianfei Zhang