From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20050.outbound.protection.outlook.com [40.107.2.50]) by dpdk.org (Postfix) with ESMTP id 75B1F1DB9 for ; Fri, 5 Oct 2018 13:20:18 +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=UNn9IWTyMupN2fF0sEqhAluCPj3lhx7ZgydR7VXPWb4=; b=Fi9G4FsAAbHTmhzz1OxEW8j7gB3kCqbNStjiaT4omT59TXdM2VCjGiLYDn9P2VaJS3g9ubKl1rusCiBHRJjMq5rT6Mx/ul3wTVjYX3NPTZeUBeseX5ufnfkpWlFc0ShFJLsvGK9qIssC5J7iBvXR1x6h9qCrAbVMU6UGPSp8RmU= Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com (52.134.8.154) by VI1PR0502MB2944.eurprd05.prod.outlook.com (10.175.25.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Fri, 5 Oct 2018 11:20:15 +0000 Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::e48b:53fa:f268:753]) by VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::e48b:53fa:f268:753%2]) with mapi id 15.20.1207.024; Fri, 5 Oct 2018 11:20:15 +0000 From: Ophir Munk To: Yongseok Koh CC: "dev@dpdk.org" , Asaf Penso , Shahaf Shuler , Thomas Monjalon , Olga Shern Thread-Topic: [PATCH] net/mlx5: allow multi probing Thread-Index: AQHUWu9GH42gSE5On0iFhzMSfK8WwqUP40mAgAChg3A= Date: Fri, 5 Oct 2018 11:20:15 +0000 Message-ID: References: <1538553677-32010-1-git-send-email-ophirmu@mellanox.com> <20181005014145.GA5488@mtidpdk.mti.labs.mlnx> In-Reply-To: <20181005014145.GA5488@mtidpdk.mti.labs.mlnx> 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; VI1PR0502MB2944; 6:LGvaF5Autsb6nWznBQkI5ZDYzVNyim++QzV0P2EQgBCwRBoP+vUygaWtD+E+r9bc2G3s/QDVe3rC/62GG2zPC8FhrJGxNeeTRYx0CfFERqaeI4DmzU7DllaW715gZBPcCF2YK8ehkuES6vZ/IpcOk01ysxvztfZo1qQILIv5zIhfTYrFvU/q1mUGrONTMhknCua3BIEGJ9n6FQGLe7UaeDu2pWCqFgJznt7fAq1ZaZ6Gl3HKtOn4zJOgHHdPjCukVYyv4tQnaScw5PjQPh3BEm+REgR22E8ndlg7WZ13M+MJc+/VKxd5P12OXQYECQ+sHrZwZo369hW+i1yevL+NFAmAiVrnre3RlLVcoCcTQn0t+aQt/lk08b6X3pAlikgxwqU8Sm/WjRxS48Bl3xKSWICluL4ksxdRkdjyYmzsR6ABS0ztb9JAZwvEcAZtU+5DL3BPbwjCOC+8Xo9ze5DivQ==; 5:GRVew335mpl2rNnuCpMyrm1BXPJVGZi8MKNY+d/XvwzdsA5YSCJJoIAPFk0DzPZIvJhV9pSgO1hg75kOj6Ozsqp5FApBgNH6g5sjrfagHT3ws197VwEaEdU4y16sdWhowIEh0aBhEJZsLcTdT35U/V2we1XzVU9X9QHd66srL78=; 7:GNKSV+GNRGCs8vOt0Bst85kF0vMG1vImVg2eo2zCDK5OiETtjChqF8N9IfIg3+il0dsDgmMKUNyIIxxNiRqzrNTb7ocffARR624w+JfE8FwfwruhpvDoGr6lzDQUGhOV3qXuwIok1BE4yZhAMc5qWAMIPqm3FES2Dm+8dXA+nHLFOUBx9TaKm5yJz9A2xW3ikqaQv+UwJO3opDcihmRoKWex/1MUO5Xhxp3Jv1j8dKI0brD3tsej8cUu9z2mNSc8 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 88f014ce-4654-4bcf-9e66-08d62ab48669 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:VI1PR0502MB2944; x-ms-traffictypediagnostic: VI1PR0502MB2944: 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)(10201501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(201708071742011)(7699051); SRVR:VI1PR0502MB2944; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB2944; x-forefront-prvs: 0816F1D86E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(376002)(39860400002)(396003)(13464003)(199004)(189003)(68736007)(33656002)(8676002)(97736004)(99286004)(5250100002)(9686003)(53936002)(14444005)(5024004)(7736002)(86362001)(2906002)(575784001)(106356001)(6862004)(4326008)(2900100001)(105586002)(107886003)(8936002)(186003)(81166006)(81156014)(6246003)(53546011)(76176011)(25786009)(5660300001)(7696005)(6506007)(486006)(71190400001)(6436002)(476003)(71200400001)(229853002)(54906003)(6636002)(102836004)(316002)(6306002)(55016002)(446003)(66066001)(11346002)(256004)(305945005)(6116002)(26005)(966005)(74316002)(478600001)(3846002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB2944; 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: /5W4faEpreoNVEVudkY7OQ0SLf3ixYJMIQO+xALWQI6Rtmhrp+gP96TqAkyQmsONMtx77lxXQ4LXvcYjeNwumeUXrup6fPX+WcxqqVwcGvN3JJ/9xgp9oaJwnVf3mh03umpHMjMBjxTwml5eneYD7Uo3IGt7YOh6kwpCiJks1ueLNhTi6mDBUXVUgSHhVxgQCdiICQtwOOhp5Rh4A+qC76G+CUjt80CUQ12OJy8CeGawQ+Ge+HwexBaQuspTT1dXdoW5m5LjJUr1oqZt241uylGdUWPX4BfWuRl0P5wYL3kctwKQWnBKecmhoul3U9q7poqCUtpHc+xZl+HfYxbj5Vr39qDDKrBmogs8VRIlNBA= 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: 88f014ce-4654-4bcf-9e66-08d62ab48669 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2018 11:20:15.6512 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB2944 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: allow multi probing 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 11:20:18 -0000 v2 sent > -----Original Message----- > From: Yongseok Koh > Sent: Friday, October 05, 2018 4:42 AM > To: Ophir Munk > Cc: dev@dpdk.org; Asaf Penso ; Shahaf Shuler > ; Thomas Monjalon ; > Olga Shern > Subject: Re: [PATCH] net/mlx5: allow multi probing >=20 > On Wed, Oct 03, 2018 at 01:01:23AM -0700, 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] > > Serie: ("eal: allow hotplug to skip an already probed device") >=20 > A typo? Series? >=20 > For the title, either 'multi-probing' or 'multiple probing'. > And I suggest >=20 > net/mlx5: allow multiple probing for representor >=20 > And I have only nitpickings below ;-) >=20 > > https://patches.dpdk.org/project/dpdk/list/?series=3D1580 > > > > Signed-off-by: Ophir Munk > > --- > > drivers/net/mlx5/mlx5.c | 22 +++++++++++++--------- > > 1 file changed, 13 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > > b2b0aaa..16a8b9d 100644 > > --- a/drivers/net/mlx5/mlx5.c > > +++ b/drivers/net/mlx5/mlx5.c > > @@ -736,6 +736,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. */ > > @@ -758,6 +759,17 @@ > > return NULL; > > } > > } > > + /* Build device name */ >=20 > Better to put a period (.), if it is a sentence. >=20 > > + 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); > > + /* if dev (master or representor) is already spawned - return NULL > > +*/ >=20 > How about, > /* Check if the device is already spawned. */ >=20 > "return NULL" is so obvious from the code. >=20 > > + if (rte_eth_dev_get_port_by_name(name, &port_id) =3D=3D 0) { > > + rte_errno =3D EBUSY; >=20 > Semantically, shouldn't it be EEXIST and add the condition in probe()? >=20 > > + return NULL; > > + } > > /* Prepare shared data between primary and secondary process. */ > > mlx5_prepare_shared_data(); > > errno =3D 0; > > @@ -864,11 +876,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); > > @@ -1298,9 +1305,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; @@ -1412,7 +1416,7 > @@ struct > > mlx5_dev_spawn_data { > > if (!list[i].eth_dev) { > > if (rte_errno !=3D EBUSY) >=20 > I meant this to be, > if (rte_errno !=3D EBUSY && rte_errno !=3D EEXIST) >=20 >=20 > Thanks, > Yongseok >=20 > > 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 > >