Commit eae1bbb2 authored by Bruce Allan's avatar Bruce Allan Committed by Jeff Kirsher

ice: Store number of functions for the device

Store the number of functions the device has and use this number when
setting safe mode capabilities instead of calculating it.
Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Co-developed-by: default avatarKevin Scott <kevin.c.scott@intel.com>
Signed-off-by: default avatarKevin Scott <kevin.c.scott@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 3243e04a
...@@ -1673,6 +1673,10 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count, ...@@ -1673,6 +1673,10 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
ice_debug(hw, ICE_DBG_INIT, ice_debug(hw, ICE_DBG_INIT,
"%s: valid_functions (bitmap) = %d\n", prefix, "%s: valid_functions (bitmap) = %d\n", prefix,
caps->valid_functions); caps->valid_functions);
/* store func count for resource management purposes */
if (dev_p)
dev_p->num_funcs = hweight32(number);
break; break;
case ICE_AQC_CAPS_SRIOV: case ICE_AQC_CAPS_SRIOV:
caps->sr_iov_1_1 = (number == 1); caps->sr_iov_1_1 = (number == 1);
...@@ -1875,8 +1879,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) ...@@ -1875,8 +1879,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
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; u32 valid_func, rxq_first_id, txq_first_id;
u32 msix_vector_first_id, max_mtu; u32 msix_vector_first_id, max_mtu;
u32 num_func = 0; u32 num_funcs;
u8 i;
/* 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; valid_func = func_caps->common_cap.valid_functions;
...@@ -1909,6 +1912,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) ...@@ -1909,6 +1912,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
rxq_first_id = dev_caps->common_cap.rxq_first_id; rxq_first_id = dev_caps->common_cap.rxq_first_id;
msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id; msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id;
max_mtu = dev_caps->common_cap.max_mtu; max_mtu = dev_caps->common_cap.max_mtu;
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));
...@@ -1919,19 +1923,14 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) ...@@ -1919,19 +1923,14 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
dev_caps->common_cap.rxq_first_id = rxq_first_id; dev_caps->common_cap.rxq_first_id = rxq_first_id;
dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id; dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id;
dev_caps->common_cap.max_mtu = max_mtu; dev_caps->common_cap.max_mtu = max_mtu;
dev_caps->num_funcs = num_funcs;
/* valid_func is a bitmap. get number of functions */
#define ICE_MAX_FUNCS 8
for (i = 0; i < ICE_MAX_FUNCS; i++)
if (valid_func & BIT(i))
num_func++;
/* one Tx and one Rx queue per function in safe mode */ /* one Tx and one Rx queue per function in safe mode */
dev_caps->common_cap.num_rxq = num_func; dev_caps->common_cap.num_rxq = num_funcs;
dev_caps->common_cap.num_txq = num_func; dev_caps->common_cap.num_txq = num_funcs;
/* two MSIX vectors per function */ /* two MSIX vectors per function */
dev_caps->common_cap.num_msix_vectors = 2 * num_func; dev_caps->common_cap.num_msix_vectors = 2 * num_funcs;
} }
/** /**
......
...@@ -202,6 +202,7 @@ struct ice_hw_dev_caps { ...@@ -202,6 +202,7 @@ struct ice_hw_dev_caps {
struct ice_hw_common_caps common_cap; struct ice_hw_common_caps common_cap;
u32 num_vfs_exposed; /* Total number of VFs exposed */ u32 num_vfs_exposed; /* Total number of VFs exposed */
u32 num_vsi_allocd_to_host; /* Excluding EMP VSI */ u32 num_vsi_allocd_to_host; /* Excluding EMP VSI */
u32 num_funcs;
}; };
/* MAC info */ /* MAC info */
......
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