From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:34223 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbcIINiq (ORCPT ); Fri, 9 Sep 2016 09:38:46 -0400 Subject: Patch "[PATCH 021/135] fm10k: reset max_queues on init_hw_vf failure" has been added to the 4.4-stable tree To: jacob.e.keller@intel.com, Krishneil.k.singh@intel.com, alexander.levin@verizon.com, bruce.w.allan@intel.com, gregkh@linuxfoundation.org, jeffrey.t.kirsher@intel.com Cc: , From: Date: Fri, 09 Sep 2016 15:37:54 +0200 Message-ID: <147342827424882@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled [PATCH 021/135] fm10k: reset max_queues on init_hw_vf failure to the 4.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: 0021-fm10k-reset-max_queues-on-init_hw_vf-failure.patch and it can be found in the queue-4.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 15680d790bfccab097d9d7c1032d2bcd41bc8649 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Fri, 16 Oct 2015 10:56:57 -0700 Subject: [PATCH 021/135] fm10k: reset max_queues on init_hw_vf failure [ Upstream commit 0e8d5b5975401c83641efd5d4595e6cdbe9e9e2f ] VF drivers must detect how many queues are available. Previously, the driver assumed that each VF has at minimum 1 queue. This assumption is incorrect, since it is possible that the PF has not yet assigned the queues to the VF by the time the VF checks. To resolve this, we added a check first to ensure that the first queue is infact owned by the VF at init_hw_vf time. However, the code flow did not reset hw->mac.max_queues to 0. In some cases, such as during reinit flows, we call init_hw_vf without clearing the previous value of hw->mac.max_queues. Due to this, when init_hw_vf errors out, if its error code is not properly handled the VF driver may still believe it has queues which no longer belong to it. Fix this by clearing the hw->mac.max_queues on exit due to errors. Signed-off-by: Jacob Keller Reviewed-by: Bruce Allan Tested-by: Krishneil Singh Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/fm10k/fm10k_vf.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c @@ -105,8 +105,10 @@ static s32 fm10k_init_hw_vf(struct fm10k /* verify we have at least 1 queue */ if (!~fm10k_read_reg(hw, FM10K_TXQCTL(0)) || - !~fm10k_read_reg(hw, FM10K_RXQCTL(0))) - return FM10K_ERR_NO_RESOURCES; + !~fm10k_read_reg(hw, FM10K_RXQCTL(0))) { + err = FM10K_ERR_NO_RESOURCES; + goto reset_max_queues; + } /* determine how many queues we have */ for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) { @@ -124,7 +126,7 @@ static s32 fm10k_init_hw_vf(struct fm10k /* shut down queues we own and reset DMA configuration */ err = fm10k_disable_queues_generic(hw, i); if (err) - return err; + goto reset_max_queues; /* record maximum queue count */ hw->mac.max_queues = i; @@ -134,6 +136,11 @@ static s32 fm10k_init_hw_vf(struct fm10k FM10K_TXQCTL_VID_MASK) >> FM10K_TXQCTL_VID_SHIFT; return 0; + +reset_max_queues: + hw->mac.max_queues = 0; + + return err; } /* This structure defines the attibutes to be parsed below */ Patches currently in stable-queue which might be from jacob.e.keller@intel.com are queue-4.4/0022-fm10k-always-check-init_hw-for-errors.patch queue-4.4/0021-fm10k-reset-max_queues-on-init_hw_vf-failure.patch queue-4.4/0023-fm10k-reinitialize-queuing-scheme-after-calling-init.patch queue-4.4/0018-fm10k-do-not-assume-VF-always-has-1-queue.patch queue-4.4/0019-fm10k-Correct-MTU-for-jumbo-frames.patch