Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4355559pxj; Tue, 8 Jun 2021 12:16:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnU6YnKQ6F50g3EgQS5pO+tzN9GZCO8uhua8cb3xkssenClUkSYEJZxLZEZ2IX0UjAED64 X-Received: by 2002:a17:906:530e:: with SMTP id h14mr25102647ejo.165.1623179769173; Tue, 08 Jun 2021 12:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623179769; cv=none; d=google.com; s=arc-20160816; b=c6n3D9pYgCtuOrZKxF7z13mbiX5doh0CLjLeyolhgxwWPLEcNn6sN+ay4if88P7fBj uhQ7ZkZbxvOPfJtJdKHNzHymW48GNvB5eih8TCYY14Cal/98NhQGA5dBi3mqBCfETXZv 22xRGbcsK6+T8up/MpNtPSUEFKzn1vwLO5cy77r9OBzudBy3BSu51uAMiXWEBXbZKwcH 1RTqiLBnT0aJUzYMsCg081Gp4Yc+i+1+JY/TD0phf1P50AbykM7w3+xN9dEINxKlHTO1 d+aYP8njMrRX59/A9/woLKAjTeYZfByKHJdSl4tgqoydyOnBrWeiQsaVysogVQvmfFQL Ud4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x80RndHZNBcaImj1qz/kOi9F1U5IEncJo/APgm/xuEA=; b=maydP7JLTKII7zOQz4cuItH7vt4ndrcTAouImGjtS64MlQ59jZkW+U4vwb06xB9e0N OBVwV2cS3xh7aechm+ZY+9E1+nwD32dr8d2yx5QGs0oNFDb7s/M5OY/3M2LwcqO1a2Qv k7KSTHk+8gL4ElOdMZ2/POZsCdysIHDuYvExtwcLwqFAbFfUGboNLP/2rDKPkKI5Lrp1 9Uzb43Rxa4KJI4UiYzPp2ya45VcluJQg7Dp2DYFpI/dpeqSoUY/Y4AQOBt/Q0LhHq0iD wzdz9emT9OkDDpjUDQWDgj5qJ/zqxg1hGVYQpJlk2JE3AyBkZjoofV/E+GBbq78A7Hq0 ++bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1A3zft4B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bj22si449289ejb.53.2021.06.08.12.15.45; Tue, 08 Jun 2021 12:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1A3zft4B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238367AbhFHTOt (ORCPT + 99 others); Tue, 8 Jun 2021 15:14:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:44948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236852AbhFHTD1 (ORCPT ); Tue, 8 Jun 2021 15:03:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E6E561925; Tue, 8 Jun 2021 18:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177948; bh=S62UvOcIL6GR9cIOkgaAcjLOlEL4L6W72ky7PUZPyJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1A3zft4BCWVL4Lawmbbhl29DLHIwKh6lLqU15PIdIXOpcrhtWHo9cPksyrByhrUsB dHkAffNdyuegy80S/4FFdXLk8DnmFjAB+V02fLP4gQZgbtAHw2ZYmGRhVC843Gxa8v sSeyGU924kNfzkKCy9IrG9hfSbhhGo22+FzUE8Zk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parav Pandit , Jiri Pirko , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.12 021/161] devlink: Correct VIRTUAL port to not have phys_port attributes Date: Tue, 8 Jun 2021 20:25:51 +0200 Message-Id: <20210608175946.169978930@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175945.476074951@linuxfoundation.org> References: <20210608175945.476074951@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Parav Pandit [ Upstream commit b28d8f0c25a9b0355116cace5f53ea52bd4020c8 ] Physical port name, port number attributes do not belong to virtual port flavour. When VF or SF virtual ports are registered they incorrectly append "np0" string in the netdevice name of the VF/SF. Before this fix, VF netdevice name were ens2f0np0v0, ens2f0np0v1 for VF 0 and 1 respectively. After the fix, they are ens2f0v0, ens2f0v1. With this fix, reading /sys/class/net/ens2f0v0/phys_port_name returns -EOPNOTSUPP. Also devlink port show example for 2 VFs on one PF to ensure that any physical port attributes are not exposed. $ devlink port show pci/0000:06:00.0/65535: type eth netdev ens2f0np0 flavour physical port 0 splittable false pci/0000:06:00.3/196608: type eth netdev ens2f0v0 flavour virtual splittable false pci/0000:06:00.4/262144: type eth netdev ens2f0v1 flavour virtual splittable false This change introduces a netdevice name change on systemd/udev version 245 and higher which honors phys_port_name sysfs file for generation of netdevice name. This also aligns to phys_port_name usage which is limited to switchdev ports as described in [1]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/Documentation/networking/switchdev.rst Fixes: acf1ee44ca5d ("devlink: Introduce devlink port flavour virtual") Signed-off-by: Parav Pandit Reviewed-by: Jiri Pirko Link: https://lore.kernel.org/r/20210526200027.14008-1-parav@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/devlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index 737b61c2976e..4c363fa7d4d1 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -705,7 +705,6 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, case DEVLINK_PORT_FLAVOUR_PHYSICAL: case DEVLINK_PORT_FLAVOUR_CPU: case DEVLINK_PORT_FLAVOUR_DSA: - case DEVLINK_PORT_FLAVOUR_VIRTUAL: if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER, attrs->phys.port_number)) return -EMSGSIZE; @@ -8629,7 +8628,6 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, switch (attrs->flavour) { case DEVLINK_PORT_FLAVOUR_PHYSICAL: - case DEVLINK_PORT_FLAVOUR_VIRTUAL: if (!attrs->split) n = snprintf(name, len, "p%u", attrs->phys.port_number); else @@ -8670,6 +8668,8 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, n = snprintf(name, len, "pf%usf%u", attrs->pci_sf.pf, attrs->pci_sf.sf); break; + case DEVLINK_PORT_FLAVOUR_VIRTUAL: + return -EOPNOTSUPP; } if (n >= len) -- 2.30.2