Message ID | 20221116105205.1127843-3-linux@rasmusvillemoes.dk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp79443wru; Wed, 16 Nov 2022 03:08:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf7VBKNog97po/olKh7i0RJYq0Oume/HjN6VLaddOiUdzf0N23RQMplTBBSuqoq2fwLH6q+F X-Received: by 2002:a05:6402:5a:b0:45a:1bfa:98bf with SMTP id f26-20020a056402005a00b0045a1bfa98bfmr18756739edu.413.1668596914999; Wed, 16 Nov 2022 03:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668596914; cv=none; d=google.com; s=arc-20160816; b=0SK0v2Lob8tca+1SkIMOzXZ3nhYP5szEsLc+sszNhZ+5rBiRNrYD4nBXRGkh+bp7fN U6MB50Uh3tIxizXhBfWbT56Uhn1Yb2SLaBV6ywQN2X1jVDHzkEzURctdMCxJs99e6mJ3 ZFhzrYmPfLxZUqo3cnCUQIhWGk0rpg2tXBY2iqTfgUQoCSh6jVDFnGqL/bm3g3Pbr2H+ mWGwHfYnV5CA7K2+DOETdsNc/5Ntu6ykHOMwnR+6NV8XEzP7Ekj1yheCcCzMG8MKzYbh SuWs+9nP/OD9kf4njnuMSQXX5p7Gskv5z9lRl5dpvxDvB4C5CRyOJ1fRVOc63qHAggjo vIqg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Plqwnup+7oIelGEONlO5qvIt8Tuu+/wT1TXFJs1u9Nk=; b=l5zo2wV3AOE86N9FDesq+EolCYtZIeSFi07n1oRYZj7Uf0w7jkS0P7jKUiAKOMiTri ImXlSHGOpoHX2LDNFERIuwEBNZpqqkIZ4qqA4txXa3HyhFQj3C7XusmjZafkKdIZDG4j oXq3R1uIJH+QxN8fuWf4SyGIH2M2hJa/UvloyDSerFV40+WJo+H7xEFjtBEJ48FTIt2j 5MdX8j+jgkk1SJpyAhaN4W+tVl+7BSyhB4TlIcSgIMb8ggQqq0bBvT2EmFZ7JTBJTa4G KaN6fbe8+O+NE98j5/cIPNO3cCbUFmVKnX1w4+BsNhaH6RoSjjvtPgFQeoCkvtum3HJm U1Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=edTfsxl8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a056402248700b00456964d3369si14069372eda.230.2022.11.16.03.08.10; Wed, 16 Nov 2022 03:08:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=edTfsxl8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239026AbiKPLG1 (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Wed, 16 Nov 2022 06:06:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238608AbiKPLFm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 06:05:42 -0500 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B660F30541 for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 02:52:12 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id x21so21297756ljg.10 for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 02:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Plqwnup+7oIelGEONlO5qvIt8Tuu+/wT1TXFJs1u9Nk=; b=edTfsxl8lhPrR/gzCTwcVjVGe7HY9DcTsgM5PzvXupDXWAahISUX/t7qj7j6wsvZAB xJOrpZ0YJ3ZWOTnpV8q6t+UhgJeXGOdxhB/O69iyc8wumAieFnlZDVEk/SYXg//QMYZ8 Gc7lUQPoSqfuhGarWKYaGCE2rnkKC6QraGVDE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Plqwnup+7oIelGEONlO5qvIt8Tuu+/wT1TXFJs1u9Nk=; b=V81lHzpJ+IUgKdgViiJikDVFFX96qOF3umG8nUmZ9/8e1UkKnltGQdWB1SU/RH6enI 7UiN07iMLBK+xTF2yQXZ1mMpR6J46X57fJpf+/H5FgNm6bt+B32mjt3HUNwVUrkbfxWQ LRUj2SD3/2R9KNgRiECdCH6uakgvV99vglVy52hzRm1yhW/Bf5oc/lRIoUhE8e46yXaJ /j8ZagtufAJr7Qvx9m0WURXaYUGA3w1uyKEn+0+bPaRqJY6E4jlWBVASBTaDYoKVVv1d KYXyX1nBJcMgNk81nRSvxXHgUnKz9XOqgkJbkSDUJfo5GzK1a3Jr+azi4h1uKMUGs2/X FodA== X-Gm-Message-State: ANoB5pmcYfULgc9MgBzikiT5h7+KL6iX2slKiCPsPFWUFKkFvj4hY92q 6mxRtMS91qmBKssxYvfnddgb6w== X-Received: by 2002:a2e:b007:0:b0:276:ff14:7a4d with SMTP id y7-20020a2eb007000000b00276ff147a4dmr7197293ljk.490.1668595931072; Wed, 16 Nov 2022 02:52:11 -0800 (PST) Received: from localhost.localdomain ([87.54.42.112]) by smtp.gmail.com with ESMTPSA id g42-20020a0565123baa00b004b094730074sm2547119lfv.267.2022.11.16.02.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:52:10 -0800 (PST) From: Rasmus Villemoes <linux@rasmusvillemoes.dk> To: Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] net: dsa: use NET_NAME_PREDICTABLE for user ports with name given in DT Date: Wed, 16 Nov 2022 11:52:03 +0100 Message-Id: <20221116105205.1127843-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221116105205.1127843-1-linux@rasmusvillemoes.dk> References: <20221115074356.998747-1-linux@rasmusvillemoes.dk> <20221116105205.1127843-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749650678772724510?= X-GMAIL-MSGID: =?utf-8?q?1749650678772724510?= |
Series |
net: dsa: use more appropriate NET_NAME_* constants for user ports
|
|
Commit Message
Rasmus Villemoes
Nov. 16, 2022, 10:52 a.m. UTC
When a user port has a label in device tree, the corresponding
netdevice is, to quote include/uapi/linux/netdevice.h, "predictably
named by the kernel". This is also explicitly one of the intended use
cases for NET_NAME_PREDICTABLE, quoting 685343fc3ba6 ("net: add
name_assign_type netdev attribute"):
NET_NAME_PREDICTABLE:
The ifname has been assigned by the kernel in a predictable way
[...] Examples include [...] and names deduced from hardware
properties (including being given explicitly by the firmware).
Expose that information properly for the benefit of userspace tools
that make decisions based on the name_assign_type attribute,
e.g. a systemd-udev rule with "kernel" in NamePolicy.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
net/dsa/slave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Nov 16, 2022 at 11:52:03AM +0100, Rasmus Villemoes wrote: > When a user port has a label in device tree, the corresponding > netdevice is, to quote include/uapi/linux/netdevice.h, "predictably > named by the kernel". This is also explicitly one of the intended use > cases for NET_NAME_PREDICTABLE, quoting 685343fc3ba6 ("net: add > name_assign_type netdev attribute"): > > NET_NAME_PREDICTABLE: > The ifname has been assigned by the kernel in a predictable way > [...] Examples include [...] and names deduced from hardware > properties (including being given explicitly by the firmware). > > Expose that information properly for the benefit of userspace tools > that make decisions based on the name_assign_type attribute, > e.g. a systemd-udev rule with "kernel" in NamePolicy. > > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
On 11/16/2022 2:52 AM, Rasmus Villemoes wrote: > When a user port has a label in device tree, the corresponding > netdevice is, to quote include/uapi/linux/netdevice.h, "predictably > named by the kernel". This is also explicitly one of the intended use > cases for NET_NAME_PREDICTABLE, quoting 685343fc3ba6 ("net: add > name_assign_type netdev attribute"): > > NET_NAME_PREDICTABLE: > The ifname has been assigned by the kernel in a predictable way > [...] Examples include [...] and names deduced from hardware > properties (including being given explicitly by the firmware). > > Expose that information properly for the benefit of userspace tools > that make decisions based on the name_assign_type attribute, > e.g. a systemd-udev rule with "kernel" in NamePolicy. > > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Florian Fainelli <f.faineli@gmail.com>
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d19e9a536b8f..dfefcc4a9ccf 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2385,7 +2385,7 @@ int dsa_slave_create(struct dsa_port *port) if (port->name) { name = port->name; - assign_type = NET_NAME_UNKNOWN; + assign_type = NET_NAME_PREDICTABLE; } else { name = "eth%d"; assign_type = NET_NAME_UNKNOWN;