Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3487524imu; Sun, 11 Nov 2018 16:12:50 -0800 (PST) X-Google-Smtp-Source: AJdET5dOJ9FX04goA3fYbqDJJX4vzka0X5kLI/FyekgqhwO98rPSYZtd6eTT9IF/LiDMEK3NJckk X-Received: by 2002:a62:5904:: with SMTP id n4mr548523pfb.120.1541981570370; Sun, 11 Nov 2018 16:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981570; cv=none; d=google.com; s=arc-20160816; b=AekNpTEN/0k4u4bc8eyJSSXqx3ylB4D/ncvDYHpXPVgyKNJbMYEuEwTflgEtFEEsMW LwS12JT/zybVVn8fU9fvEOX+dDBGq1+oMsIa+L2IYVyuM3rnophW+AccsAy8gIxOSvZ/ poTukO2yXmuHSnkniiKJ6gNf6UfkuUorWxHGgDNvUB/tMtVbww1IEFQ6sG6BTQybSdV0 gnWvfynimpBE/bl3M3fao7Ua5MhtSiru2aT5f/RV5OHW/1CrH7KHwLTcC8ETf1u2DVj3 x7POf50oEX4OyiA6J29xycfKZD/Gvmqglcc0GxANxHGXZDVvzXv/j7Z4IMOG+s8K9LtQ 5cPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cL4hWEMqscQrJndLl28Pvxb+JR1bs5TkYaQboNsDGco=; b=JbagOMf/UB+aN24nxypvQxfpktcmAZhCIi2mAapLLh5Y45FER1l0sa9gjaIrN9Tqdd k5OQ6bf7PqshbRAtMwvr/hyx93O/guGypVs82lkEr/81+Ud3wCoSYcTf+p2H9dBpFSdz MfzKoD3lUQVA8IlKhdIVbGK9tgYd2PYlFlwHhRy7v6xDJcvzB04sMZJYDaxgNvioGhvt 5fSRiMFhi8Allf1c0rv+XXlVPgUrrUJcmmYaguXFmR6MCLya36UkA4/3Ydrn/LZJmSBQ IlRMicNH6ErgN27Mt4LyTKxXJSNd/M70xiQ/vGO2DQ+0JtSqKVQClncmK9uKhyao46sP IHCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l4qkq0bg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si15210198plk.304.2018.11.11.16.12.35; Sun, 11 Nov 2018 16:12:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l4qkq0bg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731969AbeKLKCm (ORCPT + 99 others); Mon, 12 Nov 2018 05:02:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:59948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730574AbeKLIRS (ORCPT ); Mon, 12 Nov 2018 03:17:18 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 889E8223C6; Sun, 11 Nov 2018 22:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975242; bh=V9MFlBvxHJMMc7LxMhKAEUL1Dj8Q4DBD4jjMV0YMqks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l4qkq0bgMwW/bzY213BUjrAMDlq/qkNVNyZveOfsLGMAw2inJfIYlH/11rYJuWd15 Rv2HlEK2dWd8a2pykwG14N+Yb7RdwZGxeNZLtsodw96a7zrkOPBnMCg50pNCX+ARXJ /OSX8gqldeV2PBo4xqvOHHj1kt2Q7SYnCJiClZhc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Keller , Anirudh Venkataramanan , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.19 089/361] ice: update fw version check logic Date: Sun, 11 Nov 2018 14:17:16 -0800 Message-Id: <20181111221632.221230961@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacob Keller [ Upstream commit 396fbf9cab5dc07f8f87773062a8d35f54b40a05 ] We have MAX_FW_API_VER_BRANCH, MAX_FW_API_VER_MAJOR, and MAX_FW_API_VER_MINOR that we use in ice_controlq.h to test when a firmware version is newer than expected. This is currently tested by comparing each field separately. Thus, we compare the branch field against the MAX_FW_API_VER_BRANCH, and so forth. This means that currently, if we suppose that the max firmware version is defined as 0.2.1, i.e. Then firmware 0.1.3 will fail to load. This is because the minor version 3 is greater than the max minor version 1. This is not intuitive, because of the notion that increasing the major firmware version to 2 should mean any firmware version with a major version is less than 2 should be considered older than 2... In order to allow both 0.2.1 and 0.1.3 to load, you would have to define the "max" firmware version as 0.2.3.. It is possible that such a firmware version doesn't even exist yet! Fix this by replacing the current logic with an updated check that behaves as follows: First, we check the major version. If it is greater than the expected version, then we prevent driver load. Additionally, a warning message is logged to indicate to the system administrator that they need to update their driver. This is now the only case where the driver will refuse to load. Second, if the major version is less than the expected version, we log an information message indicating the NVM should be updated. Third, if the major version is exact, we'll then check the minor version. If the minor version is more than two versions less than expected, we log an information message indicating the NVM should be updated. If it is more than two versions greater than the expected version, we log an information message that the driver should be updated. To support this, the ice_aq_ver_check function needs its signature updated to pass the HW structure. Since we now pass this structure, there is no need to pass the firmware API versions separately. Signed-off-by: Jacob Keller Signed-off-by: Anirudh Venkataramanan Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/ice/ice_controlq.c | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_controlq.c +++ b/drivers/net/ethernet/intel/ice/ice_controlq.c @@ -518,22 +518,31 @@ shutdown_sq_out: /** * ice_aq_ver_check - Check the reported AQ API version. - * @fw_branch: The "branch" of FW, typically describes the device type - * @fw_major: The major version of the FW API - * @fw_minor: The minor version increment of the FW API + * @hw: pointer to the hardware structure * * Checks if the driver should load on a given AQ API version. * * Return: 'true' iff the driver should attempt to load. 'false' otherwise. */ -static bool ice_aq_ver_check(u8 fw_branch, u8 fw_major, u8 fw_minor) +static bool ice_aq_ver_check(struct ice_hw *hw) { - if (fw_branch != EXP_FW_API_VER_BRANCH) - return false; - if (fw_major != EXP_FW_API_VER_MAJOR) - return false; - if (fw_minor != EXP_FW_API_VER_MINOR) + if (hw->api_maj_ver > EXP_FW_API_VER_MAJOR) { + /* Major API version is newer than expected, don't load */ + dev_warn(ice_hw_to_dev(hw), + "The driver for the device stopped because the NVM image is newer than expected. You must install the most recent version of the network driver.\n"); return false; + } else if (hw->api_maj_ver == EXP_FW_API_VER_MAJOR) { + if (hw->api_min_ver > (EXP_FW_API_VER_MINOR + 2)) + dev_info(ice_hw_to_dev(hw), + "The driver for the device detected a newer version of the NVM image than expected. Please install the most recent version of the network driver.\n"); + else if ((hw->api_min_ver + 2) < EXP_FW_API_VER_MINOR) + dev_info(ice_hw_to_dev(hw), + "The driver for the device detected an older version of the NVM image than expected. Please update the NVM image.\n"); + } else { + /* Major API version is older than expected, log a warning */ + dev_info(ice_hw_to_dev(hw), + "The driver for the device detected an older version of the NVM image than expected. Please update the NVM image.\n"); + } return true; } @@ -588,8 +597,7 @@ static enum ice_status ice_init_check_ad if (status) goto init_ctrlq_free_rq; - if (!ice_aq_ver_check(hw->api_branch, hw->api_maj_ver, - hw->api_min_ver)) { + if (!ice_aq_ver_check(hw)) { status = ICE_ERR_FW_API_VER; goto init_ctrlq_free_rq; }