From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78C56C6FD1C for ; Mon, 13 Mar 2023 20:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjCMUg0 (ORCPT ); Mon, 13 Mar 2023 16:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230123AbjCMUgV (ORCPT ); Mon, 13 Mar 2023 16:36:21 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6093E6287B for ; Mon, 13 Mar 2023 13:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678739780; x=1710275780; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VCPTPiyABYid1thuFeQbZUz9ZVLBNEdSttuKCZK3BXE=; b=LhRndVM15p6fiP5TBnEYCuffwu8yRa0SPly9Fo7P6GBds8sYAzXHSd30 G3ivQgqM7d+pOzCWFxQHF6ELMdvHIkG0M97P52L+AwPhqSvrLyJJgqZ2m ylJ4eJirKzpuz0gIcF8zDS4X+kGL84dXp4nYdJVAUPedsVJAfpPQgnFR0 qwDa/Pcpb4TWnldRrvkHbvbtKR/taXttH1+IQIL9tgAw5AF2jU8pvuH/5 SaeEHS6l+dNrx2IOWmSIj9UhogcVxZRE3EADALXhpUYrv6HQ0QbEXJ6Po EadviH8mejTegql6t5yjXz8YWFkI2vLrO6wndzLKpG5UzQyr46WUhTHh9 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="364913224" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="364913224" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 13:36:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="747732603" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="747732603" Received: from jbrandeb-saw1.jf.intel.com ([10.166.28.102]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 13:36:17 -0700 From: Jesse Brandeburg To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, Brett Creeley , Robert Malz , Jesse Brandeburg , Piotr Raczynski Subject: [PATCH net v1 2/2] ice: Fix ice_cfg_rdma_fltr() to only update relevant fields Date: Mon, 13 Mar 2023 13:36:08 -0700 Message-Id: <20230313203608.1680781-3-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313203608.1680781-1-jesse.brandeburg@intel.com> References: <20230313203608.1680781-1-jesse.brandeburg@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Brett Creeley The current implementation causes ice_vsi_update() to update all VSI fields based on the cached VSI context. This also assumes that the ICE_AQ_VSI_PROP_Q_OPT_VALID bit is set. This can cause problems if the VSI context is not correctly synced by the driver. Fix this by only updating the fields that correspond to ICE_AQ_VSI_PROP_Q_OPT_VALID. Also, make sure to save the updated result in the cached VSI context on success. Fixes: 348048e724a0 ("ice: Implement iidc operations") Co-developed-by: Robert Malz Signed-off-by: Robert Malz Signed-off-by: Brett Creeley Signed-off-by: Jesse Brandeburg Reviewed-by: Piotr Raczynski --- drivers/net/ethernet/intel/ice/ice_switch.c | 26 +++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 61f844d22512..46b36851af46 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -1780,18 +1780,36 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, int ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable) { - struct ice_vsi_ctx *ctx; + struct ice_vsi_ctx *ctx, *cached_ctx; + int status; + + cached_ctx = ice_get_vsi_ctx(hw, vsi_handle); + if (!cached_ctx) + return -ENOENT; - ctx = ice_get_vsi_ctx(hw, vsi_handle); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) - return -EIO; + return -ENOMEM; + + ctx->info.q_opt_rss = cached_ctx->info.q_opt_rss; + ctx->info.q_opt_tc = cached_ctx->info.q_opt_tc; + ctx->info.q_opt_flags = cached_ctx->info.q_opt_flags; + + ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_Q_OPT_VALID); if (enable) ctx->info.q_opt_flags |= ICE_AQ_VSI_Q_OPT_PE_FLTR_EN; else ctx->info.q_opt_flags &= ~ICE_AQ_VSI_Q_OPT_PE_FLTR_EN; - return ice_update_vsi(hw, vsi_handle, ctx, NULL); + status = ice_update_vsi(hw, vsi_handle, ctx, NULL); + if (!status) { + cached_ctx->info.q_opt_flags = ctx->info.q_opt_flags; + cached_ctx->info.valid_sections |= ctx->info.valid_sections; + } + + kfree(ctx); + return status; } /** -- 2.39.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C896C6FD19 for ; Mon, 13 Mar 2023 20:36:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1911760FD7; Mon, 13 Mar 2023 20:36:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1911760FD7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1678739786; bh=P0rV+BnJd8zXVM1xJ/4WuIXRsfRv7Tthm00BCjV96VE=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=D/GW4VDl6g5eZT+spSI6rwS9sYXEplLFOmlQR5pqBlLz//Tdh08sa8SCnDDYJbNhl cmpb31upGXiV7GYIWaV9mXQ1dpTJIaniT5dGSFSTnDdGY4Ei66oOMBFj81BKYX0zGu 7fJ38nFBfJuFcqxgh7zGFqf3ODJ3q6hYgIrWt3qUN5Cp9Hak74BL/8acLmMoOlgLEZ QjngBBcWaHUKdZYYrSDvWHKCH63h1n1nLTfZMYZiHQH1crnrSYjj+KJm1sSuWzkqfO 3x5e5QBQTZA6ff3CdQbNsCcd7/ubv+iI4XFVOrDiSFa2HgITVAUnSlagfU7tK0Mzg6 r5RYU/sXG+hMg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sduOo2m7czOM; Mon, 13 Mar 2023 20:36:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 0E49A60FEE; Mon, 13 Mar 2023 20:36:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0E49A60FEE Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A6DBE1BF2C2 for ; Mon, 13 Mar 2023 20:36:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 230054173D for ; Mon, 13 Mar 2023 20:36:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 230054173D X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8bZmyJIP0tpc for ; Mon, 13 Mar 2023 20:36:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 179AF41736 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp4.osuosl.org (Postfix) with ESMTPS id 179AF41736 for ; Mon, 13 Mar 2023 20:36:18 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="364913225" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="364913225" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 13:36:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="747732603" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="747732603" Received: from jbrandeb-saw1.jf.intel.com ([10.166.28.102]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 13:36:17 -0700 From: Jesse Brandeburg To: intel-wired-lan@lists.osuosl.org Date: Mon, 13 Mar 2023 13:36:08 -0700 Message-Id: <20230313203608.1680781-3-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313203608.1680781-1-jesse.brandeburg@intel.com> References: <20230313203608.1680781-1-jesse.brandeburg@intel.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678739779; x=1710275779; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VCPTPiyABYid1thuFeQbZUz9ZVLBNEdSttuKCZK3BXE=; b=X1iAm0wGlAHSTvN/zs2qHQVKv+tg2dHTYd3lJHouKZ2U00L4/roXbz2n U+z2oNSirB3b1J7v10vBrM0SgQxQgDqGuRCfKEDToTmLUepvYpdoHefXZ 7KN9V9l6y1CWglQgesR8qzkx2lq5vxL/xrncIcN+s6hj6VLQerx3roKnV ZgANad+3Ef5Y9gBa0H6fOpif/bySx6TkwWZ27z82gaFzvRVOY/DC1yk7B 0TZigNMZsTTlWb6VPbws7rz0N3BUq0zfWijS4h/Rc9nUBmLRZUfKuWBHt y6nyf35D2UNVyRfpxxGTLFYCTFBpbSR5AOed0c9AjmXjnFOTAwOl+NOwB g==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=X1iAm0wG Subject: [Intel-wired-lan] [PATCH net v1 2/2] ice: Fix ice_cfg_rdma_fltr() to only update relevant fields X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Brett Creeley , Jesse Brandeburg , Robert Malz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Brett Creeley The current implementation causes ice_vsi_update() to update all VSI fields based on the cached VSI context. This also assumes that the ICE_AQ_VSI_PROP_Q_OPT_VALID bit is set. This can cause problems if the VSI context is not correctly synced by the driver. Fix this by only updating the fields that correspond to ICE_AQ_VSI_PROP_Q_OPT_VALID. Also, make sure to save the updated result in the cached VSI context on success. Fixes: 348048e724a0 ("ice: Implement iidc operations") Co-developed-by: Robert Malz Signed-off-by: Robert Malz Signed-off-by: Brett Creeley Signed-off-by: Jesse Brandeburg Reviewed-by: Piotr Raczynski --- drivers/net/ethernet/intel/ice/ice_switch.c | 26 +++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 61f844d22512..46b36851af46 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -1780,18 +1780,36 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, int ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable) { - struct ice_vsi_ctx *ctx; + struct ice_vsi_ctx *ctx, *cached_ctx; + int status; + + cached_ctx = ice_get_vsi_ctx(hw, vsi_handle); + if (!cached_ctx) + return -ENOENT; - ctx = ice_get_vsi_ctx(hw, vsi_handle); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) - return -EIO; + return -ENOMEM; + + ctx->info.q_opt_rss = cached_ctx->info.q_opt_rss; + ctx->info.q_opt_tc = cached_ctx->info.q_opt_tc; + ctx->info.q_opt_flags = cached_ctx->info.q_opt_flags; + + ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_Q_OPT_VALID); if (enable) ctx->info.q_opt_flags |= ICE_AQ_VSI_Q_OPT_PE_FLTR_EN; else ctx->info.q_opt_flags &= ~ICE_AQ_VSI_Q_OPT_PE_FLTR_EN; - return ice_update_vsi(hw, vsi_handle, ctx, NULL); + status = ice_update_vsi(hw, vsi_handle, ctx, NULL); + if (!status) { + cached_ctx->info.q_opt_flags = ctx->info.q_opt_flags; + cached_ctx->info.valid_sections |= ctx->info.valid_sections; + } + + kfree(ctx); + return status; } /** -- 2.39.2 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan