net/ice/base: save queue bandwidth for replay after reset
Added code to save the queue bandwidth information when it is applied and it is replayed when queue is re-enabled again. Earlier saved value is used for replay purpose. Added vsi_handle, tc, and q_handle argument to the ice_cfg_q_bw_lmt, ice_cfg_q_bw_dflt_lmt. Signed-off-by: Tarun Singh <tarun.k.singh@intel.com> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> Signed-off-by: Leyi Rong <leyi.rong@intel.com> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
parent
f89aa3affa
commit
1b969112dc
@ -3606,7 +3606,7 @@ ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
|
||||
* @tc: TC number
|
||||
* @q_handle: software queue handle
|
||||
*/
|
||||
static struct ice_q_ctx *
|
||||
struct ice_q_ctx *
|
||||
ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle)
|
||||
{
|
||||
struct ice_vsi_ctx *vsi;
|
||||
@ -3703,9 +3703,12 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
|
||||
node.node_teid = buf->txqs[0].q_teid;
|
||||
node.data.elem_type = ICE_AQC_ELEM_TYPE_LEAF;
|
||||
q_ctx->q_handle = q_handle;
|
||||
q_ctx->q_teid = LE32_TO_CPU(node.node_teid);
|
||||
|
||||
/* add a leaf node into schduler tree queue layer */
|
||||
/* add a leaf node into scheduler tree queue layer */
|
||||
status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node);
|
||||
if (!status)
|
||||
status = ice_sched_replay_q_bw(pi, q_ctx);
|
||||
|
||||
ena_txq_exit:
|
||||
ice_release_lock(&pi->sched_lock);
|
||||
|
@ -186,6 +186,10 @@ void ice_sched_replay_agg(struct ice_hw *hw);
|
||||
enum ice_status ice_sched_replay_tc_node_bw(struct ice_hw *hw);
|
||||
enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle);
|
||||
enum ice_status
|
||||
ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx);
|
||||
struct ice_q_ctx *
|
||||
ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle);
|
||||
enum ice_status
|
||||
ice_cfg_tc_node_bw_alloc(struct ice_port_info *pi, u8 tc,
|
||||
enum ice_rl_type rl_type, u8 bw_alloc);
|
||||
enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes);
|
||||
|
@ -4326,27 +4326,61 @@ ice_sched_validate_srl_node(struct ice_sched_node *node, u8 sel_layer)
|
||||
return ICE_ERR_CFG;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_sched_save_q_bw - save queue node's BW information
|
||||
* @q_ctx: queue context structure
|
||||
* @rl_type: rate limit type min, max, or shared
|
||||
* @bw: bandwidth in Kbps - Kilo bits per sec
|
||||
*
|
||||
* Save BW information of queue type node for post replay use.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_sched_save_q_bw(struct ice_q_ctx *q_ctx, enum ice_rl_type rl_type, u32 bw)
|
||||
{
|
||||
switch (rl_type) {
|
||||
case ICE_MIN_BW:
|
||||
ice_set_clear_cir_bw(&q_ctx->bw_t_info, bw);
|
||||
break;
|
||||
case ICE_MAX_BW:
|
||||
ice_set_clear_eir_bw(&q_ctx->bw_t_info, bw);
|
||||
break;
|
||||
case ICE_SHARED_BW:
|
||||
ice_set_clear_shared_bw(&q_ctx->bw_t_info, bw);
|
||||
break;
|
||||
default:
|
||||
return ICE_ERR_PARAM;
|
||||
}
|
||||
return ICE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_sched_set_q_bw_lmt - sets queue BW limit
|
||||
* @pi: port information structure
|
||||
* @q_id: queue ID (leaf node TEID)
|
||||
* @vsi_handle: sw VSI handle
|
||||
* @tc: traffic class
|
||||
* @q_handle: software queue handle
|
||||
* @rl_type: min, max, or shared
|
||||
* @bw: bandwidth in Kbps
|
||||
*
|
||||
* This function sets BW limit of queue scheduling node.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u32 q_id,
|
||||
enum ice_rl_type rl_type, u32 bw)
|
||||
ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u16 q_handle, enum ice_rl_type rl_type, u32 bw)
|
||||
{
|
||||
enum ice_status status = ICE_ERR_PARAM;
|
||||
struct ice_sched_node *node;
|
||||
struct ice_q_ctx *q_ctx;
|
||||
|
||||
if (!ice_is_vsi_valid(pi->hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
ice_acquire_lock(&pi->sched_lock);
|
||||
|
||||
node = ice_sched_find_node_by_teid(pi->root, q_id);
|
||||
q_ctx = ice_get_lan_q_ctx(pi->hw, vsi_handle, tc, q_handle);
|
||||
if (!q_ctx)
|
||||
goto exit_q_bw_lmt;
|
||||
node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid);
|
||||
if (!node) {
|
||||
ice_debug(pi->hw, ICE_DBG_SCHED, "Wrong q_id\n");
|
||||
ice_debug(pi->hw, ICE_DBG_SCHED, "Wrong q_teid\n");
|
||||
goto exit_q_bw_lmt;
|
||||
}
|
||||
|
||||
@ -4374,6 +4408,9 @@ ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u32 q_id,
|
||||
else
|
||||
status = ice_sched_set_node_bw_lmt(pi, node, rl_type, bw);
|
||||
|
||||
if (!status)
|
||||
status = ice_sched_save_q_bw(q_ctx, rl_type, bw);
|
||||
|
||||
exit_q_bw_lmt:
|
||||
ice_release_lock(&pi->sched_lock);
|
||||
return status;
|
||||
@ -4382,32 +4419,38 @@ ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u32 q_id,
|
||||
/**
|
||||
* ice_cfg_q_bw_lmt - configure queue BW limit
|
||||
* @pi: port information structure
|
||||
* @q_id: queue ID (leaf node TEID)
|
||||
* @vsi_handle: sw VSI handle
|
||||
* @tc: traffic class
|
||||
* @q_handle: software queue handle
|
||||
* @rl_type: min, max, or shared
|
||||
* @bw: bandwidth in Kbps
|
||||
*
|
||||
* This function configures BW limit of queue scheduling node.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_cfg_q_bw_lmt(struct ice_port_info *pi, u32 q_id, enum ice_rl_type rl_type,
|
||||
u32 bw)
|
||||
ice_cfg_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u16 q_handle, enum ice_rl_type rl_type, u32 bw)
|
||||
{
|
||||
return ice_sched_set_q_bw_lmt(pi, q_id, rl_type, bw);
|
||||
return ice_sched_set_q_bw_lmt(pi, vsi_handle, tc, q_handle, rl_type,
|
||||
bw);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_cfg_q_bw_dflt_lmt - configure queue BW default limit
|
||||
* @pi: port information structure
|
||||
* @q_id: queue ID (leaf node TEID)
|
||||
* @vsi_handle: sw VSI handle
|
||||
* @tc: traffic class
|
||||
* @q_handle: software queue handle
|
||||
* @rl_type: min, max, or shared
|
||||
*
|
||||
* This function configures BW default limit of queue scheduling node.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u32 q_id,
|
||||
enum ice_rl_type rl_type)
|
||||
ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u16 q_handle, enum ice_rl_type rl_type)
|
||||
{
|
||||
return ice_sched_set_q_bw_lmt(pi, q_id, rl_type, ICE_SCHED_DFLT_BW);
|
||||
return ice_sched_set_q_bw_lmt(pi, vsi_handle, tc, q_handle, rl_type,
|
||||
ICE_SCHED_DFLT_BW);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5421,3 +5464,23 @@ ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle)
|
||||
ice_release_lock(&pi->sched_lock);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_sched_replay_q_bw - replay queue type node BW
|
||||
* @pi: port information structure
|
||||
* @q_ctx: queue context structure
|
||||
*
|
||||
* This function replays queue type node bandwidth. This function needs to be
|
||||
* called with scheduler lock held.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx)
|
||||
{
|
||||
struct ice_sched_node *q_node;
|
||||
|
||||
/* Following also checks the presence of node in tree */
|
||||
q_node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid);
|
||||
if (!q_node)
|
||||
return ICE_ERR_PARAM;
|
||||
return ice_sched_replay_node_bw(pi->hw, q_node, &q_ctx->bw_t_info);
|
||||
}
|
||||
|
@ -122,11 +122,11 @@ ice_move_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,
|
||||
u8 tc_bitmap);
|
||||
enum ice_status ice_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id);
|
||||
enum ice_status
|
||||
ice_cfg_q_bw_lmt(struct ice_port_info *pi, u32 q_id, enum ice_rl_type rl_type,
|
||||
u32 bw);
|
||||
ice_cfg_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u16 q_handle, enum ice_rl_type rl_type, u32 bw);
|
||||
enum ice_status
|
||||
ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u32 q_id,
|
||||
enum ice_rl_type rl_type);
|
||||
ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u16 q_handle, enum ice_rl_type rl_type);
|
||||
enum ice_status
|
||||
ice_cfg_tc_node_bw_lmt(struct ice_port_info *pi, u8 tc,
|
||||
enum ice_rl_type rl_type, u32 bw);
|
||||
|
@ -21,11 +21,6 @@
|
||||
#define ICE_VSI_INVAL_ID 0xFFFF
|
||||
#define ICE_INVAL_Q_HANDLE 0xFFFF
|
||||
|
||||
/* VSI queue context structure */
|
||||
struct ice_q_ctx {
|
||||
u16 q_handle;
|
||||
};
|
||||
|
||||
/* VSI context structure for add/get/update/free operations */
|
||||
struct ice_vsi_ctx {
|
||||
u16 vsi_num;
|
||||
|
@ -557,6 +557,14 @@ struct ice_bw_type_info {
|
||||
u32 shared_bw;
|
||||
};
|
||||
|
||||
/* VSI queue context structure for given TC */
|
||||
struct ice_q_ctx {
|
||||
u16 q_handle;
|
||||
u32 q_teid;
|
||||
/* bw_t_info saves queue BW information */
|
||||
struct ice_bw_type_info bw_t_info;
|
||||
};
|
||||
|
||||
/* VSI type list entry to locate corresponding VSI/aggregator nodes */
|
||||
struct ice_sched_vsi_info {
|
||||
struct ice_sched_node *vsi_node[ICE_MAX_TRAFFIC_CLASS];
|
||||
|
Loading…
Reference in New Issue
Block a user