net/ice/base: add definitions for FW health status codes
[dpdk.git] / drivers / net / ice / base / ice_common.c
index 2a9185f..b217ae6 100644 (file)
@@ -1704,7 +1704,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries,
        if (!buf)
                return ICE_ERR_PARAM;
 
-       if (buf_size < (num_entries * sizeof(buf->elem[0])))
+       if (buf_size < FLEX_ARRAY_SIZE(buf, elem, num_entries))
                return ICE_ERR_PARAM;
 
        ice_fill_dflt_direct_cmd_desc(&desc, opc);
@@ -1882,6 +1882,23 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
                ice_debug(hw, ICE_DBG_INIT, "%s: msix_vector_first_id = %d\n", prefix,
                          caps->msix_vector_first_id);
                break;
+       case ICE_AQC_CAPS_NVM_MGMT:
+               caps->sec_rev_disabled =
+                       (number & ICE_NVM_MGMT_SEC_REV_DISABLED) ?
+                       true : false;
+               ice_debug(hw, ICE_DBG_INIT, "%s: sec_rev_disabled = %d\n", prefix,
+                         caps->sec_rev_disabled);
+               caps->update_disabled =
+                       (number & ICE_NVM_MGMT_UPDATE_DISABLED) ?
+                       true : false;
+               ice_debug(hw, ICE_DBG_INIT, "%s: update_disabled = %d\n", prefix,
+                         caps->update_disabled);
+               caps->nvm_unified_update =
+                       (number & ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT) ?
+                       true : false;
+               ice_debug(hw, ICE_DBG_INIT, "%s: nvm_unified_update = %d\n", prefix,
+                         caps->nvm_unified_update);
+               break;
        case ICE_AQC_CAPS_MAX_MTU:
                caps->max_mtu = number;
                ice_debug(hw, ICE_DBG_INIT, "%s: max_mtu = %d\n",
@@ -3218,23 +3235,33 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
 /**
  * __ice_aq_get_set_rss_lut
  * @hw: pointer to the hardware structure
- * @vsi_id: VSI FW index
- * @lut_type: LUT table type
- * @lut: pointer to the LUT buffer provided by the caller
- * @lut_size: size of the LUT buffer
- * @glob_lut_idx: global LUT index
+ * @params: RSS LUT parameters
  * @set: set true to set the table, false to get the table
  *
  * Internal function to get (0x0B05) or set (0x0B03) RSS look up table
  */
 static enum ice_status
-__ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut,
-                        u16 lut_size, u8 glob_lut_idx, bool set)
+__ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *params, bool set)
 {
+       u16 flags = 0, vsi_id, lut_type, lut_size, glob_lut_idx, vsi_handle;
        struct ice_aqc_get_set_rss_lut *cmd_resp;
        struct ice_aq_desc desc;
        enum ice_status status;
-       u16 flags = 0;
+       u8 *lut;
+
+       if (!params)
+               return ICE_ERR_PARAM;
+
+       vsi_handle = params->vsi_handle;
+       lut = params->lut;
+
+       if (!ice_is_vsi_valid(hw, vsi_handle) || !lut)
+               return ICE_ERR_PARAM;
+
+       lut_size = params->lut_size;
+       lut_type = params->lut_type;
+       glob_lut_idx = params->global_lut_id;
+       vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
 
        cmd_resp = &desc.params.get_set_rss_lut;
 
@@ -3311,43 +3338,27 @@ ice_aq_get_set_rss_lut_exit:
 /**
  * ice_aq_get_rss_lut
  * @hw: pointer to the hardware structure
- * @vsi_handle: software VSI handle
- * @lut_type: LUT table type
- * @lut: pointer to the LUT buffer provided by the caller
- * @lut_size: size of the LUT buffer
+ * @get_params: RSS LUT parameters used to specify which RSS LUT to get
  *
  * get the RSS lookup table, PF or VSI type
  */
 enum ice_status
-ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type,
-                  u8 *lut, u16 lut_size)
+ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params)
 {
-       if (!ice_is_vsi_valid(hw, vsi_handle) || !lut)
-               return ICE_ERR_PARAM;
-
-       return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle),
-                                       lut_type, lut, lut_size, 0, false);
+       return __ice_aq_get_set_rss_lut(hw, get_params, false);
 }
 
 /**
  * ice_aq_set_rss_lut
  * @hw: pointer to the hardware structure
- * @vsi_handle: software VSI handle
- * @lut_type: LUT table type
- * @lut: pointer to the LUT buffer provided by the caller
- * @lut_size: size of the LUT buffer
+ * @set_params: RSS LUT parameters used to specify how to set the RSS LUT
  *
  * set the RSS lookup table, PF or VSI type
  */
 enum ice_status
-ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type,
-                  u8 *lut, u16 lut_size)
+ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params)
 {
-       if (!ice_is_vsi_valid(hw, vsi_handle) || !lut)
-               return ICE_ERR_PARAM;
-
-       return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle),
-                                       lut_type, lut, lut_size, 0, true);
+       return __ice_aq_get_set_rss_lut(hw, set_params, true);
 }
 
 /**