/[packages]/cauldron/kernel/current/PATCHES/patches/0043-ice-update-fw-version-check-logic.patch
ViewVC logotype

Contents of /cauldron/kernel/current/PATCHES/patches/0043-ice-update-fw-version-check-logic.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1329221 - (show annotations) (download)
Fri Nov 9 22:05:45 2018 UTC (5 years, 10 months ago) by tmb
File size: 5105 byte(s)
add fixes from sashas autosel queue
1 From 3f1edc48c849ce42070d773bfbb1f5dec722dfcf Mon Sep 17 00:00:00 2001
2 From: Jacob Keller <jacob.e.keller@intel.com>
3 Date: Wed, 19 Sep 2018 17:23:07 -0700
4 Subject: [PATCH 043/145] ice: update fw version check logic
5
6 [ Upstream commit 396fbf9cab5dc07f8f87773062a8d35f54b40a05 ]
7
8 We have MAX_FW_API_VER_BRANCH, MAX_FW_API_VER_MAJOR, and
9 MAX_FW_API_VER_MINOR that we use in ice_controlq.h to test when a
10 firmware version is newer than expected. This is currently tested by
11 comparing each field separately. Thus, we compare the branch field
12 against the MAX_FW_API_VER_BRANCH, and so forth.
13
14 This means that currently, if we suppose that the max firmware version
15 is defined as 0.2.1, i.e.
16
17 Then firmware 0.1.3 will fail to load. This is because the minor version
18 3 is greater than the max minor version 1.
19
20 This is not intuitive, because of the notion that increasing the major
21 firmware version to 2 should mean any firmware version with a major
22 version is less than 2 should be considered older than 2...
23
24 In order to allow both 0.2.1 and 0.1.3 to load, you would have to define
25 the "max" firmware version as 0.2.3.. It is possible that such
26 a firmware version doesn't even exist yet!
27
28 Fix this by replacing the current logic with an updated check that
29 behaves as follows:
30
31 First, we check the major version. If it is greater than the expected
32 version, then we prevent driver load. Additionally, a warning message is
33 logged to indicate to the system administrator that they need to update
34 their driver. This is now the only case where the driver will refuse to
35 load.
36
37 Second, if the major version is less than the expected version, we log
38 an information message indicating the NVM should be updated.
39
40 Third, if the major version is exact, we'll then check the minor
41 version. If the minor version is more than two versions less than
42 expected, we log an information message indicating the NVM should be
43 updated. If it is more than two versions greater than the expected
44 version, we log an information message that the driver should be
45 updated.
46
47 To support this, the ice_aq_ver_check function needs its signature
48 updated to pass the HW structure. Since we now pass this structure,
49 there is no need to pass the firmware API versions separately.
50
51 Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
52 Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
53 Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
54 Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
55 Signed-off-by: Sasha Levin <sashal@kernel.org>
56 ---
57 drivers/net/ethernet/intel/ice/ice_controlq.c | 30 ++++++++++++-------
58 1 file changed, 19 insertions(+), 11 deletions(-)
59
60 diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c
61 index 62be72fdc8f3..e783976c401d 100644
62 --- a/drivers/net/ethernet/intel/ice/ice_controlq.c
63 +++ b/drivers/net/ethernet/intel/ice/ice_controlq.c
64 @@ -518,22 +518,31 @@ ice_shutdown_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
65
66 /**
67 * ice_aq_ver_check - Check the reported AQ API version.
68 - * @fw_branch: The "branch" of FW, typically describes the device type
69 - * @fw_major: The major version of the FW API
70 - * @fw_minor: The minor version increment of the FW API
71 + * @hw: pointer to the hardware structure
72 *
73 * Checks if the driver should load on a given AQ API version.
74 *
75 * Return: 'true' iff the driver should attempt to load. 'false' otherwise.
76 */
77 -static bool ice_aq_ver_check(u8 fw_branch, u8 fw_major, u8 fw_minor)
78 +static bool ice_aq_ver_check(struct ice_hw *hw)
79 {
80 - if (fw_branch != EXP_FW_API_VER_BRANCH)
81 - return false;
82 - if (fw_major != EXP_FW_API_VER_MAJOR)
83 - return false;
84 - if (fw_minor != EXP_FW_API_VER_MINOR)
85 + if (hw->api_maj_ver > EXP_FW_API_VER_MAJOR) {
86 + /* Major API version is newer than expected, don't load */
87 + dev_warn(ice_hw_to_dev(hw),
88 + "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");
89 return false;
90 + } else if (hw->api_maj_ver == EXP_FW_API_VER_MAJOR) {
91 + if (hw->api_min_ver > (EXP_FW_API_VER_MINOR + 2))
92 + dev_info(ice_hw_to_dev(hw),
93 + "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");
94 + else if ((hw->api_min_ver + 2) < EXP_FW_API_VER_MINOR)
95 + dev_info(ice_hw_to_dev(hw),
96 + "The driver for the device detected an older version of the NVM image than expected. Please update the NVM image.\n");
97 + } else {
98 + /* Major API version is older than expected, log a warning */
99 + dev_info(ice_hw_to_dev(hw),
100 + "The driver for the device detected an older version of the NVM image than expected. Please update the NVM image.\n");
101 + }
102 return true;
103 }
104
105 @@ -588,8 +597,7 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw)
106 if (status)
107 goto init_ctrlq_free_rq;
108
109 - if (!ice_aq_ver_check(hw->api_branch, hw->api_maj_ver,
110 - hw->api_min_ver)) {
111 + if (!ice_aq_ver_check(hw)) {
112 status = ICE_ERR_FW_API_VER;
113 goto init_ctrlq_free_rq;
114 }
115 --
116 2.19.1
117

  ViewVC Help
Powered by ViewVC 1.1.30