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 1CEB5A0548; Thu, 1 Apr 2021 17:13:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CC0A1410B1; Thu, 1 Apr 2021 17:13:39 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) by mails.dpdk.org (Postfix) with ESMTP id E4CF214106C for ; Thu, 1 Apr 2021 17:13:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VA/J/C7QVFzf3TKiiPSGoUfRtjyrcPa4rdg/csrjtH7NoiSK648oNt2SBmhK92DuzyC8WMt5HBmD+MgED4gPADq/du60vYYV2nE8/ZtOxb/OSLoBPRxydHsh3fP3N3E5UJ4NK0pgmyunSSeOBAZkRn6rU2zcAURo2v2LWVzRYfkAlSht1cv7wiUMA3Ap3DfLyTdqTvz+h491LHeyux88WeVgWr427Q4M9c6ZRRsqQBLz1rZcrjhJt5eHGNrE7KljewaniT4xAzNAwy0AtYZERu8Y/N/n4ma0RPybpbjFNDx3pjkt+csYc+mAHPB8UWZWoBji0+LD4rUfzHyF5+FIgA== 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=O0t1Na6TXxF4I4G8fkNKqMrcoTpDJLFXaKJAjzGT7E0=; b=S7/nNqvGgWgjuC5k6yJ2zFrB0YumPZmiqTsRLFNmSm1BjPaGYIWFvZCV47nQJ4F8rrOsBUg+DN3CJvugqKmS39nBFx7wwBjUBowHc6l41BPwmRL/Me+O7eF/T0zIuK5A8eHsbDk0vMhA7+IA2jVnJib0BWTGh3YdRr50ooPfMJ/TDZcuhydZ4r2mOYbhkfjeBDQGypQ9z6kYGpI2Yrzqg5aDVokeHFE1Sk12vjgulgijA7/E0f61tRSIPm9bb4De7YwZDT/tb95OBdtpXz6ge7/urmUv0KFFSGu0cBVK4oO+DE74PWRfQZUM0d11tBXmC79+hff4IUD43z0bN+SaGA== 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=O0t1Na6TXxF4I4G8fkNKqMrcoTpDJLFXaKJAjzGT7E0=; b=ZoMIpQ2CWOn5k716M/0sWu1ZazcMyq+G2skoDHujgBewQSN+r15hbxSzUT2AgYWrU3fI+jF8qZBJi+01Udwa/ka1PJs3xaC5fI3mOlANCob4i37RsUyQq94H9AubS7MnXR9O4AZLDm9STM3zc9/UvvJT9//V9R6UVVG9V3qUoxRWULvZ4BOZcFhkNA37TMVh5KiBW2wh9Ivk+l4fIFzyChx+n6wZIOjTOYHOv0DEEu4LkMqNedHk5oNkQrKjRc/j9tq2APPmu4d/CkqfKuWn2vMjTbcxcat6qgV/dhkXzj31ihmPogW8iHRvZPi3eaLKV6FnB6hUfNQePQkQKDayEw== Received: from BY5PR12MB4324.namprd12.prod.outlook.com (2603:10b6:a03:209::10) by BY5PR12MB4819.namprd12.prod.outlook.com (2603:10b6:a03:1fd::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Thu, 1 Apr 2021 15:13:31 +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.3977.033; Thu, 1 Apr 2021 15:13:31 +0000 From: "Xueming(Steven) Li" To: NBU-Contact-Thomas Monjalon CC: Gaetan Rivet , "dev@dpdk.org" , Asaf Penso , "david.marchand@redhat.com" , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" , "hemant.agrawal@nxp.com" , "stephen@networkplumber.org" , "rosen.xu@intel.com" , "ajit.khaparde@broadcom.com" , "jerinj@marvell.com" Thread-Topic: [dpdk-dev] [PATCH v3 4/5] bus: add device arguments name parsing API Thread-Index: AQHXJV6Bs5jypaV+10Kt2qOwaw8r2Kqd5AQAgAHWiyA= Date: Thu, 1 Apr 2021 15:13:31 +0000 Message-ID: References: <1617106521-25931-1-git-send-email-xuemingl@nvidia.com> <1617106521-25931-5-git-send-email-xuemingl@nvidia.com> <5906599.tKcfDlsr6y@thomas> In-Reply-To: <5906599.tKcfDlsr6y@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [180.174.128.146] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c72c51e1-0f47-4074-98ad-08d8f520b600 x-ms-traffictypediagnostic: BY5PR12MB4819: 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:489; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XAMd8pefrNPNTuttqOGylAifL0ZboUic6/cNuiqYFxM+HrwFySkBEsePwrbmLuAnr2LAFnyt+EvVuv+nSR243L1sfUs8RMX/Vgjo4cO7h7W/moh0S1LLOdAyGUW9/u3N6qYr7Im1PVJdWnbml2pPDbqBGxXLXS6AlaGCJzrQv1Glfd3aka1seSi60Y4avs/+DjdFX6L+eEBzUtgoMClwfw21An8zQuFKsmm/+59jp+mIwO5ToMNi5RcsUAWnM+xxe6eTfIbpXtu7e5oTA9KrWXw0QVIHEIe+sfrxf6vL2ExAIymInc1fivTgixhRoiPx/6H6DAtE9S4hlNe8Y9STkMzneCGhaKxT83P7YRahiXlqatZvmlqcyRf1Gh00aJ0/lx8u4uAWjP4Ry1Jv4ENiYmHPKQnChOROGWCyuyUkC67pjw+ijq69Twp1mN2gOAaqnO3OZrMjER1WIWOtukc4PZEMXIZw7Yt0yCMZG7nZMy9kIFRsS2zbz7tgjDGOVPRsTFwfk2NYQriXiNqXIBg0vlqw+sG8UipLExn59MsYis3ZEDDmMXY8vN7UMmn2KBRyh5d3JxSBaOc3/bY+lemjOrm16dXAllkBYUmHJNLhuFjuBW+bllktQckbAHrkqogy7+dBYxbnMNovlzotJLsZrZSq4FK0NGqiZkszHyqsgSQ= 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)(39860400002)(396003)(376002)(366004)(136003)(346002)(4326008)(54906003)(26005)(86362001)(8936002)(8676002)(7416002)(186003)(316002)(52536014)(5660300002)(83380400001)(71200400001)(33656002)(66446008)(64756008)(66556008)(66476007)(6506007)(478600001)(66946007)(6916009)(2906002)(9686003)(55016002)(76116006)(38100700001)(7696005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?dD+2eRpPz7+45sPXAMpAVA3DUGmYULc0LfzzSsxTHNajo2I79LumMP3jH9kN?= =?us-ascii?Q?cJzRDrZ7R81mupf5OguggLgFhWTKtOoD1h5sFAwBCjGPDja+rBTWbFcp8aBv?= =?us-ascii?Q?2lQFR6BECkbU82kTeAydUuBO1QFiU7Yptj4+5m603OvEznlpHn9H2ea4MYYf?= =?us-ascii?Q?HLIQdJuiAZ0JyB57HwjNoJWChth++HEGKNeDc+gGQYsZvIKQsfjNgw+voV8+?= =?us-ascii?Q?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6wYBiyEDK7Dehc3Iv?= =?us-ascii?Q?hqWqt8TLCN83gJPcI1/rXOST3EvD4LNzbYLBUijAjj/XDkdc5sfbAjy3pVDC?= =?us-ascii?Q?QaFuIiTtM3O1dxLep6fvNO7ZB+t8I99TsfVgCl/Pe7WYWfiZM7NuLqq1m06f?= =?us-ascii?Q?oo00CXN0QqHZjPAe8ieMNPGcNZZ92mEXn12Xpe8F4oB/Kag3OG2+MmUIkRoA?= =?us-ascii?Q?1iN+Ybp+HEsfsN2CiOjQrVKe?= 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: c72c51e1-0f47-4074-98ad-08d8f520b600 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 15:13:31.3319 (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: 9o4Rxbxm4IgpVIKuk1c9im7zuTlve7vAkQTYalnEKydGZ6FUSXlgL33JPhheGGIfN5oVnl4rW44p2l4m4CM4gg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4819 Subject: Re: [dpdk-dev] [PATCH v3 4/5] bus: add device arguments name parsing API 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: Thomas Monjalon >Sent: Wednesday, March 31, 2021 6:20 PM >To: Xueming(Steven) Li >Cc: Gaetan Rivet ; dev@dpdk.org; Asaf Penso ; david.marchand@redhat.com; >ferruh.yigit@intel.com; andrew.rybchenko@oktetlabs.ru; hemant.agrawal@nxp.= com; stephen@networkplumber.org; >rosen.xu@intel.com; ajit.khaparde@broadcom.com; jerinj@marvell.com >Subject: Re: [dpdk-dev] [PATCH v3 4/5] bus: add device arguments name pars= ing API > >The commit log should start by explaining it is adding a callback to the b= us drivers for the new devargs syntax. OK. > >30/03/2021 14:15, Xueming Li: >> To use Global Device Syntax as devargs, name is required for device >> management. > >Context is missing. >You mean the argument "name" for the vdev bus? Devargs.name, it is used by probe and device iterator. To locate a device f= rom a devargs, devargs.name is compared agains name of probed devices. This not an issue for legacy syntax, since t= he string after "bus:" is saved as name. > >> >> In legacy parsing API, devargs name was extracted after bus name: >> bus:name,kv_params,,, >> >> To parse new Global Device Syntax, this patch introduces new bus API >> to parse devargs and update name, different bus driver might choose >> different keys from parameters with unified formating, example: >> -a bus=3Dpci,addr=3D83:00.0/class=3Deth/driver=3Dmlx5,... >> name: 0000:03:00.0 >> -a bus=3Dvdev,name=3Dpcap0/class=3Deth/driver=3Dpcap,... >> name:pcap0 > >Only PCI and vdev buses are implemented. >What can be the plan for others? >We should track the progress somewhere, maybe with TODO comments. Like legacy parser, how about using "name" as default name key, the new syn= tax parser can resolve it by default. Then PCI bus overrides by using "addr" key in new bus API,=20 vdev and other bus drivers simply use default implementation, i.e. using "n= ame" as key.. > >This commit log could also state what is the status of the global syntax s= upport, talking about class and device drivers. Yes > >We could update this comment in ethdev: > * A new syntax is in development (not yet supported): > * - bus=3DX,paramX=3Dx/class=3DY,paramY=3Dy/driver=3DZ,paramZ=3Dz Will do it in next patch - enable new syntax > >[...] >> +int >> +rte_pci_devargs_parse(struct rte_devargs *da) { >> + struct rte_kvargs *kvargs; >> + const char *addr_str; >> + struct rte_pci_addr addr; >> + int ret; >> + >> + if (da =3D=3D NULL) >> + return 0; >> + RTE_ASSERT(da->bus_str !=3D NULL); >> + >> + kvargs =3D rte_kvargs_parse(da->bus_str, NULL); >> + if (kvargs =3D=3D NULL) { >> + RTE_LOG(ERR, EAL, "cannot parse argument list: %s\n", >> + da->bus_str); >> + ret =3D -ENODEV; >> + goto out; >> + } >> + >> + addr_str =3D rte_kvargs_get(kvargs, pci_params_keys[RTE_PCI_PARAM_ADDR= ]); >> + if (addr_str =3D=3D NULL) { >> + RTE_LOG(ERR, EAL, "No PCI address specified using '%s=3D' in: %s\= n", >> + pci_params_keys[RTE_PCI_PARAM_ADDR], da->bus_str); >> + ret =3D -ENODEV; >> + goto out; >> + } >> + >> + ret =3D rte_pci_addr_parse(addr_str, &addr); >> + if (ret !=3D 0) { >> + RTE_LOG(ERR, EAL, "PCI address invalid: %s\n", da->bus_str); >> + ret =3D -EINVAL; >> + goto out; >> + } >> + >> + rte_pci_device_name(&addr, da->name, sizeof(da->name)); >> + >> + /* TODO: class parse -> driver parse */ > >Please could you give a longer explanation of what is missing? Just an option to give class driver and device driver to override name pars= ing. But this should happen in new devargs parser, not here if needed. I'll remove this line, and mention it in commit log. >