Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp169404imd; Wed, 31 Oct 2018 16:43:09 -0700 (PDT) X-Google-Smtp-Source: AJdET5cvlZmmsem3Mo+ZsxiUijssT56yFSvNnb9DaNrI2Wy0ah7QMI7AR6R8tdYmgxyb8OKuagAa X-Received: by 2002:aa7:858b:: with SMTP id w11-v6mr5476261pfn.77.1541029389831; Wed, 31 Oct 2018 16:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029389; cv=none; d=google.com; s=arc-20160816; b=PudlW5pq3GNp99u36W8vtH0gPwG20wPjVM7MoOg19G5l/UeKCTE06pbiVowDGWL/+Z 0ku+I7BDFTgjD7qP+oMzQTc4OO3iA4eKBuLGbWxx2LDMByXt9pMQCrtUlpadMLSwFieD lLuGPnZVHk6uBJjcFxAOJmyldnrWa3HqAaBkQLPuJdLjxeDCVTzSkkTZEe3HpBbxlhZU PKwpsLhBHuJU3qArTt/6aauiMuvkNOIRQW2zVFYGnAwMzIGJXJvrWPBAkwDNm6XcY3xq 0LJNJYEO1/5WE2XleKh6JRY5vc4VpmpLI1XnitiDrtEeJNTN0Ao9WxrNDGhrLXuEnjSy 57Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=WVxf7LsjxSaLD07E/UYFbJCpkKLjPZtIEoc2ZySWQ94=; b=WDOwYfpVQcHpU2gXFjII0P1zmWS2dBNRqWcWXDS12OpylrR2QBeJrdECkZVjLXIb/6 1lC3xudvhUEINJZpuIGVNbUN7WkrzDi2lUwNpUgAz8yhCVpGJTe0oVJZaSzccxwOEcDe sS5RE0SqRlQavFyUQO1e+ujOXfSOVcYYBBX5XsQi/L8VQXdSoFZzpT6zB/u4v66A8l4m LKITTKf22IitdVaigiKYW9qVBv33YW3rI8HtXVcgYFSWqlOWh0d4HMuYCc/fCWUNRiE+ yG/yfngOdQGwZ3jCusBmEsDOistaEPrNF4RPmDU704OTZ4+93wijRvHpTLxbJDZdBjQb KC6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPhKds3h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y35-v6si24559658pgl.14.2018.10.31.16.42.55; Wed, 31 Oct 2018 16:43:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPhKds3h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729493AbeKAImz (ORCPT + 99 others); Thu, 1 Nov 2018 04:42:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:56124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729150AbeKAIHy (ORCPT ); Thu, 1 Nov 2018 04:07:54 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 478942081B; Wed, 31 Oct 2018 23:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027262; bh=Iwc4BzNnRWhsEvk+pi/1G8ghlkj6TChOHvX5l4wnkbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CPhKds3hsVICfRj8MaoNOoGeYOkd0/qT//x48I/3AxnqFvQ2hTKs3o0RSkisZdvqK z6ZFtV1gYTDWCkikZqrXdzqWSAJNg64tjL7ykmsvKF5No9EBWFMsy2dIBvjjTGV++M BDOHn0nRh8S2/pQpAuu6QVLl11q8+ZyypEuDlNYA= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arseny Maslennikov , Doug Ledford , Sasha Levin Subject: [PATCH AUTOSEL 4.19 134/146] IB/ipoib: Use dev_port to expose network interface port numbers Date: Wed, 31 Oct 2018 19:05:29 -0400 Message-Id: <20181031230541.28822-134-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arseny Maslennikov [ Upstream commit 9b8b2a323008aedd39a8debb861b825707f01420 ] Some InfiniBand network devices have multiple ports on the same PCI function. This initializes the `dev_port' sysfs field of those network interfaces with their port number. Prior to this the kernel erroneously used the `dev_id' sysfs field of those network interfaces to convey the port number to userspace. The use of `dev_id' was considered correct until Linux 3.15, when another field, `dev_port', was defined for this particular purpose and `dev_id' was reserved for distinguishing stacked ifaces (e.g: VLANs) with the same hardware address as their parent device. Similar fixes to net/mlx4_en and many other drivers, which started exporting this information through `dev_id' before 3.15, were accepted into the kernel 4 years ago. See 76a066f2a2a0 (`net/mlx4_en: Expose port number through sysfs'). Signed-off-by: Arseny Maslennikov Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index e3d28f9ad9c0..30f840f874b3 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1880,6 +1880,8 @@ static int ipoib_parent_init(struct net_device *ndev) sizeof(union ib_gid)); SET_NETDEV_DEV(priv->dev, priv->ca->dev.parent); + priv->dev->dev_port = priv->port - 1; + /* Let's set this one too for backwards compatibility. */ priv->dev->dev_id = priv->port - 1; return 0; -- 2.17.1