net/ice/base: add function to configure Tx AQ command
authorQi Zhang <qi.z.zhang@intel.com>
Thu, 29 Aug 2019 02:36:28 +0000 (10:36 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 13:00:53 +0000 (15:00 +0200)
This function is needed by the driver to move PSM leaf nodes to a new
parent.

Additionally, add struct ice_aqc_move_txqs to struct ice_aq_desc so
driver code can access it.

Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
drivers/net/ice/base/ice_adminq_cmd.h
drivers/net/ice/base/ice_common.c
drivers/net/ice/base/ice_common.h

index b9e3bd5..9a06359 100644 (file)
@@ -2292,6 +2292,7 @@ struct ice_aq_desc {
                struct ice_aqc_clear_fd_table clear_fd_table;
                struct ice_aqc_add_txqs add_txqs;
                struct ice_aqc_dis_txqs dis_txqs;
+               struct ice_aqc_move_txqs move_txqs;
                struct ice_aqc_txqs_cleanup txqs_cleanup;
                struct ice_aqc_add_get_update_free_vsi vsi_cmd;
                struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
index e19ce73..c2d4f1f 100644 (file)
@@ -3415,6 +3415,77 @@ do_aq:
        return status;
 }
 
+/**
+ * ice_aq_move_recfg_lan_txq
+ * @hw: pointer to the hardware structure
+ * @num_qs: number of queues to move/reconfigure
+ * @is_move: true if this operation involves node movement
+ * @is_tc_change: true if this operation involves a TC change
+ * @subseq_call: true if this operation is a subsequent call
+ * @flush_pipe: on timeout, true to flush pipe, false to return EAGAIN
+ * @timeout: timeout in units of 100 usec (valid values 0-50)
+ * @blocked_cgds: out param, bitmap of CGDs that timed out if returning EAGAIN
+ * @buf: struct containing src/dest TEID and per-queue info
+ * @buf_size: size of buffer for indirect command
+ * @txqs_moved: out param, number of queues successfully moved
+ * @cd: pointer to command details structure or NULL
+ *
+ * Move / Reconfigure Tx LAN queues (0x0C32)
+ */
+enum ice_status
+ice_aq_move_recfg_lan_txq(struct ice_hw *hw, u8 num_qs, bool is_move,
+                         bool is_tc_change, bool subseq_call, bool flush_pipe,
+                         u8 timeout, u32 *blocked_cgds,
+                         struct ice_aqc_move_txqs_data *buf, u16 buf_size,
+                         u8 *txqs_moved, struct ice_sq_cd *cd)
+{
+       struct ice_aqc_move_txqs *cmd;
+       struct ice_aq_desc desc;
+       enum ice_status status;
+
+       cmd = &desc.params.move_txqs;
+       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_move_recfg_txqs);
+
+#define ICE_LAN_TXQ_MOVE_TIMEOUT_MAX 50
+       if (timeout > ICE_LAN_TXQ_MOVE_TIMEOUT_MAX)
+               return ICE_ERR_PARAM;
+
+       if (is_tc_change && !flush_pipe && !blocked_cgds)
+               return ICE_ERR_PARAM;
+
+       if (!is_move && !is_tc_change)
+               return ICE_ERR_PARAM;
+
+       desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
+
+       if (is_move)
+               cmd->cmd_type |= ICE_AQC_Q_CMD_TYPE_MOVE;
+
+       if (is_tc_change)
+               cmd->cmd_type |= ICE_AQC_Q_CMD_TYPE_TC_CHANGE;
+
+       if (subseq_call)
+               cmd->cmd_type |= ICE_AQC_Q_CMD_SUBSEQ_CALL;
+
+       if (flush_pipe)
+               cmd->cmd_type |= ICE_AQC_Q_CMD_FLUSH_PIPE;
+
+       cmd->num_qs = num_qs;
+       cmd->timeout = ((timeout << ICE_AQC_Q_CMD_TIMEOUT_S) &
+                       ICE_AQC_Q_CMD_TIMEOUT_M);
+
+       status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
+
+       if (!status && txqs_moved)
+               *txqs_moved = cmd->num_qs;
+
+       if (hw->adminq.sq_last_status == ICE_AQ_RC_EAGAIN &&
+           is_tc_change && !flush_pipe)
+               *blocked_cgds = LE32_TO_CPU(cmd->blocked_cgds);
+
+       return status;
+}
+
 
 /* End of FW Admin Queue command wrappers */
 
index 67adc9c..c42c586 100644 (file)
@@ -106,6 +106,12 @@ enum ice_status
 ice_aq_add_lan_txq(struct ice_hw *hw, u8 count,
                   struct ice_aqc_add_tx_qgrp *qg_list, u16 buf_size,
                   struct ice_sq_cd *cd);
+enum ice_status
+ice_aq_move_recfg_lan_txq(struct ice_hw *hw, u8 num_qs, bool is_move,
+                         bool is_tc_change, bool subseq_call, bool flush_pipe,
+                         u8 timeout, u32 *blocked_cgds,
+                         struct ice_aqc_move_txqs_data *buf, u16 buf_size,
+                         u8 *txqs_moved, struct ice_sq_cd *cd);
 
 bool ice_check_sq_alive(struct ice_hw *hw, struct ice_ctl_q_info *cq);
 enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading);