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 3C31EC4332F for ; Wed, 20 Apr 2022 17:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381097AbiDTRcE (ORCPT ); Wed, 20 Apr 2022 13:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235399AbiDTRcC (ORCPT ); Wed, 20 Apr 2022 13:32:02 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CBEA46B0E for ; Wed, 20 Apr 2022 10:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650475756; x=1682011756; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dCgTHxftR8Cl2G6xgS86qDmLpyxtR4iV2gDR3AL/FRQ=; b=YwEPq5XKNn7lLy2oyFW2CVvYbvSZ6xb2N7pRhNuQLLMpYv9Crq0uW76q yMWrOAbkbC9xruSxew09ESd0lJ2hnX0R3vp0RHL+7aey9DxkNy34Jnfle UKWHXy82Hxv3vqn509cq/lJtFEbJvDum2tPBS6qXvWuEIRj7RkxKavvp0 zvzhDvSerdrtuYdqiYIKTGQnBBks0X6DcAkBht0OOok+Df6cjfFMr1sxf 89OjpYTW7ghGPFQcXs8Bb4/J05whq5G6lGGspQ5CujP8ZiJWsijysKndN itE8XZr9FPR25gDQQI1jWm0kIRjE25J8CZaBI1BOg2FwMvT+mFNmQEvNX g==; X-IronPort-AV: E=McAfee;i="6400,9594,10323"; a="244037002" X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="244037002" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 10:29:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="727594575" Received: from anguy11-desk2.jf.intel.com ([10.166.244.147]) by orsmga005.jf.intel.com with ESMTP; 20 Apr 2022 10:29:15 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Michal Maloszewski , netdev@vger.kernel.org, anthony.l.nguyen@intel.com, sassmann@redhat.com, Sylwester Dziedziuch , Konrad Jankowski Subject: [PATCH net 1/2] iavf: Fix error when changing ring parameters on ice PF Date: Wed, 20 Apr 2022 10:26:23 -0700 Message-Id: <20220420172624.931237-2-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220420172624.931237-1-anthony.l.nguyen@intel.com> References: <20220420172624.931237-1-anthony.l.nguyen@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Michal Maloszewski Reset is triggered when ring parameters are being changed through ethtool and queues are reconfigured for VF's VSI. If ring is changed again immediately, then the next reset could be executed before queues could be properly reinitialized on VF's VSI. It caused ice PF to mess up the VSI resource tree. Add a check in iavf_set_ringparam for adapter and VF's queue state. If VF is currently resetting or queues are disabled for the VF return with EAGAIN error. Fixes: d732a1844507 ("i40evf: fix crash when changing ring sizes") Signed-off-by: Sylwester Dziedziuch Signed-off-by: Michal Maloszewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c index 3bb56714beb0..08efbc50fbe9 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c @@ -631,6 +631,11 @@ static int iavf_set_ringparam(struct net_device *netdev, if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) return -EINVAL; + if (adapter->state == __IAVF_RESETTING || + (adapter->state == __IAVF_RUNNING && + (adapter->flags & IAVF_FLAG_QUEUES_DISABLED))) + return -EAGAIN; + if (ring->tx_pending > IAVF_MAX_TXD || ring->tx_pending < IAVF_MIN_TXD || ring->rx_pending > IAVF_MAX_RXD || -- 2.31.1