Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3126566pxp; Mon, 14 Mar 2022 11:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcLGsA1VbmFNn7GgN8xOdEOZwFuV3fW3bycohjcOg7cDW5+4ICIHEzp+/k0nMf2gHMVsid X-Received: by 2002:a17:902:a50c:b0:14d:4e8b:d6f with SMTP id s12-20020a170902a50c00b0014d4e8b0d6fmr24763245plq.42.1647282175914; Mon, 14 Mar 2022 11:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647282175; cv=none; d=google.com; s=arc-20160816; b=tysfj//nX8zanvQKP2V6W0EEtf+i9gZY13/xedc0LSM5CStXMesJjPwPPWuOwg4iZ5 l+DVqcKkR8Jv6+a8y5oNINZr4NDppt1M3dQohc0O4QJ/2GGmM74ItW2MTQvqffhbMiXs 2/G+NJjSXzmgf58KWoEN+YfP62vQCh3dR1rzopsLHfXt6MuogerMperYR+xuUw3YGCpG SzeygWSHJM8N0u5aBjKzdI2Tuv10UQVyb2jgttIAmzI9vFTDsDe5Ux00ZTy/KOV4Zn8T kYt9l99RKBNjJ03EDkGQbg2qeyt93dOr2jfs3HONG4favnt5wQJ2Vb3L2hOEW2eW6YXE Ddmw== 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=piHdZr2IohYJiHEOGL3YFVbNp5r8MaKW8a5mzYHA/dg=; b=i9UGf/UPxylo3XJXQOchRLQlcweX8P6SRiOKTfFkK4MqIUE514LTX7OnNsFxXPakuf hrEH3uk8e50rBIucYZAS21xgSP6LeDZC5p9YsheGhk9Yd2UYVCzELgQBiphROEwFqddi kFISIjXXuhM3Mi25ZvOVOeGhU1bmmW7L0maOfk7ZE76gX/U62bG4EqVIExNy4jrOq7kE rP5zKitVPr3r8n5Pnd8P8cbCy0RqV4SwA8M3ZDedY4uAwvzWnMzsv6Q5Yt5jVUz0u3id HzIISMebPSN73ooLghJdD3432XUhOs/t0N5hHXy6o/wyvsf0tKCmsdZt72JScf5gKhO6 SDDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ySa4HX1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u62-20020a638541000000b0038037be6b2asi15808612pgd.544.2022.03.14.11.22.42; Mon, 14 Mar 2022 11:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ySa4HX1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241559AbiCNMZZ (ORCPT + 99 others); Mon, 14 Mar 2022 08:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242127AbiCNMSq (ORCPT ); Mon, 14 Mar 2022 08:18:46 -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 6519537AB5; Mon, 14 Mar 2022 05:13:38 -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 DEFE5B80DF4; Mon, 14 Mar 2022 12:13:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E94C340EC; Mon, 14 Mar 2022 12:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260015; bh=UvXv8CoBIHSYv2czPD3shVCPtUxLOgoHieXifBMuTc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ySa4HX1riUGO1JkRDZQ3gtG0Vx/ZDc/NW8pUHHBWT4RElEqQhUgGdNafqwExRsvqT bM2Zs6avwQW3DelnIl818mkCqQ4etgQDWuXzNcqg/wCvvetuLWQayIpH8ta1m2Bn27 VJmCz4IVjzT56dPLsdTYwd1QMnbDtvcHv4pQQ2sM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Norbert Ciosek , Michal Maloszewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.16 033/121] iavf: Fix handling of vlan strip virtual channel messages Date: Mon, 14 Mar 2022 12:53:36 +0100 Message-Id: <20220314112745.053459816@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@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=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Michal Maloszewski [ Upstream commit 2cf29e55894886965722e6625f6a03630b4db31d ] Modify netdev->features for vlan stripping based on virtual channel messages received from the PF. Change is needed to synchronize vlan strip status between PF sysfs and iavf ethtool. Fixes: 5951a2b9812d ("iavf: Fix VLAN feature flags after VFR") Signed-off-by: Norbert Ciosek Signed-off-by: Michal Maloszewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c index d3da65d24bd6..c83ac6adeeb7 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -1460,6 +1460,22 @@ void iavf_request_reset(struct iavf_adapter *adapter) adapter->current_op = VIRTCHNL_OP_UNKNOWN; } +/** + * iavf_netdev_features_vlan_strip_set - update vlan strip status + * @netdev: ptr to netdev being adjusted + * @enable: enable or disable vlan strip + * + * Helper function to change vlan strip status in netdev->features. + */ +static void iavf_netdev_features_vlan_strip_set(struct net_device *netdev, + const bool enable) +{ + if (enable) + netdev->features |= NETIF_F_HW_VLAN_CTAG_RX; + else + netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; +} + /** * iavf_virtchnl_completion * @adapter: adapter structure @@ -1683,8 +1699,18 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, } break; case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING: + dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured\n"); + /* Vlan stripping could not be enabled by ethtool. + * Disable it in netdev->features. + */ + iavf_netdev_features_vlan_strip_set(netdev, false); + break; case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING: dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured\n"); + /* Vlan stripping could not be disabled by ethtool. + * Enable it in netdev->features. + */ + iavf_netdev_features_vlan_strip_set(netdev, true); break; default: dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n", @@ -1918,6 +1944,20 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, spin_unlock_bh(&adapter->adv_rss_lock); } break; + case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING: + /* PF enabled vlan strip on this VF. + * Update netdev->features if needed to be in sync with ethtool. + */ + if (!v_retval) + iavf_netdev_features_vlan_strip_set(netdev, true); + break; + case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING: + /* PF disabled vlan strip on this VF. + * Update netdev->features if needed to be in sync with ethtool. + */ + if (!v_retval) + iavf_netdev_features_vlan_strip_set(netdev, false); + break; default: if (adapter->current_op && (v_opcode != adapter->current_op)) dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", -- 2.34.1