Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp98496imm; Tue, 24 Jul 2018 14:49:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe5Vs+rV0VGZ9pz/il+HGfpymZm6jvX66B3vCgQjhcFajn+7Wza3+FlIOk5dv1OJrXGwkJA X-Received: by 2002:a63:d155:: with SMTP id c21-v6mr6167360pgj.188.1532468983875; Tue, 24 Jul 2018 14:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532468983; cv=none; d=google.com; s=arc-20160816; b=fyZLtYgKey7BgN8vrHPZbOlPpNoYYJnBWZzlFoSNyW61s67WEXGa8K+uKtG7wYiFpM s7vOnSvBP2aS+fz8k4qttCcs+ZjnH/MVsaFJRx2rCIBW1toxGs/3ok5/+KF7b56SaKdt s7yNJnQQ99dElACtj1R0xae2GW+CFDa6Hl+mlpU7rFJ78rlA9guATi1q7RuW/9WDjbo2 TZ4m8OgbhqsH3HJIMMUZrWDFBcjf96+3ZjBnGA/senKi1NPxuVHRgqfWvqEQXueIPyOR b5QNaRnx7SgikhYP9dZu8Sfz5vF+vqRxCIbl28wqyV/dcTT1ujSQkZqozalKVL4NG0r+ nzqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=OvTV887pi6zaPuLasFfm1L9vmPFsgL+sWquokboB8v8=; b=NvAaw2rITr22mYftIbFrN0dMMa+tmZjehCMCrFUPt06aXLJGPVkfbvhSugMCHQtBTP rjSzMZHJ6dKB/BFjX8ax8gBqkboHjjpJcJq/FeOwnuO+68keVaECN+kAPlAX9V2Fo//X Yon85VC/IJgfEeoXcqQDU3Da3LstQXLHZ/VgLfP12JyjLXRBHhtWd5hAoeBSrYabvT12 Swpp5Ctid3IDb2fBgAVz63k5/S+MgFk8+WEIeEyg/ZelP2Jo1w4kl0HL9DQcehCqUfyX 98kH+6oXuolDUoe0B4tdRZgmO7kDtu9dAaPjKGJsXkO/WvmVSfFr1mFiUPvaWE8r8U/9 ejHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=DJyheRvV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si13241158pfu.79.2018.07.24.14.49.29; Tue, 24 Jul 2018 14:49:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=DJyheRvV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388745AbeGXW5F (ORCPT + 99 others); Tue, 24 Jul 2018 18:57:05 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:32838 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388491AbeGXW5E (ORCPT ); Tue, 24 Jul 2018 18:57:04 -0400 Received: by mail-yw0-f194.google.com with SMTP id c135-v6so2127158ywa.0 for ; Tue, 24 Jul 2018 14:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=OvTV887pi6zaPuLasFfm1L9vmPFsgL+sWquokboB8v8=; b=DJyheRvVbrHScoCYgn0nLyxW5aXyToAvFeka5j7aWUFD5lbbGmMkqaZ+sI+vO0gXqM ci9ADVYOMKdafyxS6vugM2EcRw5Phf16zN5isoa6kdlMFFYCoFqo9nNIkUdRpDxdwNGk NeyvLe8UvFPixopUjudWGg+AMMVbnI8P1P7OU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=OvTV887pi6zaPuLasFfm1L9vmPFsgL+sWquokboB8v8=; b=lezE65JWRblmP+wF7eHTtL1BkveTQ/29m7x1hxX+Lm+LWQur8gq8tBVlyrQR6glmox rrNEBWx84cq/kPMzReCaqkwk9L/IB9138CDbwfEDh777JttHmirx0JYVqsYRcn7Fb3SY WodTvilnBy/gthZzD5GvfHRtuaE3xpX2mH+2xAUAdvwOonX+aeyHK3wXU3ItdvXV4agf Ol9diBoeq/Nmdi1+wkyEcGvpKW/9A98H6n+dMf1cm/lR0Jco8u6nFitDFbU5eLoxfP8P MQoB6fekMn05B2Xuz17SOHGotvB+XRF/RZkalFw8OP+/8GQBOwq+SSR0AD3n6CdTdzYl khUg== X-Gm-Message-State: AOUpUlEg6QjHK7J+3XFbG7Pi6ePRt7u5xlsw22czIbVD+eF6o+qvcAKt kWevXSUL16hphnLkX/Y9yXHsgtiRgGY/glFOOWbqHQ== X-Received: by 2002:a81:7cc5:: with SMTP id x188-v6mr9994043ywc.358.1532468915528; Tue, 24 Jul 2018 14:48:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:e716:0:0:0:0:0 with HTTP; Tue, 24 Jul 2018 14:48:34 -0700 (PDT) In-Reply-To: References: <20180724052454.21524-1-yuehaibing@huawei.com> From: Michael Chan Date: Tue, 24 Jul 2018 14:48:34 -0700 Message-ID: Subject: Re: [PATCH net-next] bnxt_en: Fix logic of forward the VF MAC address to PF in bnxt_vf_validate_set_mac To: Vasundhara Volam Cc: YueHaibing , David Miller , open list , Netdev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 24, 2018 at 9:01 AM, Vasundhara Volam wrote: > On Tue, Jul 24, 2018 at 1:01 PM, Michael Chan wrote: >> >> On Mon, Jul 23, 2018 at 10:24 PM, YueHaibing wrote: >> > Based on the comments,req->l2addr must match the VF MAC address >> > if firmware spec >= 1.2.2, mac_ok can be true. >> > >> > Signed-off-by: YueHaibing >> > --- >> > drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 ++----- >> > 1 file changed, 2 insertions(+), 5 deletions(-) >> > >> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c >> > index a649108..7925964 100644 >> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c >> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c >> > @@ -954,12 +954,9 @@ static int bnxt_vf_validate_set_mac(struct bnxt *bp, struct bnxt_vf_info *vf) >> > if (ether_addr_equal((const u8 *)req->l2_addr, vf->mac_addr)) >> > mac_ok = true; >> > } else if (is_valid_ether_addr(vf->vf_mac_addr)) { >> > - if (ether_addr_equal((const u8 *)req->l2_addr, vf->vf_mac_addr)) >> > + if (ether_addr_equal((const u8 *)req->l2_addr, vf->vf_mac_addr) && >> > + bp->hwrm_spec_code >= 0x10202) >> > mac_ok = true; >> >> I'm not sure if this is correct. If firmware spec < 0x10202, the VF >> MAC address is not forwarded to the PF and so it doesn't have to match >> and mac_ok should still be true. I think we are missing that >> condition with this patch. >> >> I need to let my colleague Vasundhara comment on this. She is more >> familiar with this logic. > Yes Michael, you are right. Also, the plain else condition is to cover > a special case to allow VF to modify > it's own MAC when PF has not assigned a valid MAC address and HWRM > spec code > 0x10202. We should combine the "else if" and "else" below into a plain else and add some comments to explain the conditions. >> >> > - } else if (bp->hwrm_spec_code < 0x10202) { >> > - mac_ok = true; >> > - } else { >> > - mac_ok = true; >> > } >> > if (mac_ok) >> > return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); >> > -- >> > 2.7.0 >> > >> >