From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 611C2C7618F for ; Fri, 19 Jul 2019 16:41:43 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id E857C2186A for ; Fri, 19 Jul 2019 16:41:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="JjJ0YHJ6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E857C2186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9ACE1322C; Fri, 19 Jul 2019 18:41:41 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150057.outbound.protection.outlook.com [40.107.15.57]) by dpdk.org (Postfix) with ESMTP id 41D062C2B for ; Fri, 19 Jul 2019 18:41:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDJHCScvvYE4yocgEN2k4xA0clxtpM8buOXsOTcfhRkRiGGRbT/UBx2xHbRhyJygW5HhMc/b0nlFq4/21ciGHov6zE+nyb+/Ai54wnqXTKRQOgLdids+Mg7ZFOshpEwbvmeS9wIUcctdO6usJM3lAQmWNEKR88mSMA1/bCApmyVWpW1Sqvmw9HZaIjHLAc7SzjaeIkEHXb3We6GxGSYPEK+NhdthjS9e87GxbjxUNNFAxpYcZrfxEweD1KZxDYRqmFf4O5iMA7kFN8nj9RVxOUESJwNmDhWTYMwst1dmGbpj7ugY3JYZHjFj3UnTyE12ETGKK2Bvm5Pugq1bO7tUCw== 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=l3fmSCNmEiUo6EOjuTZS31zE6Nz9niCoixlQruoTG4o=; b=ILfL5KzIwnYhA2NALrXqXK8LezBy16OBMf552TpT+2b1I+7bTAXOb0kbd+5Hg1h8pkTefv0NB4SFLLRZ2RYbdPv8yMU0h7SuAp+UTFL/CMGkrVxgt5TBqeR6mMm3vI4ew9LP/MMZQTMKL3sjYW3NtZU6gmQzn8/PgJm9JYAlkm6ifES+Gwma/WE0dKdQDJopPO24AwG13ggxC/UNxIPiL5Ml5cZOQa78N7m3gsTiNpq+OdJajurLEyEoQ9hKby0RasNLu7Al5TwtPKIhnm904MXvEFnYps0sYEYK1bG6BNy8AZdbDIjTQTCrxSKALw7PhOKo8+0JdBpbizyCod4ZsQ== 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=l3fmSCNmEiUo6EOjuTZS31zE6Nz9niCoixlQruoTG4o=; b=JjJ0YHJ6qPzbe51LLysje732BOIEq4NbMHRhVw48gFcUi/L9czB21WvzRSAnFNHj1MJfdcALigCzD5Pu/9/RtExSoeI2GYi/MP9ukJx3In42AXuA2y9IBIkUzwJjc3iBbh8gb/FaEFQ5RfbH21e9W9GZy1uPS093Fl0Z+8zJ0wg= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3298.eurprd05.prod.outlook.com (10.171.187.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.12; Fri, 19 Jul 2019 16:41:38 +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 16:41:38 +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+mKbSIGfA Date: Fri, 19 Jul 2019 16:41:38 +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> In-Reply-To: <20190719091544.40294c43@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.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8ff17116-57b6-48dc-c0f6-08d70c67f89a 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:AM4PR05MB3298; x-ms-traffictypediagnostic: AM4PR05MB3298: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3173; x-forefront-prvs: 01039C93E4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(13464003)(199004)(189003)(66066001)(3846002)(6116002)(11346002)(446003)(6436002)(26005)(53936002)(476003)(186003)(33656002)(102836004)(478600001)(14454004)(25786009)(256004)(14444005)(5024004)(486006)(305945005)(71190400001)(316002)(71200400001)(7736002)(6916009)(74316002)(4326008)(6506007)(99286004)(8676002)(6246003)(86362001)(107886003)(54906003)(7696005)(5660300002)(55016002)(2906002)(76176011)(9686003)(8936002)(53546011)(52536014)(229853002)(66446008)(66556008)(68736007)(64756008)(66476007)(81156014)(66946007)(81166006)(76116006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3298; 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: ny1IAr6QyAtOyeGKrGSQF5ECAE2xbWCgXS2tL0ka2DnmaQ+MNRCjNL/6M2M7N2Xg0aUTH5pmehLmuBIwMmtB4N2RDkBTILOXgc8lHXjFpMoUQ0U6EsSUPS0pvPfSmZSt5h7s64Gdb783IryXb7YxVu+PTzvyY77IdQriGsM/z8pK3dBbPNZFUZGJqcpZ3KqW7M0QjPcrpN1mF3DxrHTWtHN+vm5LrMJnTyEKKzzK665gDv2qHL6LUa4W41e0m4VegAmS6Mr2zav3QX9iWtCaxZeHHdbUtX0yaUpk2KCkjKFf7Y+ky1rI3rqo6JOaJOBTwsjm04YhJCbPqSAZ1izS1uqmjcuwt2nuXB8OXsCWx3utf5UhY2nSq75fbGwDHLtQ9Q+Y4TJBnvXJZXv5fK2V6ZU2Buol1nM7Su9C57+f39E= 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: 8ff17116-57b6-48dc-c0f6-08d70c67f89a X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2019 16:41:38.3873 (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: AM4PR05MB3298 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 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 >=20 > On Fri, 19 Jul 2019 05:31:44 +0000 > Viacheslav Ovsiienko wrote: >=20 > > + /* > > + * Store associated network device interface index. This index > > + * is permanent throughout the lifetime of device. We do not spawn > > + * 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 store > > + * 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; >=20 > This correct, but overkill. >=20 > 1. The comment is way too wordy. Please stick to only a couple of lines. > If you feel more explanation is necessary put that in the commit log. I'd prefer to see the issue description in the source, not by searching th= e git log for the appropriate commit. But OK, it does not matter. =20 > 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 c= hecked against zero to validate infiniband port is active). We need this assert he= re. > 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