Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp670987imm; Wed, 25 Jul 2018 04:16:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdoFyMXalB7VlFBNzcD8bsz5EhX4NiOBCGZPZJhwEq1tCpYtTMYvxPBlf07u43PAK1wyC/T X-Received: by 2002:a63:dc17:: with SMTP id s23-v6mr20536621pgg.40.1532517391696; Wed, 25 Jul 2018 04:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532517391; cv=none; d=google.com; s=arc-20160816; b=bmtOGnOFk5bB8D3PEYoqPEWmSnn40DGYncoQ3E8wLLgcrrj94ZOjmjzIdAu2rGGIwg 8H++9jYBzsavZr59wBlXNGB6SU1Kz/UyOxHIdpT/k08oqnF6DQHuwyvz373DZZNFNi7v YdR9Ul49u+aQfPy3Dn+QJBBd/gCZLUzovMpJthF8mvGxlyY0TjXDreUfnwiqM7mf2c6W aXce0FyzZQvoNJ6I5hWo8u0UJFYHjYPe915LLFWSvQMuV0w8sAuMr8KstQ80h0lIeB6i SxZYosnlcmglBFcRS4NNtMAsh6PDuo66ooFC30K/QVdjhknEj8S1GX+l2M67f0Sfa3lF tTrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=NPG55t6z9SGgZEiiqF+BmJlFaUGsjHH3XblJBHWcqvs=; b=oAcfLolq89UZjFgLNgZO1qcv+z6tSibi/mfO8zIjitcd9pzbRSWuZfJFWlo423zkU2 ykC4Lzf/+I1GRv4qoeE5PcBITIoG2qTulOdb9/zXHVvs2tcgNZlOtvtJPekg+sw+jV1M RQYvN7I+esOyQj9eGYMIu0Oc/AsV0bevk9ABJhposOnR2nJw77TyTSRPZqzm37JHDA3i M/QMaIBFUU45tQ91U3/2CfK6Qm2IoO/or8QhDAMSKU2gd6vygnU5Lj37CmBZukFWLOp8 ZFXce5Q/ZP8TxYI4wp0FHnNkIdtXoONtIbSeJZlP9Qlkdv5THhKA4azjbholKR7Y7ThS PrNw== 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 f34-v6si3710315ple.365.2018.07.25.04.16.17; Wed, 25 Jul 2018 04:16:31 -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 S1728858AbeGYM02 (ORCPT + 99 others); Wed, 25 Jul 2018 08:26:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9720 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728555AbeGYM02 (ORCPT ); Wed, 25 Jul 2018 08:26:28 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 91E89F236DDC8; Wed, 25 Jul 2018 19:15:12 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Wed, 25 Jul 2018 19:15:04 +0800 From: YueHaibing To: , CC: , , , YueHaibing Subject: [PATCH net-next] bnxt_en: combine 'else if' and 'else' into single branche Date: Wed, 25 Jul 2018 19:14:58 +0800 Message-ID: <20180725111459.10800-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain 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 The else-if branch and else branch set mac_ok to true similarly, so combine the two into single else branch. Aslo add comments to explain the two conditions, which from Michael Chan and Vasundhara Volam. Signed-off-by: YueHaibing --- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c index a649108..f560845 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -956,9 +956,13 @@ static int bnxt_vf_validate_set_mac(struct bnxt *bp, struct bnxt_vf_info *vf) } else if (is_valid_ether_addr(vf->vf_mac_addr)) { if (ether_addr_equal((const u8 *)req->l2_addr, vf->vf_mac_addr)) mac_ok = true; - } else if (bp->hwrm_spec_code < 0x10202) { - mac_ok = true; } else { + /* There are two cases: + * 1.If firmware spec < 0x10202,VF MAC address is not forwarded + * to the PF and so it doesn't have to match + * 2.Allow VF to modify it's own MAC when PF has not assigned a + * valid MAC address and firmware spec >= 0x10202 + */ mac_ok = true; } if (mac_ok) -- 2.7.0