]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ice: Prevent unintended multiple chain resets
authorDave Ertman <david.m.ertman@intel.com>
Wed, 13 Feb 2019 18:51:08 +0000 (10:51 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:45:16 +0000 (06:45 -0700)
[ Upstream commit 2ebd4428d93a2f6ce0c813b10a1a43b6a8241fe5 ]

In the current implementation of ice_reset_subtask, if multiple reset
types are set in the pf->state, the most intrusive one is meant to be
performed only, but the bits requesting the other types are not being
cleared. This would lead to another reset being performed the next time
the service task is scheduled.

Change the flow of ice_reset_subtask so that all reset request bits in
pf->state are cleared, and we still perform the most intrusive of the
resets requested.

Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ice/ice_main.c

index d083979acc22cc188aa539f068b6c9f8f1f1e870..43064b4176d3824dc86e0eb46119a1b1a26780aa 100644 (file)
@@ -416,8 +416,14 @@ static void ice_reset_subtask(struct ice_pf *pf)
         * for the reset now), poll for reset done, rebuild and return.
         */
        if (test_bit(__ICE_RESET_OICR_RECV, pf->state)) {
-               clear_bit(__ICE_GLOBR_RECV, pf->state);
-               clear_bit(__ICE_CORER_RECV, pf->state);
+               /* Perform the largest reset requested */
+               if (test_and_clear_bit(__ICE_CORER_RECV, pf->state))
+                       reset_type = ICE_RESET_CORER;
+               if (test_and_clear_bit(__ICE_GLOBR_RECV, pf->state))
+                       reset_type = ICE_RESET_GLOBR;
+               /* return if no valid reset type requested */
+               if (reset_type == ICE_RESET_INVAL)
+                       return;
                if (!test_bit(__ICE_PREPARED_FOR_RESET, pf->state))
                        ice_prepare_for_reset(pf);