Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp447201pxb; Wed, 29 Sep 2021 02:42:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxRUWXjhUoRwN6XXPS9eLYyRPPavM34MsO//PovXe6FkBFy/+7F5sig2fhRBzRnPoKKlsM X-Received: by 2002:a17:90a:17e1:: with SMTP id q88mr5336174pja.99.1632908551824; Wed, 29 Sep 2021 02:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632908551; cv=none; d=google.com; s=arc-20160816; b=UP8Qsj8/77AArP+hZgvFfDNm4S/ZNdR1u98CBTqt8VbL+7TitUiitx75VqtG9dArQO gE/+Lp/uJbdGEpVTf6Ynxxs37oSiVNx9KcQN7dF+N7glMjevnzxjpzwrn2k/WWslMmHQ O/cqAJ63bRKSKVubVhzCF8gNOhxxd2pRJardAHBHuRP7Bj/THilnSUkCMKZ+4p7nvvft ryTf4PhLSOVQTSjY4yHa32t2GwwqTPd31yxoTrBzRo3OSaw2ubIu21CVm2K5Bbpcf5VI ndh6Y2wZ/79JAQk+e2zpsxivJBR46l8E+mBEMLOGnD3OHX0B1jLt2didmcx2pcgS2m6N 8W0w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=y+3NsBqnCYBsjA0dSpQO8EAncwB1++15d2dXRUtIOII=; b=JWHdLaw5+bqDrk+IgXd6NfNMs6wk3tK/SUqVtYyzg3GLCE8qiDLlxas46uJZQGj/53 O4nEpafyk/6/7sbP44OSyi0B69GBGvPVLINLYp6DGvRVTdXRz+4Uvo0+DOSGSFEujNWk Xrff+p4uJltL1s0lx852Daceoe+1djQ1PDVKzBMSBSqFHTxUT/uoHLfwrhSxJGVkPSkZ 9O9Ef65PzbofEYB1q4NyMTphIcZJValrc0l8HQhQWX99smKQo7jfVr6p35UjihetjVoG BXVwiGobxaEsbdtpWAO720MqZUiiYfG/A5EFilquvCtLqs9aRCMIhW1kzogCwykOcrbg qlKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h2si2471913pfg.239.2021.09.29.02.42.18; Wed, 29 Sep 2021 02:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245160AbhI2Jl7 (ORCPT + 99 others); Wed, 29 Sep 2021 05:41:59 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:13393 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245100AbhI2Jlv (ORCPT ); Wed, 29 Sep 2021 05:41:51 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HKB7R2VJxz901L; Wed, 29 Sep 2021 17:35:31 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 29 Sep 2021 17:40:09 +0800 Received: from localhost.localdomain (10.67.165.24) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 29 Sep 2021 17:40:09 +0800 From: Guangbin Huang To: , CC: , , , Subject: [PATCH net 7/8] net: hns3: fix always enable rx vlan filter problem after selftest Date: Wed, 29 Sep 2021 17:35:55 +0800 Message-ID: <20210929093556.9146-8-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210929093556.9146-1-huangguangbin2@huawei.com> References: <20210929093556.9146-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the rx vlan filter will always be disabled before selftest and be enabled after selftest as the rx vlan filter feature is fixed on in old device earlier than V3. However, this feature is not fixed in some new devices and it can be disabled by user. In this case, it is wrong if rx vlan filter is enabled after selftest. So fix it. Fixes: bcc26e8dc432 ("net: hns3: remove unused code in hns3_self_test()") Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 7ea511d59e91..5ebd96f6833d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -334,7 +334,8 @@ static void hns3_selftest_prepare(struct net_device *ndev, #if IS_ENABLED(CONFIG_VLAN_8021Q) /* Disable the vlan filter for selftest does not support it */ - if (h->ae_algo->ops->enable_vlan_filter) + if (h->ae_algo->ops->enable_vlan_filter && + ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) h->ae_algo->ops->enable_vlan_filter(h, false); #endif @@ -359,7 +360,8 @@ static void hns3_selftest_restore(struct net_device *ndev, bool if_running) h->ae_algo->ops->halt_autoneg(h, false); #if IS_ENABLED(CONFIG_VLAN_8021Q) - if (h->ae_algo->ops->enable_vlan_filter) + if (h->ae_algo->ops->enable_vlan_filter && + ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) h->ae_algo->ops->enable_vlan_filter(h, true); #endif -- 2.33.0