Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp622718imm; Wed, 25 Jul 2018 03:20:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd9we4UCBFWnguIWtOhCRrZRPOlTUpWu+oA5WZE2O2L32doVYNu/VC3BHWlQROYSQoLz0bQ X-Received: by 2002:a62:9bc5:: with SMTP id e66-v6mr21328270pfk.84.1532514024702; Wed, 25 Jul 2018 03:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532514024; cv=none; d=google.com; s=arc-20160816; b=gvXU655IBO86tUqQJWtCMYgRZo2E55Ok3LxNUXNobOot2hncIr35SVDXZ4NW7FTwGJ pHratKXgcMRQM0vB3i2Jqmk6dnAc6FFxy2CcNp8gY3KCWV7zt+R5OhjRkqE88TaIgkYn Fdgl+HNUqoJWEaCJ5wPNSm9/08DO1CgngeavOt+1/+xapodoPV9/x9lPSu5A/BNDKFOg 5M/AD8LM51YwGtnALaDcgMFWBH3WxBlP4nrF3zccRT31ZeKXZuCaKPJJjLKVGEpXMcer 4VTF5mdfEr02uaVKq75qpV8a5SNVFNgN1yjwVWrRwLil4Xf8DmJH6v8CGeA0mJxuWNbC 8Tkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=dYHqwWbhpCY7TqbR3AGAm/PIIjmyXJxMRkvuUInwBGM=; b=TbgE3R6UEkEuqQE6o0Pp0E+P4Z+iKmH0Ss+QVFLqlGOYz+0DDoi2CaupKn3XX5SthL ZzJYeKBzlk3LDBIEVegSK6Ir0t43p7XxKD4y9vghyAu86ksuXIbN7XnO9lcaToYJUqny uN092myx4NJK3jC13lS1iwtXTQtcdyeNuCLeGLoUFg46r+nN6DvSR2g1TP7Vp1aZ3woL CLNDrYtN+2h78xvoLMNlIyguJyHr8nvr+oZVwqDLFRPLlht4e4ZG9YNclIuxWQp/F8KB nbEpu4jRHtPXELEHcrBeWLdXJu1diiNi+kuoxmV1rT19wHHCD/AivoNyisdwfaiEwXda JRNg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q145-v6si14335649pfq.315.2018.07.25.03.20.10; Wed, 25 Jul 2018 03:20:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728822AbeGYL3m (ORCPT + 99 others); Wed, 25 Jul 2018 07:29:42 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:51270 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728708AbeGYL3l (ORCPT ); Wed, 25 Jul 2018 07:29:41 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1539A3B7277ED; Wed, 25 Jul 2018 18:18:37 +0800 (CST) Received: from [127.0.0.1] (10.177.31.96) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.382.0; Wed, 25 Jul 2018 18:18:36 +0800 Subject: Re: [PATCH net-next] bnxt_en: Fix logic of forward the VF MAC address to PF in bnxt_vf_validate_set_mac To: Michael Chan , Vasundhara Volam References: <20180724052454.21524-1-yuehaibing@huawei.com> CC: David Miller , open list , Netdev From: YueHaibing Message-ID: <04616f0d-ca58-db28-a4ad-3ea0cf8e7c3c@huawei.com> Date: Wed, 25 Jul 2018 18:18:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/7/25 5:48, Michael Chan wrote: > 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. Thank you for clarification. I will send a new patch for this. > >>> >>>> - } 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 >>>> >>>> > > . >