net/ice/base: support DCB
[dpdk.git] / drivers / net / ice / base / ice_common.c
index 2362dd7..2025927 100644 (file)
@@ -1930,6 +1930,18 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
                                          number);
                        }
                        break;
+               case ICE_AQC_CAPS_DCB:
+                       caps->dcb = (number == 1);
+                       caps->active_tc_bitmap = logical_id;
+                       caps->maxtc = phys_id;
+                       ice_debug(hw, ICE_DBG_INIT,
+                                 "HW caps: DCB = %d\n", caps->dcb);
+                       ice_debug(hw, ICE_DBG_INIT,
+                                 "HW caps: Active TC bitmap = %d\n",
+                                 caps->active_tc_bitmap);
+                       ice_debug(hw, ICE_DBG_INIT,
+                                 "HW caps: TC Max = %d\n", caps->maxtc);
+                       break;
                case ICE_AQC_CAPS_RSS:
                        caps->rss_table_size = number;
                        caps->rss_table_entry_width = logical_id;
@@ -3654,14 +3666,17 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
        if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
                return ICE_ERR_CFG;
 
-       /* if queue is disabled already yet the disable queue command has to be
-        * sent to complete the VF reset, then call ice_aq_dis_lan_txq without
-        * any queue information
-        */
 
-       if (!num_queues && rst_src)
-               return ice_aq_dis_lan_txq(pi->hw, 0, NULL, 0, rst_src, vmvf_num,
-                                         NULL);
+       if (!num_queues) {
+               /* if queue is disabled already yet the disable queue command
+                * has to be sent to complete the VF reset, then call
+                * ice_aq_dis_lan_txq without any queue information
+                */
+               if (rst_src)
+                       return ice_aq_dis_lan_txq(pi->hw, 0, NULL, 0, rst_src,
+                                                 vmvf_num, NULL);
+               return ICE_ERR_CFG;
+       }
 
        ice_acquire_lock(&pi->sched_lock);
 
@@ -3912,3 +3927,18 @@ ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
                ice_debug(hw, ICE_DBG_SCHED, "query element failed\n");
        return status;
 }
+
+/**
+ * ice_is_fw_in_rec_mode
+ * @hw: pointer to the HW struct
+ *
+ * This function returns true if fw is in recovery mode
+ */
+bool ice_is_fw_in_rec_mode(struct ice_hw *hw)
+{
+       u32 reg;
+
+       /* check the current FW mode */
+       reg = rd32(hw, GL_MNG_FWSM);
+       return (reg & GL_MNG_FWSM_FW_MODES_M) > ICE_FW_MODE_DBG;
+}