From patchwork Sat Apr 24 20:14:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12222775 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE,SPF_PASS,T_TVD_MIME_NO_HEADERS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0908C433B4 for ; Sat, 24 Apr 2021 20:14:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 873CB61406 for ; Sat, 24 Apr 2021 20:14:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237413AbhDXUPf (ORCPT ); Sat, 24 Apr 2021 16:15:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237277AbhDXUP2 (ORCPT ); Sat, 24 Apr 2021 16:15:28 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE6FCC06175F for ; Sat, 24 Apr 2021 13:14:49 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id m11so36359168pfc.11 for ; Sat, 24 Apr 2021 13:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nrxIeap/aghw+zFS7/bPQZvTq9BzP4tp+0o4iehJnDk=; b=Z6lxxPGjH7Fp3+XupeF5WsesgoRWqplrbKuhhsDwLFhVSSzBhbPhsuRjalvI64cqSO Na7xKARvKqG+Tip9JvqszLABF9odNuAV3gYgV4tM2oatmd+1eO2W8BHfDyXCNdyq5f0T GrN0IAbTxE0/3vK1J8yiJPIy1AP78wt5Zic9M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nrxIeap/aghw+zFS7/bPQZvTq9BzP4tp+0o4iehJnDk=; b=IAi+VTk5mZnnWRm5AlK7vAh0Fg5N8TZu6fSiQta/fp61jOsV79mpwLP7J7J5z+WHZa Y74yIBRI8lo6Kfi+jYAvdDkG78esa6WcP2o4uOT5vBOUMp+Fi7ko6W51DXs59OtMXJ8S eI5HfnJYictZ4lVSu64M15+P7XhfJaUG3C57ln7dA08FIN0ScIP1VMaVilXrrncBPmsF wH/6VKjTMIpFIw2dE0IXDQxeyXSucxa7CcHcILOs4KHjkdLeGp49ggD+PdxWzxSOws2I y63AOylLagAvrGsIgwmXXOxlMJMkGme/8z9sghN08yDhfhTxgtO8Cyu4yMKbTXwLf/n3 5HoA== X-Gm-Message-State: AOAM5314qH7q8Uesr+nhynFUtKsnsJWdOH9EVvRj9dXVfjJ8gt4T3jxl tLHEAq44+V0EUwMG0StfNL1aANNqmQY5jH8B X-Google-Smtp-Source: ABdhPJxlh81Y9zjtaSPRNH33BDU7KaGEMjI/LNSV82lQM8H6eyLivGA5HnbElhrKULgbFssy9LAx9w== X-Received: by 2002:a65:57cb:: with SMTP id q11mr10233303pgr.183.1619295289085; Sat, 24 Apr 2021 13:14:49 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id z29sm7914070pga.52.2021.04.24.13.14.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 13:14:48 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next 07/10] bnxt_en: Call bnxt_approve_mac() after the PF gives up control of the VF MAC. Date: Sat, 24 Apr 2021 16:14:28 -0400 Message-Id: <1619295271-30853-8-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1619295271-30853-1-git-send-email-michael.chan@broadcom.com> References: <1619295271-30853-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When the PF is no longer enforcing an assigned MAC address on a VF, the VF needs to call bnxt_approve_mac() to tell the PF what MAC address it is now using. Otherwise it gets out of sync and the PF won't know what MAC address the VF wants to use. Ultimately the VF will fail when it tries to setup the L2 MAC filter for the vnic. Reviewed-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c index e65093f4aa7a..eb00a219aa51 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -1147,6 +1147,7 @@ void bnxt_update_vf_mac(struct bnxt *bp) { struct hwrm_func_qcaps_input req = {0}; struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr; + bool inform_pf = false; bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCAPS, -1, -1); req.fid = cpu_to_le16(0xffff); @@ -1162,14 +1163,22 @@ void bnxt_update_vf_mac(struct bnxt *bp) * default but the stored zero MAC will allow the VF user to change * the random MAC address using ndo_set_mac_address() if he wants. */ - if (!ether_addr_equal(resp->mac_address, bp->vf.mac_addr)) + if (!ether_addr_equal(resp->mac_address, bp->vf.mac_addr)) { memcpy(bp->vf.mac_addr, resp->mac_address, ETH_ALEN); + /* This means we are now using our own MAC address, let + * the PF know about this MAC address. + */ + if (!is_valid_ether_addr(bp->vf.mac_addr)) + inform_pf = true; + } /* overwrite netdev dev_addr with admin VF MAC */ if (is_valid_ether_addr(bp->vf.mac_addr)) memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN); update_vf_mac_exit: mutex_unlock(&bp->hwrm_cmd_lock); + if (inform_pf) + bnxt_approve_mac(bp, bp->dev->dev_addr, false); } #else