Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp82900lqs; Thu, 13 Jun 2024 04:44:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/rkCG85rts1VclsbEp7y//TLUIbeeyt/QuAid/9RInZc5n1RoQ6Nqg21ZLg0dJUgc0wwR8WxEh/S2fBlgN/Lnd9rBu83XBi2O6mezBA== X-Google-Smtp-Source: AGHT+IGoXUrY05jY8gZvKRPXI/vnAvl4F9foGYGieJweGomWz8pESHZUohX/Mrq6n6ZCnz7N+gzz X-Received: by 2002:a05:6a00:1146:b0:702:6dc7:2368 with SMTP id d2e1a72fcca58-705bce514aemr4541912b3a.12.1718279057589; Thu, 13 Jun 2024 04:44:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718279057; cv=pass; d=google.com; s=arc-20160816; b=v1dRMXA+Jt3mRNsi7co1h2LY7D/jlh+ZtvZTW/BPLhhiTqNw75rRp4zJzZi4GqOzOT n56hnNFjz1Tegsqgc4w2vs10zKxRPnyBPI/util/v60vlY2vGXsQBEiI6V0WG3sXoKKi do1ENrGKvMeO+BYhLVwEgMJCDCjzjYz9HrF1AmFeEDo0ARKRExvKUISFDENoJ3gifCu2 Xx5Jk2rPZoYn0qXkznE78ODKFo3OhydZRm8xTd0slZrPJbMSeeETing+CUfOJGRyINjW Q3jVzjMI1D0w0qyEtZzxelt18ecFB8R8HblkCGqGTSEcvM8heCgvHGpvr5f9D1iVpojr 3uBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ap6edeidspAUVCx1fQWUKPf2+SgKd686FNENvkCeyJk=; fh=ly389JgsgRoUdqb30KwfhVeG3MR0ofjY7xxfeSAkSbg=; b=qmWi4LgI9j0AYzgtkgn5VGrRkVG4Vd/Cnn4HFmOkNyz37eK+Lq5ct88545tmKnBIRd xDsZAkojCEzo9bP3WmLtDXeqQu+G5REBNfOp4IFilJ78eZgkV5TiHT0vZLgSn3Rn+PfB N9INgJ3U8j/9yaBeMgJCCfvrf6QVu0xdJ+oFozLFTS+dPuo/y//iqiMO+WX8KzqggKea 5i+VgEVGD1DXYsJf5xxBJSRRjaZe95msTOMvHSJ6O7xJdzMQMKEJIQqwMGS6hmudzzyH Z3LpzyrRHEH6lPAzbvxUoh1xe9FfXjeyMKFcaRCXIBjuAGelgzjChKMzTiUbUcd7ZE5U KjsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R0ClGfHU; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213111-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-705ccbc3d2csi1272124b3a.373.2024.06.13.04.44.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 04:44:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213111-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R0ClGfHU; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213111-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C2F5028234E for ; Thu, 13 Jun 2024 11:44:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EF3A1448E6; Thu, 13 Jun 2024 11:43:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R0ClGfHU" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6586143739; Thu, 13 Jun 2024 11:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718279002; cv=none; b=H9gSS/u9BYpCmhy9mXV1enJByJbgXNeGovTOKab1oaVkOLrmXuSDgjPCc8Qa5TWXCW0xPNJE6v9huhntBtSanikaWJn3XCk3C32kgA2fTuosIjOk/bkc4ehDrjuRrMcTWEc8DlGV0egosMrB07F2s1w0GUhQPVzPM4DamDK19fM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718279002; c=relaxed/simple; bh=mcDgRVbRrAqzkf7QdkeGKeRLT0SPhoINNm+D1NB5bgc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DEZ6iiKnQFqR3xss5n14M1sLYHlYOPKBS3mQQfpvl18D7Tts6WdpsHzcHxVcwJMyJ/91p93S4j3/kp1GgBwMgwQE6J6Mngq+lZ1R5oaWmENyeAHpbu/U0KYtOjEQfxl5Aw8drKoHX8duKcWhKAn/SKM3MVewqbsApKeeuUe1mA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R0ClGfHU; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-57a31d63b6bso1120303a12.0; Thu, 13 Jun 2024 04:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718278999; x=1718883799; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ap6edeidspAUVCx1fQWUKPf2+SgKd686FNENvkCeyJk=; b=R0ClGfHUCTYy3sAZCH81Od27vSnY4VYytm227IRXbg6DX4fnvEr6cuRK5vkZnOeuC/ Y5welOKycMCtok7UyS6f/xhYIDsz+sDVB558Hkxh4B4PR90C8X2eJTJ/21/lRByumLqm 7Zi/0FdNuWpPZACCdEs1PhPDqSPh5uJ1IYFTkoxrZTej00/Se9vYbf0VkudJIXYOFsVz CTfLN8eG7aS116C+QV5XWIftQQKTu86xspHDCAh0r18NZUISa/FlwH17M7cXyeQcjhNh vaPd0oAss0uU1zCwmFvjfpnZZ8o7R3dbehP0Y/XJmIhfTjtpmPt6kjX3Hl/fGmWfyWNU 9rjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718278999; x=1718883799; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ap6edeidspAUVCx1fQWUKPf2+SgKd686FNENvkCeyJk=; b=XEkqEcHVRklJr3WLIswXuzb1imdu+SK+Hul6ARIRqYhtpJsXzSq1kq7W6PcVbNkEj8 Juldgh6ge9yGRGxLqU/cO+voO1l3S6btDiN975Q5yj8u2waZfphWYTWC8UY53qI1S5n3 KUmp+wmGyu7xUOEP84HD76EgCzHb8YJ1A6s9836XXZGBxp2XVh1yK3IGDJ7Z+5hWhQt4 F12fjt5R4cZPmZb1CwhXCpC71qsPbOVVR/Nb5jFc1gWw8vCjm3Uk0eUeP/0o4Fu5dVAk ZSbuKbHMjGZTdd2bkB/LJC4ToHGec8WMnzlHMFeO4Ka+zeUvlazvPEwFYSQ6bpBj1l4X h+2A== X-Forwarded-Encrypted: i=1; AJvYcCV4yRhNBjwcdQw158R/m0nyAWDH7OMd7PUXiPH97PQlJZxcWdNtR8UaD3BJMmaNSJHIrf/Sb28ZwbiM+APes6OGuImiEqlMcC2E6X0dmUs/mOHRe9k/2RpRERvQlpPP8lCir/oIJMy09IVUIITfHvU0Ri62l2UUKqJHqxY2PhZhsw== X-Gm-Message-State: AOJu0YyCI9MJOLaa+uH733L19104wdCfE3KTdI9I6flOGInUyhrwA6Ds KdtmF68GjOQ8NlTuEl5ZU5ch9pGHe4MmFWAieau5/AVbRfHLnt0T X-Received: by 2002:a17:906:a259:b0:a6e:feae:e1df with SMTP id a640c23a62f3a-a6f47f894a7mr299540966b.21.1718278998542; Thu, 13 Jun 2024 04:43:18 -0700 (PDT) Received: from skbuf ([188.25.55.166]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56f42877sm62794966b.182.2024.06.13.04.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 04:43:16 -0700 (PDT) Date: Thu, 13 Jun 2024 14:43:14 +0300 From: Vladimir Oltean To: John Thomson Cc: daniel@makrotopia.org, andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC net-next] net: dsa: generate port ifname if exists or invalid Message-ID: <20240613114314.jxmjkdbycqqiu5wn@skbuf> References: <20240608014724.2541990-1-git@johnthomson.fastmail.com.au> <20240608014724.2541990-1-git@johnthomson.fastmail.com.au> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240608014724.2541990-1-git@johnthomson.fastmail.com.au> <20240608014724.2541990-1-git@johnthomson.fastmail.com.au> On Sat, Jun 08, 2024 at 11:47:24AM +1000, John Thomson wrote: > RFC: > Not a full solution. > > Not sure if supported, I cannot see any users in tree DTS, > but I guess I would need to skip these checks (and should mark as > NEM_NAME_ENUM) if port->name contains '%'. > > name is also used in alloc_netdev_mqs, and I have not worked out if any > of the functionality between alloc_netdev_mqs and the register_netdevice > uses name, so I added these test early, but believe without a rntl lock, > a colliding name could still be allocated to another device between this > introduced test, and where this device does lock and register_netdevice > near the end of this function. > To deal with this looks to require moving the rntl_lock before > these tests, which would lock around significantly more. > > As an alternative, could we possibly always register an enumerated name, > then (if name valid) dev_change_name (not exported), while still within > the lock after register_netdevice? > > Or could we introduce a parameter or switch-level DTS property that forces > DSA to ignore port labels, so that all network devices names can be > managed from userspace (using the existing port DSA label as intended name, > as this still seems the best place to define device labels, even if the > driver does not use this label)? Why not just _not_ use the 'label' device tree property, and bring a decent udev implementation into OpenWrt which can handle persistent naming according to the labels on the box? Even within DSA, it is considered better practice to use udev rather than 'label'. Not to mention that once available, udev is a uniform solution for all network interfaces, unlike 'label'. Full disclosure: I myself tried for about 30 minutes to convert the udev rules below into an /etc/hotplug.d script that procd would run, before getting the impression it's never going to work as intended, because by the time all relevant "add" actions run (built-in drivers), user space hasn't even loaded, and thus hasn't got a chance to run any hooks. I haven't actually opened the source code to compare how other uevent handlers deal with this. ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p0", NAME="swp0" ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p1", NAME="swp1" ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p2", NAME="swp2" ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p3", NAME="swp3" ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p4", NAME="swp4" ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p5", NAME="swp5"