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 D4DF5A0A0C; Thu, 15 Apr 2021 09:55:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A60171620C7; Thu, 15 Apr 2021 09:55:16 +0200 (CEST) Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690079.outbound.protection.outlook.com [40.107.69.79]) by mails.dpdk.org (Postfix) with ESMTP id BCF651620C1 for ; Thu, 15 Apr 2021 09:55:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lUWtUoHgAznVms+Tzd4vTtJxseyMjePB37T53n15PDdsneNpMoFvZYSjxycEvUTzVPZ/N7aQ+1HBE7wbzPylRW5Bi1EWtyDAqIeoGKWmZ1VLJkyeuJ3r9g3Zw4bI++mMxo/2aAasW46v/ut229br3i4m+7nSo4Y07aYmG+QpK67xdYZSnV+u97X+H0waMjW9IeWwaYhu9fZk3lCF4Jab8iakLd8e2OMUVdrUUxOYAXaxZn+ewNBpieU6wymFajCsCgi5VBDW+8oQ8qMiHLZhBMGT7bV1slVkJ2uCiXhojaqAG6YV+ye8j1nWxbdu85tb0Id5OVDi5EZHZUhEoYa3Sg== 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=2vcTYLaizHCIPrpLjdDY9smory+gRMW1DbuuMrO68wU=; b=f4JdpmGViOrdWhOcRN0zqx2UFQgP/3+Vflpx39wPTBvl5zSkRBurBUc8b0Cam32+MZWqUWcH3z+zS5pJHahIuTywVK8QzSYTmrIjzhXPSrmZL7M7aNoJrQfvk7GzT/+ayy9b8GgDqgZJjhSIL4mlVsfjuzSVjx8tXteGtYYY0lMBcuCVCrgECEdzqhG6BAVc5tgox85pVROhFeshFMIRKjzJ6ULyGephiZqQL5btuUfxzlsqxuuXLNZLKjYG5egV4eeudISjBvRVxkHKFOxFGgXkmnBThYcB/BlkX66xhxU5ycV7xmSkvYQ/kN2CzBFZ3KxD9+8CQTYGm85EGeRSfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2vcTYLaizHCIPrpLjdDY9smory+gRMW1DbuuMrO68wU=; b=Qzs8HAE9hASJ5+KvePMaHGIcOpwT5IlxX3nvfsdiaCb42a/lemQmlrM4n01i0NMGIzsjxDmFIsxmwwkPlZddnLkiVw8kYi+p9OEA2DDZTeKnd0W8t0h+OlNOZ5BpCBujvVTREwNaF3oPVGepY1X5ZgXZ9OPVKhOczJBu+YQQcvH6SixtKgGffVE5fD1W0I+t0LhaiNlHtOdp8z0Q7+E0DITJHZ+MBHTv2DH+4gqYl8DSfoz5G1tosmayy7CjvqG13YDTLPChfQNW3IQoZuRvTCZTVsm1FiDqDGjaTI6FJOp305CZPU0mp6bqrmzOfaJ28QXKF+MAkWlwJqgDnWpiqQ== Received: from BY5PR12MB4324.namprd12.prod.outlook.com (2603:10b6:a03:209::10) by BYAPR12MB2933.namprd12.prod.outlook.com (2603:10b6:a03:138::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Thu, 15 Apr 2021 07:55:14 +0000 Received: from BY5PR12MB4324.namprd12.prod.outlook.com ([fe80::b919:53f4:6757:331c]) by BY5PR12MB4324.namprd12.prod.outlook.com ([fe80::b919:53f4:6757:331c%5]) with mapi id 15.20.4020.023; Thu, 15 Apr 2021 07:55:14 +0000 From: "Xueming(Steven) Li" To: "Wang, Haiyue" , NBU-Contact-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: AQHXMBR7KefWjHt1PkOf7D5G3ZHCMaq1M7aAgAABb2CAAAL/AIAAAFng Date: Thu, 15 Apr 2021 07:55:13 +0000 Message-ID: References: <20210311130113.31382-1-xuemingl@nvidia.com> <20210413032329.25551-1-xuemingl@nvidia.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [180.162.52.50] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 74bd1798-6ba0-427e-e42e-08d8ffe3cd50 x-ms-traffictypediagnostic: BYAPR12MB2933: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 40Rdv7hSGPOsyim4DnhwldgCFjFyVBCUBmKtLlkd26kHNj6FKlEHUJ30431fqVri/saFsYP4k9mffRv02W7J1lZt1brxxKD95eDdIrrFXt3Ve4XqtxoA506MX1Xv9hEZ4vIqq0hfARV1ODGzFDCCWgiMUJyu1fQtv5YCC1IETI/WwFlvHjGo/Y+JZoC+AQrCA6HJDLD4Dm0Wi8kaPD92XRHQn05p4RYbFlOWN3/UByssNat/wPC0N/lLIc7VoTc8wegt+DaiuKAQ28+WhTEUqhF1poFFpsVxAN4c/2GCxDWdBix2kDM3sj+C+ov9GaZU+ep2IHliJTo/uqJVZhH/fxFqiYQDMSsBo4xGxlp6A2SQHgn+fUC6C4gilImfsViimMyUm5/Fuukgsg+u772e6m8izYbMFc5apmpSKavYUBzK90ZOSqRIQ8UmneromDrG9/cWVm2XVAKX4t9kldk6RHtK2Im3psLllcIztNMxqN+g4vzFw0riN7bAmDi5Ek8j7XTobbcag1WO2sdaJMaAXyOrhlwleygEhbDLHVaRlzQiIiKcVJEB6lNhmily3qTZw1oYaumUeAK6li4PmiJQgzpi0li0+2RWRTB6Cib1lfAJKzpTY0l5OgxhgAbJ55dXY3EvvA/Y70gBYPcbk7WukolQeYktFG3iGCBgX9FR/cIIcyCaeysXqPFFdw9ZBn+l x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4324.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(136003)(376002)(346002)(396003)(39860400002)(53546011)(4326008)(966005)(38100700002)(66556008)(86362001)(26005)(52536014)(71200400001)(83380400001)(186003)(110136005)(7696005)(2906002)(6506007)(316002)(33656002)(64756008)(5660300002)(66446008)(9686003)(66476007)(54906003)(66946007)(478600001)(8936002)(76116006)(55016002)(8676002)(122000001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?bjG++rUl0eRvKHZvtneuaaMyrZVvnAozfgbyn1grgF/i87iUssNcSG5AqjYo?= =?us-ascii?Q?smz1PnY1b2DX0qvg/7J/+DZK+m5vtXrMexsSefZSHGkl4y8d/6JbevRlY2gs?= =?us-ascii?Q?SdvdBHcmy4MmKKHxUicI5xw4r5fjECeaNAMXN0slgoy3vNQPAE5sZupO5h33?= =?us-ascii?Q?znmhcWR67rEq21lIS9lhbioHBTEt90+uPsKjKQdr5yvbCtG26YkuN/h0dWHu?= =?us-ascii?Q?QkLj5tK0I0mX6c8b7OfvssBiPLluEvERYM/SSbd4bBl19ijbNDLWxpRLxT/D?= =?us-ascii?Q?M6cV/45xnBBeTzYMrHQMd2hvHgRJzXHwmq6MfA2LQGPSsWdI9y83khWM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ZCeaetU4D1ajMO2JnxtTgRbDEDIkMZ?= =?us-ascii?Q?XEBCEJX55wNJuEwVMrgvyeONikFqqPtVUiLRSDYxESeXKH9+XNpUuUL/oTiT?= =?us-ascii?Q?ikKVLg8dMlVCmi2y/vWmtnl7?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4324.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74bd1798-6ba0-427e-e42e-08d8ffe3cd50 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2021 07:55:13.9358 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qed3Okz3yVCuDrovpwugHKxh/tLT9aQKIW3vkNgQWTpX69pC3yDWE7YYPNH2+Tl443vbgQQLw+enkhqo0OaCeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2933 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: Wang, Haiyue > Sent: Thursday, April 15, 2021 3:52 PM > To: Xueming(Steven) Li ; NBU-Contact-Thomas Monjalon= > Cc: dev@dpdk.org; Asaf Penso ; Parav Pandit ; Ray Kinsella ; Neil Horman > > Subject: RE: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus >=20 > > -----Original Message----- > > From: Xueming(Steven) Li > > Sent: Thursday, April 15, 2021 15:46 > > To: Wang, Haiyue ; NBU-Contact-Thomas Monjalon > > > > Cc: dev@dpdk.org; Asaf Penso ; Parav Pandit > > ; Ray Kinsella ; Neil Horman > > > > Subject: RE: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary > > bus > > > > > > > -----Original Message----- > > > From: Wang, Haiyue > > > Sent: Thursday, April 15, 2021 3:36 PM > > > To: Xueming(Steven) Li ; NBU-Contact-Thomas > > > Monjalon > > > Cc: dev@dpdk.org; Asaf Penso ; Parav Pandit > > > ; Ray Kinsella > > ; Neil Horman > > > > > > Subject: RE: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce > > > auxiliary bus > > > > > > > -----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 > > > > ; Parav Pandit ; Ray Kinsella > > > > ; Neil Horman > > > > Subject: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary > > > > bus > > > > > > > > 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. > > > > > > > > Auxiliary device is identified by unique device name, sysfs path: > > > > /sys/bus/auxiliary/devices/ > > > > > > > > [1] kernel auxiliary bus document: > > > > https://www.kernel.org/doc/html/latest/driver-api/auxiliary_bus.ht > > > > ml > > > > > > > > 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 > > > > > > > > > > > > > > --- /dev/null > > > > +++ b/drivers/bus/auxiliary/rte_bus_auxiliary.h > > > > @@ -0,0 +1,180 @@ > > > > +/* SPDX-License-Identifier: BSD-3-Clause > > > > + * Copyright 2021 Mellanox Technologies, Ltd */ > > > > + > > > > +#ifndef _RTE_BUS_AUXILIARY_H_ > > > > +#define _RTE_BUS_AUXILIARY_H_ > > > > + > > > > +/** > > > > + * @file > > > > + * > > > > + * RTE Auxiliary Bus Interface. > > > > + */ > > > > + > > > > +#ifdef __cplusplus > > > > +extern "C" { > > > > +#endif > > > > + > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > + > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > + > > > > +/* Forward declarations */ > > > > +struct rte_auxiliary_driver; > > > > +struct rte_auxiliary_bus; > > > > +struct rte_auxiliary_device; > > > > + > > > > +/** > > > > + * Match function for the driver to decide if device can be handle= d. > > > > + */ > > > > +typedef bool(auxiliary_match_t) (const char *); > > > > + > > > > +/** > > > > + * Initialization function for the driver called during auxiliary = probing. > > > > + */ > > > > +typedef int(auxiliary_probe_t) (struct rte_auxiliary_driver*, > > > > + struct rte_auxiliary_device*); > > > > + > > > > +/** > > > > + * Uninitialization function for the driver called during hotplugg= ing. > > > > + */ > > > > +typedef int (auxiliary_remove_t)(struct rte_auxiliary_device *); > > > > + > > > > +/** > > > > + * Driver-specific DMA mapping. After a successful call the > > > > +device > > > > + * will be able to read/write from/to this segment. > > > > + * > > > > + * @param dev > > > > + * Pointer to the auxiliary device. > > > > + * @param addr > > > > + * Starting virtual address of memory to be mapped. > > > > + * @param iova > > > > + * Starting IOVA address of memory to be mapped. > > > > + * @param len > > > > + * Length of memory segment being mapped. > > > > + * @return > > > > + * - 0 On success. > > > > + * - Negative value and rte_errno is set otherwise. > > > > + */ > > > > +typedef int (auxiliary_dma_map_t)(struct rte_auxiliary_device *dev= , void *addr, > > > > + uint64_t iova, size_t len); > > > > + > > > > +/** > > > > + * Driver-specific DMA un-mapping. After a successful call the > > > > +device > > > > + * will not be able to read/write from/to this segment. > > > > + * > > > > + * @param dev > > > > + * Pointer to the auxiliary device. > > > > + * @param addr > > > > + * Starting virtual address of memory to be unmapped. > > > > + * @param iova > > > > + * Starting IOVA address of memory to be unmapped. > > > > + * @param len > > > > + * Length of memory segment being unmapped. > > > > + * @return > > > > + * - 0 On success. > > > > + * - Negative value and rte_errno is set otherwise. > > > > + */ > > > > +typedef int (auxiliary_dma_unmap_t)(struct rte_auxiliary_device *d= ev, > > > > + void *addr, uint64_t iova, size_t len); > > > > + > > > > +/** > > > > + * A structure describing an auxiliary device. > > > > + */ > > > > +struct rte_auxiliary_device { > > > > + TAILQ_ENTRY(rte_auxiliary_device) next; /**< Next probed device= . */ > > > > + char name[RTE_DEV_NAME_MAX_LEN + 1]; /**< ASCII device name = */ > > > > + struct rte_device device; /**< Inherit core devic= e */ > > > > + struct rte_intr_handle intr_handle; /**< Interrupt handle *= / > > > > + struct rte_auxiliary_driver *driver; /**< driver used in pro= bing */ > > > > +}; > > > > + > > > > +/** List of auxiliary devices */ > > > > +TAILQ_HEAD(rte_auxiliary_device_list, rte_auxiliary_device); > > > > +/** List of auxiliary drivers */ > > > > +TAILQ_HEAD(rte_auxiliary_driver_list, rte_auxiliary_driver); > > > > + > > > > +/** > > > > + * Structure describing the auxiliary bus */ struct > > > > +rte_auxiliary_bus { > > > > + struct rte_bus bus; /**< Inherit the generic cla= ss */ > > > > + struct rte_auxiliary_device_list device_list; /**< List of devic= es */ > > > > + struct rte_auxiliary_driver_list driver_list; /**< List of > > > > +drivers */ }; > > > > + > > > > +/** > > > > + * A structure describing an auxiliary driver. > > > > + */ > > > > +struct rte_auxiliary_driver { > > > > + TAILQ_ENTRY(rte_auxiliary_driver) next; /**< Next in list. */ > > > > + struct rte_driver driver; /**< Inherit core driver. */ > > > > + struct rte_auxiliary_bus *bus; /**< Auxiliary bus reference= . */ > > > > + auxiliary_match_t *match; /**< Device match function. = */ > > > > + auxiliary_probe_t *probe; /**< Device Probe function. = */ > > > > + auxiliary_remove_t *remove; /**< Device Remove function.= */ > > > > + auxiliary_dma_map_t *dma_map; /**< Device dma map function= . */ > > > > + auxiliary_dma_unmap_t *dma_unmap; /**< Device dma unmap functi= on. */ > > > > > > These API type can be pointer type defined, then no need "*": > > > > > > typedef int (*auxiliary_dma_unmap_t)(struct rte_auxiliary_device *dev= , > > > void *addr, uint64_t iova, size_t len); > > > > > > auxiliary_dma_unmap_t dma_unmap; > > > > > > Like: > > > https://patchwork.dpdk.org/project/dpdk/patch/20210331224547.2217759 > > > -1-thomas@monjalon.net/ > > > > > > typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, > > > void *addr, uint64_t iova, size_t len); > > > > Thanks, is there a reason to prefer pointer type? >=20 > Good practice to make code beautiful ? ;-) >=20 > > > > Thoma's patch looks good, will rebase on it once accepted. >=20 > I mean the function type is defined as pointer type. Yes, I'm talking another topic :) His patch makes dma map/unmap higher level to rte_bus, so that no need to d= efine the api again here. >=20 > > > > > > > > > -- > > > > 2.25.1