Commit 4fb33f31 authored by Anirudh Venkataramanan's avatar Anirudh Venkataramanan Committed by Jeff Kirsher

ice: Expand use of VSI handles part 2/2

This patch is a continuation of the previous patch where VSI
handles are used instead of VSI numbers.
Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 5726ca0e
...@@ -2055,7 +2055,7 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ...@@ -2055,7 +2055,7 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut,
/** /**
* ice_aq_get_rss_lut * ice_aq_get_rss_lut
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
* @vsi_id: VSI FW index * @vsi_handle: software VSI handle
* @lut_type: LUT table type * @lut_type: LUT table type
* @lut: pointer to the LUT buffer provided by the caller * @lut: pointer to the LUT buffer provided by the caller
* @lut_size: size of the LUT buffer * @lut_size: size of the LUT buffer
...@@ -2063,17 +2063,20 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ...@@ -2063,17 +2063,20 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut,
* get the RSS lookup table, PF or VSI type * get the RSS lookup table, PF or VSI type
*/ */
enum ice_status enum ice_status
ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type,
u16 lut_size) u8 *lut, u16 lut_size)
{ {
return __ice_aq_get_set_rss_lut(hw, vsi_id, lut_type, lut, lut_size, 0, if (!ice_is_vsi_valid(hw, vsi_handle) || !lut)
false); 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);
} }
/** /**
* ice_aq_set_rss_lut * ice_aq_set_rss_lut
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
* @vsi_id: VSI FW index * @vsi_handle: software VSI handle
* @lut_type: LUT table type * @lut_type: LUT table type
* @lut: pointer to the LUT buffer provided by the caller * @lut: pointer to the LUT buffer provided by the caller
* @lut_size: size of the LUT buffer * @lut_size: size of the LUT buffer
...@@ -2081,11 +2084,14 @@ ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ...@@ -2081,11 +2084,14 @@ ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut,
* set the RSS lookup table, PF or VSI type * set the RSS lookup table, PF or VSI type
*/ */
enum ice_status enum ice_status
ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type,
u16 lut_size) u8 *lut, u16 lut_size)
{ {
return __ice_aq_get_set_rss_lut(hw, vsi_id, lut_type, lut, lut_size, 0, if (!ice_is_vsi_valid(hw, vsi_handle) || !lut)
true); 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);
} }
/** /**
...@@ -2126,31 +2132,39 @@ ice_status __ice_aq_get_set_rss_key(struct ice_hw *hw, u16 vsi_id, ...@@ -2126,31 +2132,39 @@ ice_status __ice_aq_get_set_rss_key(struct ice_hw *hw, u16 vsi_id,
/** /**
* ice_aq_get_rss_key * ice_aq_get_rss_key
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
* @vsi_id: VSI FW index * @vsi_handle: software VSI handle
* @key: pointer to key info struct * @key: pointer to key info struct
* *
* get the RSS key per VSI * get the RSS key per VSI
*/ */
enum ice_status enum ice_status
ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_id, ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle,
struct ice_aqc_get_set_rss_keys *key) struct ice_aqc_get_set_rss_keys *key)
{ {
return __ice_aq_get_set_rss_key(hw, vsi_id, key, false); if (!ice_is_vsi_valid(hw, vsi_handle) || !key)
return ICE_ERR_PARAM;
return __ice_aq_get_set_rss_key(hw, ice_get_hw_vsi_num(hw, vsi_handle),
key, false);
} }
/** /**
* ice_aq_set_rss_key * ice_aq_set_rss_key
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
* @vsi_id: VSI FW index * @vsi_handle: software VSI handle
* @keys: pointer to key info struct * @keys: pointer to key info struct
* *
* set the RSS key per VSI * set the RSS key per VSI
*/ */
enum ice_status enum ice_status
ice_aq_set_rss_key(struct ice_hw *hw, u16 vsi_id, ice_aq_set_rss_key(struct ice_hw *hw, u16 vsi_handle,
struct ice_aqc_get_set_rss_keys *keys) struct ice_aqc_get_set_rss_keys *keys)
{ {
return __ice_aq_get_set_rss_key(hw, vsi_id, keys, true); if (!ice_is_vsi_valid(hw, vsi_handle) || !keys)
return ICE_ERR_PARAM;
return __ice_aq_get_set_rss_key(hw, ice_get_hw_vsi_num(hw, vsi_handle),
keys, true);
} }
/** /**
...@@ -2489,7 +2503,7 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info) ...@@ -2489,7 +2503,7 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
/** /**
* ice_ena_vsi_txq * ice_ena_vsi_txq
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI id * @vsi_handle: software VSI handle
* @tc: tc number * @tc: tc number
* @num_qgrps: Number of added queue groups * @num_qgrps: Number of added queue groups
* @buf: list of queue groups to be added * @buf: list of queue groups to be added
...@@ -2499,7 +2513,7 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info) ...@@ -2499,7 +2513,7 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
* This function adds one lan q * This function adds one lan q
*/ */
enum ice_status enum ice_status
ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_id, u8 tc, u8 num_qgrps, ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,
struct ice_aqc_add_tx_qgrp *buf, u16 buf_size, struct ice_aqc_add_tx_qgrp *buf, u16 buf_size,
struct ice_sq_cd *cd) struct ice_sq_cd *cd)
{ {
...@@ -2516,15 +2530,19 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_id, u8 tc, u8 num_qgrps, ...@@ -2516,15 +2530,19 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_id, u8 tc, u8 num_qgrps,
hw = pi->hw; hw = pi->hw;
if (!ice_is_vsi_valid(hw, vsi_handle))
return ICE_ERR_PARAM;
mutex_lock(&pi->sched_lock); mutex_lock(&pi->sched_lock);
/* find a parent node */ /* find a parent node */
parent = ice_sched_get_free_qparent(pi, vsi_id, tc, parent = ice_sched_get_free_qparent(pi, vsi_handle, tc,
ICE_SCHED_NODE_OWNER_LAN); ICE_SCHED_NODE_OWNER_LAN);
if (!parent) { if (!parent) {
status = ICE_ERR_PARAM; status = ICE_ERR_PARAM;
goto ena_txq_exit; goto ena_txq_exit;
} }
buf->parent_teid = parent->info.node_teid; buf->parent_teid = parent->info.node_teid;
node.parent_teid = parent->info.node_teid; node.parent_teid = parent->info.node_teid;
/* Mark that the values in the "generic" section as valid. The default /* Mark that the values in the "generic" section as valid. The default
...@@ -2602,7 +2620,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids, ...@@ -2602,7 +2620,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,
/** /**
* ice_cfg_vsi_qs - configure the new/exisiting VSI queues * ice_cfg_vsi_qs - configure the new/exisiting VSI queues
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI Id * @vsi_handle: software VSI handle
* @tc_bitmap: TC bitmap * @tc_bitmap: TC bitmap
* @maxqs: max queues array per TC * @maxqs: max queues array per TC
* @owner: lan or rdma * @owner: lan or rdma
...@@ -2610,7 +2628,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids, ...@@ -2610,7 +2628,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,
* This function adds/updates the VSI queues per TC. * This function adds/updates the VSI queues per TC.
*/ */
static enum ice_status static enum ice_status
ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap,
u16 *maxqs, u8 owner) u16 *maxqs, u8 owner)
{ {
enum ice_status status = 0; enum ice_status status = 0;
...@@ -2619,6 +2637,9 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, ...@@ -2619,6 +2637,9 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap,
if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
return ICE_ERR_CFG; return ICE_ERR_CFG;
if (!ice_is_vsi_valid(pi->hw, vsi_handle))
return ICE_ERR_PARAM;
mutex_lock(&pi->sched_lock); mutex_lock(&pi->sched_lock);
for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) { for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) {
...@@ -2626,7 +2647,7 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, ...@@ -2626,7 +2647,7 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap,
if (!ice_sched_get_tc_node(pi, i)) if (!ice_sched_get_tc_node(pi, i))
continue; continue;
status = ice_sched_cfg_vsi(pi, vsi_id, i, maxqs[i], owner, status = ice_sched_cfg_vsi(pi, vsi_handle, i, maxqs[i], owner,
ice_is_tc_ena(tc_bitmap, i)); ice_is_tc_ena(tc_bitmap, i));
if (status) if (status)
break; break;
...@@ -2639,17 +2660,17 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, ...@@ -2639,17 +2660,17 @@ ice_cfg_vsi_qs(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap,
/** /**
* ice_cfg_vsi_lan - configure VSI lan queues * ice_cfg_vsi_lan - configure VSI lan queues
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI Id * @vsi_handle: software VSI handle
* @tc_bitmap: TC bitmap * @tc_bitmap: TC bitmap
* @max_lanqs: max lan queues array per TC * @max_lanqs: max lan queues array per TC
* *
* This function adds/updates the VSI lan queues per TC. * This function adds/updates the VSI lan queues per TC.
*/ */
enum ice_status enum ice_status
ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap,
u16 *max_lanqs) u16 *max_lanqs)
{ {
return ice_cfg_vsi_qs(pi, vsi_id, tc_bitmap, max_lanqs, return ice_cfg_vsi_qs(pi, vsi_handle, tc_bitmap, max_lanqs,
ICE_SCHED_NODE_OWNER_LAN); ICE_SCHED_NODE_OWNER_LAN);
} }
......
...@@ -37,17 +37,18 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx, ...@@ -37,17 +37,18 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
u32 rxq_index); u32 rxq_index);
enum ice_status enum ice_status
ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut,
u16 lut_size); u16 lut_size);
enum ice_status enum ice_status
ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut,
u16 lut_size); u16 lut_size);
enum ice_status enum ice_status
ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_id, ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle,
struct ice_aqc_get_set_rss_keys *keys); struct ice_aqc_get_set_rss_keys *keys);
enum ice_status enum ice_status
ice_aq_set_rss_key(struct ice_hw *hw, u16 vsi_id, ice_aq_set_rss_key(struct ice_hw *hw, u16 vsi_handle,
struct ice_aqc_get_set_rss_keys *keys); struct ice_aqc_get_set_rss_keys *keys);
bool ice_check_sq_alive(struct ice_hw *hw, struct ice_ctl_q_info *cq); 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); enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading);
void ice_fill_dflt_direct_cmd_desc(struct ice_aq_desc *desc, u16 opcode); void ice_fill_dflt_direct_cmd_desc(struct ice_aq_desc *desc, u16 opcode);
...@@ -89,10 +90,10 @@ enum ice_status ...@@ -89,10 +90,10 @@ enum ice_status
ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids, ice_dis_vsi_txq(struct ice_port_info *pi, u8 num_queues, u16 *q_ids,
u32 *q_teids, struct ice_sq_cd *cmd_details); u32 *q_teids, struct ice_sq_cd *cmd_details);
enum ice_status enum ice_status
ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_id, u8 tc_bitmap, ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap,
u16 *max_lanqs); u16 *max_lanqs);
enum ice_status enum ice_status
ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_id, u8 tc, u8 num_qgrps, ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,
struct ice_aqc_add_tx_qgrp *buf, u16 buf_size, struct ice_aqc_add_tx_qgrp *buf, u16 buf_size,
struct ice_sq_cd *cd); struct ice_sq_cd *cd);
void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf); void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);
......
...@@ -137,7 +137,7 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q) ...@@ -137,7 +137,7 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
} }
/* make sure the context is associated with the right VSI */ /* make sure the context is associated with the right VSI */
tlan_ctx->src_vsi = vsi->vsi_num; tlan_ctx->src_vsi = ice_get_hw_vsi_num(hw, vsi->idx);
tlan_ctx->tso_ena = ICE_TX_LEGACY; tlan_ctx->tso_ena = ICE_TX_LEGACY;
tlan_ctx->tso_qnum = pf_q; tlan_ctx->tso_qnum = pf_q;
...@@ -1230,8 +1230,8 @@ static int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi) ...@@ -1230,8 +1230,8 @@ static int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi)
else else
ice_fill_rss_lut(lut, vsi->rss_table_size, vsi->rss_size); ice_fill_rss_lut(lut, vsi->rss_table_size, vsi->rss_size);
status = ice_aq_set_rss_lut(&pf->hw, vsi->vsi_num, vsi->rss_lut_type, status = ice_aq_set_rss_lut(&pf->hw, vsi->idx, vsi->rss_lut_type, lut,
lut, vsi->rss_table_size); vsi->rss_table_size);
if (status) { if (status) {
dev_err(&vsi->back->pdev->dev, dev_err(&vsi->back->pdev->dev,
...@@ -1255,7 +1255,7 @@ static int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi) ...@@ -1255,7 +1255,7 @@ static int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi)
memcpy(&key->standard_rss_key, seed, memcpy(&key->standard_rss_key, seed,
ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE); ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE);
status = ice_aq_set_rss_key(&pf->hw, vsi->vsi_num, key); status = ice_aq_set_rss_key(&pf->hw, vsi->idx, key);
if (status) { if (status) {
dev_err(&vsi->back->pdev->dev, "set_rss_key failed, error %d\n", dev_err(&vsi->back->pdev->dev, "set_rss_key failed, error %d\n",
...@@ -1524,7 +1524,7 @@ int ice_vsi_cfg_txqs(struct ice_vsi *vsi) ...@@ -1524,7 +1524,7 @@ int ice_vsi_cfg_txqs(struct ice_vsi *vsi)
* comm scheduler queue doorbell. * comm scheduler queue doorbell.
*/ */
vsi->tx_rings[i]->tail = pf->hw.hw_addr + QTX_COMM_DBELL(pf_q); vsi->tx_rings[i]->tail = pf->hw.hw_addr + QTX_COMM_DBELL(pf_q);
status = ice_ena_vsi_txq(vsi->port_info, vsi->vsi_num, tc, status = ice_ena_vsi_txq(vsi->port_info, vsi->idx, tc,
num_q_grps, qg_buf, buf_len, NULL); num_q_grps, qg_buf, buf_len, NULL);
if (status) { if (status) {
dev_err(&vsi->back->pdev->dev, dev_err(&vsi->back->pdev->dev,
...@@ -1929,8 +1929,8 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, ...@@ -1929,8 +1929,8 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
for (i = 0; i < vsi->tc_cfg.numtc; i++) for (i = 0; i < vsi->tc_cfg.numtc; i++)
max_txqs[i] = vsi->num_txq; max_txqs[i] = vsi->num_txq;
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->vsi_num, ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
vsi->tc_cfg.ena_tc, max_txqs); max_txqs);
if (ret) { if (ret) {
dev_info(&pf->pdev->dev, "Failed VSI lan queue config\n"); dev_info(&pf->pdev->dev, "Failed VSI lan queue config\n");
goto unroll_vector_base; goto unroll_vector_base;
...@@ -2340,8 +2340,8 @@ int ice_vsi_rebuild(struct ice_vsi *vsi) ...@@ -2340,8 +2340,8 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
for (i = 0; i < vsi->tc_cfg.numtc; i++) for (i = 0; i < vsi->tc_cfg.numtc; i++)
max_txqs[i] = vsi->num_txq; max_txqs[i] = vsi->num_txq;
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->vsi_num, ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
vsi->tc_cfg.ena_tc, max_txqs); max_txqs);
if (ret) { if (ret) {
dev_info(&vsi->back->pdev->dev, dev_info(&vsi->back->pdev->dev,
"Failed VSI lan queue config\n"); "Failed VSI lan queue config\n");
......
...@@ -253,7 +253,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) ...@@ -253,7 +253,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
clear_bit(ICE_VSI_FLAG_PROMISC_CHANGED, vsi->flags); clear_bit(ICE_VSI_FLAG_PROMISC_CHANGED, vsi->flags);
if (vsi->current_netdev_flags & IFF_PROMISC) { if (vsi->current_netdev_flags & IFF_PROMISC) {
/* Apply TX filter rule to get traffic from VMs */ /* Apply TX filter rule to get traffic from VMs */
status = ice_cfg_dflt_vsi(hw, vsi->vsi_num, true, status = ice_cfg_dflt_vsi(hw, vsi->idx, true,
ICE_FLTR_TX); ICE_FLTR_TX);
if (status) { if (status) {
netdev_err(netdev, "Error setting default VSI %i tx rule\n", netdev_err(netdev, "Error setting default VSI %i tx rule\n",
...@@ -263,7 +263,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) ...@@ -263,7 +263,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
goto out_promisc; goto out_promisc;
} }
/* Apply RX filter rule to get traffic from wire */ /* Apply RX filter rule to get traffic from wire */
status = ice_cfg_dflt_vsi(hw, vsi->vsi_num, true, status = ice_cfg_dflt_vsi(hw, vsi->idx, true,
ICE_FLTR_RX); ICE_FLTR_RX);
if (status) { if (status) {
netdev_err(netdev, "Error setting default VSI %i rx rule\n", netdev_err(netdev, "Error setting default VSI %i rx rule\n",
...@@ -274,7 +274,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) ...@@ -274,7 +274,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
} }
} else { } else {
/* Clear TX filter rule to stop traffic from VMs */ /* Clear TX filter rule to stop traffic from VMs */
status = ice_cfg_dflt_vsi(hw, vsi->vsi_num, false, status = ice_cfg_dflt_vsi(hw, vsi->idx, false,
ICE_FLTR_TX); ICE_FLTR_TX);
if (status) { if (status) {
netdev_err(netdev, "Error clearing default VSI %i tx rule\n", netdev_err(netdev, "Error clearing default VSI %i tx rule\n",
...@@ -283,8 +283,8 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) ...@@ -283,8 +283,8 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
err = -EIO; err = -EIO;
goto out_promisc; goto out_promisc;
} }
/* Clear filter RX to remove traffic from wire */ /* Clear RX filter to remove traffic from wire */
status = ice_cfg_dflt_vsi(hw, vsi->vsi_num, false, status = ice_cfg_dflt_vsi(hw, vsi->idx, false,
ICE_FLTR_RX); ICE_FLTR_RX);
if (status) { if (status) {
netdev_err(netdev, "Error clearing default VSI %i rx rule\n", netdev_err(netdev, "Error clearing default VSI %i rx rule\n",
...@@ -3310,7 +3310,7 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) ...@@ -3310,7 +3310,7 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)
struct ice_aqc_get_set_rss_keys *buf = struct ice_aqc_get_set_rss_keys *buf =
(struct ice_aqc_get_set_rss_keys *)seed; (struct ice_aqc_get_set_rss_keys *)seed;
status = ice_aq_set_rss_key(hw, vsi->vsi_num, buf); status = ice_aq_set_rss_key(hw, vsi->idx, buf);
if (status) { if (status) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
...@@ -3321,8 +3321,8 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) ...@@ -3321,8 +3321,8 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)
} }
if (lut) { if (lut) {
status = ice_aq_set_rss_lut(hw, vsi->vsi_num, status = ice_aq_set_rss_lut(hw, vsi->idx, vsi->rss_lut_type,
vsi->rss_lut_type, lut, lut_size); lut, lut_size);
if (status) { if (status) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
"Cannot set RSS lut, err %d aq_err %d\n", "Cannot set RSS lut, err %d aq_err %d\n",
...@@ -3353,7 +3353,7 @@ int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) ...@@ -3353,7 +3353,7 @@ int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)
struct ice_aqc_get_set_rss_keys *buf = struct ice_aqc_get_set_rss_keys *buf =
(struct ice_aqc_get_set_rss_keys *)seed; (struct ice_aqc_get_set_rss_keys *)seed;
status = ice_aq_get_rss_key(hw, vsi->vsi_num, buf); status = ice_aq_get_rss_key(hw, vsi->idx, buf);
if (status) { if (status) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
"Cannot get RSS key, err %d aq_err %d\n", "Cannot get RSS key, err %d aq_err %d\n",
...@@ -3363,8 +3363,8 @@ int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) ...@@ -3363,8 +3363,8 @@ int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)
} }
if (lut) { if (lut) {
status = ice_aq_get_rss_lut(hw, vsi->vsi_num, status = ice_aq_get_rss_lut(hw, vsi->idx, vsi->rss_lut_type,
vsi->rss_lut_type, lut, lut_size); lut, lut_size);
if (status) { if (status) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
"Cannot get RSS lut, err %d aq_err %d\n", "Cannot get RSS lut, err %d aq_err %d\n",
......
...@@ -599,9 +599,7 @@ ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids, ...@@ -599,9 +599,7 @@ ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,
static void ice_sched_clear_tx_topo(struct ice_port_info *pi) static void ice_sched_clear_tx_topo(struct ice_port_info *pi)
{ {
struct ice_sched_agg_info *agg_info; struct ice_sched_agg_info *agg_info;
struct ice_sched_vsi_info *vsi_elem;
struct ice_sched_agg_info *atmp; struct ice_sched_agg_info *atmp;
struct ice_sched_vsi_info *tmp;
struct ice_hw *hw; struct ice_hw *hw;
if (!pi) if (!pi)
...@@ -620,13 +618,6 @@ static void ice_sched_clear_tx_topo(struct ice_port_info *pi) ...@@ -620,13 +618,6 @@ static void ice_sched_clear_tx_topo(struct ice_port_info *pi)
} }
} }
/* remove the vsi list */
list_for_each_entry_safe(vsi_elem, tmp, &pi->vsi_info_list,
list_entry) {
list_del(&vsi_elem->list_entry);
devm_kfree(ice_hw_to_dev(hw), vsi_elem);
}
if (pi->root) { if (pi->root) {
ice_free_sched_node(pi, pi->root); ice_free_sched_node(pi, pi->root);
pi->root = NULL; pi->root = NULL;
...@@ -676,31 +667,6 @@ void ice_sched_cleanup_all(struct ice_hw *hw) ...@@ -676,31 +667,6 @@ void ice_sched_cleanup_all(struct ice_hw *hw)
hw->max_cgds = 0; hw->max_cgds = 0;
} }
/**
* ice_sched_create_vsi_info_entry - create an empty new VSI entry
* @pi: port information structure
* @vsi_id: VSI Id
*
* This function creates a new VSI entry and adds it to list
*/
static struct ice_sched_vsi_info *
ice_sched_create_vsi_info_entry(struct ice_port_info *pi, u16 vsi_id)
{
struct ice_sched_vsi_info *vsi_elem;
if (!pi)
return NULL;
vsi_elem = devm_kzalloc(ice_hw_to_dev(pi->hw), sizeof(*vsi_elem),
GFP_KERNEL);
if (!vsi_elem)
return NULL;
list_add(&vsi_elem->list_entry, &pi->vsi_info_list);
vsi_elem->vsi_id = vsi_id;
return vsi_elem;
}
/** /**
* ice_sched_add_elems - add nodes to hw and SW DB * ice_sched_add_elems - add nodes to hw and SW DB
* @pi: port information structure * @pi: port information structure
...@@ -1072,7 +1038,6 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi) ...@@ -1072,7 +1038,6 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi)
pi->port_state = ICE_SCHED_PORT_STATE_READY; pi->port_state = ICE_SCHED_PORT_STATE_READY;
mutex_init(&pi->sched_lock); mutex_init(&pi->sched_lock);
INIT_LIST_HEAD(&pi->agg_list); INIT_LIST_HEAD(&pi->agg_list);
INIT_LIST_HEAD(&pi->vsi_info_list);
err_init_port: err_init_port:
if (status && pi->root) { if (status && pi->root) {
...@@ -1141,27 +1106,6 @@ enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw) ...@@ -1141,27 +1106,6 @@ enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw)
return status; return status;
} }
/**
* ice_sched_get_vsi_info_entry - Get the vsi entry list for given vsi_id
* @pi: port information structure
* @vsi_id: vsi id
*
* This function retrieves the vsi list for the given vsi id
*/
static struct ice_sched_vsi_info *
ice_sched_get_vsi_info_entry(struct ice_port_info *pi, u16 vsi_id)
{
struct ice_sched_vsi_info *list_elem;
if (!pi)
return NULL;
list_for_each_entry(list_elem, &pi->vsi_info_list, list_entry)
if (list_elem->vsi_id == vsi_id)
return list_elem;
return NULL;
}
/** /**
* ice_sched_find_node_in_subtree - Find node in part of base node subtree * ice_sched_find_node_in_subtree - Find node in part of base node subtree
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
...@@ -1198,30 +1142,28 @@ ice_sched_find_node_in_subtree(struct ice_hw *hw, struct ice_sched_node *base, ...@@ -1198,30 +1142,28 @@ ice_sched_find_node_in_subtree(struct ice_hw *hw, struct ice_sched_node *base,
/** /**
* ice_sched_get_free_qparent - Get a free lan or rdma q group node * ice_sched_get_free_qparent - Get a free lan or rdma q group node
* @pi: port information structure * @pi: port information structure
* @vsi_id: vsi id * @vsi_handle: software VSI handle
* @tc: branch number * @tc: branch number
* @owner: lan or rdma * @owner: lan or rdma
* *
* This function retrieves a free lan or rdma q group node * This function retrieves a free lan or rdma q group node
*/ */
struct ice_sched_node * struct ice_sched_node *
ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_id, u8 tc, ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
u8 owner) u8 owner)
{ {
struct ice_sched_node *vsi_node, *qgrp_node = NULL; struct ice_sched_node *vsi_node, *qgrp_node = NULL;
struct ice_sched_vsi_info *list_elem; struct ice_vsi_ctx *vsi_ctx;
u16 max_children; u16 max_children;
u8 qgrp_layer; u8 qgrp_layer;
qgrp_layer = ice_sched_get_qgrp_layer(pi->hw); qgrp_layer = ice_sched_get_qgrp_layer(pi->hw);
max_children = pi->hw->max_children[qgrp_layer]; max_children = pi->hw->max_children[qgrp_layer];
list_elem = ice_sched_get_vsi_info_entry(pi, vsi_id); vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
if (!list_elem) if (!vsi_ctx)
goto lan_q_exit; return NULL;
vsi_node = vsi_ctx->sched.vsi_node[tc];
vsi_node = list_elem->vsi_node[tc];
/* validate invalid VSI id */ /* validate invalid VSI id */
if (!vsi_node) if (!vsi_node)
goto lan_q_exit; goto lan_q_exit;
...@@ -1245,14 +1187,14 @@ ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_id, u8 tc, ...@@ -1245,14 +1187,14 @@ ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_id, u8 tc,
* ice_sched_get_vsi_node - Get a VSI node based on VSI id * ice_sched_get_vsi_node - Get a VSI node based on VSI id
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
* @tc_node: pointer to the TC node * @tc_node: pointer to the TC node
* @vsi_id: VSI id * @vsi_handle: software VSI handle
* *
* This function retrieves a VSI node for a given VSI id from a given * This function retrieves a VSI node for a given VSI id from a given
* TC branch * TC branch
*/ */
static struct ice_sched_node * static struct ice_sched_node *
ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node, ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node,
u16 vsi_id) u16 vsi_handle)
{ {
struct ice_sched_node *node; struct ice_sched_node *node;
u8 vsi_layer; u8 vsi_layer;
...@@ -1262,7 +1204,7 @@ ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node, ...@@ -1262,7 +1204,7 @@ ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node,
/* Check whether it already exists */ /* Check whether it already exists */
while (node) { while (node) {
if (node->vsi_id == vsi_id) if (node->vsi_handle == vsi_handle)
return node; return node;
node = node->sibling; node = node->sibling;
} }
...@@ -1301,7 +1243,7 @@ ice_sched_calc_vsi_child_nodes(struct ice_hw *hw, u16 num_qs, u16 *num_nodes) ...@@ -1301,7 +1243,7 @@ ice_sched_calc_vsi_child_nodes(struct ice_hw *hw, u16 num_qs, u16 *num_nodes)
/** /**
* ice_sched_add_vsi_child_nodes - add VSI child nodes to tree * ice_sched_add_vsi_child_nodes - add VSI child nodes to tree
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI id * @vsi_handle: software VSI handle
* @tc_node: pointer to the TC node * @tc_node: pointer to the TC node
* @num_nodes: pointer to the num nodes that needs to be added per layer * @num_nodes: pointer to the num nodes that needs to be added per layer
* @owner: node owner (lan or rdma) * @owner: node owner (lan or rdma)
...@@ -1310,7 +1252,7 @@ ice_sched_calc_vsi_child_nodes(struct ice_hw *hw, u16 num_qs, u16 *num_nodes) ...@@ -1310,7 +1252,7 @@ ice_sched_calc_vsi_child_nodes(struct ice_hw *hw, u16 num_qs, u16 *num_nodes)
* lan and rdma separately. * lan and rdma separately.
*/ */
static enum ice_status static enum ice_status
ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
struct ice_sched_node *tc_node, u16 *num_nodes, struct ice_sched_node *tc_node, u16 *num_nodes,
u8 owner) u8 owner)
{ {
...@@ -1323,7 +1265,7 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, ...@@ -1323,7 +1265,7 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id,
qgl = ice_sched_get_qgrp_layer(hw); qgl = ice_sched_get_qgrp_layer(hw);
vsil = ice_sched_get_vsi_layer(hw); vsil = ice_sched_get_vsi_layer(hw);
parent = ice_sched_get_vsi_node(hw, tc_node, vsi_id); parent = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
for (i = vsil + 1; i <= qgl; i++) { for (i = vsil + 1; i <= qgl; i++) {
if (!parent) if (!parent)
return ICE_ERR_CFG; return ICE_ERR_CFG;
...@@ -1436,7 +1378,7 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw, ...@@ -1436,7 +1378,7 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw,
/** /**
* ice_sched_add_vsi_support_nodes - add VSI supported nodes into tx tree * ice_sched_add_vsi_support_nodes - add VSI supported nodes into tx tree
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI Id * @vsi_handle: software VSI handle
* @tc_node: pointer to TC node * @tc_node: pointer to TC node
* @num_nodes: pointer to num nodes array * @num_nodes: pointer to num nodes array
* *
...@@ -1444,7 +1386,7 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw, ...@@ -1444,7 +1386,7 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw,
* VSI, its parent and intermediate nodes in below layers * VSI, its parent and intermediate nodes in below layers
*/ */
static enum ice_status static enum ice_status
ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_id, ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,
struct ice_sched_node *tc_node, u16 *num_nodes) struct ice_sched_node *tc_node, u16 *num_nodes)
{ {
struct ice_sched_node *parent = tc_node; struct ice_sched_node *parent = tc_node;
...@@ -1478,7 +1420,7 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_id, ...@@ -1478,7 +1420,7 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_id,
return ICE_ERR_CFG; return ICE_ERR_CFG;
if (i == vsil) if (i == vsil)
parent->vsi_id = vsi_id; parent->vsi_handle = vsi_handle;
} }
return 0; return 0;
...@@ -1487,13 +1429,13 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_id, ...@@ -1487,13 +1429,13 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_id,
/** /**
* ice_sched_add_vsi_to_topo - add a new VSI into tree * ice_sched_add_vsi_to_topo - add a new VSI into tree
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI Id * @vsi_handle: software VSI handle
* @tc: TC number * @tc: TC number
* *
* This function adds a new VSI into scheduler tree * This function adds a new VSI into scheduler tree
*/ */
static enum ice_status static enum ice_status
ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_id, u8 tc) ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc)
{ {
u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 };
struct ice_sched_node *tc_node; struct ice_sched_node *tc_node;
...@@ -1507,13 +1449,14 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_id, u8 tc) ...@@ -1507,13 +1449,14 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_id, u8 tc)
ice_sched_calc_vsi_support_nodes(hw, tc_node, num_nodes); ice_sched_calc_vsi_support_nodes(hw, tc_node, num_nodes);
/* add vsi supported nodes to tc subtree */ /* add vsi supported nodes to tc subtree */
return ice_sched_add_vsi_support_nodes(pi, vsi_id, tc_node, num_nodes); return ice_sched_add_vsi_support_nodes(pi, vsi_handle, tc_node,
num_nodes);
} }
/** /**
* ice_sched_update_vsi_child_nodes - update VSI child nodes * ice_sched_update_vsi_child_nodes - update VSI child nodes
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI Id * @vsi_handle: software VSI handle
* @tc: TC number * @tc: TC number
* @new_numqs: new number of max queues * @new_numqs: new number of max queues
* @owner: owner of this subtree * @owner: owner of this subtree
...@@ -1521,14 +1464,14 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_id, u8 tc) ...@@ -1521,14 +1464,14 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_id, u8 tc)
* This function updates the VSI child nodes based on the number of queues * This function updates the VSI child nodes based on the number of queues
*/ */
static enum ice_status static enum ice_status
ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc, ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
u16 new_numqs, u8 owner) u8 tc, u16 new_numqs, u8 owner)
{ {
u16 prev_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; u16 prev_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 };
u16 new_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; u16 new_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 };
struct ice_sched_node *vsi_node; struct ice_sched_node *vsi_node;
struct ice_sched_node *tc_node; struct ice_sched_node *tc_node;
struct ice_sched_vsi_info *vsi; struct ice_vsi_ctx *vsi_ctx;
enum ice_status status = 0; enum ice_status status = 0;
struct ice_hw *hw = pi->hw; struct ice_hw *hw = pi->hw;
u16 prev_numqs; u16 prev_numqs;
...@@ -1538,16 +1481,16 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc, ...@@ -1538,16 +1481,16 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc,
if (!tc_node) if (!tc_node)
return ICE_ERR_CFG; return ICE_ERR_CFG;
vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_id); vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
if (!vsi_node) if (!vsi_node)
return ICE_ERR_CFG; return ICE_ERR_CFG;
vsi = ice_sched_get_vsi_info_entry(pi, vsi_id); vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);
if (!vsi) if (!vsi_ctx)
return ICE_ERR_CFG; return ICE_ERR_PARAM;
if (owner == ICE_SCHED_NODE_OWNER_LAN) if (owner == ICE_SCHED_NODE_OWNER_LAN)
prev_numqs = vsi->max_lanq[tc]; prev_numqs = vsi_ctx->sched.max_lanq[tc];
else else
return ICE_ERR_PARAM; return ICE_ERR_PARAM;
...@@ -1572,13 +1515,13 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc, ...@@ -1572,13 +1515,13 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc,
for (i = 0; i < ICE_AQC_TOPO_MAX_LEVEL_NUM; i++) for (i = 0; i < ICE_AQC_TOPO_MAX_LEVEL_NUM; i++)
new_num_nodes[i] -= prev_num_nodes[i]; new_num_nodes[i] -= prev_num_nodes[i];
status = ice_sched_add_vsi_child_nodes(pi, vsi_id, tc_node, status = ice_sched_add_vsi_child_nodes(pi, vsi_handle, tc_node,
new_num_nodes, owner); new_num_nodes, owner);
if (status) if (status)
return status; return status;
} }
vsi->max_lanq[tc] = new_numqs; vsi_ctx->sched.max_lanq[tc] = new_numqs;
return status; return status;
} }
...@@ -1586,7 +1529,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc, ...@@ -1586,7 +1529,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc,
/** /**
* ice_sched_cfg_vsi - configure the new/exisiting VSI * ice_sched_cfg_vsi - configure the new/exisiting VSI
* @pi: port information structure * @pi: port information structure
* @vsi_id: VSI Id * @vsi_handle: software VSI handle
* @tc: TC number * @tc: TC number
* @maxqs: max number of queues * @maxqs: max number of queues
* @owner: lan or rdma * @owner: lan or rdma
...@@ -1597,25 +1540,21 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc, ...@@ -1597,25 +1540,21 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc,
* disabled then suspend the VSI if it is not already. * disabled then suspend the VSI if it is not already.
*/ */
enum ice_status enum ice_status
ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_id, u8 tc, u16 maxqs, ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,
u8 owner, bool enable) u8 owner, bool enable)
{ {
struct ice_sched_node *vsi_node, *tc_node; struct ice_sched_node *vsi_node, *tc_node;
struct ice_sched_vsi_info *vsi; struct ice_vsi_ctx *vsi_ctx;
enum ice_status status = 0; enum ice_status status = 0;
struct ice_hw *hw = pi->hw; struct ice_hw *hw = pi->hw;
tc_node = ice_sched_get_tc_node(pi, tc); tc_node = ice_sched_get_tc_node(pi, tc);
if (!tc_node) if (!tc_node)
return ICE_ERR_PARAM; return ICE_ERR_PARAM;
vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);
vsi = ice_sched_get_vsi_info_entry(pi, vsi_id); if (!vsi_ctx)
if (!vsi) return ICE_ERR_PARAM;
vsi = ice_sched_create_vsi_info_entry(pi, vsi_id); vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
if (!vsi)
return ICE_ERR_NO_MEMORY;
vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_id);
/* suspend the VSI if tc is not enabled */ /* suspend the VSI if tc is not enabled */
if (!enable) { if (!enable) {
...@@ -1632,20 +1571,26 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_id, u8 tc, u16 maxqs, ...@@ -1632,20 +1571,26 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_id, u8 tc, u16 maxqs,
/* TC is enabled, if it is a new VSI then add it to the tree */ /* TC is enabled, if it is a new VSI then add it to the tree */
if (!vsi_node) { if (!vsi_node) {
status = ice_sched_add_vsi_to_topo(pi, vsi_id, tc); status = ice_sched_add_vsi_to_topo(pi, vsi_handle, tc);
if (status) if (status)
return status; return status;
vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_id); vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
if (!vsi_node) if (!vsi_node)
return ICE_ERR_CFG; return ICE_ERR_CFG;
vsi->vsi_node[tc] = vsi_node; vsi_ctx->sched.vsi_node[tc] = vsi_node;
vsi_node->in_use = true; vsi_node->in_use = true;
/* invalidate the max queues whenever VSI gets added first time
* into the scheduler tree (boot or after reset). We need to
* recreate the child nodes all the time in these cases.
*/
vsi_ctx->sched.max_lanq[tc] = 0;
} }
/* update the VSI child nodes */ /* update the VSI child nodes */
status = ice_sched_update_vsi_child_nodes(pi, vsi_id, tc, maxqs, owner); status = ice_sched_update_vsi_child_nodes(pi, vsi_handle, tc, maxqs,
owner);
if (status) if (status)
return status; return status;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
struct ice_sched_agg_vsi_info { struct ice_sched_agg_vsi_info {
struct list_head list_entry; struct list_head list_entry;
DECLARE_BITMAP(tc_bitmap, ICE_MAX_TRAFFIC_CLASS); DECLARE_BITMAP(tc_bitmap, ICE_MAX_TRAFFIC_CLASS);
u16 vsi_id;
}; };
struct ice_sched_agg_info { struct ice_sched_agg_info {
...@@ -35,9 +34,9 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer, ...@@ -35,9 +34,9 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node); void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node);
struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc); struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc);
struct ice_sched_node * struct ice_sched_node *
ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_id, u8 tc, ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
u8 owner); u8 owner);
enum ice_status enum ice_status
ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_id, u8 tc, u16 maxqs, ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,
u8 owner, bool enable); u8 owner, bool enable);
#endif /* _ICE_SCHED_H_ */ #endif /* _ICE_SCHED_H_ */
...@@ -283,7 +283,7 @@ ice_aq_update_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, ...@@ -283,7 +283,7 @@ ice_aq_update_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
* *
* check whether the VSI is valid or not * check whether the VSI is valid or not
*/ */
static bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle) bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle)
{ {
return vsi_handle < ICE_MAX_VSI && hw->vsi_ctx[vsi_handle]; return vsi_handle < ICE_MAX_VSI && hw->vsi_ctx[vsi_handle];
} }
...@@ -296,7 +296,7 @@ static bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle) ...@@ -296,7 +296,7 @@ static bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle)
* return the hw VSI number * return the hw VSI number
* Caution: call this function only if VSI is valid (ice_is_vsi_valid) * Caution: call this function only if VSI is valid (ice_is_vsi_valid)
*/ */
static u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle) u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle)
{ {
return hw->vsi_ctx[vsi_handle]->vsi_num; return hw->vsi_ctx[vsi_handle]->vsi_num;
} }
...@@ -308,7 +308,7 @@ static u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle) ...@@ -308,7 +308,7 @@ static u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle)
* *
* return the VSI context entry for a given VSI handle * return the VSI context entry for a given VSI handle
*/ */
static struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle) struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle)
{ {
return (vsi_handle >= ICE_MAX_VSI) ? NULL : hw->vsi_ctx[vsi_handle]; return (vsi_handle >= ICE_MAX_VSI) ? NULL : hw->vsi_ctx[vsi_handle];
} }
......
...@@ -17,6 +17,7 @@ struct ice_vsi_ctx { ...@@ -17,6 +17,7 @@ struct ice_vsi_ctx {
u16 vsis_unallocated; u16 vsis_unallocated;
u16 flags; u16 flags;
struct ice_aqc_vsi_props info; struct ice_aqc_vsi_props info;
struct ice_sched_vsi_info sched;
u8 alloc_from_pool; u8 alloc_from_pool;
}; };
...@@ -185,6 +186,8 @@ ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, ...@@ -185,6 +186,8 @@ ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
enum ice_status enum ice_status
ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
struct ice_sq_cd *cd); struct ice_sq_cd *cd);
bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);
enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);
/* Switch/bridge related commands */ /* Switch/bridge related commands */
...@@ -197,6 +200,8 @@ enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); ...@@ -197,6 +200,8 @@ enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list);
enum ice_status enum ice_status
ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction); ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction);
u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
enum ice_status ice_replay_all_fltr(struct ice_hw *hw); enum ice_status ice_replay_all_fltr(struct ice_hw *hw);
enum ice_status ice_init_def_sw_recp(struct ice_hw *hw); enum ice_status ice_init_def_sw_recp(struct ice_hw *hw);
......
...@@ -186,7 +186,7 @@ struct ice_sched_node { ...@@ -186,7 +186,7 @@ struct ice_sched_node {
struct ice_sched_node **children; struct ice_sched_node **children;
struct ice_aqc_txsched_elem_data info; struct ice_aqc_txsched_elem_data info;
u32 agg_id; /* aggregator group id */ u32 agg_id; /* aggregator group id */
u16 vsi_id; u16 vsi_handle;
u8 in_use; /* suspended or in use */ u8 in_use; /* suspended or in use */
u8 tx_sched_layer; /* Logical Layer (1-9) */ u8 tx_sched_layer; /* Logical Layer (1-9) */
u8 num_children; u8 num_children;
...@@ -245,8 +245,6 @@ struct ice_port_info { ...@@ -245,8 +245,6 @@ struct ice_port_info {
struct ice_mac_info mac; struct ice_mac_info mac;
struct ice_phy_info phy; struct ice_phy_info phy;
struct mutex sched_lock; /* protect access to TXSched tree */ struct mutex sched_lock; /* protect access to TXSched tree */
struct ice_sched_tx_policy sched_policy;
struct list_head vsi_info_list;
struct list_head agg_list; /* lists all aggregator */ struct list_head agg_list; /* lists all aggregator */
u8 lport; u8 lport;
#define ICE_LPORT_MASK 0xff #define ICE_LPORT_MASK 0xff
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment