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 D4510A054A for ; Wed, 15 Jun 2022 09:13:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA0174280E; Wed, 15 Jun 2022 09:13:14 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 284D940220; Wed, 15 Jun 2022 09:13:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655277191; x=1686813191; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=XZ0qnvF1yZzezQf0xdoZzILNahUd+k0FLI5y/jYKoJ8=; b=BmdldsK9/7tK1GXNtvR86LQZT0jEW2Y/n3HM7RSc7ftQEMjvZwr16TiX 9CLq00vbRK6+JHzdOMjdjgYeXPyGN+C7gKd3acHOzPgyMw2bt8nRlMEXr eCnMiAlK63s7ieIm6yYrQKIG7/fMIQ4lNcasnwvyPZyiU9ch2pDuEsfEK AzKKFrIfFr4OL0X5NmEsy6jDTUxksTlVB8Yg7gTh97MQUfnrw0u2EAxes o/0xfEoGmE5+YM3r/T7MuzfrQck8c8g1BGggNPALaMM9w11eidPzHLklW /zJyODqmiN41kzA2FRna295frlBIfp3URae283R0o83cbQOx/djm6qlGz A==; X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="365213360" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="365213360" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 00:13:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="727242770" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga001.fm.intel.com with ESMTP; 15 Jun 2022 00:13:03 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx603.amr.corp.intel.com (10.18.126.83) 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:13:03 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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 via Frontend Transport; Wed, 15 Jun 2022 00:13:03 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.177) by edgegateway.intel.com (192.55.55.71) 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:13:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aOs78QF5rLB9SO2vDi9/FOfppaskaTkgeWb1eVD9uEHBY8buVIIfkVlAB/XAJH+YR6KBz2VQqcqr1wyrJ+6tS9P+6Om7wm9Mx0UtXDFqMJSfUu7XFqVKtjCEqkP+/DvTvLewl5UFNFQeAQC0uGzRJw0FXL1OyGFr5QsXR4cMjsbYc6dhUVKZizBxjZcBVXqGEB+bn8uFUnlwJ9ePh3kjOeKZXZI89SN4rduFzW2cx7EMOUXzYkC3gAyYS8YogaZbn888szfwBkMZXqHQKuWqiaMhTEThaimTZhRDTX/MDWGl6WUyfNa2sz8lFbPmAdj3weLJJSmNMoYDwCQetnliRw== 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=oztL7SiLO9D9AIozJZa+NQ6f4PplKJmJoedPd9ctIDs=; b=FDWM82ME4ZCH5O089k9+iJPuwYzXavgjsjOMg/y6QgY60IESN3zW/R2UVKd2/HvyS+twI/+zUIg8Jzd4s1Erhf5XH5ejBOTWr4mOsM69fk36IM5z6cdr4iE/7dJgUFIAt/TXIKpKiyvB8JYNQPAvOojOZALtlYNBH3pDsJIZMILkH8XOW+V9Qj69X44X/PbatUX/eLJQyicoruo34VF3UaXLK3eVzgmqN22IKFdQSKDNp+mEXYUM8OXp2pSskgrIB4VFqQX+w8Wt7b4vb/0oHgpVkrlpCsE4EHq7ZKXDpq2hVAuGvff3GLa4mhP0TXM0vmQQZ0M4wgQaivpKmE2tRg== 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 SJ0PR11MB5893.namprd11.prod.outlook.com (2603:10b6:a03:429::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.19; Wed, 15 Jun 2022 07:13:01 +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:13:00 +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 4/5] raw/ifpga: add HE-MEM AFU driver Thread-Topic: [PATCH v7 4/5] raw/ifpga: add HE-MEM AFU driver Thread-Index: AQHYe9K+D+syaUtCfUK0JZfj08SSsa1QFvnw Date: Wed, 15 Jun 2022 07:13:00 +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-5-git-send-email-wei.huang@intel.com> In-Reply-To: <1654760242-7832-5-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzkwMGFkYjAtZTA3Yy00OTA4LWJkOTMtNzA4ODg1NGEwNWU3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieVNGTlwvbk0yNXgwMTh5K3IxVG81MTR0eUw4Rkt3ZTNlNExQazQ3TW9LRVh1SXRCWVRpSUdjVm1Ma3BDQzBPbHAifQ== 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: d628c748-93bd-4b12-cab9-08da4e9e7b72 x-ms-traffictypediagnostic: SJ0PR11MB5893: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: iTinOHoF0WlccmFMogY8/CXzb75hKjdx8+eDYrg4wMSkdPuLNJ1GAEKX3uUeh/h3QbF0wrfoXnrE+jkmAFdbCJDBKKmR4E8MA6pSHwYQDmoQrM4ZZmFj+jdeLWFMROln+Qp49L371Y1CecLxfztiMHxONycRO3qT8i8TzD3U1eIOn6HkXpxo7GQMF6hEelYj0Q5gokCFms99g+pUD1NUojE7+IZxOMVeSCa8mtfeHI2qPd1N3qR0i9dOXarf7QV2bcokvBLGgLOlOfUAH4w4Cma/7AGqZibEL2ahH+LUHZeAxLTAhUV2+YI6jYHu8yPS9Y8lv7416a1HmPVMf1pFBE+b9isoj4CBRYPmgxa5dlmvFQJO3Kk55NIEha6aKALegkXeGqHxuyht6rLR5ywEQmNxeTM+eKS3p9/HNEsGJMrFMzFZ0XH42VMr6Yulnhok/2YjW6iY3/1FUfe17h/WPSBuPubTKqNmzJdTNhbbvzd9IocHwIYCYdwxUFxWYWW6iNNPHw17hTTuVomFb2Kqig3193Nfxi7eEskfAANNRMeqeaLleZnmLIT3wY/t1I1Hf1eLoyteh6/QJkhrEtLatcVvkR0nUgi74G0swOktE80tSaxBNSTl4OYnJ8KxGOC8yY4Mph37Tb40pX23rmBGqsR4gRbZqYZPx99D6k9NQLgDceRs7li7GL9E3/UWfDS7M9ASPM4DSiIUH1yLlZzyyw== 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)(26005)(122000001)(33656002)(6506007)(107886003)(8676002)(53546011)(76116006)(4326008)(38100700002)(110136005)(38070700005)(9686003)(186003)(82960400001)(86362001)(64756008)(7696005)(66556008)(55016003)(52536014)(316002)(5660300002)(54906003)(2906002)(71200400001)(66446008)(508600001)(66946007)(83380400001)(66476007)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?n2oKlmsj2x68+pf5cua7ZrwZDaeW0Sa5TQa0U2nxJstplpaoy4r97+qMmylH?= =?us-ascii?Q?hIOFMXO4dksGe8LaZxtwaf3jRLXnX/33MH8lO8itj1SbuqHz7nWhjBcMNj5q?= =?us-ascii?Q?L7PqgfOqneGK0vT28bz5EPIrYBoWkp5KY+rCjpV86qx4lCwKP+GRMrj3ZIXO?= =?us-ascii?Q?3yaNaf1ZajDTlpBNK5cPprWZ/lSrloTWyO//AiZaphIgNdriOImP+MEktLm4?= =?us-ascii?Q?ufMrBgpAjwNdopuMyEtjAR+mweMChyqpJfWFXf/KqRYUnMMBa/VPBxY2pPYG?= =?us-ascii?Q?nBuDSvo9z32B+kPf4+T52xAVzc8+E+OWDCo/iIV1s5L+dv92iihNQgAAOWtO?= =?us-ascii?Q?uzzP+83Y8PDqBkbxkJ4pk5cw2Uvhff0u6OEDSUD9tWMhMOrZj6Q9VJxyg4GL?= =?us-ascii?Q?AiSLjH/vUB9e5togH73cbxNckeB9u1IPBDz6X4KjvIY/g3At2amfyxOy+vFM?= =?us-ascii?Q?7cQr4G7u9jKpFs1bGItM7IlEiFSu0nj7LtFHTwBXvxj3sb7lO5oyJNLZZdRT?= =?us-ascii?Q?DRB7ougG9SJj5iGxk8FX7aua9dqGnyzmoEYoj+6RTbik23xRHDRCHX1eD6nZ?= =?us-ascii?Q?kP+41pXvuP8Ag3FE/Aclr988be+cDqfu5sbtfCLb7CZxgX4vCuWbzb+de+sm?= =?us-ascii?Q?X68XwP+LG031bGJz5y0tgWbMJh1YEEtaFddnTKDW5sGaCy7XuU3EeTDelhs8?= =?us-ascii?Q?Qz5q/Belt82/vd8xSKLhhfl+YXAwjdk1f+4M6pGIh2EJked4Ayx/iKyBrrzG?= =?us-ascii?Q?KtUJKC0Zuc2JvnSlx7+1WFt+FWxW2Y7fPXWpfZWlB2D8f3NMPmwN9mPq6HQ3?= =?us-ascii?Q?AW7fGRI0LUmjdIeouzBL8n3rORmafLHzg/ky2jXP0aktjbT2ks9XrERma2Bi?= =?us-ascii?Q?QYwePTQqbaaPQOge8ZrxBny4m+p+oUZ1FJ8yNZ03AnZ3g0tLVVE6CQq6/aLa?= =?us-ascii?Q?psN4V7CPbYzhEDtwQbNvVlYqg+5GVaoS6ZksD0OIRL4vSFeFhzBUxWqCWwSW?= =?us-ascii?Q?/SGQmmSUhZSbCGeVE5Uf30IbdNonAt0Cy2wJFkXil9UMV67jdeQnoK4mtHor?= =?us-ascii?Q?Mr2sIvW8EoNGhC8YdsFm/VrT1cLKOf0jj3ndZLoXlhGW1feVCh2eDF5yRZzK?= =?us-ascii?Q?O8kW2tZwikH4oRlG95x9YR3KXTpWPaF0PV/Rl8Akjev67IEcAsrUszYO7e/3?= =?us-ascii?Q?AOJlSTpzYi1q2imlXJ2aG2vfE6qw6hPpk1HkDPeOfYw3DbYpw5BdHYwwM+HQ?= =?us-ascii?Q?7pAPFh/IdMZUb4LTW3nmMhc+nSDZP2LuT9jA5aBtxVyKngujaGcnUNc0zq4r?= =?us-ascii?Q?QUvGXmaEv6AxgclReWGILMu7PXy1uVRLhBO2dGtVVfTtYq/bkotauJGn+Wgq?= =?us-ascii?Q?vx9i1SNlOUpBEmh6NFA7uTr0UGuw6gXCkhklSo2AGErERC5DYfib8Tppmx9c?= =?us-ascii?Q?Ud0FL3Z9fT7HB3N2YtpQhi0gMIVJHiXc4z7zCRJTwtGz4dCDKqV8VB86OoZ0?= =?us-ascii?Q?pOxb6b4uWRlt+C3U+zTpl4viQw5Dl9GIdpVbVLSKNLRj/KTPDhEcTxIBcsh3?= =?us-ascii?Q?NmEY6L/LAoZrXuNrQ8AGHbn9Waopm9CnozuPkTzgU2ZuZ8Gl44McrJMCsIwG?= =?us-ascii?Q?6MZXeVmX2Ua+96Ek5SaeRI4gl8vAVu7vHygjkbAVxGjr1tW1FVwSJy2TUIGI?= =?us-ascii?Q?repwJULKwvhX9OQHlQB/JU9a44db3iULZssuqOJey/7jV4rP4qXO5Lk5xETc?= =?us-ascii?Q?lflkr2WWpg=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: d628c748-93bd-4b12-cab9-08da4e9e7b72 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jun 2022 07:13:00.8485 (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: UcGIQkYLiT7uUShCvPh+EC1zBEE2wQgXHD/NccVKEx7athDUoyCpirRpKlgxhOu0j95AZiW+teSan1BQIvdAsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5893 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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 4/5] raw/ifpga: add HE-MEM AFU driver >=20 > HE-MEM is one of the host exerciser modules in OFS FPGA, which is used to > test local memory with built-in traffic generator. > This driver initialize the module and report test result. >=20 > Signed-off-by: Wei Huang > Acked-by: Tianfei Zhang > --- > v2: move source files to ifpga and rename > --- > drivers/raw/ifpga/afu_pmd_he_mem.c | 183 > +++++++++++++++++++++++++++++++++++++ > drivers/raw/ifpga/afu_pmd_he_mem.h | 46 ++++++++++ > drivers/raw/ifpga/meson.build | 2 +- > drivers/raw/ifpga/rte_pmd_afu.h | 7 ++ > 4 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 > drivers/raw/ifpga/afu_pmd_he_mem.c > create mode 100644 drivers/raw/ifpga/afu_pmd_he_mem.h >=20 > diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c > b/drivers/raw/ifpga/afu_pmd_he_mem.c > new file mode 100644 > index 0000000..0f57a03 > --- /dev/null > +++ b/drivers/raw/ifpga/afu_pmd_he_mem.c > @@ -0,0 +1,183 @@ > +/* 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 "afu_pmd_core.h" > +#include "afu_pmd_he_mem.h" > + > +static int he_mem_tg_test(struct afu_rawdev *dev) { > + struct he_mem_tg_priv *priv =3D NULL; > + struct rte_pmd_afu_he_mem_tg_cfg *cfg =3D NULL; > + struct he_mem_tg_ctx *ctx =3D NULL; > + uint64_t value =3D 0x12345678; > + uint64_t cap =3D 0; > + uint64_t channel_mask =3D 0; > + int i, t =3D 0; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_mem_tg_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + cfg =3D &priv->he_mem_tg_cfg; > + ctx =3D &priv->he_mem_tg_ctx; > + > + IFPGA_RAWDEV_PMD_DEBUG("Channel mask: 0x%x", cfg- > >channel_mask); > + > + rte_write64(value, ctx->addr + MEM_TG_SCRATCHPAD); > + cap =3D rte_read64(ctx->addr + MEM_TG_SCRATCHPAD); > + IFPGA_RAWDEV_PMD_DEBUG("Scratchpad value: 0x%"PRIx64, cap); > + if (cap !=3D value) { > + IFPGA_RAWDEV_PMD_ERR("Test scratchpad register failed"); > + return -EIO; > + } > + > + cap =3D rte_read64(ctx->addr + MEM_TG_CTRL); > + IFPGA_RAWDEV_PMD_DEBUG("Capability: 0x%"PRIx64, cap); > + > + channel_mask =3D cfg->channel_mask & cap; > + /* start traffic generators */ > + rte_write64(channel_mask, ctx->addr + MEM_TG_CTRL); > + > + /* check test status */ > + while (t < MEM_TG_TIMEOUT_MS) { > + value =3D rte_read64(ctx->addr + MEM_TG_STAT); > + for (i =3D 0; i < NUM_MEM_TG_CHANNELS; i++) { > + if (channel_mask & (1 << i)) { > + if (TGACTIVE(value, i)) > + continue; > + printf("TG channel %d test %s\n", i, > + TGPASS(value, i) ? "pass" : > + TGTIMEOUT(value, i) ? "timeout" : > + TGFAIL(value, i) ? "fail" : "error"); > + channel_mask &=3D ~(1 << i); > + } > + } > + if (!channel_mask) > + break; > + rte_delay_ms(MEM_TG_POLL_INTERVAL_MS); > + t +=3D MEM_TG_POLL_INTERVAL_MS; > + } > + > + if (channel_mask) { > + IFPGA_RAWDEV_PMD_ERR("Timeout 0x%04lx", (unsigned > long)value); > + return channel_mask; > + } > + > + return 0; > +} > + > +static int he_mem_tg_init(struct afu_rawdev *dev) { > + struct he_mem_tg_priv *priv =3D NULL; > + struct he_mem_tg_ctx *ctx =3D NULL; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_mem_tg_priv *)dev->priv; > + if (!priv) { > + priv =3D rte_zmalloc(NULL, sizeof(struct he_mem_tg_priv), 0); > + if (!priv) > + return -ENOMEM; > + dev->priv =3D priv; > + } > + > + ctx =3D &priv->he_mem_tg_ctx; > + ctx->addr =3D (uint8_t *)dev->addr; > + > + return 0; > +} > + > +static int he_mem_tg_config(struct afu_rawdev *dev, void *config, > + size_t config_size) > +{ > + struct he_mem_tg_priv *priv =3D NULL; > + > + if (!dev || !config || !config_size) > + return -EINVAL; > + > + priv =3D (struct he_mem_tg_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + if (config_size !=3D sizeof(struct rte_pmd_afu_he_mem_tg_cfg)) > + return -EINVAL; > + > + rte_memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv- > >he_mem_tg_cfg)); > + > + return 0; > +} > + > +static int he_mem_tg_close(struct afu_rawdev *dev) { > + if (!dev) > + return -EINVAL; > + > + rte_free(dev->priv); > + dev->priv =3D NULL; > + > + return 0; > +} > + > +static int he_mem_tg_dump(struct afu_rawdev *dev, FILE *f) { > + struct he_mem_tg_priv *priv =3D NULL; > + struct he_mem_tg_ctx *ctx =3D NULL; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_mem_tg_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + if (!f) > + f =3D stdout; > + > + ctx =3D &priv->he_mem_tg_ctx; > + > + fprintf(f, "addr:\t\t%p\n", (void *)ctx->addr); > + > + return 0; > +} > + > +static struct afu_ops he_mem_tg_ops =3D { > + .init =3D he_mem_tg_init, > + .config =3D he_mem_tg_config, > + .start =3D NULL, > + .stop =3D NULL, > + .test =3D he_mem_tg_test, > + .close =3D he_mem_tg_close, > + .dump =3D he_mem_tg_dump, > + .reset =3D NULL > +}; > + > +struct afu_rawdev_drv he_mem_tg_drv =3D { > + .uuid =3D { HE_MEM_TG_UUID_L, HE_MEM_TG_UUID_H }, > + .ops =3D &he_mem_tg_ops > +}; > + > +AFU_PMD_REGISTER(he_mem_tg_drv); > diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.h > b/drivers/raw/ifpga/afu_pmd_he_mem.h > new file mode 100644 > index 0000000..5549687 > --- /dev/null > +++ b/drivers/raw/ifpga/afu_pmd_he_mem.h > @@ -0,0 +1,46 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2022 Intel Corporation > + */ > + > +#ifndef _AFU_PMD_HE_MEM_H_ > +#define _AFU_PMD_HE_MEM_H_ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include "afu_pmd_core.h" > +#include "rte_pmd_afu.h" > + > +#define HE_MEM_TG_UUID_L 0xa3dc5b831f5cecbb #define > HE_MEM_TG_UUID_H > +0x4dadea342c7848cb > + > +#define NUM_MEM_TG_CHANNELS 4 > +#define MEM_TG_TIMEOUT_MS 5000 > +#define MEM_TG_POLL_INTERVAL_MS 10 > + > +/* MEM-TG registers definition */ > +#define MEM_TG_SCRATCHPAD 0x28 > +#define MEM_TG_CTRL 0x30 > +#define TGCONTROL(n) (1 << (n)) > +#define MEM_TG_STAT 0x38 > +#define TGSTATUS(v, n) (((v) >> (n << 2)) & 0xf) > +#define TGPASS(v, n) (((v) >> ((n << 2) + 3)) & 0x1) > +#define TGFAIL(v, n) (((v) >> ((n << 2) + 2)) & 0x1) > +#define TGTIMEOUT(v, n) (((v) >> ((n << 2) + 1)) & 0x1) > +#define TGACTIVE(v, n) (((v) >> (n << 2)) & 0x1) > + > +struct he_mem_tg_ctx { > + uint8_t *addr; > +}; > + > +struct he_mem_tg_priv { > + struct rte_pmd_afu_he_mem_tg_cfg he_mem_tg_cfg; > + struct he_mem_tg_ctx he_mem_tg_ctx; > +}; > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _AFU_PMD_HE_MEM_H_ */ > diff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.buil= d > index 629ff8a..dc6941d 100644 > --- a/drivers/raw/ifpga/meson.build > +++ b/drivers/raw/ifpga/meson.build > @@ -14,7 +14,7 @@ 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_n3000.c', 'afu_pmd_he_lpbk.c', 'afu_pmd_he_mem.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 19b3902..213e854 100644 > --- a/drivers/raw/ifpga/rte_pmd_afu.h > +++ b/drivers/raw/ifpga/rte_pmd_afu.h > @@ -104,6 +104,13 @@ struct rte_pmd_afu_he_lpbk_cfg { > uint32_t freq_mhz; > }; >=20 > +/** > + * HE-MEM-TG AFU configuration data structure. > + */ > +struct rte_pmd_afu_he_mem_tg_cfg { > + uint32_t channel_mask; /* mask of traffic generator channel */ > +}; > + > #ifdef __cplusplus > } > #endif > -- > 1.8.3.1 Reviewed-by: Rosen Xu