From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70079.outbound.protection.outlook.com [40.107.7.79]) by dpdk.org (Postfix) with ESMTP id 19CC21B173 for ; Fri, 5 Oct 2018 20:06:31 +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=OZAj02KyhULvhB4iDisLeoSVupB9uy0SQqSOs2j+meY=; b=BdIEzAMtPAJSzjabkBU6uElKKxZX9TOA7pGFIgLTK01SvSyXQ8Yo8vpUgfvOgoloZPyoz9B0nfV196TR87MouIxM2sqVc7dPzazlVImFZe25eReFDkiZHGm//imQC+acn8XV0Xum9wRu2NpJplqN0AXTXaui5Np7+Z4ZZ0olSUI= Received: from AM0PR0502MB3971.eurprd05.prod.outlook.com (52.133.40.151) by AM0PR0502MB3969.eurprd05.prod.outlook.com (52.133.40.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Fri, 5 Oct 2018 18:06:29 +0000 Received: from AM0PR0502MB3971.eurprd05.prod.outlook.com ([fe80::f599:3e55:5958:e29f]) by AM0PR0502MB3971.eurprd05.prod.outlook.com ([fe80::f599:3e55:5958:e29f%2]) with mapi id 15.20.1185.027; Fri, 5 Oct 2018 18:06:29 +0000 From: Yongseok Koh To: Ophir Munk 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: AQHUXJuErmlL0xVOb0GuB4oRgsSRKqUQ8w4A Date: Fri, 5 Oct 2018 18:06:29 +0000 Message-ID: <4FEB98EC-FA6B-4881-A776-738272103728@mellanox.com> References: <1538553677-32010-1-git-send-email-ophirmu@mellanox.com> <1538737591-24022-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1538737591-24022-1-git-send-email-ophirmu@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=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR0502MB3969; 6:IOUcmKXTpttaQ6ixWu/rroLcIqjkFGtoM6+gBDQPx5eXzwqIyBmNcm5eLijygjRjGBfSl1cPh0Na57aq0nvWWoMFNODOLeqSlTvTIRJnAzzD2tYCwY/x1056EXGWlCFGV5GJBVjuOyhUzcrA9dDBJRJVLqdZkY0EvBmtwRZAYfn2NxTQl2aEvphgP23EUFVacvhWrUmwDtPODO76WQuT5nUFzTQn+yUh/E2AlyNIpTeyusND+Lt39owBPu0ZQ5Rw+P0StHnE0bRnK2jFNSK5tkSPv85VQJYSOKB71kcObPjVfnKrzr62r91eUllnyOyu9guqL2yLC+8jv9za4FmoV9GmJGFoEaOfPyNjpinr/o86rBxTM92MGCB0kM7lCbLUZyg4g1nOlSA5YywXFYnX2naqSek8ciBekjdQdaLdytnGVKoUBlNIlulZrafEw5T4NKg71lBQ8ITRkoM0rEXgtQ==; 5:XCyZ8C6SUyjMoCbZg4RWMDA7DHxgGr1jyMB/2r7wPoNbZt/WbJrwkPCokjkY6Kt/ik84J4s4FrsiVhIU5I1wnodp22ZW3C0TDR/5PC07Yrr0BuVZqxFCcf8IXF3tFeHoOERnw85NQfh/5KArxLDjSKmguqFEUj8ap76w88FXxD4=; 7:vh7cTrJwxbSwD/PzNoVbcFmeDOoSStyOJDfSWYBF6LQG4rQkjDiIINuvJzCDt2URwvYDq9SBs81PzkaS2UeCu0x0cLqYQ13DWsW47ienISQ5s9jCF/kIhpnDFK3dTSj8qY9olAHy4bG+/yYxEOXLPwfLkFtakxw7B2mdnNcXZ4A1UxwOZPOU9wsTx43QXSL5YRI82oRjo0e7zvTXXLOcv3V9jtDTKuIzLuIQoXHTtgAXLgpngA8oYVVwhkVBeaN3 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 3658598b-699d-4d67-f1c6-08d62aed4663 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:AM0PR0502MB3969; x-ms-traffictypediagnostic: AM0PR0502MB3969: 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)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051); SRVR:AM0PR0502MB3969; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0502MB3969; x-forefront-prvs: 0816F1D86E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39850400004)(376002)(396003)(366004)(136003)(199004)(189003)(81166006)(86362001)(966005)(6306002)(6512007)(6246003)(68736007)(53936002)(97736004)(316002)(8676002)(186003)(446003)(486006)(11346002)(2616005)(476003)(81156014)(102836004)(5250100002)(229853002)(6436002)(8936002)(26005)(7736002)(256004)(305945005)(5024004)(14444005)(6486002)(2900100001)(33656002)(25786009)(105586002)(76176011)(106356001)(53546011)(37006003)(71200400001)(71190400001)(99286004)(83716004)(54906003)(14454004)(2906002)(6116002)(4326008)(3846002)(6506007)(5660300001)(66066001)(82746002)(36756003)(6636002)(6862004)(107886003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3969; H:AM0PR0502MB3971.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: DTHpxZa81KlU5//KptkBRdRLihJukkvnVEj71s1YAXoqli82srtDD3nzKX7cHwIpXOLR+q3EpU4lYNPH+9cNOxgsI0B1E+2I+XBATZ20TxdtaPQqEIKpfBlPWqlpaX3IZLr27sNPNbF+UZtIqrUotgmBI7glqrC+6X+PanhaVzzb0pbxfojTD0olA7tAtys9G0pCA1WNXaw+zjFmGHKLrt1zgLvdhlZH2DofVgq3bnGUUjWK+G/OpilKcQjv7lSfl2m1J7qnXC2C2zZsj/eYlQAFXGWw+NvMnD7tGlAmP6hozJZvfyZg2u+0lPPZsoCs7+Z/ed8GOV6r4yvurN5JFcyH82tGSO7NrIyX1MF0xnQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <7A5978A403E97F4B890F7FEAF7C05F54@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3658598b-699d-4d67-f1c6-08d62aed4663 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2018 18:06:29.4824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3969 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: Fri, 05 Oct 2018 18:06:31 -0000 > On Oct 5, 2018, at 4:06 AM, Ophir Munk wrote: >=20 > 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. >=20 > [1] > https://patches.dpdk.org/patch/45601/ > ("eal: allow probing a device again") >=20 > Signed-off-by: Ophir Munk > --- Acked-by: Yongseok Koh =20 Thanks > v1: > Initial release >=20 > v2: > Rebase + code review updates > https://patches.dpdk.org/patch/45927/ >=20 > drivers/net/mlx5/mlx5.c | 27 ++++++++++++++++----------- > 1 file changed, 16 insertions(+), 11 deletions(-) >=20 > 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_er= rno > - * 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; >=20 > /* 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; >=20 > - 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; > --=20 > 1.8.3.1 >=20