From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00061.outbound.protection.outlook.com [40.107.0.61]) by dpdk.org (Postfix) with ESMTP id 0CA485F2B for ; Fri, 5 Oct 2018 03:42:02 +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=7LVtZBFbpY03IlUny57qUAVmYQnhM7oNfYMM2cLf18g=; b=qfEItRIdlYNklpTSUusStPc9AlNplrH71TxL9vgivu9vDWWZJI4eh5Z/Hec0/5h820m03DhPtdoD333PgkMftuo8aJ8iOkJNxAjT1bthU9NIwojbQmALpDTD8zXTKABHxTkY3Jb9KSbgl9Ap7bJ/CFUUp6GvwFA6bRr0mhN0g38= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Fri, 5 Oct 2018 01:41:59 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1185.029; Fri, 5 Oct 2018 01:41:59 +0000 From: Yongseok Koh To: Ophir Munk CC: "dev@dpdk.org" , Asaf Penso , Shahaf Shuler , Thomas Monjalon , Olga Shern Thread-Topic: [PATCH] net/mlx5: allow multi probing Thread-Index: AQHUWu9GH42gSE5On0iFhzMSfK8WwqUP40mA Date: Fri, 5 Oct 2018 01:41:59 +0000 Message-ID: <20181005014145.GA5488@mtidpdk.mti.labs.mlnx> References: <1538553677-32010-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1538553677-32010-1-git-send-email-ophirmu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR15CA0065.namprd15.prod.outlook.com (2603:10b6:301:4c::27) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:jIhpOvDJl9mLjsrpgsWzZCuSyQ6nVsSFqp9WNtiXHFn9QHHgu6txbdBkx1BnkYNEsJeklEWizT+IvHMx1gsK+7G7Q8AN9CMaDzsBx0cuWZ+BckUpfzeiPwsMH4a0HRrfiptcbQpMZtErhILyUHwc0zXr9o3QBHz6StNhDk46AOQlCvlAkNa32O2pjbztE/HgiRM4CXPs9R+tfh3DYzECnA2LMa6NDoYwn0wP8aTYrVhTz2MSr2Aq6CjH+I9WXRz2Jt/i6D9qL3mACH0pPLGRmhrCg79oX0bCsKflzOrAWeLFLLgfJyZS/C24yMlatedQHtA3o8Qn1vOy4JzS7kNyQVhkjbO+/RER1roFg+Yq3Yey9rXijBoo0lXBHsWU0lzahbwfH475XJw8b3fLDnaOpQB4Kn8lqrHfQQ0FBZeKvPxNP1iDyJE0/oVMlhyvtLX4pwAU1JCfBkHEqw1dUgnLSQ==; 5:eHzWpq8IanIfAXYkSFglAS9qi4zkC2skWBbCt0Nz3coJZGoyDahySq9Q3tQ6eWm9oqL7xFariUEbJthuJUX8Gwvwz3081HYN22z+LnJ/We+qD3NOiFSr7mgWxPgbJCZHI0alu5PIQiYSrLaBasG7AzaAoZzTQas55oZgmkyJHDw=; 7:YC1dD/Gu2J5o3ptD0O3sCgmyGA/sQv2TRniyAa9yxSVhgi26A1D6YLLsjwSsbTkSJxylc77mDlOO+FnNtYuYpi80X4gVCRN8DjqlwKUlhvLGN70f93/+85+VhsIAHuTlm5/B/HkXCVjZIA3EAc6SJNPNwdUWJq8X+xvRBDsU8wfRR/PRWWYKJip9VRSHsTYBSCVokwZJ3MvwEh7S4fbtrgp+OlThxywps+TxZ+7tl1cZVDcF281y0ECZ6TQXTav3 x-ms-office365-filtering-correlation-id: 98916084-ecb5-4ee4-5887-08d62a63bd36 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 0816F1D86E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(376002)(396003)(39860400002)(189003)(199004)(1076002)(6486002)(33656002)(6436002)(2906002)(316002)(8936002)(256004)(5024004)(14444005)(6512007)(9686003)(6306002)(53936002)(68736007)(81166006)(8676002)(81156014)(99286004)(6506007)(5660300001)(575784001)(86362001)(66066001)(52116002)(386003)(6116002)(3846002)(33896004)(76176011)(7736002)(229853002)(305945005)(6636002)(25786009)(97736004)(14454004)(54906003)(105586002)(106356001)(5250100002)(2900100001)(486006)(446003)(71190400001)(476003)(71200400001)(11346002)(107886003)(6246003)(186003)(26005)(4326008)(102836004)(478600001)(966005)(6862004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: AEC5vdq1jDRuaLaA8RbBr2LPi6QpjgIMSgURnswxygKDnhpRsqEIf+GB0muNVRVrXUEfvOGQCUx9xx0Vc75o/jMswo0+ERmeA0JILu7an8vy6PgX868sN+oBBcb/AYa6nRApg6UTU9Q9+RHLxuJyfsRXqoV5sCOWvWjdoextdtPvPtDmUnnasuGpQlWoDVEL3RJd7mxiRxS53ODvB+3vPLzxmCkh/c6hkICpoWZfbadIYn/052WJC1sdmDLdnyYyU9UW2GNgu977uJtveC+dA76Bd2CT5ZBf7NhX9VHTpRN1XyC1Y0vX+sFlXL7sjyCHgelX7XR6Pwm1XUkxUqgOO1s9lJ2tmdpJMjfoxrQfgOI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <688C597A8772EE41B2FAEBF1C1BB65F8@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98916084-ecb5-4ee4-5887-08d62a63bd36 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2018 01:41:59.6136 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 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 01:42:03 -0000 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. >=20 > [1] > Serie: ("eal: allow hotplug to skip an already probed device") A typo? Series? For the title, either 'multi-probing' or 'multiple probing'. And I suggest net/mlx5: allow multiple probing for representor And I have only nitpickings below ;-) > https://patches.dpdk.org/project/dpdk/list/?series=3D1580 >=20 > Signed-off-by: Ophir Munk > --- > drivers/net/mlx5/mlx5.c | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) >=20 > 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; > =20 > /* Determine if this port representor is supposed to be spawned. */ > @@ -758,6 +759,17 @@ > return NULL; > } > } > + /* Build device name */ Better to put a period (.), if it is a sentence. > + 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 */ How about, /* Check if the device is already spawned. */ "return NULL" is so obvious from the code. > + if (rte_eth_dev_get_port_by_name(name, &port_id) =3D=3D 0) { > + rte_errno =3D EBUSY; Semantically, shouldn't it be EEXIST and add the condition in probe()? > + 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; > =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; > @@ -1412,7 +1416,7 @@ struct mlx5_dev_spawn_data { > if (!list[i].eth_dev) { > if (rte_errno !=3D EBUSY) I meant this to be, if (rte_errno !=3D EBUSY && rte_errno !=3D EEXIST) Thanks, Yongseok > 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