From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD37AA04FC; Tue, 17 Dec 2019 12:00:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D6BC1BECF; Tue, 17 Dec 2019 12:00:06 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 8AF851BEB2 for ; Tue, 17 Dec 2019 12:00:04 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBHAv11j009510; Tue, 17 Dec 2019 03:00:03 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=QrUQzxT7MMg1XQlcRpaIl9kk6D2O6GVevFKCqGZN3DU=; b=vQ6Wyy1zGGDMmMSEqrQAjp2DgiwJOR4D7mQc/g4wcFSJjJlOtNa4BTj/6JgvFlJhJ3hh ePswx+k6Np0HwrOG9gjLJCstrYYB4oynpmGmz3tusvJYLB0LRXEte2+5Ne6cmoK8P4CC vARSdD3Zny+At69eCzYSCzNRxGhiu+XG+SulSIII6mR7dxStgGYC2WaWP1odfO4AYB6i TAc8VBEYQlmlOw3E1qZHGB6V9O+YgTJ5o8WN70EaMRWzDdEGym5qJaVpC1Scf2ipy0o5 mU6aJ0fzbHEiF1rSIasVcH4E7WtR5nceGFJIWyoY5i6Si5FK2hMUJcCfnGtzLfkFHLj1 yQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2wxneasknx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2019 03:00:03 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Dec 2019 03:00:01 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Tue, 17 Dec 2019 03:00:01 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cni2GDbLCBvbkd2bFNJf735cJH2hQJMdYnURNMFrVRMgaqYOiE4yE4WW6K5hhZOCC6Fbb39mh3tJ2WV9MWKeHESqcrVaUsQedIGFV9fBOaC0WqSAPVlCJgih93bIlfH6LLH5nyPzYhnnRDOqThXVR9vuQqAOX6nwwSIquxi8umBksty62EoLgGIZPpxfpvtKNf+Jx0v2lF/V89RRLxpby4MdFyGVomx75YETPQFwpR9saUwdLkfEX++z6O+nomoWt0tkuMmmQp44pSEfQHEwBHEmMK5zYiPMf9SFDENIfFtd6uJ42rDYajPLyfz3w1GY8lVXe+3MKj206p0LWOthwA== 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=QrUQzxT7MMg1XQlcRpaIl9kk6D2O6GVevFKCqGZN3DU=; b=e+AIu0NS9iiTjMK9KYzN3R9hnWFJwE5Y0KjIBJddDtu0pcuRQ/QugP+6Dcjte1cCOUkqQR0UoUGJLCWZ/IWiH6CrOSEAoT572am4eyj6eLXjEP4gFecCN0pM1sqGteXqe7VW13ap9mhwXRGwht+DcIpFwUWsyA4BGXCUvbc6F/C720eij3iHQpSaVPhKzvt94tr6BZURjX/GBWrAGB5oVbB9QKwSa32f9pfniwyvXsHpGgCx46fkxyD6QuM3MVEMkGXv4t1crkdJuOz5NYpIYVsgwoKh/YnjRah5aIZhZPo4dvZMjLzN7Ss9mNxpnemzVeaDXquD55MFRY2lLESQKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QrUQzxT7MMg1XQlcRpaIl9kk6D2O6GVevFKCqGZN3DU=; b=OPjfXctdxhIcflvqXaYxYn71HBMw5PSSs8R94ZBYfbw+7JPXdLQ4NIQvVWMFhFBHEvlSGzz6jZfCdLkiHbDXe4ioqJm7SN4Jbe1Bydyad1BTPIrtXaAy531/kQgJE/lTENn1mVaOFRlyrbyiD5qqq8o4EJA0825Kq1TdUCHiU54= Received: from CH2PR18MB3270.namprd18.prod.outlook.com (52.132.247.204) by CH2PR18MB3317.namprd18.prod.outlook.com (52.132.245.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.18; Tue, 17 Dec 2019 11:00:00 +0000 Received: from CH2PR18MB3270.namprd18.prod.outlook.com ([fe80::68d8:fcac:e9f9:c594]) by CH2PR18MB3270.namprd18.prod.outlook.com ([fe80::68d8:fcac:e9f9:c594%7]) with mapi id 15.20.2538.019; Tue, 17 Dec 2019 11:00:00 +0000 From: Sunil Kumar Kori To: Stephen Hemminger CC: "dev@dpdk.org" Thread-Topic: [EXT] Re: [dpdk-dev] [PATCH] bus/pci: restricted bus scanning to allowed devices Thread-Index: AQHVs+YlfvJ7V+gbMk2VGqjgA55aBae876eAgAE4ttA= Date: Tue, 17 Dec 2019 11:00:00 +0000 Message-ID: References: <20191216075501.15669-1-skori@marvell.com> <20191216081317.30f10c9d@hermes.lan> In-Reply-To: <20191216081317.30f10c9d@hermes.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.140.231.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a94fb170-2e21-4c74-9567-08d782e04304 x-ms-traffictypediagnostic: CH2PR18MB3317: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-forefront-prvs: 02543CD7CD x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(376002)(366004)(396003)(39860400002)(136003)(199004)(189003)(13464003)(55236004)(2906002)(52536014)(71200400001)(7696005)(9686003)(81166006)(55016002)(8676002)(6916009)(186003)(66476007)(66556008)(64756008)(66946007)(66446008)(5660300002)(26005)(316002)(8936002)(86362001)(4326008)(478600001)(33656002)(81156014)(6506007)(76116006); DIR:OUT; SFP:1101; SCL:1; SRVR:CH2PR18MB3317; H:CH2PR18MB3270.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: coF+LRgTyZpHeeUdLONUPBxIoZtE/B+jNsN1ryQyRvaK/CN0gvI+xdu03Gf1l3NjO9lTORaEbVVAGKvahRKYYDF8SJRuHuq+QRgG8zixJZ66tJmim3HEmoXPK8v50xw+CiE0mb1bYa3OmZqb+2T+fws5zB+bMRk/XKQTXRJbiRwHsj4KQ4IzrIm2+BGlO/l+EhZopXSkloD6Q6J3Ds1x4YJVmQ7TmmrB2hSBsFTEecGQaM2UQnBUH/2eTB1pFAiMQsca/XR2IwksXd8ELTfM3lIk9oOoXULljtpBS+6NNJ4oyMk9p2XxywOX128Mj8KWzlTfEbKwL+k6kqaVynqUfAX2XvpZ5xxESJo6PP/YBZsyGTmhUDKeb0tfvJTPDf5qaC7TIZ+iRha8xYZlSIyewtNSCi6AEu4t3FmIt+1cAApn3vRTV2xop5tjwjQ+YGzbNLIvXxBp2ADIrvfQdliWOrOlhltLtMyp9X6ionydz1MP4BlvUHIlwH6roWEKbEIP 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-Network-Message-Id: a94fb170-2e21-4c74-9567-08d782e04304 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2019 11:00:00.3674 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /n0/msPcsrVSjuL5qy2DOYSUCHArqOXOEFqsrxq7oSofOrZzl4sz/T741a0vloSWRGBIaH0wCkHyaP5zjaBGlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR18MB3317 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-17_02:2019-12-16,2019-12-17 signatures=0 Subject: Re: [dpdk-dev] [EXT] Re: [PATCH] bus/pci: restricted bus scanning to allowed devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Regards Sunil Kumar Kori >-----Original Message----- >From: Stephen Hemminger >Sent: Monday, December 16, 2019 9:43 PM >To: Sunil Kumar Kori >Cc: dev@dpdk.org >Subject: [EXT] Re: [dpdk-dev] [PATCH] bus/pci: restricted bus scanning to >allowed devices > >External Email > >---------------------------------------------------------------------- >> /* Create dummy pci device to get devargs */ >> + dummy_dev.addr.domain =3D >matches[i].pc_sel.pc_domain; >> + dummy_dev.addr.bus =3D matches[i].pc_sel.pc_bus; >> + dummy_dev.addr.devid =3D matches[i].pc_sel.pc_dev; >> + dummy_dev.addr.function =3D >matches[i].pc_sel.pc_func; >> + dummy_dev.device.devargs =3D >> + > pci_devargs_lookup(&dummy_dev); >> + >> + /* Check that device should be ignored or not */ >> + if (pci_ignore_device(&dummy_dev)) >> + continue; > >It seems that you are creating dummy_dev as an alternative to passing just= the >PCI bus/device/function. Wouldn't be easier to just use BDF instead. Dummy >arguments on the stack can lead to more corner cases in the future if devi= ce >subsystem changes. Agreed and initially I have implemented using BDF only instead of using dum= my device. But using that approach, I was not able to use existing APIs to get devargs= and ignore device. I had to write almost same functions to solve the purpose. So just to avoid= having replica of same code, I followed this approach. Please suggest. > >> +/** >> + * Get the devargs of a PCI device. >> + * >> + * @param pci_dev >> + * PCI device to be validated >> + * @return >> + * devargs on succes, NULL otherwise >> + */ >> +struct rte_devargs *pci_devargs_lookup(struct rte_pci_device >> +*pci_dev); > >Must be marked experimental (or internal). >The pci_device should be marked const. Okay but If I go with BDF one then this change is not required anyway.=20 > > >> + >> +/** >> + * Validate whether a pci device should be ignored or not. >> + * >> + * @param pci_dev >> + * PCI device to be validated >> + * @return >> + * 1 if device is to be ignored, 0 otherwise >> + */ >> +bool pci_ignore_device(const struct rte_pci_device *pci_dev); > >ditto ditto