Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2487290pxb; Mon, 19 Apr 2021 06:56:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwitutQPelx0Ai3SgU38v3TZjhrw+O3SK22BpGKPfMOORkTAWo0xrF8VBUwBZ4g4OOZBV/n X-Received: by 2002:a05:6402:204e:: with SMTP id bc14mr26059818edb.312.1618840592809; Mon, 19 Apr 2021 06:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618840592; cv=none; d=google.com; s=arc-20160816; b=LeB8Z94CAVwXzZC/r1oU/5JMtY/FyIXye8ipyYrCYbcWroGE2cFmDTWnPnU2zvFW/L iIvQqRNRNiMWcz5CY+zMVEkzB4Nc7+a7Rdu0nCt996RWLF98b638dEJC2eUxm2mX33el JgchkKpcTKPWUpcThx8nJixQOQdUxoJ0RZ2TAK5zugE7Iw6P6TiBvBzmHWplFfArb7Ke nk5Ku7HOdeHLH2vgD5th4oEbPdF0qyACXhGzM0LX/t/BDW+5DNVxk2nIGmNPH32xyQ2e 0NR/3JXG1q56kyC0Oeeh31zG9m2bYlo70YJfqGrfl0ilTJD8UMO1SjR8y7BDNyfq23k7 GIUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NyiLHws0iWwRSBUEmBa0u4IkgtunixVAzh1dyI3MN5A=; b=0eBUYhcNTCA7sYy51XUBV713YJv7JI3vq8+/9Qdl4AL6uFnY+ifAHUUxV2iliy+KB4 uJzEKVFEqCchI7+41Wvy7fjHXY7eK4029H+9h0PKFi/c8xX8V8b8Bzkq4FaNXzO36itb ViXwkuGYifomsHi2nJqFLc2d0cuO3NHE547O1jC1YENLDrKX79WjiQffBqNh1PEBT0SK mw7dsrfNo3YGPU4QOjmQQd/cx7kj5zoh78ybvsnSCrKrlhHju1N8khgi8WRU4MDoXDOh xrXSydRV+UO/Wbh8sZZYQQ5dqOsVTIrnFFONhPdRuE29b/yLnl3fm5Yn+JNiFnOa7fOA iv6Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x19si12432854ejc.167.2021.04.19.06.56.07; Mon, 19 Apr 2021 06:56:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238696AbhDSMQF (ORCPT + 99 others); Mon, 19 Apr 2021 08:16:05 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:58198 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbhDSMQE (ORCPT ); Mon, 19 Apr 2021 08:16:04 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lYSo4-00HWif-T8; Mon, 19 Apr 2021 14:15:12 +0200 Date: Mon, 19 Apr 2021 14:15:12 +0200 From: Andrew Lunn To: Ilya Lipnitskiy Cc: "David S. Miller" , Jakub Kicinski , Rob Herring , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Russell King , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?iso-8859-1?Q?Ren=E9?= van Dorst Subject: Re: [PATCH net-next 2/2] net: ethernet: mediatek: support custom GMAC label Message-ID: References: <20210419040352.2452-1-ilya.lipnitskiy@gmail.com> <20210419040352.2452-3-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210419040352.2452-3-ilya.lipnitskiy@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 18, 2021 at 09:03:52PM -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? van Dorst > Signed-off-by: Ilya Lipnitskiy > --- > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > index 6b00c12c6c43..4c0ce4fb7735 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 = { > > static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) > { > + const char *label = of_get_property(np, "label", NULL); > const __be32 *_id = of_get_property(np, "reg", NULL); > phy_interface_t phy_mode; > struct phylink *phylink; > @@ -2940,6 +2941,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) > else > eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; > > + if (label) > + strscpy(eth->netdev[id]->name, label, IFNAMSIZ); It is better to use alloc_netdev_mqs() so you get validation the name is unique. Andrew