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 E7CEFA0471 for ; Fri, 19 Jul 2019 20:31:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 17A65322C; Fri, 19 Jul 2019 20:31:24 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150081.outbound.protection.outlook.com [40.107.15.81]) by dpdk.org (Postfix) with ESMTP id 28C3E23D for ; Fri, 19 Jul 2019 20:31:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b42qdeU5r2aHgKze7JGajnQ7bxasJpREcaRaSJYA6FDUmeRr8JjttPtuwDlqv4Qs+FRG4C1nHVdmrrQ4Ay1R5R+6e9IbA7ife3r4bAvakHXsCa6kLfBWyOSjY2TTvfRC2OAwxcgZHheEfMh1QitATHA/nFJmebhyksmsM0ei+oHD5rN4sn/TBW/hpJBmoz5Jp96p4UdOX5IySnhpfFGodctACxMx/YLDeKhHd6IxjPOSzOa1fgzAnNjlxgeB5hZ4DazdRBiUdo7STTgsNZUU35rXeANZ331tgPuPk62jBB8HPSuf37mCrSW6RqJfdp6LP5nyv4LKyFGUx69MAIJwgw== 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=RJWAOOZzne+GVwRri1Vt/x+gOCplM4ATQKshhrmZRDU=; b=ZGHz6U32nusQxuLfRu/lYBh+P6uOGaYmdlzdRIB1gCytbClZnkhp+fRQjw73i2UpFb1wwz7ksNogoTS7WSKIH0PkAPBFJMsnjA0+VWZIVk2MLaN3N3mBjQjTsN8Btz3bt2ZRnF9SreCh/jcmcXOkDLG3BsauihkuRZoFoGzyEYmqt58umS6AIinuLVU9Rx2LR/2zzIRtwUs32QgYfM2H4k5qrEzb397f9h+E3+pFJ9Kpevyp+BtoNoKsdxs0Yuo0MYufBkbDMlOkgScDIeGizb0eKXd2/lgaurrGLUuTte77D5Dt6LHa8EdY2k25xyCpe2cQuMFQ27mcBdwjRou0ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RJWAOOZzne+GVwRri1Vt/x+gOCplM4ATQKshhrmZRDU=; b=paRQHomo+wW4MEugGZQXIg5VNQVXoyq1qRtn9CUN+vg2fALWoQxa8eS4zU5jDw0w/gMcWTDysRCSKxwkCFHJEfHTQRF7BdU214NBmKwPGZLPN4EhEPhof1OuZbebAcifuFegei95p44jI/VuDc1Pbssb/Y3R2ceaQSuhNGjfsH4= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3201.eurprd05.prod.outlook.com (10.171.188.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Fri, 19 Jul 2019 18:31:21 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::ec83:c573:8eda:b6a]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::ec83:c573:8eda:b6a%4]) with mapi id 15.20.2094.013; Fri, 19 Jul 2019 18:31:21 +0000 From: Slava Ovsiienko To: Stephen Hemminger CC: "dev@dpdk.org" , Yongseok Koh , Shahaf Shuler Thread-Topic: [PATCH 1/2] net/mlx5: cache the associated network device ifindex Thread-Index: AQHVPk0+r9LQ7/23fkCmWvIn2oI+mKbSIGfAgAAbeYCAAAOLcA== Date: Fri, 19 Jul 2019 18:31:21 +0000 Message-ID: References: <20190712205425.17781-3-stephen@networkplumber.org> <1563514305-27405-1-git-send-email-viacheslavo@mellanox.com> <1563514305-27405-2-git-send-email-viacheslavo@mellanox.com> <20190719091544.40294c43@hermes.lan> <20190719110317.27222925@hermes.lan> In-Reply-To: <20190719110317.27222925@hermes.lan> 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=viacheslavo@mellanox.com; x-originating-ip: [95.164.10.10] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 137c2b58-b9e6-4e9d-125b-08d70c774c52 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM4PR05MB3201; x-ms-traffictypediagnostic: AM4PR05MB3201: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 01039C93E4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(136003)(366004)(346002)(396003)(39860400002)(199004)(13464003)(189003)(66066001)(71190400001)(71200400001)(9686003)(6246003)(2906002)(4326008)(107886003)(66446008)(86362001)(64756008)(76116006)(55016002)(66476007)(66946007)(53936002)(5660300002)(74316002)(52536014)(66556008)(478600001)(6916009)(3846002)(305945005)(6116002)(14454004)(33656002)(68736007)(486006)(256004)(25786009)(5024004)(14444005)(54906003)(6436002)(6506007)(81156014)(76176011)(81166006)(316002)(229853002)(99286004)(186003)(7736002)(102836004)(26005)(53546011)(446003)(7696005)(8936002)(8676002)(11346002)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3201; H:AM4PR05MB3265.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: PVk9u7UMc+pCIj5gXbBGZo6BGS+0c+77E6diN2Zeq+9oJ9X/DIg6byKsM4xhyCAkZiL1VRHy9GevCv+6wP9SL3lhPQHG//lzmCpKRzfh8s96k2TmTGZif6tFt5hSumPPgAE8T1cFkxj5aHDgrJVW1IEboAWrNFzIzfqVd2kRNFT1xIRn1IYE5YZGVaHqvbYhaGcsOb8Y/IFr9wGz5efchv1fgxW+2KHZlMw2Xk1H9VZM8b0pPLymnCXCLHHkZTBK2rR2Y6z/XczuHW86rgvhxlEfDidPimCvByprQ6z2gWKHdXs58YeDcFuirpdd3ZBEBxc91dKTunryukb0IZLqSCkeXS/lf+hv3Zrei/3EinPkJXHZY+JutG4lyxO3z5DgZhX9kV7/7pFzNBQS56eKeFXbp8gEaon+cF9oTAgeVxI= 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: 137c2b58-b9e6-4e9d-125b-08d70c774c52 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2019 18:31:21.5724 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: viacheslavo@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3201 Subject: Re: [dpdk-dev] [PATCH 1/2] net/mlx5: cache the associated network device ifindex 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" > -----Original Message----- > From: Stephen Hemminger > Sent: Friday, July 19, 2019 21:03 > To: Slava Ovsiienko > Cc: dev@dpdk.org; Yongseok Koh ; Shahaf Shuler > > Subject: Re: [PATCH 1/2] net/mlx5: cache the associated network device > ifindex >=20 > On Fri, 19 Jul 2019 16:41:38 +0000 > Slava Ovsiienko wrote: >=20 > > > -----Original Message----- > > > From: Stephen Hemminger > > > Sent: Friday, July 19, 2019 19:16 > > > To: Slava Ovsiienko > > > Cc: dev@dpdk.org; Yongseok Koh ; Shahaf > Shuler > > > > > > Subject: Re: [PATCH 1/2] net/mlx5: cache the associated network > > > device ifindex > > > > > > On Fri, 19 Jul 2019 05:31:44 +0000 > > > Viacheslav Ovsiienko wrote: > > > > > > > + /* > > > > + * Store associated network device interface index. This index > > > > + * is permanent throughout the lifetime of device. We do not spaw= n > > > > + * rte_eth_dev ports without associated network device, and if > > > > + * network device is being unbound we get the remove notification > > > > + * message and rte_eth_dev port is also detached. So, we may stor= e > > > > + * the ifindex here and use the cached value further. The network > > > > + * device name can be changed dynamically and should not be > > > cached. > > > > + */ > > > > + assert(spawn->ifindex); > > > > + priv->if_index =3D spawn->ifindex; > > > > > > This correct, but overkill. > > > > > > 1. The comment is way too wordy. Please stick to only a couple of lin= es. > > > If you feel more explanation is necessary put that in the commit l= og. > > > > I'd prefer to see the issue description in the source, not by > > searching the git log for the appropriate commit. But OK, it does not > matter. > > > > > 2. It is perfectly okay to return 0 as a value in dev_info. > > > Therefore the assert is unnecessary. > > > > Valid network interface index cannot be zero. For example, > > if_nametoindex() returns zero in case of error. Also, in mlx5 we do > > not spawn ports without attached network interfaces. Assert is not > > related to dev_info, it checks whether the mlx5_dev_spawn() is called > > with valid ifindex for valid port (ifindex checked against zero to vali= date > infiniband port is active). We need this assert here. > > > > > 3. Where is "Reported-by:" > > It is in cover letter: > > "Proposed-by: Stephen Hemminger " > > Sorry, I forgot to add this one in commit message, will fix. > > > > > 4. What was wrong with my simpler patch? > > Please, see the cover letter. Your patch fixes only the part of > > problem - the mlx5_dev_infos_get(). But it is just the case of unsafe > mlx5_ifindex() usage. > > mlx5_ifindex() itself must be fixed instead. > > > > WBR, Slava >=20 > Will your patch be backported to stable? > It is critical that primary/secondary work on older releases. Quite possible. Is there the full-featured secondary processes support in 18.11 LTS? I think it's worth to recheck the hotplug feature in 18.11 to avoid ifindex unexpected change (try to unbound/rebound network device from/to PC= I one, check whether it is disabled/rejected, etc). With best regards, Slava