net/ice/base: enable FDIR queue region
[dpdk.git] / drivers / net / ice / base / ice_controlq.c
index 8070bb9..8a65fae 100644 (file)
@@ -4,7 +4,6 @@
 
 #include "ice_common.h"
 
-
 #define ICE_CQ_INIT_REGS(qinfo, prefix)                                \
 do {                                                           \
        (qinfo)->sq.head = prefix##_ATQH;                       \
@@ -53,7 +52,6 @@ static void ice_mailbox_init_regs(struct ice_hw *hw)
        ICE_CQ_INIT_REGS(cq, PF_MBX);
 }
 
-
 /**
  * ice_check_sq_alive
  * @hw: pointer to the HW struct
@@ -412,7 +410,7 @@ do {                                                                        \
        /* free the buffer info list */                                 \
        if ((qi)->ring.cmd_buf)                                         \
                ice_free(hw, (qi)->ring.cmd_buf);                       \
-       /* free dma head */                                             \
+       /* free DMA head */                                             \
        ice_free(hw, (qi)->ring.dma_head);                              \
 } while (0)
 
@@ -521,7 +519,6 @@ shutdown_rq_out:
        return ret_code;
 }
 
-
 /**
  * ice_init_check_adminq - Check version for Admin Queue to know if its alive
  * @hw: pointer to the hardware structure
@@ -533,12 +530,10 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw)
 
        ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 
-
        status = ice_aq_get_fw_ver(hw, NULL);
        if (status)
                goto init_ctrlq_free_rq;
 
-
        if (!ice_aq_ver_check(hw)) {
                status = ICE_ERR_FW_API_VER;
                goto init_ctrlq_free_rq;
@@ -633,7 +628,6 @@ enum ice_status ice_init_all_ctrlq(struct ice_hw *hw)
 
        ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 
-
        /* Init FW admin queue */
        ret_code = ice_init_ctrlq(hw, ICE_CTL_Q_ADMIN);
        if (ret_code)
@@ -859,7 +853,7 @@ static bool ice_sq_done(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 }
 
 /**
- * ice_sq_send_cmd - send command to Control Queue (ATQ)
+ * ice_sq_send_cmd_nolock - send command to Control Queue (ATQ)
  * @hw: pointer to the HW struct
  * @cq: pointer to the specific Control queue
  * @desc: prefilled descriptor describing the command (non DMA mem)
@@ -870,10 +864,10 @@ static bool ice_sq_done(struct ice_hw *hw, struct ice_ctl_q_info *cq)
  * This is the main send command routine for the ATQ. It runs the queue,
  * cleans the queue, etc.
  */
-enum ice_status
-ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
-               struct ice_aq_desc *desc, void *buf, u16 buf_size,
-               struct ice_sq_cd *cd)
+static enum ice_status
+ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
+                      struct ice_aq_desc *desc, void *buf, u16 buf_size,
+                      struct ice_sq_cd *cd)
 {
        struct ice_dma_mem *dma_buf = NULL;
        struct ice_aq_desc *desc_on_ring;
@@ -887,7 +881,6 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
        /* if reset is in progress return a soft error */
        if (hw->reset_ongoing)
                return ICE_ERR_RESET_ONGOING;
-       ice_acquire_lock(&cq->sq_lock);
 
        cq->sq_last_status = ICE_AQ_RC_OK;
 
@@ -973,7 +966,6 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 
        ice_debug_cq(hw, (void *)desc_on_ring, buf, buf_size);
 
-
        (cq->sq.next_to_use)++;
        if (cq->sq.next_to_use == cq->sq.count)
                cq->sq.next_to_use = 0;
@@ -983,7 +975,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
                if (ice_sq_done(hw, cq))
                        break;
 
-               ice_msec_delay(1, false);
+               ice_usec_delay(ICE_CTL_Q_SQ_CMD_USEC, false);
                total_delay++;
        } while (total_delay < cq->sq_cmd_timeout);
 
@@ -1026,7 +1018,6 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 
        ice_debug_cq(hw, (void *)desc, buf, buf_size);
 
-
        /* save writeback AQ if requested */
        if (details->wb_desc)
                ice_memcpy(details->wb_desc, desc_on_ring,
@@ -1040,7 +1031,36 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
        }
 
 sq_send_command_error:
+       return status;
+}
+
+/**
+ * ice_sq_send_cmd - send command to Control Queue (ATQ)
+ * @hw: pointer to the HW struct
+ * @cq: pointer to the specific Control queue
+ * @desc: prefilled descriptor describing the command (non DMA mem)
+ * @buf: buffer to use for indirect commands (or NULL for direct commands)
+ * @buf_size: size of buffer for indirect commands (or 0 for direct commands)
+ * @cd: pointer to command details structure
+ *
+ * This is the main send command routine for the ATQ. It runs the queue,
+ * cleans the queue, etc.
+ */
+enum ice_status
+ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
+               struct ice_aq_desc *desc, void *buf, u16 buf_size,
+               struct ice_sq_cd *cd)
+{
+       enum ice_status status = ICE_SUCCESS;
+
+       /* if reset is in progress return a soft error */
+       if (hw->reset_ongoing)
+               return ICE_ERR_RESET_ONGOING;
+
+       ice_acquire_lock(&cq->sq_lock);
+       status = ice_sq_send_cmd_nolock(hw, cq, desc, buf, buf_size, cd);
        ice_release_lock(&cq->sq_lock);
+
        return status;
 }
 
@@ -1130,7 +1150,6 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
        ice_debug_cq(hw, (void *)desc, e->msg_buf,
                     cq->rq_buf_size);
 
-
        /* Restore the original datalen and buffer address in the desc,
         * FW updates datalen to indicate the event message size
         */