From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80044.outbound.protection.outlook.com [40.107.8.44]) by dpdk.org (Postfix) with ESMTP id 7E5A01B4D1 for ; Wed, 10 Oct 2018 00:23:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RW5YsFZbhkTBft97h1PcZcePVMS59ofuNtx4hjynzno=; b=SFPNRzTVsJdCMMWTibPqM971l5u0FV6Amzp6h1dNnlpz7M8ajdcrZo22rpxAw/4IfTjnw3wKYX7t0MGUzo9zQeP5dXU4xzGuorxGnniDLPzaqfphaMIoWb2lfrXYTsimXtOE9mzqklzXLkTPOfbppHzmvJYs2NgbaQ4IfIiLd3U= Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com (52.134.8.154) by VI1PR0502MB2926.eurprd05.prod.outlook.com (10.175.24.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Tue, 9 Oct 2018 22:23:08 +0000 Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::fd5f:be55:2063:d2de]) by VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::fd5f:be55:2063:d2de%3]) with mapi id 15.20.1228.020; Tue, 9 Oct 2018 22:23:07 +0000 From: Ophir Munk To: Yongseok Koh CC: "dev@dpdk.org" , Asaf Penso , Shahaf Shuler , Thomas Monjalon , Olga Shern Thread-Topic: [PATCH v2] net/mlx5: allow multiple probing for representor Thread-Index: AQHUXJuDE/vRm8qkxkeUUkPJFV7rM6UQ8xCAgAaQGQA= Date: Tue, 9 Oct 2018 22:23:07 +0000 Message-ID: References: <1538553677-32010-1-git-send-email-ophirmu@mellanox.com> <1538737591-24022-1-git-send-email-ophirmu@mellanox.com> <4FEB98EC-FA6B-4881-A776-738272103728@mellanox.com> In-Reply-To: <4FEB98EC-FA6B-4881-A776-738272103728@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-originating-ip: [46.116.221.121] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0502MB2926; 6:dj2vkv4pmuJEPH2S/X8XM9PO0tw2nYH3N9Lpu1grKuog3CMjICYUx2fn3juAw0/b7Un4i34G0py2xqQXlnOEPH1jSedZK+J7NpvwRuFka5VR4jO/jPymygI8mnIFtv6x2LDSwHckhgpoMbRGEaKq/J2+4dA3LyRz2yzTFVS3JWS5YWTq7M+6AVFyNY46xLNoR2NLJSMJG6362Ap9Lsogi+S0UmnMCte6gcriB4W9XU6ttNNALEODFDvNVQqxslZkDPhBxw/OAQ5+D5x2rGC/92S+WpiGoiC55KqyNAFaZdbdVTkOBJdiQHx/IA38QKMjeqJw7yduC+Q3Qkypbxuy/t8f8YVZP+nO5Ej4AvJqbwrjgWYGMFFUcKs+C/alSyE8NcG4iQWnJKAf65aHgwB0ppofmKnJyz4DONmPoaBnzrl7v65bZbQS7/FiVRVgoNEeAXkgkX5EzpM96ydr4ciYWA==; 5:KS7XrwtKuX86we7qXOrppSgAihug0y6k3zSFmanHnPhLOQyqzpAIbWshW+SKvoeGhgXnhhyuY1v/c1jzCbTPs16pwDCVCxjHXVfCgwdwRPqyyic4NfDf3XfClseT6tk+0S39r/1KYPB/VFp8mzjBC7pmQ6gISM+MAiTvkQSJ0BM=; 7:Q9auhI7hTKqbUdoaxuVweVP2T+Pd3noWpfBF+F5/OtyKzaGr5zBhHKpxoqSif6e1D5PdI0MiEbIiR3i5K9i/u1mg9S01oaeNCE8x/6OqIXqRPNfruBy/+0Eh9pTz7AQpuJTvIF6C6dE4P6+x1bgG0R2mrFNNqt/kEaiQJDwE7r+v20YqWZHY87sJXLlw9EUHptozjONj9gRhNT4LT7qKKIk1Iczk953HuFuu6QabufFdl0Fc4y34figOouBNGHBf x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: af07dfe3-7195-44c6-62cc-08d62e35ca32 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0502MB2926; x-ms-traffictypediagnostic: VI1PR0502MB2926: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991055); SRVR:VI1PR0502MB2926; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB2926; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(136003)(366004)(346002)(376002)(199004)(189003)(13464003)(76176011)(99286004)(5660300001)(6636002)(54906003)(7736002)(53546011)(6506007)(7696005)(316002)(6306002)(9686003)(53936002)(81156014)(8676002)(81166006)(68736007)(71200400001)(71190400001)(8936002)(5250100002)(97736004)(186003)(2906002)(26005)(486006)(14444005)(256004)(74316002)(5024004)(966005)(305945005)(14454004)(86362001)(102836004)(446003)(11346002)(476003)(107886003)(6246003)(6862004)(105586002)(106356001)(25786009)(66066001)(4326008)(6436002)(2900100001)(478600001)(55016002)(229853002)(33656002)(3846002)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB2926; H:VI1PR0502MB3743.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 51SJXChVKpOzBa7PFPsf3LIcOg305VmhfQ0RFk/Xdt+yJzOiU+j08S9EoefZrEEHiMaC1+YXoropC6W7c8ALnMZC6njVNWz6a9EAVgHIcGZRkU+vM2qwmh+STHyAhMRq/mTLZ1SwkG8X/eyf9FoSHRrx6HQPCOBneRnuE26AnJEah9dP1ec1gsVIWWeCxDwbnpN6Pyyv/2yoqs1C97GBixAR8Jd5l8WJjCTL6W7CFiu6gsVbum6rWYgylpPr+YmEsD9xopjz1KS4ovvfYFHEbzlis4xks6yFpkROdEVMnCTMNNjINDVa4y/l41bB36l9CQHc4j4JgQUFMWgRGESSmeI4KPxx9ofHllA5qalPf1A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: af07dfe3-7195-44c6-62cc-08d62e35ca32 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 22:23:07.7916 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB2926 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: allow multiple probing for representor 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: , X-List-Received-Date: Tue, 09 Oct 2018 22:23:11 -0000 PATCH v3 is expected to accommodate more updates in hotplug series by Thoma= s. Please do not merge this patch. > -----Original Message----- > From: Yongseok Koh > Sent: Friday, October 05, 2018 9:06 PM > To: Ophir Munk > Cc: dev@dpdk.org; Asaf Penso ; Shahaf Shuler > ; Thomas Monjalon ; > Olga Shern > Subject: Re: [PATCH v2] net/mlx5: allow multiple probing for representor >=20 > > On Oct 5, 2018, at 4:06 AM, Ophir Munk wrote: > > > > Implement probing of a device multiple times, see [1]. > > Consecutive probing requests with a devargs string may contain > > repetitive master and representors devices for which eth device should > > be created. If an eth device already exists - silently ignore it. > > > > [1] > > https://patches.dpdk.org/patch/45601/ > > ("eal: allow probing a device again") > > > > Signed-off-by: Ophir Munk > > --- > Acked-by: Yongseok Koh >=20 > Thanks >=20 > > v1: > > Initial release > > > > v2: > > Rebase + code review updates > > https://patches.dpdk.org/patch/45927/ > > > > drivers/net/mlx5/mlx5.c | 27 ++++++++++++++++----------- > > 1 file changed, 16 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > > 9131290..a5a9eca 100644 > > --- a/drivers/net/mlx5/mlx5.c > > +++ b/drivers/net/mlx5/mlx5.c > > @@ -693,9 +693,10 @@ > > * > > * @return > > * A valid Ethernet device object on success, NULL otherwise and > rte_errno > > - * is set. The following error is defined: > > + * is set. The following errors are defined: > > * > > * EBUSY: device is not supposed to be spawned. > > + * EEXIST: device is already spawned > > */ > > static struct rte_eth_dev * > > mlx5_dev_spawn(struct rte_device *dpdk_dev, @@ -744,6 +745,7 @@ > > struct ether_addr mac; > > char name[RTE_ETH_NAME_MAX_LEN]; > > int own_domain_id =3D 0; > > + uint16_t port_id; > > unsigned int i; > > > > /* Determine if this port representor is supposed to be spawned. */ > > @@ -766,6 +768,17 @@ > > return NULL; > > } > > } > > + /* Build device name. */ > > + if (!switch_info->representor) > > + rte_strlcpy(name, dpdk_dev->name, sizeof(name)); > > + else > > + snprintf(name, sizeof(name), "%s_representor_%u", > > + dpdk_dev->name, switch_info->port_name); > > + /* check if the device is already spawned */ > > + if (rte_eth_dev_get_port_by_name(name, &port_id) =3D=3D 0) { > > + rte_errno =3D EEXIST; > > + return NULL; > > + } > > /* Prepare shared data between primary and secondary process. */ > > mlx5_prepare_shared_data(); > > errno =3D 0; > > @@ -872,11 +885,6 @@ > > DEBUG("ibv_query_device_ex() failed"); > > goto error; > > } > > - if (!switch_info->representor) > > - rte_strlcpy(name, dpdk_dev->name, sizeof(name)); > > - else > > - snprintf(name, sizeof(name), "%s_representor_%u", > > - dpdk_dev->name, switch_info->port_name); > > DRV_LOG(DEBUG, "naming Ethernet device \"%s\"", name); > > if (rte_eal_process_type() =3D=3D RTE_PROC_SECONDARY) { > > eth_dev =3D rte_eth_dev_attach_secondary(name); > > @@ -1306,9 +1314,6 @@ struct mlx5_dev_spawn_data { > > assert(pci_drv =3D=3D &mlx5_driver); > > errno =3D 0; > > > > - if (rte_dev_is_probed(&pci_dev->device)) > > - return -EEXIST; > > - > > ibv_list =3D mlx5_glue->get_device_list(&ret); > > if (!ibv_list) { > > rte_errno =3D errno ? errno : ENOSYS; > > @@ -1418,9 +1423,9 @@ struct mlx5_dev_spawn_data { > > list[i].eth_dev =3D mlx5_dev_spawn > > (&pci_dev->device, list[i].ibv_dev, vf, &list[i].info); > > if (!list[i].eth_dev) { > > - if (rte_errno !=3D EBUSY) > > + if (rte_errno !=3D EBUSY && rte_errno !=3D EEXIST) > > break; > > - /* Device is disabled, ignore it. */ > > + /* Device is disabled or already spawned. Ignore it. > */ > > continue; > > } > > restore =3D list[i].eth_dev->data->dev_flags; > > -- > > 1.8.3.1 > >