Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1654904rwb; Sat, 19 Nov 2022 00:42:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ai/Tz9euBBjRRooKk1qoqnDuv15ha69QzlcrpakvibuT59Nnm9Px3aLoWHC9kzsx1gUA9 X-Received: by 2002:a17:902:9889:b0:182:e9dd:936d with SMTP id s9-20020a170902988900b00182e9dd936dmr3290208plp.6.1668847358027; Sat, 19 Nov 2022 00:42:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668847358; cv=none; d=google.com; s=arc-20160816; b=EWxwmNaELxEZEPw7cTAN5c+MrVB6Fgw4APaKV+8QHQac1RTpWD5gDM3E3wcKWOtoBX NlRcJa2RkM3h+cd4gGA0ULAGI0fe8nxGiONM0WCtfduDnK2DGWrUFmuSSNS/lOIxqn1z U8t3rrPJysrNZLj0JvHhqaTsuGJCslIYyz0Y22jXRvUKvL/8psJ6CzLJkfrYPW2b3h1w Kq/JNMKWDBcvkgjt81ZA6OMOhwC1+NjZcCmzYMiUQ7Bjwqxe/0PbXlD1oks9TKWSXI/e VcbA0OgVb8bcoeYDADIHM3CxBWhQ7ZkdZE7gb4y6QcB0Os65DidEf2n/USYnnb4DLk3G idPw== 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=mjyF9GZRbjnKvRIu6G5HCxPcIESHSZ+tBu/Yu/REEs4=; b=z2ldqr7cMZXqE5qFAOk/QdpDaUJAsBILUJjQ0zjN5VsdIUtkRjbt0Ggx5L0Irh52Cs Q0cpnx2eeYFRr71mg0Qv/uztYsWP4CcPgr/jvsNYwU0CNKwUUegvaMDv5PFGlI2Of5R/ dXMd1NE8GTUqYsmKLdLHL2xe4NeXm5t2+xZrTkt8nAYu/6AauTa0J6ZgWgPj8qmwKEOK gCqrGMvTVYUiHpZWpjnHo3C5RP4phNgz8jwAw3cugnHQm1NmzRipHokmpch4rml4Hc7g H1XsqYygWtUimhhU05FCtANOjkhmytSvhRU651wU/vAtTuVd+A81YKrNo+rPUdLaNPGC V7aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=eyXCEckv; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a170902ea0400b0016f1eb1317esi1335271plg.471.2022.11.19.00.42.23; Sat, 19 Nov 2022 00:42:38 -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=@semihalf.com header.s=google header.b=eyXCEckv; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbiKSISu (ORCPT + 91 others); Sat, 19 Nov 2022 03:18:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232173AbiKSISq (ORCPT ); Sat, 19 Nov 2022 03:18:46 -0500 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B436760379 for ; Sat, 19 Nov 2022 00:18:43 -0800 (PST) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-39ce6773248so62857b3.12 for ; Sat, 19 Nov 2022 00:18:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mjyF9GZRbjnKvRIu6G5HCxPcIESHSZ+tBu/Yu/REEs4=; b=eyXCEckvHE06z2dtwRm4PcFouCfPbIuLakCBQ9vvDMvBMRmny/HmbxE8OPH2X6KuXL +/Yy/OCjAv/7K4K7yKYwHq/RqeulHdbCV6sgJozK0whr/IRu5ykRk9tzmDQgj3TFEswf vR0GY2SfZQa5kmbgkaFwE0180whk0dDyUac9GBW9jdmfF1FAjbO48ckdX7WUvTOXn/zI GmB9BOW3pYn1woKsphcqan+U3dtIMR+lMGi4FqMW1+aIV7pKeSlDvsVq4h/pfs5bPfVp 4T69uS0vaax/fUgrDYm6TJKcN4F29DKbk8Khc9VQRrZTWLptStqHtP62kyAILSuk2t3+ Gr2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mjyF9GZRbjnKvRIu6G5HCxPcIESHSZ+tBu/Yu/REEs4=; b=umRkUm0lpBuRZkrDNWvAFVUrcm2kqa6EgqJ3V6yPmiF+wmVWOqilygsXgDw/ycLnwy 0cH8PTIlv/GQO9UpNT6CUFGIOjyi7wm0HzAtnoq28R47y8/1Bn5i8L/qrGgF/1UN62Xg yQsCMTNB5RSGsxH0b0KPVFsc4yCkRAx2uX7/XJMBOmoQMezF1gNwNNvgqY+2sqVvrDQh AiMT3S35FU5tE5HprVrFoByGVh6nw/KDv3UZKFPjDe1xqe3M8RWSf2Gzjv02jgAHngOb 5pR4KL6bDTLeTvtPXriEVci7+d1zE4F52V1rQfFGeNkU+hqY2JDZ5GFsA4jevuTdDcwx 8jtw== X-Gm-Message-State: ANoB5pljOON2qyoq1ajdDLOB/cT28op2CUbqnMgGwN3zZDlHJKwORiUd Olov9NzZOeBGUPv7TL2CsGSUKMRgCvvHdV6aqYXtdA== X-Received: by 2002:a0d:ea05:0:b0:368:52a0:9173 with SMTP id t5-20020a0dea05000000b0036852a09173mr9566915ywe.191.1668845922812; Sat, 19 Nov 2022 00:18:42 -0800 (PST) MIME-Version: 1.0 References: <20221117215557.1277033-1-miquel.raynal@bootlin.com> <20221117215557.1277033-7-miquel.raynal@bootlin.com> In-Reply-To: <20221117215557.1277033-7-miquel.raynal@bootlin.com> From: Marcin Wojtas Date: Sat, 19 Nov 2022 09:18:34 +0100 Message-ID: Subject: Re: [PATCH net-next 6/6] net: mvpp2: Consider NVMEM cells as possible MAC address source To: Miquel Raynal Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org, Russell King , Taras Chornyi , linux-kernel@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miquel, czw., 17 lis 2022 o 22:56 Miquel Raynal napisa= =C5=82(a): > > The ONIE standard describes the organization of tlv (type-length-value) > arrays commonly stored within NVMEM devices on common networking > hardware. > > Several drivers already make use of NVMEM cells for purposes like > retrieving a default MAC address provided by the manufacturer. > > What made ONIE tables unusable so far was the fact that the information > where "dynamically" located within the table depending on the > manufacturer wishes, while Linux NVMEM support only allowed statically > defined NVMEM cells. Fortunately, this limitation was eventually tackled > with the introduction of discoverable cells through the use of NVMEM > layouts, making it possible to extract and consistently use the content > of tables like ONIE's tlv arrays. > > Parsing this table at runtime in order to get various information is now > possible. So, because many Marvell networking switches already follow > this standard, let's consider using NVMEM cells as a new valid source of > information when looking for a base MAC address, which is one of the > primary uses of these new fields. Indeed, manufacturers following the > ONIE standard are encouraged to provide a default MAC address there, so > let's eventually use it if no other MAC address has been found using the > existing methods. > > Link: https://opencomputeproject.github.io/onie/design-spec/hw_requiremen= ts.html Thanks for the patch. Did you manage to test in on a real HW? I am curious = about > Signed-off-by: Miquel Raynal > --- > drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/ne= t/ethernet/marvell/mvpp2/mvpp2_main.c > index eb0fb8128096..7c8c323f4411 100644 > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > @@ -6104,6 +6104,12 @@ static void mvpp2_port_copy_mac_addr(struct net_de= vice *dev, struct mvpp2 *priv, > } > } > > + if (!of_get_mac_address(to_of_node(fwnode), hw_mac_addr)) { Unfortunately, nvmem cells seem to be not supported with ACPI yet, so we cannot extend fwnode_get_mac_address - I think it should be, however, an end solution. As of now, I'd prefer to use of_get_mac_addr_nvmem directly, to avoid parsing the DT again (after fwnode_get_mac_address) and relying implicitly on falling back to nvmem stuff (currently, without any comment it is not obvious). Best regards, Marcin > + *mac_from =3D "nvmem cell"; > + eth_hw_addr_set(dev, hw_mac_addr); > + return; > + } > + > *mac_from =3D "random"; > eth_hw_addr_random(dev); > } > -- > 2.34.1 >