Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2965207rwb; Wed, 30 Nov 2022 13:24:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf7e3L0vXo/qgFAg+DVnl5wHGacuDM8aQ9tJzCTKuWz25zxhJDaNM1HEDpzEZWxdmwfJWwuc X-Received: by 2002:a17:903:258f:b0:189:754b:9d9e with SMTP id jb15-20020a170903258f00b00189754b9d9emr24166656plb.119.1669843442899; Wed, 30 Nov 2022 13:24:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669843442; cv=none; d=google.com; s=arc-20160816; b=Fypf69LfTktA/7sRPznEbjm8AsxAsVMnWFzUucwaC7HNijP/MrLbfBF91wJEDoBnJz EzyliBlZJVhRc9rrI+t8zsHwqWlmh33kY1xaIR3NxOP0Rr4KNDqxxlOrEHNTCTadj+V/ ltzc3oNFcmPvS0vFtRi14WxYp9u8BtSFL9X++SUbv9n7I/v0gjcY7+6WWzyRFHkV91Nm w/RGm3sT2b8sri9L1IoyOgXS4GT/iRGyENxOe3Djz2eEyS7zCk6lfzp+dJDC3innDa/F vrSfrU2Nb3kY2+rCjqpG0lIfhYI9ZbPvlSn0Cl+3HuVo6OB+CIXzrGy9eZztjGAVVZ42 aaFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zuR/603fC7oK9nUlhZCLCOYS4yq/2eg7O9E/kbNn+vo=; b=telyDRJhIbcvjbrvGsVqjBZoYJ92QYcTrGOWh1oPIEk0Npi9rEXWckdfGCaCgg0AT9 boiMX1xdZmO7XWGH5V3GleFiXqp8B8qH1URAu5M3LSqVRAKM0oW4TvJi1QH/0GaHTnTv JYP6UoEE299ai+njRWaVfFt4clhYhHshE8OBGGiodAoDkoIqaFQelPh+Ic8WLtn6XBe0 auTzsL4kW/9H+BT3N3xmsN7leHM9/gRjM0KRHvbCdXiEk237XLUNtG/QO7DIFHanh6YV wnPkYKntKK5yEeO6tCucu4U+HiEEIsFsKs+ahNBBtlthkzfv9DGWRSG8LCdAh4Sj2b7v WUKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NGqYR0J6; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a056a00125100b0056cb8f67eefsi2838932pfi.70.2022.11.30.13.23.52; Wed, 30 Nov 2022 13:24:02 -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=@redhat.com header.s=mimecast20190719 header.b=NGqYR0J6; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbiK3VJM (ORCPT + 84 others); Wed, 30 Nov 2022 16:09:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiK3VJL (ORCPT ); Wed, 30 Nov 2022 16:09:11 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7D995474B for ; Wed, 30 Nov 2022 13:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669842494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zuR/603fC7oK9nUlhZCLCOYS4yq/2eg7O9E/kbNn+vo=; b=NGqYR0J6lofamqBg7UXL6Yi6zKyEKUi9z+X7fDllO6pgJI7/EkrH1aqpPDktqomOW+s/wL NzC0bh05TwP1eit6Kq6Km95nPT4RqYMfdGJUl+2cj4vfWAEL2Uce0jiTYsUUnC6Ds8AFG7 gCoK8OTKo68Ukh53By+6+0x9lWZ+nCU= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-503-jfVSveQ6OgK8nWH0RZZPiw-1; Wed, 30 Nov 2022 16:08:12 -0500 X-MC-Unique: jfVSveQ6OgK8nWH0RZZPiw-1 Received: by mail-qv1-f69.google.com with SMTP id ng1-20020a0562143bc100b004bb706b3a27so28836116qvb.20 for ; Wed, 30 Nov 2022 13:08:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent: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=zuR/603fC7oK9nUlhZCLCOYS4yq/2eg7O9E/kbNn+vo=; b=B6pA0I0982bXA3ooUi9QioPGPDMZ/FEJno526uaIOWMpfUv8JJuuMxkShbz3AX92Zb kUf5B7A5Ym5X+eglh/UDJ6yhg0Agyz0w/JJqHx3DbOgyBGI812b11rT5vk5Hv+xEqMno 1uE2tZgUR3hEBqcTz0IXbTikgPhlvrSOyrtIBeSQV6B5sI8qLbSYL0EhE1I3UjMiAuDR STQlMKpnhAkQwHqPY8TT1yuOx+HwsDHw/hN31RWXS90CacnwRoBtC/HdQPJX6NLj7iej X7Zvfc8qC9Axv9q7F2K+jueepcRv0s4e4VGiLafgCtEn6o5uT2VtgJkEHFPfgcCVq8KL NQIw== X-Gm-Message-State: ANoB5pnHumydG68igWvK0LNor4Xrjm9hiLB/qqwmLlRKYgqfPvpgMKXG JCgxo794TNubAIj8eZIbZV1F+g7ydgm6M47tG929O7aLqlPf13YiH/Cg5w5d4gm2r/Lvsk6NXdW zSjCxINXtJS6d2RPHiwQzpylX X-Received: by 2002:a0c:c3cc:0:b0:4c6:a05d:f67e with SMTP id p12-20020a0cc3cc000000b004c6a05df67emr40931287qvi.4.1669842491511; Wed, 30 Nov 2022 13:08:11 -0800 (PST) X-Received: by 2002:a0c:c3cc:0:b0:4c6:a05d:f67e with SMTP id p12-20020a0cc3cc000000b004c6a05df67emr40931260qvi.4.1669842491240; Wed, 30 Nov 2022 13:08:11 -0800 (PST) Received: from x1 (c-73-214-169-22.hsd1.pa.comcast.net. [73.214.169.22]) by smtp.gmail.com with ESMTPSA id x10-20020a05620a258a00b006fc92cf4703sm1898765qko.132.2022.11.30.13.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 13:08:10 -0800 (PST) Date: Wed, 30 Nov 2022 16:08:09 -0500 From: Brian Masney To: Andrew Lunn Cc: irusskikh@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, cth451@gmail.com Subject: Re: [PATCH] net: atlantic: fix check for invalid ethernet addresses Message-ID: References: <20221130174259.1591567-1-bmasney@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.7 (2022-08-07) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 On Wed, Nov 30, 2022 at 08:41:29PM +0100, Andrew Lunn wrote: > On Wed, Nov 30, 2022 at 12:42:59PM -0500, Brian Masney wrote: > > The Qualcomm sa8540p automotive development board (QDrive3) has an > > Aquantia NIC wired over PCIe. The ethernet MAC address assigned to > > all of the boards in our lab is 00:17:b6:00:00:00. The existing > > check in aq_nic_is_valid_ether_addr() only checks for leading zeros > > in the MAC address. Let's update the check to also check for trailing > > zeros in the MAC address so that a random MAC address is assigned > > in this case. > > > > Signed-off-by: Brian Masney > > --- > > drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c > > index 06508eebb585..c9c850bbc805 100644 > > --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c > > +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c > > @@ -293,7 +293,8 @@ static bool aq_nic_is_valid_ether_addr(const u8 *addr) > > /* Some engineering samples of Aquantia NICs are provisioned with a > > * partially populated MAC, which is still invalid. > > */ > > - return !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0); > > + return !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0) && > > + !(addr[3] == 0 && addr[4] == 0 && addr[5] == 0); > > Hi Brian > > is_valid_ether_addr() aq_nic_ndev_register() already calls is_valid_ether_addr(): if (is_valid_ether_addr(addr) && aq_nic_is_valid_ether_addr(addr)) { (self->ndev, addr); } else { ... } That won't work for this board since that function only checks that the MAC "is not 00:00:00:00:00:00, is not a multicast address, and is not FF:FF:FF:FF:FF:FF." The MAC address that we get on all of our boards is 00:17:b6:00:00:00. Brian