Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp786170pxb; Tue, 5 Apr 2022 23:16:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgOQsaS0ezTIPGnRHpWlx+w+FG4h2MbT68HY44ydNL1P2TznssbYtcttU6NLRwbnvuk71S X-Received: by 2002:a17:90a:6d96:b0:1c9:c1de:ef2f with SMTP id a22-20020a17090a6d9600b001c9c1deef2fmr8130970pjk.210.1649225789585; Tue, 05 Apr 2022 23:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649225789; cv=none; d=google.com; s=arc-20160816; b=YpgHB0l7rsNIeviLEBWoWQR+1I1vfV2mDrvu804GN+v0NC2QXqWyDzqjFDG6ftEDxi epqZXwzg+I2PUgjMAa6QFDkgKbjLWkLrUJPmfXb9QT7PRTfin2VGkTg/4EGNMZnjODto QRj/5WhmmYtHtlTeQSTVQQCNnEnw341U34t42HDLydzqQApMCreFNoDErh+d2whRJ6e1 kz6FBNKJhdNRDgyMKZGy32+iH6Wc7JUR+YIWX/fOXoybTNc+1QlSj3AaPgE9IxbBrKZR dSE3w262cum2sCwV4Nm6mLBsN94reH2YF9c2IApYgCIvEmgKUOUBW+1R2KP6Tfu4GZb2 rzPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S32ACD5rJHtjIXHyoOzkeSng2o0wg0ZrweAZHpDuuRk=; b=iT5Z9m1D6qahBH2ioGCT5HKynbOf8fFkfU4vEGfJFFJB3akAaVsaJvM2cRtQyxbnJD NZUyBdp+ZDLdMgvQJUZbKaHhBbqGpDVARoazQCaVIiTllr4traiGZ7zNuoh/Ejmz1WG9 fs1pxlFhspObHVMqGbDgAcp5Ili3FfhoPF9jIFJ/FyOHX0z7RCxAWsDUlutqSnTYB4Bv U8KMzAilBTrq6Qu2yxR/NadV844eN6S6GeIl8rx++ethWJN8OFt0wXloxeByNflaPEKR L9308rIkdXxJazxJnbkZB/vtNKMnXLpSK2sT7ZF6EUZGOedorWpSPgTLHMCCGwZdcMC6 Vslg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cG8Z+hvJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 127-20020a630785000000b0039852256cb6si14769481pgh.181.2022.04.05.23.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 23:16:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cG8Z+hvJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0072F181DB0; Tue, 5 Apr 2022 23:08:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1450029AbiDEWgB (ORCPT + 99 others); Tue, 5 Apr 2022 18:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350052AbiDEJwe (ORCPT ); Tue, 5 Apr 2022 05:52:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC4D40903; Tue, 5 Apr 2022 02:50:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9195FB81B14; Tue, 5 Apr 2022 09:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05CF1C385A2; Tue, 5 Apr 2022 09:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152233; bh=H6yXsyLC+XmnjgO7uGN+UwUrHdlEQxZyvfw1gQLR/us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cG8Z+hvJJ+VrHeCh/JtFotz9bnLZEQWzSR6/iPWsidiFfNis1cG1yUzTS5M8Ow9M5 0ao1hQUtExQvLj4d1KCtMwagZfZPDDhD/8pzVCKfukZcXU/ftqmPXcMuLZxklGzNuN NR7NnVUTSCiJngTSi7MHunHdHlp2jo0Vz3Hg+N5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 665/913] net: hns3: refine the process when PF set VF VLAN Date: Tue, 5 Apr 2022 09:28:47 +0200 Message-Id: <20220405070359.769657732@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen [ Upstream commit 190cd8a72b0181c543ecada6243be3a50636941b ] Currently, when PF set VF VLAN, it sends notify mailbox to VF if VF alive. VF stop its traffic, and send request mailbox to PF, then PF updates VF VLAN. It's a bit complex. If VF is killed before sending request, PF will not set VF VLAN without any log. This patch refines the process, PF can set VF VLAN direclty, and then notify the VF. If VF is resetting at that time, the notify may be dropped, so VF should query it after reset finished. Fixes: 92f11ea177cd ("net: hns3: fix set port based VLAN issue for VF") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- .../hisilicon/hns3/hns3pf/hclge_main.c | 18 +++++++++++++----- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 5 +++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 0b0b79eec1a6..d3a259ad8ce1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -9290,11 +9290,16 @@ static int hclge_set_vf_mac(struct hnae3_handle *handle, int vf, ether_addr_copy(vport->vf_info.mac, mac_addr); + /* there is a timewindow for PF to know VF unalive, it may + * cause send mailbox fail, but it doesn't matter, VF will + * query it when reinit. + */ if (test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) { dev_info(&hdev->pdev->dev, "MAC of VF %d has been set to %s, and it will be reinitialized!\n", vf, format_mac_addr); - return hclge_inform_reset_assert_to_vf(vport); + (void)hclge_inform_reset_assert_to_vf(vport); + return 0; } dev_info(&hdev->pdev->dev, "MAC of VF %d has been set to %s\n", @@ -10522,14 +10527,17 @@ static int hclge_set_vf_vlan_filter(struct hnae3_handle *handle, int vfid, return ret; } - /* for DEVICE_VERSION_V3, vf doesn't need to know about the port based + /* there is a timewindow for PF to know VF unalive, it may + * cause send mailbox fail, but it doesn't matter, VF will + * query it when reinit. + * for DEVICE_VERSION_V3, vf doesn't need to know about the port based * VLAN state. */ if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V3 && test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) - hclge_push_vf_port_base_vlan_info(&hdev->vport[0], - vport->vport_id, state, - &vlan_info); + (void)hclge_push_vf_port_base_vlan_info(&hdev->vport[0], + vport->vport_id, + state, &vlan_info); return 0; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 98c847fe4c5b..21678c12afa2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -3344,6 +3344,11 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev) return ret; } + /* get current port based vlan state from PF */ + ret = hclgevf_get_port_base_vlan_filter_state(hdev); + if (ret) + return ret; + set_bit(HCLGEVF_STATE_PROMISC_CHANGED, &hdev->state); hclgevf_init_rxd_adv_layout(hdev); -- 2.34.1