Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp75626pxy; Tue, 20 Apr 2021 13:01:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzZNyyW4qxo31rERFI+qy20LbSHwip3fYg/vvuCUUFcCa/PmllgAPV4CsrMnuHsWI55QA6 X-Received: by 2002:aa7:d85a:: with SMTP id f26mr22912354eds.305.1618948913087; Tue, 20 Apr 2021 13:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618948913; cv=none; d=google.com; s=arc-20160816; b=sPinvOaFN99XIgXLbJ0nk56FtcQ1ymgvJZDV7mDa4/FknwoVSXUOqlxOFhi+cFRZUW yZTGFPFTnUna4QlUPJUtbM2ELRo9IetMDtLv31NdFZQ2TTvSj601TqfF1N9P3QW/TzF/ zOMkF9FpTKmxTMlml6UZF/Q/Fs+WStoVD2Qj7CRW2p93s9u+vUPrK4OX+IrkJRbVkBsX Im0aDDzBxO1RP94+CQg9CzoUIU3dpxQxMXuNX4PKqeA0uF3cIlxhiA6/+7wVBDZXGSZS O6qWO33IlES/RSsmD5ZLIj/Wcq21UY1vOoeTSiXU9p4DRbBAkRWBoUTajmfbb8em8kLT JPGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ulOh35YKTzDGjHHbOIeKgCUjEcwsBwlNnX1HkWl6feU=; b=m7UiIQ3h6gVWN5xdgoT2xV7AmDkFc8k6Rv/pW/GMazjs7+Ltqs5yMtD+OhNxlPg28v hBU4gHYa4sFMmdSKE6Rx+V/9CTB543/bXJS10aHw4VnMh/WzljTPtayibMpl1SaE7fzB WhW04zwZ4FKWKH5Yo2ymJOYiylRAJPW+dr8F7+rz6Xcccqc5Mk8sz0CxqqzqnSearLfA v9VYbp87NL0SxZaKMESkehojKHHPNmpQ/fmwwxV7AJBdPQghfVEp4ihw/pHWm15BiLQi mbsT2/B+hfsdkZvQCNUXtcmb4Rdzx5uf+CJObYPECSBmCmmZOByafTSuIHkiSVJwPqzi 2OCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hBVbeV4B; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si62800edl.24.2021.04.20.13.01.24; Tue, 20 Apr 2021 13:01:53 -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=@gmail.com header.s=20161025 header.b=hBVbeV4B; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233768AbhDTT63 (ORCPT + 99 others); Tue, 20 Apr 2021 15:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233541AbhDTT62 (ORCPT ); Tue, 20 Apr 2021 15:58:28 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85077C06174A; Tue, 20 Apr 2021 12:57:54 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id l21so3125415iob.1; Tue, 20 Apr 2021 12:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ulOh35YKTzDGjHHbOIeKgCUjEcwsBwlNnX1HkWl6feU=; b=hBVbeV4BnJGRV3FquaMNFY/ntM0zt3JBUFcQsMJEsKzY0P5cmc7WNpusW18VkSN+za Dn75WQbqI+m0NWAJLwp2P4O6SRuNKeAVPjt+g7EBTmL2TjwB06SJFC4vNQe6d2xYQ1VX S2Sn3TpTxLY9z0lmHSmt3TQJlvR2hVuWJ7j9PoOS0ffJIL4c0cTLRakKwljssQffYaJY /n4dU8E4sr+5sqCh64amQMw1Gk2jk7qF6NC9DzZH6g/9GmjPqtUy2NusyMxvA6KxoO60 Q/IO5lDqPfGgaKM0eSrxM92CudrgLCFqexslTn19gyZ/nnUYjKZ6zrX10QIPWamkgUOX tFvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ulOh35YKTzDGjHHbOIeKgCUjEcwsBwlNnX1HkWl6feU=; b=ZXOesiSFR6/WjzcmQr7PQuRhniVuyvyRzlrCoaQurfc+mhFOqktWqGTTIB7GSb5dKY ES8xKn+4NONjMzp2wMOkfGSArWrv73SlgMUgZcrZvbFWDdv0jc+Cu5DmSF9RqCMRCeW4 mH+3a3a6OE0fY8lHc8HnZHDHjI9mCVbvHV6UcxvGMR7qg35PGkrp8UR+gZvaNWSnw/0K H9IXfqLIeBR8nkKv7FZq03Bkl7bngwr34i7nAXO2B6zseyr7ZXPek7C9NffByAzaSp7F KOhsBx1tjPK5Y1NCev6Oh7T4Let+xEpOle9GH9vRPyP1igHkbxxdWf7NmL41Ub0ZuRCH 5jUQ== X-Gm-Message-State: AOAM530yMVz21GMbxo97vvKYM9OVm834KzcMbqU+8cT+3AzKsKpUEg8q q2VehD0oXSAJXUK735N89bQr+p3V5C+Hi3OjIgk= X-Received: by 2002:a6b:fc05:: with SMTP id r5mr20312524ioh.103.1618948674007; Tue, 20 Apr 2021 12:57:54 -0700 (PDT) MIME-Version: 1.0 References: <20210419154659.44096-1-ilya.lipnitskiy@gmail.com> <20210419154659.44096-3-ilya.lipnitskiy@gmail.com> <20210420195132.GA3686955@robh.at.kernel.org> In-Reply-To: <20210420195132.GA3686955@robh.at.kernel.org> From: Ilya Lipnitskiy Date: Tue, 20 Apr 2021 12:57:43 -0700 Message-ID: Subject: Re: [PATCH net-next v2 2/2] net: ethernet: mediatek: support custom GMAC label To: Rob Herring Cc: "David S. Miller" , Jakub Kicinski , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Russell King , netdev@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?UTF-8?Q?Ren=C3=A9_van_Dorst?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 20, 2021 at 12:51 PM Rob Herring wrote: > > On Mon, Apr 19, 2021 at 08:46:59AM -0700, Ilya Lipnitskiy wrote: > > The MAC device name can now be set within DTS file instead of always > > being "ethX". This is helpful for DSA to clearly label the DSA master > > device and distinguish it from DSA slave ports. > > > > For example, some devices, such as the Ubiquiti EdgeRouter X, may have > > ports labeled ethX. Labeling the master GMAC with a different prefix > > than DSA ports helps with clarity. > > > > Suggested-by: Ren=C3=A9 van Dorst > > Signed-off-by: Ilya Lipnitskiy > > --- > > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/= ethernet/mediatek/mtk_eth_soc.c > > index 6b00c12c6c43..df3cda63a8c5 100644 > > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c > > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > > @@ -2845,6 +2845,7 @@ static const struct net_device_ops mtk_netdev_ops= =3D { > > > > static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) > > { > > + const char *label =3D of_get_property(np, "label", NULL); > > const __be32 *_id =3D of_get_property(np, "reg", NULL); > > phy_interface_t phy_mode; > > struct phylink *phylink; > > @@ -2867,9 +2868,10 @@ static int mtk_add_mac(struct mtk_eth *eth, stru= ct device_node *np) > > return -EINVAL; > > } > > > > - eth->netdev[id] =3D alloc_etherdev(sizeof(*mac)); > > + eth->netdev[id] =3D alloc_netdev(sizeof(*mac), label ? label : "e= th%d", > > + NET_NAME_UNKNOWN, ether_setup); > > 'label' is generally supposed to correspond to the sticker for the > device connector for a human to id. I can't really tell if that's the > case here. I don't see how 'gmacX' vs. 'ethX' maps to DSA master vs. > slave. The ports on devices such as Ubiquiti ER-X are named eth0 through eth4, all of them DSA slaves. The gmac (DSA master) is hard-coded to eth0 without this change. > > I don't think this should be handled within a specific driver either. If > we're going to have a way to name things, then fix it in > alloc_etherdev(). > > It can also be argued that device naming for userspace is a userspace > (udev) problem. Yeah, that is a valid argument. We can drop this changeset if the agreement is that it doesn't belong in the specific driver or the kernel-space at all. Some discussion (and device picture) here if you are interested: https://github.com/openwrt/openwrt/pull/3971 Ilya