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 3ECCBA054A for ; Wed, 15 Jun 2022 09:12:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30D944280E; Wed, 15 Jun 2022 09:12:34 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 98E8240220; Wed, 15 Jun 2022 09:12:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655277151; x=1686813151; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Q8AOhYsSh1d933AMTi8fzSm2Ifr/g6RAJge2H4ZCEPk=; b=kSPfVe9+dFyKUgN3Emt3IEyC8za5W9PbUyd8vgP1hjsh2bB1NqXRXJs8 A9hD5SlKthhvlrHUID2EomfFD/WmcYm/XIcFrfBtydiWrw2ahYsF6qACh p+8MpVVt3Nl2cvTKGR+wuvHAFAVaWu6xSNoUwyt8yywt88DhIz1cwlHJ0 u8Ga2buGsZk9wGapQC3zceylVPYvKXSXLZ+efx8OxXGoMWNJXqjPzMyN6 +N3qu1GkUNFz2GapI7/bZS9r4xO/oE3V3Z7pD7FhvcFVeSLCc3gVw30WV tQrMsAZH60iML9CvVTIdOvWM/wAN/us00QgSZJVBDXwAKaO0kRV/a9EJQ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="304291617" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="304291617" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 00:12:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="674335649" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by FMSMGA003.fm.intel.com with ESMTP; 15 Jun 2022 00:12:30 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) 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; Wed, 15 Jun 2022 00:12:30 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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; Wed, 15 Jun 2022 00:12:29 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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:12:29 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (192.55.55.68) 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:12:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TOpUODMBB6OU7oF1S4THA/fz2GGDU+8EXAB4V3bZuE5EacRKMqXwIenuj/LIce0XT/i5Y62tOYjUozL+YlZs/q1QVfGvQvm96mSR7fq9WgZk+sljKa+ipo0JaE+Y/cOeAP4is63VoMD/omQvsu+43Z262aqv4CSVoh6f4G6YvZKPDlyPMyalgYq4epwEs+j+V6/70pzt0U9y/HvP8tWPhwdx3saZp/s4wuf0ZNEW/78sXb2hqkDGRBw33iGClvqb8gQ2BtMndwLvWw4wzh3l5sbezK3vajHLHv17xJlWg3hpDHCZnMx2rDvFwFjvq+1stYE/i6PMMJ5aM0JW8fLOFw== 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=1QqRG1ZCeEYWsu7u+iuIBEPg9KybkSM43geE/HECwj8=; b=EgKTpAPpBtGAAfA26jO/F9emxA58qGVRm6chBFdb+WlD3jG01WKZOQSew6VFClU8IZk1eLU6S8mBa/dCYaJoATgQl8W5gSgwpmDWEgL79cV7YXDfr58VcyMlHaUXOXA/uSkzm76CqGORmbLdtGxiHoEiig2JdvKZkTYI1CZVz8An7TZ2B/Glbq2KUni2wA117YGEgcLJRif5wiIC0g7afbtmtK+P9ab8cZctkzHuztCMVjsdU1zFvJkNqt1y4jEr1cfch34ynn9z2iJe3oNWdjcBT5wAyVTewDXr1q3DwAo4q3Njdi8UJ5JbMepX6H5iOM1VUF0BtM1uy3zpPB5G0w== 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:12:25 +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:12:25 +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 3/5] raw/ifpga: add HE-LPBK AFU driver Thread-Topic: [PATCH v7 3/5] raw/ifpga: add HE-LPBK AFU driver Thread-Index: AQHYe9K/SB9FYszBP06vrcWBVSrjaa1QFsxw Date: Wed, 15 Jun 2022 07: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-4-git-send-email-wei.huang@intel.com> In-Reply-To: <1654760242-7832-4-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDFmYTQ2NjEtMzRlMS00ZjgwLWFjYTAtMjE5Y2ZjOTBiNDhlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaFJWV2szWHpCcWxXU1dlQVlWQ09JajM1azhVem5hdlNHdDBTQzBQNnBPMDZWTlpwTDJKXC84TVhHTTZacE9rOFMifQ== 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: 560d28d7-d726-42fa-95ff-08da4e9e6626 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: ugAXP+MN7Lr01ahph9OhYDfa2gdlkhnnQsPHt5jvqGUaro1MMfSMQGCamGDr1bM2kNyFygFicpJgK0UyTbS80uoN3zUwtCJlBs4F9Yzg8RDgpBNNfM33lS6HuqRD7gCpZ9nQnhXqkxjOjNVM+k061XlK/futUbjXYYUvW0C/jb4yCixM4jfZTablFNO3oqn/HucOWUOxA+4QUXCblTPd/ovr+uohM5XLHcyQh8R6WZe9OCcykL11uUynZqxFDCNs+B4ge8SyLa2KR/FT1WO6HK0v+fqDjHyCh4H6SZWMMi4Z2Huv/js5jQXNZndzZha2CRoSPqhx2cWLaCw0s9APfPS5p+nhCRu3Uey6ZSxDv+UixzsO8FM+E8X9tuxJEuic1FheIQ3TB8JlVJCd2KSmVrQk6vOx4OJE/Gl4gvtJt2fKbsdkea/jfnK9J8vBU+kdWtfWf2LTral2rjQtGeR7olqLubIu+1CrhzpUfJWkkT8aa3zYHLpRNm8zQvCXnw4WxtvMGqo3f8E/zDvbtQhMyKoQ1vGDdOYxLQ5GTK4jBU4nmCbQzzJf8fz2qrTvs9CZUzAjurOeej0K36v+o4hVZgaF5GDNsecE7NDO/nyVT7cyrOKRx2e4GbDrzmv5wTq9rmsnetToLYltbvM6jExSKNiMMgZ2df5Ebjqhf7X8Hn1LBnTeImlTfSGSYSAMkNeU4fQbnAHqYyP2aiZk/EXjJQ== 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)(64756008)(86362001)(55016003)(7696005)(66556008)(82960400001)(54906003)(508600001)(71200400001)(66446008)(8936002)(66946007)(83380400001)(66476007)(52536014)(316002)(2906002)(5660300002)(107886003)(8676002)(53546011)(30864003)(26005)(33656002)(122000001)(6506007)(186003)(4326008)(76116006)(38070700005)(9686003)(38100700002)(110136005)(579004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gbSCBzetE8lne1lHJSZIURfPpgUHJb8EjC+MODcxPwZ/UdndqO6PjEaq0KR/?= =?us-ascii?Q?rD1mWvKCRkf5T354ggYBR1O6D+JmUDsPkVPeUqYY9wIjoPZBc/7wryBAHpFC?= =?us-ascii?Q?rm6XHcNa7IzAuBAj7wPeJliekPbteRcvZadvuLwBWbzy3q+QbvKcd3MY3wji?= =?us-ascii?Q?DOgIu+Fv6sXpBzp29viitE535VCN2Z7fDU6gcEN6CL/Rv9wr5pXgGU4+iwMF?= =?us-ascii?Q?CfzMRSL+5qKTV9cRizQmCrvCxq9dORNKw5B2O2rMciInBxC3aLRgvkNsOnCt?= =?us-ascii?Q?dbnDlU7p7E/xvqUrcltM6b01KxGTc+gnA/9MsdgNTVDo7Cxh6qRfZ/IeHPhO?= =?us-ascii?Q?GCsksc9FOXMuGJYU/tK/+CaRZ8qkOPbac4cSA8a1Nzvv9XyMM3RAn+K5kpog?= =?us-ascii?Q?CfMTDuv9ab2FwsY9kom9XmqaQPf5QkXeu2MysVUn72YAWoghkbBC3vnhjWJR?= =?us-ascii?Q?pVhq0unikBmkRIRrTu4DphoCOSdT0b19u10P9U8hA22B/vCJNpfAnl6aI38q?= =?us-ascii?Q?K7I+dudi45NXoSk+Dk2SGRHTsz32aoL8E0LwpAddtIwe96okK3kCfiUORmCG?= =?us-ascii?Q?4GhxQFxtDZLN282unZnq3h5LAJWZHd2528JJmC8CUkgiInPREN0ungdEpIn5?= =?us-ascii?Q?i9usIloUI0Ht93Qcbpt+4cHdCD/dYXCFdSnEPAPMAQ5fdR3t4wV2X7sZLgA8?= =?us-ascii?Q?CG2+R0f7C81061h0dTgcDmbyPaJv32fUvtYRX2dcrNLWRekQ+xdAlLWgkX6k?= =?us-ascii?Q?h1dwxegYm5AgdomGrqC5JPd3WUcn9vygW1Xs+aPiYJ09+ZQtG0JT0Pzm1c23?= =?us-ascii?Q?D8VDhGMj1zYQGDPzWHO1hCM32vevlrKOUYyEtmjIMdScJct6m5fAWHiHYOXn?= =?us-ascii?Q?wXL3muCTs1oQnkdDGit0DTMDFR7gnEAU7G7RpxyAgwtRB0eWJFgY1xfJhJyh?= =?us-ascii?Q?3xtEqk15LkldT11wxHxz97l2QJNsx+bswnZfL2O/yaJ9nf60RFmwT3LfL2LN?= =?us-ascii?Q?aF6fBVONgVUWavgB1bKcwRe8TAbXt4MvHLh+7aMp5aL3kWzn1rvf2dJTA8v+?= =?us-ascii?Q?0kFNBk6WzTGeOwYZj+7Rw6BPbkEn3xMNSEnCVDAZAYh93PageBqG+o4nTLge?= =?us-ascii?Q?H9ZFy1y951+/JixqugnoZ/SljHK7zC61KAo6NSOGmsm3ShlwTpWSAycQujDK?= =?us-ascii?Q?9u9bIdSWif5AcUQnWj/yaURv0GYD3BmWa+7HKdO6wIm8Cke8U53fR20QXof9?= =?us-ascii?Q?vUKEwIk/cHwXIdTBucwwKE9SdgWvv/qP56Sjq47qbg1xoINXz7HO5ZuYagT7?= =?us-ascii?Q?y6jFJ/I6rB/p7EwGyuRdEJNnse3oTY2Ekj8+nkTpLulZcJGXo+WooqZnwHxP?= =?us-ascii?Q?uEe9xxfNTtuTOCRCvFy6EJMD064hNAEq4qhPy5kAZcw927H6I4c0TjNFGgiv?= =?us-ascii?Q?JRTrEzgOvvUajK6uoqcOMy3SRu6tZuuS28/HwYsTypJE12wb1eo0PIG0i7iI?= =?us-ascii?Q?J+m3jtVtTsFD7+5ZM0cwYaoRMyzpWfbZkKD7M50otHZk1yYAPbDfzhmLhUI8?= =?us-ascii?Q?Iy+xUyQkx3jFUy6BpeXNuYjPf6UryA2MjWMI0se30XfcRNt8EXuOjWhSqKH9?= =?us-ascii?Q?GEB5R9ulcm5xOvU6+Ytbxps/OYGDRnKDicbgR9u4V/65Myk0NJkQavn4pUzY?= =?us-ascii?Q?lvAZ7E2aAvPnFZf2b7RwQ3dqpZ2Rl6mVpgbpP3C/nNq1t9hDSa4+rVwXC7Zc?= =?us-ascii?Q?+da+04BgMw=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: 560d28d7-d726-42fa-95ff-08da4e9e6626 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jun 2022 07:12:25.1638 (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: P/mWRTutNlNlUKsitYLuJa6E8nDvZst8WfzyNhuYCxyNlv+zRjYnukpJcBEC8RD1ZpI+Zt7WMhwBaiHxP6pTog== 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 3/5] raw/ifpga: add HE-LPBK AFU driver >=20 > HE-LPBK and HE-MEM-LPBK are host exerciser modules in OFS FPGA, HE- > LPBK is used to test PCI bus and HE-MEM-LPBK is used to test local memory= . > This driver initialize the modules 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_lpbk.c | 436 > ++++++++++++++++++++++++++++++++++++ > drivers/raw/ifpga/afu_pmd_he_lpbk.h | 126 +++++++++++ > drivers/raw/ifpga/meson.build | 2 +- > drivers/raw/ifpga/rte_pmd_afu.h | 14 ++ > 4 files changed, 577 insertions(+), 1 deletion(-) create mode 100644 > drivers/raw/ifpga/afu_pmd_he_lpbk.c > create mode 100644 drivers/raw/ifpga/afu_pmd_he_lpbk.h >=20 > diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c > b/drivers/raw/ifpga/afu_pmd_he_lpbk.c > new file mode 100644 > index 0000000..8b2c85b > --- /dev/null > +++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c > @@ -0,0 +1,436 @@ > +/* 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_lpbk.h" > + > +static int he_lpbk_afu_config(struct afu_rawdev *dev) { > + struct he_lpbk_priv *priv =3D NULL; > + struct rte_pmd_afu_he_lpbk_cfg *cfg =3D NULL; > + struct he_lpbk_csr_cfg v; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_lpbk_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + cfg =3D &priv->he_lpbk_cfg; > + > + v.csr =3D 0; > + > + if (cfg->cont) > + v.cont =3D 1; > + > + v.mode =3D cfg->mode; > + v.trput_interleave =3D cfg->trput_interleave; > + if (cfg->multi_cl =3D=3D 4) > + v.multicl_len =3D 2; > + else > + v.multicl_len =3D cfg->multi_cl - 1; > + > + IFPGA_RAWDEV_PMD_DEBUG("cfg: 0x%08x", v.csr); > + rte_write32(v.csr, priv->he_lpbk_ctx.addr + CSR_CFG); > + > + return 0; > +} > + > +static void he_lpbk_report(struct afu_rawdev *dev, uint32_t cl) { > + struct he_lpbk_priv *priv =3D NULL; > + struct rte_pmd_afu_he_lpbk_cfg *cfg =3D NULL; > + struct he_lpbk_ctx *ctx =3D NULL; > + struct he_lpbk_dsm_status *stat =3D NULL; > + struct he_lpbk_status0 stat0; > + struct he_lpbk_status1 stat1; > + uint64_t swtest_msg =3D 0; > + uint64_t ticks =3D 0; > + uint64_t info =3D 0; > + double num, rd_bw, wr_bw; > + > + if (!dev || !dev->priv) > + return; > + > + priv =3D (struct he_lpbk_priv *)dev->priv; > + cfg =3D &priv->he_lpbk_cfg; > + ctx =3D &priv->he_lpbk_ctx; > + > + stat =3D ctx->status_ptr; > + > + swtest_msg =3D rte_read64(ctx->addr + CSR_SWTEST_MSG); > + stat0.csr =3D rte_read64(ctx->addr + CSR_STATUS0); > + stat1.csr =3D rte_read64(ctx->addr + CSR_STATUS1); > + > + if (cfg->cont) > + ticks =3D stat->num_clocks - stat->start_overhead; > + else > + ticks =3D stat->num_clocks - > + (stat->start_overhead + stat->end_overhead); > + > + if (cfg->freq_mhz =3D=3D 0) { > + info =3D rte_read64(ctx->addr + CSR_HE_INFO0); > + IFPGA_RAWDEV_PMD_INFO("API version: %"PRIx64, info >> > 16); > + cfg->freq_mhz =3D info & 0xffff; > + if (cfg->freq_mhz =3D=3D 0) { > + IFPGA_RAWDEV_PMD_INFO("Frequency of AFU > clock is unknown." > + " Assuming 350 MHz."); > + cfg->freq_mhz =3D 350; > + } > + } > + > + num =3D (double)stat0.num_reads; > + rd_bw =3D (num * CLS_TO_SIZE(1) * MHZ(cfg->freq_mhz)) / ticks; > + num =3D (double)stat0.num_writes; > + wr_bw =3D (num * CLS_TO_SIZE(1) * MHZ(cfg->freq_mhz)) / ticks; > + > + printf("Cachelines Read_Count Write_Count Pend_Read > Pend_Write " > + "Clocks@%uMHz Rd_Bandwidth Wr_Bandwidth\n", > + cfg->freq_mhz); > + printf("%10u %10u %10u %10u %10u %12"PRIu64 > + " %7.3f GB/s %7.3f GB/s\n", > + cl, stat0.num_reads, stat0.num_writes, > + stat1.num_pend_reads, stat1.num_pend_writes, > + ticks, rd_bw / 1e9, wr_bw / 1e9); > + printf("Test Message: 0x%"PRIx64"\n", swtest_msg); } > + > +static int he_lpbk_test(struct afu_rawdev *dev) { > + struct he_lpbk_priv *priv =3D NULL; > + struct rte_pmd_afu_he_lpbk_cfg *cfg =3D NULL; > + struct he_lpbk_ctx *ctx =3D NULL; > + struct he_lpbk_csr_ctl ctl; > + uint32_t *ptr =3D NULL; > + uint32_t i, j, cl, val =3D 0; > + uint64_t sval =3D 0; > + int ret =3D 0; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_lpbk_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + cfg =3D &priv->he_lpbk_cfg; > + ctx =3D &priv->he_lpbk_ctx; > + > + ctl.csr =3D 0; > + rte_write32(ctl.csr, ctx->addr + CSR_CTL); > + rte_delay_us(1000); > + ctl.reset =3D 1; > + rte_write32(ctl.csr, ctx->addr + CSR_CTL); > + > + /* initialize DMA addresses */ > + IFPGA_RAWDEV_PMD_DEBUG("src_addr: 0x%"PRIx64, ctx- > >src_iova); > + rte_write64(SIZE_TO_CLS(ctx->src_iova), ctx->addr + > CSR_SRC_ADDR); > + > + IFPGA_RAWDEV_PMD_DEBUG("dst_addr: 0x%"PRIx64, ctx- > >dest_iova); > + rte_write64(SIZE_TO_CLS(ctx->dest_iova), ctx->addr + > CSR_DST_ADDR); > + > + IFPGA_RAWDEV_PMD_DEBUG("dsm_addr: 0x%"PRIx64, ctx- > >dsm_iova); > + rte_write32(SIZE_TO_CLS(ctx->dsm_iova), ctx->addr + > CSR_AFU_DSM_BASEL); > + rte_write32(SIZE_TO_CLS(ctx->dsm_iova) >> 32, > + ctx->addr + CSR_AFU_DSM_BASEH); > + > + ret =3D he_lpbk_afu_config(dev); > + if (ret) > + return ret; > + > + /* initialize src data */ > + ptr =3D (uint32_t *)ctx->src_ptr; > + j =3D CLS_TO_SIZE(cfg->end) >> 2; > + for (i =3D 0; i < j; i++) > + *ptr++ =3D i; > + > + /* start test */ > + for (cl =3D cfg->begin; cl <=3D cfg->end; cl +=3D cfg->multi_cl) { > + memset(ctx->dest_ptr, 0, CLS_TO_SIZE(cl)); > + memset(ctx->dsm_ptr, 0, DSM_SIZE); > + > + ctl.csr =3D 0; > + rte_write32(ctl.csr, ctx->addr + CSR_CTL); > + rte_delay_us(1000); > + ctl.reset =3D 1; > + rte_write32(ctl.csr, ctx->addr + CSR_CTL); > + > + rte_write32(cl - 1, ctx->addr + CSR_NUM_LINES); > + > + ctl.start =3D 1; > + rte_write32(ctl.csr, ctx->addr + CSR_CTL); > + > + if (cfg->cont) { > + rte_delay_ms(cfg->timeout * 1000); > + ctl.force_completion =3D 1; > + rte_write32(ctl.csr, ctx->addr + CSR_CTL); > + ret =3D dsm_poll_timeout(&ctx->status_ptr- > >test_complete, > + val, (val & 0x1) =3D=3D 1, DSM_POLL_INTERVAL, > + DSM_TIMEOUT); > + if (ret) { > + printf("DSM poll timeout\n"); > + goto end; > + } > + } else { > + ret =3D dsm_poll_timeout(&ctx->status_ptr- > >test_complete, > + val, (val & 0x1) =3D=3D 1, DSM_POLL_INTERVAL, > + DSM_TIMEOUT); > + if (ret) { > + printf("DSM poll timeout\n"); > + goto end; > + } > + ctl.force_completion =3D 1; > + rte_write32(ctl.csr, ctx->addr + CSR_CTL); > + } > + > + he_lpbk_report(dev, cl); > + > + i =3D 0; > + while (i++ < 100) { > + sval =3D rte_read64(ctx->addr + CSR_STATUS1); > + if (sval =3D=3D 0) > + break; > + rte_delay_us(1000); > + } > + > + if (cfg->mode =3D=3D NLB_MODE_LPBK) { > + ptr =3D (uint32_t *)ctx->dest_ptr; > + j =3D CLS_TO_SIZE(cl) >> 2; > + for (i =3D 0; i < j; i++) { > + if (*ptr++ !=3D i) { > + IFPGA_RAWDEV_PMD_ERR("Data > mismatch @ %u", i); > + break; > + } > + } > + } > + } > + > +end: > + return 0; > +} > + > +static int he_lpbk_ctx_release(struct afu_rawdev *dev) { > + struct he_lpbk_priv *priv =3D NULL; > + struct he_lpbk_ctx *ctx =3D NULL; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_lpbk_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + ctx =3D &priv->he_lpbk_ctx; > + > + rte_free(ctx->dsm_ptr); > + ctx->dsm_ptr =3D NULL; > + ctx->status_ptr =3D NULL; > + > + rte_free(ctx->src_ptr); > + ctx->src_ptr =3D NULL; > + > + rte_free(ctx->dest_ptr); > + ctx->dest_ptr =3D NULL; > + > + return 0; > +} > + > +static int he_lpbk_ctx_init(struct afu_rawdev *dev) { > + struct he_lpbk_priv *priv =3D NULL; > + struct he_lpbk_ctx *ctx =3D NULL; > + int ret =3D 0; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_lpbk_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + ctx =3D &priv->he_lpbk_ctx; > + ctx->addr =3D (uint8_t *)dev->addr; > + > + ctx->dsm_ptr =3D (uint8_t *)rte_zmalloc(NULL, DSM_SIZE, > TEST_MEM_ALIGN); > + if (!ctx->dsm_ptr) > + return -ENOMEM; > + ctx->dsm_iova =3D rte_malloc_virt2iova(ctx->dsm_ptr); > + if (ctx->dsm_iova =3D=3D RTE_BAD_IOVA) { > + ret =3D -ENOMEM; > + goto release_dsm; > + } > + > + ctx->src_ptr =3D (uint8_t *)rte_zmalloc(NULL, NLB_BUF_SIZE, > + TEST_MEM_ALIGN); > + if (!ctx->src_ptr) { > + ret =3D -ENOMEM; > + goto release_dsm; > + } > + ctx->src_iova =3D rte_malloc_virt2iova(ctx->src_ptr); > + if (ctx->src_iova =3D=3D RTE_BAD_IOVA) { > + ret =3D -ENOMEM; > + goto release_src; > + } > + > + ctx->dest_ptr =3D (uint8_t *)rte_zmalloc(NULL, NLB_BUF_SIZE, > + TEST_MEM_ALIGN); > + if (!ctx->dest_ptr) { > + ret =3D -ENOMEM; > + goto release_src; > + } > + ctx->dest_iova =3D rte_malloc_virt2iova(ctx->dest_ptr); > + if (ctx->dest_iova =3D=3D RTE_BAD_IOVA) { > + ret =3D -ENOMEM; > + goto release_dest; > + } > + > + ctx->status_ptr =3D (struct he_lpbk_dsm_status *)ctx->dsm_ptr; > + return 0; > + > +release_dest: > + rte_free(ctx->dest_ptr); > + ctx->dest_ptr =3D NULL; > +release_src: > + rte_free(ctx->src_ptr); > + ctx->src_ptr =3D NULL; > +release_dsm: > + rte_free(ctx->dsm_ptr); > + ctx->dsm_ptr =3D NULL; > + return ret; > +} > + > +static int he_lpbk_init(struct afu_rawdev *dev) { > + if (!dev) > + return -EINVAL; > + > + if (!dev->priv) { > + dev->priv =3D rte_zmalloc(NULL, sizeof(struct he_lpbk_priv), 0); > + if (!dev->priv) > + return -ENOMEM; > + } > + > + return he_lpbk_ctx_init(dev); > +} > + > +static int he_lpbk_config(struct afu_rawdev *dev, void *config, > + size_t config_size) > +{ > + struct he_lpbk_priv *priv =3D NULL; > + struct rte_pmd_afu_he_lpbk_cfg *cfg =3D NULL; > + > + if (!dev || !config || !config_size) > + return -EINVAL; > + > + priv =3D (struct he_lpbk_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + if (config_size !=3D sizeof(struct rte_pmd_afu_he_lpbk_cfg)) > + return -EINVAL; > + > + cfg =3D (struct rte_pmd_afu_he_lpbk_cfg *)config; > + if (cfg->mode > NLB_MODE_TRPUT) > + return -EINVAL; > + if ((cfg->multi_cl !=3D 1) && (cfg->multi_cl !=3D 2) && > + (cfg->multi_cl !=3D 4)) > + return -EINVAL; > + if ((cfg->begin < MIN_CACHE_LINES) || (cfg->begin > > MAX_CACHE_LINES)) > + return -EINVAL; > + if ((cfg->end < cfg->begin) || (cfg->end > MAX_CACHE_LINES)) > + return -EINVAL; > + > + rte_memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg)); > + > + return 0; > +} > + > +static int he_lpbk_close(struct afu_rawdev *dev) { > + if (!dev) > + return -EINVAL; > + > + he_lpbk_ctx_release(dev); > + > + rte_free(dev->priv); > + dev->priv =3D NULL; > + > + return 0; > +} > + > +static int he_lpbk_dump(struct afu_rawdev *dev, FILE *f) { > + struct he_lpbk_priv *priv =3D NULL; > + struct he_lpbk_ctx *ctx =3D NULL; > + > + if (!dev) > + return -EINVAL; > + > + priv =3D (struct he_lpbk_priv *)dev->priv; > + if (!priv) > + return -ENOENT; > + > + if (!f) > + f =3D stdout; > + > + ctx =3D &priv->he_lpbk_ctx; > + > + fprintf(f, "addr:\t\t%p\n", (void *)ctx->addr); > + fprintf(f, "dsm_ptr:\t%p\n", (void *)ctx->dsm_ptr); > + fprintf(f, "dsm_iova:\t0x%"PRIx64"\n", ctx->dsm_iova); > + fprintf(f, "src_ptr:\t%p\n", (void *)ctx->src_ptr); > + fprintf(f, "src_iova:\t0x%"PRIx64"\n", ctx->src_iova); > + fprintf(f, "dest_ptr:\t%p\n", (void *)ctx->dest_ptr); > + fprintf(f, "dest_iova:\t0x%"PRIx64"\n", ctx->dest_iova); > + fprintf(f, "status_ptr:\t%p\n", (void *)ctx->status_ptr); > + > + return 0; > +} > + > +static struct afu_ops he_lpbk_ops =3D { > + .init =3D he_lpbk_init, > + .config =3D he_lpbk_config, > + .start =3D NULL, > + .stop =3D NULL, > + .test =3D he_lpbk_test, > + .close =3D he_lpbk_close, > + .dump =3D he_lpbk_dump, > + .reset =3D NULL > +}; > + > +struct afu_rawdev_drv he_lpbk_drv =3D { > + .uuid =3D { HE_LPBK_UUID_L, HE_LPBK_UUID_H }, > + .ops =3D &he_lpbk_ops > +}; > + > +AFU_PMD_REGISTER(he_lpbk_drv); > + > +struct afu_rawdev_drv he_mem_lpbk_drv =3D { > + .uuid =3D { HE_MEM_LPBK_UUID_L, HE_MEM_LPBK_UUID_H }, > + .ops =3D &he_lpbk_ops > +}; > + > +AFU_PMD_REGISTER(he_mem_lpbk_drv); > diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.h > b/drivers/raw/ifpga/afu_pmd_he_lpbk.h > new file mode 100644 > index 0000000..5ad6aa8 > --- /dev/null > +++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.h > @@ -0,0 +1,126 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2022 Intel Corporation > + */ > + > +#ifndef _AFU_PMD_HE_LPBK_H_ > +#define _AFU_PMD_HE_LPBK_H_ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include "afu_pmd_core.h" > +#include "rte_pmd_afu.h" > + > +#define HE_LPBK_UUID_L 0xb94b12284c31e02b > +#define HE_LPBK_UUID_H 0x56e203e9864f49a7 > +#define HE_MEM_LPBK_UUID_L 0xbb652a578330a8eb #define > +HE_MEM_LPBK_UUID_H 0x8568ab4e6ba54616 > + > +/* HE-LBK & HE-MEM-LBK registers definition */ > +#define CSR_SCRATCHPAD0 0x100 > +#define CSR_SCRATCHPAD1 0x108 > +#define CSR_AFU_DSM_BASEL 0x110 > +#define CSR_AFU_DSM_BASEH 0x114 > +#define CSR_SRC_ADDR 0x120 > +#define CSR_DST_ADDR 0x128 > +#define CSR_NUM_LINES 0x130 > +#define CSR_CTL 0x138 > +#define CSR_CFG 0x140 > +#define CSR_INACT_THRESH 0x148 > +#define CSR_INTERRUPT0 0x150 > +#define CSR_SWTEST_MSG 0x158 > +#define CSR_STATUS0 0x160 > +#define CSR_STATUS1 0x168 > +#define CSR_ERROR 0x170 > +#define CSR_STRIDE 0x178 > +#define CSR_HE_INFO0 0x180 > + > +#define DSM_SIZE 0x200000 > +#define DSM_POLL_INTERVAL 5 /* ms */ > +#define DSM_TIMEOUT 1000 /* ms */ > + > +#define NLB_BUF_SIZE 0x400000 > +#define TEST_MEM_ALIGN 1024 > + > +struct he_lpbk_csr_ctl { > + union { > + uint32_t csr; > + struct { > + uint32_t reset:1; > + uint32_t start:1; > + uint32_t force_completion:1; > + uint32_t reserved:29; > + }; > + }; > +}; > + > +struct he_lpbk_csr_cfg { > + union { > + uint32_t csr; > + struct { > + uint32_t rsvd1:1; > + uint32_t cont:1; > + uint32_t mode:3; > + uint32_t multicl_len:2; > + uint32_t rsvd2:13; > + uint32_t trput_interleave:3; > + uint32_t test_cfg:5; > + uint32_t interrupt_on_error:1; > + uint32_t interrupt_testmode:1; > + uint32_t rsvd3:2; > + }; > + }; > +}; > + > +struct he_lpbk_status0 { > + union { > + uint64_t csr; > + struct { > + uint32_t num_writes; > + uint32_t num_reads; > + }; > + }; > +}; > + > +struct he_lpbk_status1 { > + union { > + uint64_t csr; > + struct { > + uint32_t num_pend_writes; > + uint32_t num_pend_reads; > + }; > + }; > +}; > + > +struct he_lpbk_dsm_status { > + uint32_t test_complete; > + uint32_t test_error; > + uint64_t num_clocks; > + uint32_t num_reads; > + uint32_t num_writes; > + uint32_t start_overhead; > + uint32_t end_overhead; > +}; > + > +struct he_lpbk_ctx { > + uint8_t *addr; > + uint8_t *dsm_ptr; > + uint64_t dsm_iova; > + uint8_t *src_ptr; > + uint64_t src_iova; > + uint8_t *dest_ptr; > + uint64_t dest_iova; > + struct he_lpbk_dsm_status *status_ptr; }; > + > +struct he_lpbk_priv { > + struct rte_pmd_afu_he_lpbk_cfg he_lpbk_cfg; > + struct he_lpbk_ctx he_lpbk_ctx; > +}; > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _AFU_PMD_HE_LPBK_H_ */ > diff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.buil= d > index 2294ab5..629ff8a 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_n3000.c', 'afu_pmd_he_lpbk.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 f14a053..19b3902 100644 > --- a/drivers/raw/ifpga/rte_pmd_afu.h > +++ b/drivers/raw/ifpga/rte_pmd_afu.h > @@ -90,6 +90,20 @@ struct rte_pmd_afu_n3000_cfg { > }; > }; >=20 > +/** > + * HE-LPBK & HE-MEM-LPBK AFU configuration data structure. > + */ > +struct rte_pmd_afu_he_lpbk_cfg { > + uint32_t mode; > + uint32_t begin; > + uint32_t end; > + uint32_t multi_cl; > + uint32_t cont; > + uint32_t timeout; > + uint32_t trput_interleave; > + uint32_t freq_mhz; > +}; > + > #ifdef __cplusplus > } > #endif > -- > 1.8.3.1 Reviewed-by: Rosen Xu