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 4CF07A0524; Wed, 14 Apr 2021 04:59:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 945DD160DFC; Wed, 14 Apr 2021 04:59:22 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 3F11C160AF6 for ; Wed, 14 Apr 2021 04:59:21 +0200 (CEST) IronPort-SDR: WPdz7zdP4H+mh/XmHXdyw+Q8wN1a2pR8//Rpq2zNbCyykpDZ7NBXwDnh3FPV+dOTDljoWPmhd1 FM1wIlthU4Ug== X-IronPort-AV: E=McAfee;i="6200,9189,9953"; a="215039138" X-IronPort-AV: E=Sophos;i="5.82,221,1613462400"; d="scan'208";a="215039138" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2021 19:59:20 -0700 IronPort-SDR: +hfbXIaPra2IGEC/GoyB+WYF6HTGWE0WL80dxy7Ey4VrbCnEm5e/RtbARy5KConA1L83Z3u4Hq 2J+0scYjA3Ew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,221,1613462400"; d="scan'208";a="615143570" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga005.fm.intel.com with ESMTP; 13 Apr 2021 19:59:19 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 13 Apr 2021 19:59:19 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 13 Apr 2021 19:59:19 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 13 Apr 2021 19:59:19 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Tue, 13 Apr 2021 19:59:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZBG5ABc+QYvMMqvnajAOhxjVd646dnibIWkZqrEKTqFTpt14G3PzePcyvhjDf2D2uGZNUJJ3AiUeJs6WP+TYsO454XoKUYjufW+tNRItJoaZt4NsPmGHFXieMT7D6VrEYdQzysVfCyzbGON/WV1txJ4xfwOzDJ4ZDdJnjANPuOZSldNOObQAsYpolcgmurXrvxoB2U4n/D3Q6MMgknx5VBB6LzOj7KaNX1Dr9ciHsU8wsdW1CdnyVZv5rTI2rvzeD5L5uUutihqgOVEnNcncqCet2ifYKYe0zNFCkUJZzOol2nNkqU2JCT2Va+eck80p5JT07IjrA9UPCdmM+oLl9Q== 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-SenderADCheck; bh=/vqUTTrk9RVWQE8DRc9x+YwgXGOTjEM5b8gaMocZJtA=; b=CpmlqUey6xyIOpQHx2QcNhbpjCQIzWPLr+UWUtgz21y3bKYErdhtZjNeVSsNZW5Zxin3uNZFvU0LAHyPVasI0gC3TFHwUPiWnO0j6fhGVuya116BGJmkerro0nnDOpP/XH+fKuJQbvzRcicMwZpVTdWWLTpRJILmh8Rxxy206MHI78woLsOZfGduDiRO/r10uirMpYZ++Zezfl9DW0+uj0/t7tPhNvOxFG8NI0SxFtk/QlljNQcMaJFKyFwjChP8vDDzidoDV80N0UG/Cbg6Q1vTtOVOb8eZWzpzdqZRUYidvVBOqwYE3fq/Q8ggTHng1f1xQy1+J+re3J/LqRHPWQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/vqUTTrk9RVWQE8DRc9x+YwgXGOTjEM5b8gaMocZJtA=; b=BvMHYoG17aDTkiUhkVpsrCTePX7URK2O8OV4l67WyYDDJkM01JTZsKnduYuM97Outj4uq0DCs6dk/ziyXhkohqWMPFMKdAOjWzo0AAIJs/BL3jpbTAJTNvnH+fFyEnW08enBDSkR75qysZ2thPH5jkixo8LPchsiIPIAwLbUJCY= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN9PR11MB5513.namprd11.prod.outlook.com (2603:10b6:408:102::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Wed, 14 Apr 2021 02:59:18 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::2dfc:3be2:c305:6346]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::2dfc:3be2:c305:6346%6]) with mapi id 15.20.4020.023; Wed, 14 Apr 2021 02:59:18 +0000 From: "Wang, Haiyue" To: Xueming Li , Thomas Monjalon CC: "dev@dpdk.org" , Asaf Penso , Parav Pandit , Ray Kinsella , Neil Horman Thread-Topic: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus Thread-Index: AQHXMBSKvCrREl25EkK71KLI/BpYYKqzTRNA Date: Wed, 14 Apr 2021 02:59:17 +0000 Message-ID: References: <20210311130113.31382-1-xuemingl@nvidia.com> <20210413032329.25551-1-xuemingl@nvidia.com> In-Reply-To: <20210413032329.25551-1-xuemingl@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.0.76 authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d79bac00-2b05-4021-7636-08d8fef14b99 x-ms-traffictypediagnostic: BN9PR11MB5513: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1284; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yGAapxe3biOazLbYyOKxbbMcV1Aqk5cPuoa66GLM8/MXybeMGS6IGUqJAmyjGpdsVz9IDC/9aTcr7E2ngFC9xaPY0JzfPneGySaqNdMj9Oy3HdqDqt3frLVrvlC49xk1EnTStMse+wOhf6a3MlW7OaVp2lCQR5WhXfygJKiqUgP6RiovvxOG4trTJuiBNB9cLqjCgsnoZMCfzqrJulUs3e4GKBkBAVgNNkH9TC+aK0RcJUvSXxN711Q/kvDGcYTmfQ63ANWqsVdEjuZaYBGcry6+DU64fGfEwO7nyTTPjqYTM/plYn94S8m2CPbnaLZrwUcznb+ndLV9+wKwU2CqVsOfLDd3mLJ1//DVbgPYiQgaxHq3dNH72zJGn36eccktzqg8sgvYXG37y2bXiuoldbA7EtAtk0Pkq9Fsq4auNtPgBaZYUprD7iB30W1XPu3/pQ7rnbAz7SSrUYV/ZF5fDb4Y3SDwKjoDxgdlD6vXyVXiBGWNmiJuNLKT5czBHUwyNvXeQvcET4/166yPqiRc9UX1qY3VmOshqRAv0DTt6GX7GPQAkh/hU119JZUS9ZpNNFaP94ffvrCsFGkOdMcWuKZeNoDSd5hLHCw/G/Ph1dBSEZqi2LaSH/gJoIRT/N8sJZ5DX0cnW8Jo9pX/jtvaHkhemFbdKZry02OqGZOmlrI6M56OR6FCLY0u7aMT+IiB x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(39860400002)(346002)(376002)(396003)(136003)(64756008)(478600001)(966005)(55016002)(66446008)(66476007)(316002)(66556008)(8676002)(6506007)(9686003)(71200400001)(52536014)(86362001)(66946007)(122000001)(38100700002)(26005)(30864003)(186003)(110136005)(76116006)(5660300002)(54906003)(4326008)(33656002)(83380400001)(7696005)(8936002)(53546011)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?cGkwt2I4wWAtxeuSx+B8+5pw6EazFE0swj5m/bjQRjXKy0yiPmYvjE0Pnf5I?= =?us-ascii?Q?j38kfX7dI9CSUJ4X+yKrcPmtip8x/Ba1r1SyXyksc2ZEFiPHz/sBl+Y75lFU?= =?us-ascii?Q?qALAQs9GL+qMZ4r0c5PhZNs528q3Hui9Xdvpr25TWB3H0NzrCOvgkwV2oGbv?= =?us-ascii?Q?3zccczLB4i878iKRqkjzFbOLdf1k7YLerlhJzttDfoG8b6w49LMK3Rnygdeh?= =?us-ascii?Q?c5NwV8KhV2NhaSs3yhyoj/GxpjuL2j1QcuBvMpprkMFmg5Ma8LX8bpJXG1zD?= =?us-ascii?Q?6qGiO4J0uATdOQJITLBqJsumSZ+Rshphs3gFPXDmL+5DUfDwrCNDtmdMpXjS?= =?us-ascii?Q?GttTKeZsZ/X805hXxxliicMr4VWLztXoBVYXm7LFF3tZd+9ywVU5T8Jsbjxy?= =?us-ascii?Q?dSIOWtekTE7zgIrO9AT7Ps9kalkaXRakCUl6D9QBzWduMB4TcX49hcgZ70LK?= =?us-ascii?Q?BQdiHm1bpQGhh7Mjj9ygj2PkYEBytKu3cy6Iq8GCFiepIz1NRZzq5ohIGxu9?= =?us-ascii?Q?26kMJVKHWvGZeoLSPR8/JdhjV7XAh6v0RAqjUNwRWtNOvLviTmHC1f2QW4+b?= =?us-ascii?Q?Oqe8ct33zVrsTUXS7FNv4OKVJioNWRY5g1AcbGD6a9179oJq7NRLPtIqwu25?= =?us-ascii?Q?JHOzYxN3ETuabJ6QpLONRH+O4koeSweo/rvEh3Ojw3d1mKLr/iNRYrrJbIyZ?= =?us-ascii?Q?+QMHIRF65ztCiNEiWMAYYkKZrgSD7ko34xaxeWVm7Uy9wvOMWEahwxDw/IHD?= =?us-ascii?Q?bsQcadevdZ2uehesYkHoITd099pooH+8/80VBXT4G+ko8AlUYkoQq59QnKAw?= =?us-ascii?Q?1N+CK7kJk7CVC1KjZ9nMdoub5rJ+G7YKLeqOriOq0khSCjFFYI55Ug7G/koQ?= =?us-ascii?Q?D8hz3F+QDYKxTn/6WlDO9OPivDGTWUCY65f7mr+WeL8bSYP7Sm6pogvGkQtr?= =?us-ascii?Q?jmo8edHw7uZTyq5lwYQDxmAcPimPxgFwHttKmRKKOT04pcTqiQmAnAYSGrju?= =?us-ascii?Q?BUYor6UbJZ2eEsi+izGXV8H6qdBw3GmJBIQiVew3uUauTLHfurNgnN/psNjk?= =?us-ascii?Q?d/YyqIICciY66zg5LQ17Pa2Db0W2YnZRTF/1F8+nB9QFvRb/yxh95xUftPRP?= =?us-ascii?Q?UuMScxK7VDNJwWcVX/AcWUaeC/ixkWcJDqwdwcfIOa0RrDcvgBfGo64kn1jR?= =?us-ascii?Q?XYlZwyfmKflP8fiETnDtMAjTtBBn4ByybmhLWhtl4Ms+d7MBruGcVDYMo59w?= =?us-ascii?Q?qvbheWIZ85G7Glbr8Hn/FDBypSJQKk72fQp+QhyoaEUBvZuOa1jRWXn8HtBJ?= =?us-ascii?Q?2A4=3D?= x-ms-exchange-transport-forked: True 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: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d79bac00-2b05-4021-7636-08d8fef14b99 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2021 02:59:18.0168 (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: Dr8V7LtyovJDLr7w+pEWkdbIXIUeo8Cue93W1Qz9WPR2p0KrsOTzlDCh0FgLPXvX6QUKFKrXaT/Ab5k1ZzuJAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5513 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus 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 Sender: "dev" > -----Original Message----- > From: dev On Behalf Of Xueming Li > Sent: Tuesday, April 13, 2021 11:23 > To: Thomas Monjalon > Cc: dev@dpdk.org; xuemingl@nvidia.com; Asaf Penso ; Par= av Pandit ; > Ray Kinsella ; Neil Horman > Subject: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus >=20 > Auxiliary [1] provides a way to split function into child-devices > representing sub-domains of functionality. Each auxiliary_device > represents a part of its parent functionality. >=20 > Auxiliary device is identified by unique device name, sysfs path: > /sys/bus/auxiliary/devices/ >=20 > [1] kernel auxiliary bus document: > https://www.kernel.org/doc/html/latest/driver-api/auxiliary_bus.html >=20 > Signed-off-by: Xueming Li > --- > MAINTAINERS | 5 + > drivers/bus/auxiliary/auxiliary_common.c | 391 ++++++++++++++++++++++ > drivers/bus/auxiliary/auxiliary_params.c | 58 ++++ > drivers/bus/auxiliary/linux/auxiliary.c | 147 ++++++++ > drivers/bus/auxiliary/meson.build | 17 + > drivers/bus/auxiliary/private.h | 118 +++++++ > drivers/bus/auxiliary/rte_bus_auxiliary.h | 180 ++++++++++ > drivers/bus/auxiliary/version.map | 10 + > drivers/bus/meson.build | 2 +- > 9 files changed, 927 insertions(+), 1 deletion(-) > create mode 100644 drivers/bus/auxiliary/auxiliary_common.c > create mode 100644 drivers/bus/auxiliary/auxiliary_params.c > create mode 100644 drivers/bus/auxiliary/linux/auxiliary.c > create mode 100644 drivers/bus/auxiliary/meson.build > create mode 100644 drivers/bus/auxiliary/private.h > create mode 100644 drivers/bus/auxiliary/rte_bus_auxiliary.h > create mode 100644 drivers/bus/auxiliary/version.map >=20 > --- /dev/null > +++ b/drivers/bus/auxiliary/auxiliary_common.c > @@ -0,0 +1,391 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2021 Mellanox Technologies, Ltd > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "private.h" > +#include "rte_bus_auxiliary.h" > + > + > +int auxiliary_bus_logtype; > + > +static struct rte_devargs * > +auxiliary_devargs_lookup(const char *name) > +{ > + struct rte_devargs *devargs; > + > + RTE_EAL_DEVARGS_FOREACH("auxiliary", devargs) { > + if (strcmp(devargs->name, name) =3D=3D 0) > + return devargs; > + } > + return NULL; > +} > + > +void > +auxiliary_on_scan(struct rte_auxiliary_device *dev) > +{ > + struct rte_devargs *devargs; > + > + devargs =3D auxiliary_devargs_lookup(dev->name); > + dev->device.devargs =3D devargs; Can be simple as: dev->device.devargs =3D auxiliary_devargs_lookup(dev->name); > +} > + > +/* > + * Match the auxiliary Driver and Device using driver function. > + */ > +bool > +auxiliary_match(const struct rte_auxiliary_driver *auxiliary_drv, > + const struct rte_auxiliary_device *auxiliary_dev) How about these auxiliary variable name style ? const struct rte_auxiliary_driver *aux_drv, const struct rte_auxiliary_device *aux_dev > +{ > + if (auxiliary_drv->match =3D=3D NULL) > + return false; > + return auxiliary_drv->match(auxiliary_dev->name); > +} > + > +/* > + * Call the probe() function of the driver. > + */ > +static int > +rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *dr, > + struct rte_auxiliary_device *dev) > +{ > + int ret; > + enum rte_iova_mode iova_mode; > + RCT style ? enum rte_iova_mode iova_mode; int ret; > + if ((dr =3D=3D NULL) || (dev =3D=3D NULL)) > + return -EINVAL; > + > + /* The device is not blocked; Check if driver supports it */ > + if (!auxiliary_match(dr, dev)) > + /* Match of device and driver failed */ > + return 1; > + > + AUXILIARY_LOG(DEBUG, "Auxiliary device %s on NUMA socket %i\n", > + dev->name, dev->device.numa_node); > + > + /* no initialization when marked as blocked, return without error */ > + if (dev->device.devargs !=3D NULL && > + dev->device.devargs->policy =3D=3D RTE_DEV_BLOCKED) { > + AUXILIARY_LOG(INFO, " Device is blocked, not initializing\n"); > + return -1; > + } > + > + if (dev->device.numa_node < 0) { > + AUXILIARY_LOG(WARNING, " Invalid NUMA socket, default to 0\n"); > + dev->device.numa_node =3D 0; > + } > + > + AUXILIARY_LOG(DEBUG, " Probe driver: %s\n", dr->driver.name); > + > + iova_mode =3D rte_eal_iova_mode(); > + if ((dr->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA) > 0 && '(dr->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA)' should work, no need = '> 0' > + iova_mode !=3D RTE_IOVA_VA) { > + AUXILIARY_LOG(ERR, " Expecting VA IOVA mode but current mode is PA, n= ot initializing\n"); > + return -EINVAL; > + } > + > + dev->driver =3D dr; > + > + AUXILIARY_LOG(INFO, "Probe auxiliary driver: %s device: %s (socket %i)\= n", > + dr->driver.name, dev->name, dev->device.numa_node); > + ret =3D dr->probe(dr, dev); > + if (ret) > + dev->driver =3D NULL; > + else > + dev->device.driver =3D &dr->driver; > + > + return ret; > +} > + > +/* > + * Call the remove() function of the driver. > + */ > +static int > +rte_auxiliary_driver_remove_dev(struct rte_auxiliary_device *dev) > +{ > + struct rte_auxiliary_driver *dr; > + int ret =3D 0; > + > + if (dev =3D=3D NULL) > + return -EINVAL; > + > + dr =3D dev->driver; > + > + AUXILIARY_LOG(DEBUG, "Auxiliary device %s on NUMA socket %i\n", > + dev->name, dev->device.numa_node); > + > + AUXILIARY_LOG(DEBUG, " remove driver: %s %s\n", > + dev->name, dr->driver.name); > + > + if (dr->remove) { > + ret =3D dr->remove(dev); > + if (ret < 0) > + return ret; > + } > + > + /* clear driver structure */ > + dev->driver =3D NULL; > + dev->device.driver =3D NULL; > + > + return 0; > +} > + > +/* > + * Call the probe() function of all registered driver for the given devi= ce. > + * Return < 0 if initialization failed. > + * Return 1 if no driver is found for this device. > + */ > +static int > +auxiliary_probe_all_drivers(struct rte_auxiliary_device *dev) > +{ > + struct rte_auxiliary_driver *dr =3D NULL; > + int rc =3D 0; These two variables need no initialization. > + > + if (dev =3D=3D NULL) > + return -EINVAL; > + > + FOREACH_DRIVER_ON_AUXILIARYBUS(dr) { > + if (!dr->match(dev->name)) > + continue; > + > + rc =3D rte_auxiliary_probe_one_driver(dr, dev); > + if (rc < 0) > + /* negative value is an error */ > + return rc; > + if (rc > 0) > + /* positive value means driver doesn't support it */ > + continue; > + return 0; > + } > + return 1; > +} > + > +static int > +auxiliary_dma_map(struct rte_device *dev, void *addr, uint64_t iova, siz= e_t len) > +{ > + struct rte_auxiliary_device *adev =3D RTE_DEV_TO_AUXILIARY(dev); How about to use 'aux_dev', instead of 'adev' ? > + > + if (!adev || !adev->driver) { ' RTE_DEV_TO_AUXILIARY' is container of 'dev', so it should check 'dev !=3D= NULL', not '!adev'. ; -) > + rte_errno =3D EINVAL; > + return -1; > + } > + if (adev->driver->dma_map) > + return adev->driver->dma_map(adev, addr, iova, len); > + rte_errno =3D ENOTSUP; > + return -1; > +} > + > +static int > +auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, > + size_t len) > +{ > + struct rte_auxiliary_device *adev =3D RTE_DEV_TO_AUXILIARY(dev); > + > + if (!adev || !adev->driver) { The same comment as 'auxiliary_dma_map' > + rte_errno =3D EINVAL; > + return -1; > + } > + if (adev->driver->dma_unmap) > + return adev->driver->dma_unmap(adev, addr, iova, len); > + rte_errno =3D ENOTSUP; > + return -1; > +} > + > --- /dev/null > +++ b/drivers/bus/auxiliary/auxiliary_params.c > @@ -0,0 +1,58 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2021 Mellanox Technologies, Ltd > + */ > + > +#include > + > +#include > +#include > +#include > +#include > + > +#include "private.h" > +#include "rte_bus_auxiliary.h" > + > +enum auxiliary_params { > + RTE_AUXILIARY_PARAM_NAME, > +}; > + > +static const char * const auxiliary_params_keys[] =3D { > + [RTE_AUXILIARY_PARAM_NAME] =3D "name", > +}; > + > +static int > +auxiliary_dev_match(const struct rte_device *dev, > + const void *_kvlist) > +{ > + int ret; > + const struct rte_kvargs *kvlist =3D _kvlist; > + RCT. > + ret =3D rte_kvargs_process(kvlist, > + auxiliary_params_keys[RTE_AUXILIARY_PARAM_NAME], > + rte_kvargs_strcmp, (void *)(uintptr_t)dev->name); > + > + return ret !=3D 0 ? -1 : 0; > +} > + > +void * > +auxiliary_dev_iterate(const void *start, > + const char *str, > + const struct rte_dev_iterator *it __rte_unused) > +{ > + rte_bus_find_device_t find_device; > + struct rte_kvargs *kvargs =3D NULL; > + struct rte_device *dev; > + > + if (str !=3D NULL) { > + kvargs =3D rte_kvargs_parse(str, auxiliary_params_keys); > + if (kvargs =3D=3D NULL) { > + RTE_LOG(ERR, EAL, "cannot parse argument list\n"); > + rte_errno =3D EINVAL; > + return NULL; > + } > + } > + find_device =3D auxiliary_bus.bus.find_device; > + dev =3D find_device(start, auxiliary_dev_match, kvargs); > + rte_kvargs_free(kvargs); > + return dev; > +} > diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxili= ary/linux/auxiliary.c > new file mode 100644 > index 0000000000..7888b6c5da > --- /dev/null > +++ b/drivers/bus/auxiliary/linux/auxiliary.c ^ | Seems no need to add one more directory 'linux' layer, as the meson said "l= inux only". > @@ -0,0 +1,147 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2021 Mellanox Technologies, Ltd > + */ > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "../rte_bus_auxiliary.h" > +#include "../private.h" > + > +#define AUXILIARY_SYSFS_PATH "/sys/bus/auxiliary/devices" > + > +/** > + * @file > + * Linux auxiliary probing. > + */ > + > +/* Scan one auxiliary sysfs entry, and fill the devices list from it. */ > +static int > +auxiliary_scan_one(const char *dirname, const char *name) > +{ > + struct rte_auxiliary_device *dev; > + struct rte_auxiliary_device *dev2; > + char filename[PATH_MAX]; > + unsigned long tmp; > + int ret; > + > + dev =3D malloc(sizeof(*dev)); > + if (dev =3D=3D NULL) > + return -1; > + > + memset(dev, 0, sizeof(*dev)); > + if (rte_strscpy(dev->name, name, sizeof(dev->name)) < 0) { > + free(dev); > + return -1; > + } > + dev->device.name =3D dev->name; > + dev->device.bus =3D &auxiliary_bus.bus; > + > + /* Get numa node, default to 0 if not present */ > + snprintf(filename, sizeof(filename), "%s/%s/numa_node", > + dirname, name); > + if (access(filename, F_OK) !=3D -1) { > + if (eal_parse_sysfs_value(filename, &tmp) =3D=3D 0) > + dev->device.numa_node =3D tmp; > + else > + dev->device.numa_node =3D -1; > + } else { > + dev->device.numa_node =3D 0; > + } > + > + auxiliary_on_scan(dev); > + > + /* Device is valid, add in list (sorted) */ > + TAILQ_FOREACH(dev2, &auxiliary_bus.device_list, next) { > + ret =3D strcmp(dev->name, dev2->name); > + if (ret > 0) > + continue; > + if (ret < 0) { > + auxiliary_insert_device(dev2, dev); > + } else { /* already registered */ > + if (rte_dev_is_probed(&dev2->device) && > + dev2->device.devargs !=3D dev->device.devargs) { > + /* To probe device with new devargs. */ > + rte_devargs_remove(dev2->device.devargs); > + auxiliary_on_scan(dev2); > + } > + free(dev); > + } > + return 0; > + } > + auxiliary_add_device(dev); > + return 0; > +} > + > +/* > + * Test whether the auxiliary device exist > + */ > +bool > +auxiliary_exists(const char *name) is_auxiliary_support() ? > +{ > + DIR *dir; > + char dirname[PATH_MAX]; > + > + snprintf(dirname, sizeof(dirname), "%s/%s", > + AUXILIARY_SYSFS_PATH, name); > + dir =3D opendir(AUXILIARY_SYSFS_PATH); > + if (dir =3D=3D NULL) > + return true; false > + closedir(dir); > + return false; true > -- > 2.25.1