Commit be49b1ad authored by Jacob Keller's avatar Jacob Keller Committed by Tony Nguyen

ice: preserve NVM capabilities in safe mode

If the driver initializes in safe mode, it will call
ice_set_safe_mode_caps. This results in clearing the capabilities
structures, in order to set them up for operating in safe mode, ensuring
many features are disabled.

This has a side effect of also clearing the capability bits that relate
to NVM update. The result is that the device driver will not indicate
support for unified update, even if the firmware is capable.

Fix this by adding the relevant capability fields to the list of values
we preserve. To simplify the code, use a common_cap structure instead of
a handful of local variables. To reduce some duplication of the
capability name, introduce a couple of macros used to restore the
capabilities values from the cached copy.

Fixes: de9b277e ("ice: Add support for unified NVM update flow capability")
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarBrijesh Behera <brijeshx.behera@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 0ec86e8e
...@@ -2288,26 +2288,28 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) ...@@ -2288,26 +2288,28 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
{ {
struct ice_hw_func_caps *func_caps = &hw->func_caps; struct ice_hw_func_caps *func_caps = &hw->func_caps;
struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; struct ice_hw_dev_caps *dev_caps = &hw->dev_caps;
u32 valid_func, rxq_first_id, txq_first_id; struct ice_hw_common_caps cached_caps;
u32 msix_vector_first_id, max_mtu;
u32 num_funcs; u32 num_funcs;
/* cache some func_caps values that should be restored after memset */ /* cache some func_caps values that should be restored after memset */
valid_func = func_caps->common_cap.valid_functions; cached_caps = func_caps->common_cap;
txq_first_id = func_caps->common_cap.txq_first_id;
rxq_first_id = func_caps->common_cap.rxq_first_id;
msix_vector_first_id = func_caps->common_cap.msix_vector_first_id;
max_mtu = func_caps->common_cap.max_mtu;
/* unset func capabilities */ /* unset func capabilities */
memset(func_caps, 0, sizeof(*func_caps)); memset(func_caps, 0, sizeof(*func_caps));
#define ICE_RESTORE_FUNC_CAP(name) \
func_caps->common_cap.name = cached_caps.name
/* restore cached values */ /* restore cached values */
func_caps->common_cap.valid_functions = valid_func; ICE_RESTORE_FUNC_CAP(valid_functions);
func_caps->common_cap.txq_first_id = txq_first_id; ICE_RESTORE_FUNC_CAP(txq_first_id);
func_caps->common_cap.rxq_first_id = rxq_first_id; ICE_RESTORE_FUNC_CAP(rxq_first_id);
func_caps->common_cap.msix_vector_first_id = msix_vector_first_id; ICE_RESTORE_FUNC_CAP(msix_vector_first_id);
func_caps->common_cap.max_mtu = max_mtu; ICE_RESTORE_FUNC_CAP(max_mtu);
ICE_RESTORE_FUNC_CAP(nvm_unified_update);
ICE_RESTORE_FUNC_CAP(nvm_update_pending_nvm);
ICE_RESTORE_FUNC_CAP(nvm_update_pending_orom);
ICE_RESTORE_FUNC_CAP(nvm_update_pending_netlist);
/* one Tx and one Rx queue in safe mode */ /* one Tx and one Rx queue in safe mode */
func_caps->common_cap.num_rxq = 1; func_caps->common_cap.num_rxq = 1;
...@@ -2318,22 +2320,25 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) ...@@ -2318,22 +2320,25 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
func_caps->guar_num_vsi = 1; func_caps->guar_num_vsi = 1;
/* cache some dev_caps values that should be restored after memset */ /* cache some dev_caps values that should be restored after memset */
valid_func = dev_caps->common_cap.valid_functions; cached_caps = dev_caps->common_cap;
txq_first_id = dev_caps->common_cap.txq_first_id;
rxq_first_id = dev_caps->common_cap.rxq_first_id;
msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id;
max_mtu = dev_caps->common_cap.max_mtu;
num_funcs = dev_caps->num_funcs; num_funcs = dev_caps->num_funcs;
/* unset dev capabilities */ /* unset dev capabilities */
memset(dev_caps, 0, sizeof(*dev_caps)); memset(dev_caps, 0, sizeof(*dev_caps));
#define ICE_RESTORE_DEV_CAP(name) \
dev_caps->common_cap.name = cached_caps.name
/* restore cached values */ /* restore cached values */
dev_caps->common_cap.valid_functions = valid_func; ICE_RESTORE_DEV_CAP(valid_functions);
dev_caps->common_cap.txq_first_id = txq_first_id; ICE_RESTORE_DEV_CAP(txq_first_id);
dev_caps->common_cap.rxq_first_id = rxq_first_id; ICE_RESTORE_DEV_CAP(rxq_first_id);
dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id; ICE_RESTORE_DEV_CAP(msix_vector_first_id);
dev_caps->common_cap.max_mtu = max_mtu; ICE_RESTORE_DEV_CAP(max_mtu);
ICE_RESTORE_DEV_CAP(nvm_unified_update);
ICE_RESTORE_DEV_CAP(nvm_update_pending_nvm);
ICE_RESTORE_DEV_CAP(nvm_update_pending_orom);
ICE_RESTORE_DEV_CAP(nvm_update_pending_netlist);
dev_caps->num_funcs = num_funcs; dev_caps->num_funcs = num_funcs;
/* one Tx and one Rx queue per function in safe mode */ /* one Tx and one Rx queue per function in safe mode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment