From patchwork Sun Apr 25 17:45:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12223441 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.9 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,URIBL_BLOCKED,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 EF9AEC43460 for ; Sun, 25 Apr 2021 17:45:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D61A1611CC for ; Sun, 25 Apr 2021 17:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbhDYRqg (ORCPT ); Sun, 25 Apr 2021 13:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231211AbhDYRqc (ORCPT ); Sun, 25 Apr 2021 13:46:32 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09E71C06138B for ; Sun, 25 Apr 2021 10:45:52 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id t22so3345205pgu.0 for ; Sun, 25 Apr 2021 10:45:52 -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=ALNnSTmVOdUnkbbnm/g96ZIgeDiEzW6NmwE2OEPR800=; b=WgAzEIW/RUnrlw2Af4AVHAZJ09rdHJiW9l9Bkbz+brI3TocLMqWbMGfeTt8OjQB+5c DeEh5iA0qEmfTAZ+ACQzkcaPcRZJF9VQak8clBRPpMSmKOSVgU9UvCkJxWGsyWa9/P5k JrcIbW2J2ngWZEgk8lveVLyNJC1Up83RsmHJ0= 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=ALNnSTmVOdUnkbbnm/g96ZIgeDiEzW6NmwE2OEPR800=; b=ulpqG7Pjjfn9S4XjwxTKOYodD1KG8OSmVzJ5w0q2SPj+mwlzgL2+JZ/I7f1G6CfT0C u5Z8+ghOy0wuc3NndPfihWl46E0/G1yWSaXgR0DBlHKbskpxr8gvSD6NuUf8mvsl+Uta 1o0gyA7v0BzNjGyBbP6/D+wzZyILQjHmm+mCgWHP4zw75naGKAwb5x0IMbDiqGvXBHxh adj60JJ519NCXQlmtdG9HL53E9Ap0lRJeaHgganSTWPjQuzrzifYqy7hejpyUQffth5g LqjMfaKBvSHXRL7/4vBI2/hhNtB+frRH4cR8Zqk59mJmm7OtELtrfLNQXr89jB2pCni0 /Teg== X-Gm-Message-State: AOAM531o9gxYXYH8RI2ujgSlBLOADsmSEZDfnZklpdaosy+Xu2OKlJk+ x9ra/E9DDtqOoB5PPj9USqTIZw== X-Google-Smtp-Source: ABdhPJznQyRWcXDFDSs4NJaQe5dixwYQS89vfFovbhx/6wiX0hE9r/lWOVUrtrz7WgOEGKh8ErN6EQ== X-Received: by 2002:a63:2c92:: with SMTP id s140mr13439114pgs.39.1619372751238; Sun, 25 Apr 2021 10:45:51 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id t19sm14733553pjs.1.2021.04.25.10.45.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Apr 2021 10:45:50 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next v2 07/10] bnxt_en: Call bnxt_approve_mac() after the PF gives up control of the VF MAC. Date: Sun, 25 Apr 2021 13:45:24 -0400 Message-Id: <1619372727-19187-8-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1619372727-19187-1-git-send-email-michael.chan@broadcom.com> References: <1619372727-19187-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