Lines Matching full:pi

36  * @pi: port information structure
43 ice_sched_add_root_node(struct ice_port_info *pi,
49 if (!pi)
52 hw = pi->hw;
66 pi->root = root;
172 * @pi: port information structure
180 ice_sched_add_node(struct ice_port_info *pi, u8 layer,
190 if (!pi)
193 hw = pi->hw;
196 parent = ice_sched_find_node_by_teid(pi->root,
296 * @pi: port information structure
303 ice_sched_get_first_node(struct ice_port_info *pi,
306 return pi->sib_head[parent->tc_num][layer];
311 * @pi: port information structure
316 struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc)
320 if (!pi || !pi->root)
322 for (i = 0; i < pi->root->num_children; i++)
323 if (pi->root->children[i]->tc_num == tc)
324 return pi->root->children[i];
330 * @pi: port information structure
337 void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node)
340 struct ice_hw *hw = pi->hw;
348 ice_free_sched_node(pi, node->children[0]);
374 p = ice_sched_get_first_node(pi, node, node->tx_sched_layer);
384 if (pi->sib_head[node->tc_num][node->tx_sched_layer] == node)
385 pi->sib_head[node->tc_num][node->tx_sched_layer] =
800 * @pi: port information structure
804 static void ice_sched_clear_rl_prof(struct ice_port_info *pi)
807 struct ice_hw *hw = pi->hw;
861 * @pi: port information structure
865 static void ice_sched_clear_tx_topo(struct ice_port_info *pi)
867 if (!pi)
870 ice_sched_clear_rl_prof(pi);
871 if (pi->root) {
872 ice_free_sched_node(pi, pi->root);
873 pi->root = NULL;
879 * @pi: port information structure
883 void ice_sched_clear_port(struct ice_port_info *pi)
885 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
888 pi->port_state = ICE_SCHED_PORT_STATE_INIT;
889 ice_acquire_lock(&pi->sched_lock);
890 ice_sched_clear_tx_topo(pi);
891 ice_release_lock(&pi->sched_lock);
892 ice_destroy_lock(&pi->sched_lock);
974 * @pi: port information structure
986 ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
994 struct ice_hw *hw = pi->hw;
1036 status = ice_sched_add_node(pi, layer, &buf->generic[i], prealloc_nodes[i]);
1038 status = ice_sched_add_node(pi, layer, &buf->generic[i], NULL);
1058 prev = ice_sched_get_first_node(pi, tc_node, layer);
1066 if (!pi->sib_head[tc_node->tc_num][layer])
1067 pi->sib_head[tc_node->tc_num][layer] = new_node;
1079 * @pi: port information structure
1090 ice_sched_add_nodes_to_hw_layer(struct ice_port_info *pi,
1103 if (!parent || layer < pi->hw->sw_entry_point_layer)
1107 max_child_nodes = pi->hw->max_children[parent->tx_sched_layer];
1117 return ice_sched_add_elems(pi, tc_node, parent, layer, num_nodes,
1123 * @pi: port information structure
1134 ice_sched_add_nodes_to_layer(struct ice_port_info *pi,
1149 status = ice_sched_add_nodes_to_hw_layer(pi, tc_node, parent,
1157 ice_debug(pi->hw, ICE_DBG_SCHED, "added extra nodes %d %d\n", num_nodes,
1169 max_child_nodes = pi->hw->max_children[parent->tx_sched_layer];
1244 * @pi: port information structure
1249 static void ice_rm_dflt_leaf_node(struct ice_port_info *pi)
1253 node = pi->root;
1264 status = ice_sched_remove_elems(pi->hw, node->parent, 1, &teid);
1266 ice_free_sched_node(pi, node);
1272 * @pi: port information structure
1277 static void ice_sched_rm_dflt_nodes(struct ice_port_info *pi)
1281 ice_rm_dflt_leaf_node(pi);
1284 node = pi->root;
1286 if (node->tx_sched_layer >= pi->hw->sw_entry_point_layer &&
1289 ice_free_sched_node(pi, node);
1301 * @pi: port info structure for the tree to cleanup
1307 int ice_sched_init_port(struct ice_port_info *pi)
1316 if (!pi)
1318 hw = pi->hw;
1327 status = ice_aq_get_dflt_topo(hw, pi->lport, buf, ICE_AQ_MAX_BUF_LEN,
1356 pi->last_node_teid =
1359 pi->last_node_teid =
1363 status = ice_sched_add_root_node(pi, &buf[0].generic[0]);
1378 status = ice_sched_add_node(pi, j, &buf[i].generic[j], NULL);
1385 if (pi->root)
1386 ice_sched_rm_dflt_nodes(pi);
1389 pi->port_state = ICE_SCHED_PORT_STATE_READY;
1390 ice_init_lock(&pi->sched_lock);
1395 if (status && pi->root) {
1396 ice_free_sched_node(pi, pi->root);
1397 pi->root = NULL;
1406 * @pi: port information structure
1412 struct ice_sched_node *ice_sched_get_node(struct ice_port_info *pi, u32 teid)
1416 if (!pi)
1420 ice_acquire_lock(&pi->sched_lock);
1421 node = ice_sched_find_node_by_teid(pi->root, teid);
1422 ice_release_lock(&pi->sched_lock);
1425 ice_debug(pi->hw, ICE_DBG_SCHED, "Node not found for teid=0x%x\n", teid);
1560 * @pi: port information structure
1570 ice_sched_get_free_qgrp(struct ice_port_info *pi,
1590 if (ice_sched_find_node_in_subtree(pi->hw, vsi_node, qgrp_node))
1607 * @pi: port information structure
1615 ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
1623 qgrp_layer = ice_sched_get_qgrp_layer(pi->hw);
1624 vsi_layer = ice_sched_get_vsi_layer(pi->hw);
1625 max_children = pi->hw->max_children[qgrp_layer];
1627 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
1642 qgrp_node = ice_sched_get_first_node(pi, vsi_node, qgrp_layer);
1645 if (ice_sched_find_node_in_subtree(pi->hw, vsi_node, qgrp_node))
1653 return ice_sched_get_free_qgrp(pi, vsi_node, qgrp_node, owner);
1658 * @pi: pointer to the port information structure
1666 ice_sched_get_vsi_node(struct ice_port_info *pi, struct ice_sched_node *tc_node,
1672 vsi_layer = ice_sched_get_vsi_layer(pi->hw);
1673 node = ice_sched_get_first_node(pi, tc_node, vsi_layer);
1687 * @pi: pointer to the port information structure
1695 ice_sched_get_agg_node(struct ice_port_info *pi, struct ice_sched_node *tc_node,
1699 struct ice_hw *hw = pi->hw;
1705 node = ice_sched_get_first_node(pi, tc_node, agg_layer);
1774 * @pi: port information structure
1784 ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
1789 struct ice_hw *hw = pi->hw;
1796 parent = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
1803 status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,
1831 * @pi: pointer to the port info structure
1840 ice_sched_calc_vsi_support_nodes(struct ice_port_info *pi,
1847 vsil = ice_sched_get_vsi_layer(pi->hw);
1848 for (i = vsil; i >= pi->hw->sw_entry_point_layer; i--)
1858 node = ice_sched_get_first_node(pi, tc_node, (u8)i);
1862 pi->hw->max_children[i])
1880 * @pi: port information structure
1889 ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,
1897 if (!pi)
1900 vsil = ice_sched_get_vsi_layer(pi->hw);
1901 for (i = pi->hw->sw_entry_point_layer; i <= vsil; i++) {
1904 status = ice_sched_add_nodes_to_layer(pi, tc_node, parent,
1932 * @pi: port information structure
1939 ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc)
1944 tc_node = ice_sched_get_tc_node(pi, tc);
1949 ice_sched_calc_vsi_support_nodes(pi, tc_node, num_nodes);
1952 return ice_sched_add_vsi_support_nodes(pi, vsi_handle, tc_node,
1958 * @pi: port information structure
1967 ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
1974 struct ice_hw *hw = pi->hw;
1978 tc_node = ice_sched_get_tc_node(pi, tc);
1982 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
2016 status = ice_sched_add_vsi_child_nodes(pi, vsi_handle, tc_node,
2030 * @pi: port information structure
2042 ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,
2047 struct ice_hw *hw = pi->hw;
2050 ice_debug(pi->hw, ICE_DBG_SCHED, "add/config VSI %d\n", vsi_handle);
2051 tc_node = ice_sched_get_tc_node(pi, tc);
2057 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
2074 status = ice_sched_add_vsi_to_topo(pi, vsi_handle, tc);
2078 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
2093 status = ice_sched_update_vsi_child_nodes(pi, vsi_handle, tc, maxqs,
2112 * @pi: port information structure
2118 static void ice_sched_rm_agg_vsi_info(struct ice_port_info *pi, u16 vsi_handle)
2123 LIST_FOR_EACH_ENTRY_SAFE(agg_info, atmp, &pi->hw->agg_list,
2134 ice_free(pi->hw, agg_vsi_info);
2159 * @pi: port information structure
2167 ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)
2173 ice_debug(pi->hw, ICE_DBG_SCHED, "removing VSI %d\n", vsi_handle);
2174 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
2176 ice_acquire_lock(&pi->sched_lock);
2177 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
2185 tc_node = ice_sched_get_tc_node(pi, i);
2189 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
2194 ice_debug(pi->hw, ICE_DBG_SCHED, "VSI has leaf nodes in TC %d\n", i);
2200 ice_free_sched_node(pi, vsi_node->children[j]);
2212 ice_free_sched_node(pi, vsi_node);
2216 ice_sched_rm_agg_vsi_info(pi, vsi_handle);
2226 ice_release_lock(&pi->sched_lock);
2232 * @pi: port information structure
2238 int ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle)
2240 return ice_sched_rm_vsi_cfg(pi, vsi_handle, ICE_SCHED_NODE_OWNER_LAN);
2245 * @pi: port information structure
2251 int ice_rm_vsi_rdma_cfg(struct ice_port_info *pi, u16 vsi_handle)
2253 return ice_sched_rm_vsi_cfg(pi, vsi_handle, ICE_SCHED_NODE_OWNER_RDMA);
2404 * @pi: port information structure
2412 ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,
2422 hw = pi->hw;
2438 node = ice_sched_find_node_by_teid(pi->root, list[i]);
2466 * @pi: port information structure
2475 ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,
2485 tc_node = ice_sched_get_tc_node(pi, tc);
2489 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
2493 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
2498 if (ice_sched_find_node_in_subtree(pi->hw, agg_node, vsi_node))
2501 aggl = ice_sched_get_agg_layer(pi->hw);
2502 vsil = ice_sched_get_vsi_layer(pi->hw);
2510 parent = ice_sched_get_free_vsi_parent(pi->hw,
2520 status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,
2542 return ice_sched_move_nodes(pi, parent, 1, &vsi_teid);
2547 * @pi: port information structure
2557 ice_move_all_vsi_to_dflt_agg(struct ice_port_info *pi,
2573 status = ice_sched_move_vsi_to_agg(pi, vsi_handle,
2581 ice_free(pi->hw, agg_vsi_info);
2590 * @pi: port information structure
2596 ice_sched_is_agg_inuse(struct ice_port_info *pi, struct ice_sched_node *node)
2600 vsil = ice_sched_get_vsi_layer(pi->hw);
2603 if (ice_sched_is_agg_inuse(pi, node->children[i]))
2613 * @pi: port information structure
2621 ice_sched_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)
2624 struct ice_hw *hw = pi->hw;
2626 tc_node = ice_sched_get_tc_node(pi, tc);
2630 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
2635 if (ice_sched_is_agg_inuse(pi, agg_node))
2653 ice_free_sched_node(pi, agg_node);
2659 * @pi: port information structure
2669 ice_rm_agg_cfg_tc(struct ice_port_info *pi, struct ice_sched_agg_info *agg_info,
2678 status = ice_move_all_vsi_to_dflt_agg(pi, agg_info, tc, rm_vsi_info);
2683 status = ice_sched_rm_agg_cfg(pi, agg_info->agg_id, tc);
2694 * @pi: port information structure
2702 ice_save_agg_tc_bitmap(struct ice_port_info *pi, u32 agg_id,
2707 agg_info = ice_get_agg_info(pi->hw, agg_id);
2717 * @pi: port information structure
2725 ice_sched_add_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)
2729 struct ice_hw *hw = pi->hw;
2735 tc_node = ice_sched_get_tc_node(pi, tc);
2739 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
2754 parent = ice_sched_get_first_node(pi, tc_node, i);
2774 status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,
2800 * @pi: port information structure
2815 ice_sched_cfg_agg(struct ice_port_info *pi, u32 agg_id,
2819 struct ice_hw *hw = pi->hw;
2845 status = ice_rm_agg_cfg_tc(pi, agg_info, tc, false);
2856 status = ice_sched_add_agg_cfg(pi, agg_id, tc);
2869 * @pi: port information structure
2877 ice_cfg_agg(struct ice_port_info *pi, u32 agg_id, enum ice_agg_type agg_type,
2883 ice_acquire_lock(&pi->sched_lock);
2884 status = ice_sched_cfg_agg(pi, agg_id, agg_type,
2887 status = ice_save_agg_tc_bitmap(pi, agg_id,
2889 ice_release_lock(&pi->sched_lock);
2941 * @pi: port information structure
2950 ice_save_agg_vsi_tc_bitmap(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,
2956 agg_info = ice_get_agg_info(pi->hw, agg_id);
2970 * @pi: port information structure
2980 ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
2985 struct ice_hw *hw = pi->hw;
2989 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
3027 status = ice_sched_move_vsi_to_agg(pi, vsi_handle, agg_id, tc);
3037 ice_free(pi->hw, old_agg_vsi_info);
3149 * @pi: port information structure
3157 ice_move_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,
3163 ice_acquire_lock(&pi->sched_lock);
3164 status = ice_sched_assoc_vsi_to_agg(pi, agg_id, vsi_handle,
3167 status = ice_save_agg_vsi_tc_bitmap(pi, agg_id, vsi_handle,
3169 ice_release_lock(&pi->sched_lock);
3175 * @pi: port information structure
3181 int ice_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id)
3187 ice_acquire_lock(&pi->sched_lock);
3188 agg_info = ice_get_agg_info(pi->hw, agg_id);
3195 status = ice_rm_agg_cfg_tc(pi, agg_info, tc, true);
3207 ice_free(pi->hw, agg_info);
3210 ice_sched_rm_unused_rl_prof(pi->hw);
3213 ice_release_lock(&pi->sched_lock);
3255 * @pi: port information structure
3264 ice_sched_save_vsi_bw_alloc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
3269 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
3271 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
3348 * @pi: port information structure
3357 ice_sched_save_vsi_bw(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
3362 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
3364 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
3401 * @pi: port information structure
3409 ice_sched_save_vsi_prio(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
3414 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
3416 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
3427 * @pi: port information structure
3436 ice_sched_save_agg_bw_alloc(struct ice_port_info *pi, u32 agg_id, u8 tc,
3441 agg_info = ice_get_agg_info(pi->hw, agg_id);
3461 * @pi: port information structure
3470 ice_sched_save_agg_bw(struct ice_port_info *pi, u32 agg_id, u8 tc,
3475 agg_info = ice_get_agg_info(pi->hw, agg_id);
3498 * @pi: port information structure
3508 ice_cfg_vsi_bw_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
3513 status = ice_sched_set_node_bw_lmt_per_tc(pi, vsi_handle,
3517 ice_acquire_lock(&pi->sched_lock);
3518 status = ice_sched_save_vsi_bw(pi, vsi_handle, tc, rl_type, bw);
3519 ice_release_lock(&pi->sched_lock);
3526 * @pi: port information structure
3535 ice_cfg_vsi_bw_dflt_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
3540 status = ice_sched_set_node_bw_lmt_per_tc(pi, vsi_handle,
3545 ice_acquire_lock(&pi->sched_lock);
3546 status = ice_sched_save_vsi_bw(pi, vsi_handle, tc, rl_type,
3548 ice_release_lock(&pi->sched_lock);
3555 * @pi: port information structure
3565 ice_cfg_agg_bw_lmt_per_tc(struct ice_port_info *pi, u32 agg_id, u8 tc,
3570 status = ice_sched_set_node_bw_lmt_per_tc(pi, agg_id, ICE_AGG_TYPE_AGG,
3573 ice_acquire_lock(&pi->sched_lock);
3574 status = ice_sched_save_agg_bw(pi, agg_id, tc, rl_type, bw);
3575 ice_release_lock(&pi->sched_lock);
3582 * @pi: port information structure
3591 ice_cfg_agg_bw_dflt_lmt_per_tc(struct ice_port_info *pi, u32 agg_id, u8 tc,
3596 status = ice_sched_set_node_bw_lmt_per_tc(pi, agg_id, ICE_AGG_TYPE_AGG,
3600 ice_acquire_lock(&pi->sched_lock);
3601 status = ice_sched_save_agg_bw(pi, agg_id, tc, rl_type,
3603 ice_release_lock(&pi->sched_lock);
3610 * @pi: port information structure
3620 ice_cfg_vsi_bw_shared_lmt(struct ice_port_info *pi, u16 vsi_handle, u32 min_bw,
3623 return ice_sched_set_vsi_bw_shared_lmt(pi, vsi_handle, min_bw, max_bw,
3629 * @pi: port information structure
3636 ice_cfg_vsi_bw_no_shared_lmt(struct ice_port_info *pi, u16 vsi_handle)
3638 return ice_sched_set_vsi_bw_shared_lmt(pi, vsi_handle,
3646 * @pi: port information structure
3656 ice_cfg_agg_bw_shared_lmt(struct ice_port_info *pi, u32 agg_id, u32 min_bw,
3659 return ice_sched_set_agg_bw_shared_lmt(pi, agg_id, min_bw, max_bw,
3665 * @pi: port information structure
3672 ice_cfg_agg_bw_no_shared_lmt(struct ice_port_info *pi, u32 agg_id)
3674 return ice_sched_set_agg_bw_shared_lmt(pi, agg_id, ICE_SCHED_DFLT_BW,
3681 * @pi: port information structure
3692 ice_cfg_agg_bw_shared_lmt_per_tc(struct ice_port_info *pi, u32 agg_id, u8 tc,
3695 return ice_sched_set_agg_bw_shared_lmt_per_tc(pi, agg_id, tc, min_bw,
3701 * @pi: port information structure
3709 ice_cfg_agg_bw_no_shared_lmt_per_tc(struct ice_port_info *pi, u32 agg_id, u8 tc)
3711 return ice_sched_set_agg_bw_shared_lmt_per_tc(pi, agg_id, tc,
3719 * @pi: port information structure
3728 ice_cfg_vsi_q_priority(struct ice_port_info *pi, u16 num_qs, u32 *q_ids,
3734 ice_acquire_lock(&pi->sched_lock);
3739 node = ice_sched_find_node_by_teid(pi->root, q_ids[i]);
3746 status = ice_sched_cfg_sibl_node_prio(pi, node, q_prio[i]);
3751 ice_release_lock(&pi->sched_lock);
3757 * @pi: port information structure
3768 ice_cfg_agg_vsi_priority_per_tc(struct ice_port_info *pi, u32 agg_id,
3776 struct ice_hw *hw = pi->hw;
3780 ice_acquire_lock(&pi->sched_lock);
3790 tc_node = ice_sched_get_tc_node(pi, tc);
3794 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
3821 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
3827 status = ice_sched_cfg_sibl_node_prio(pi, vsi_node,
3831 status = ice_sched_save_vsi_prio(pi, vsi_handle, tc,
3839 ice_release_lock(&pi->sched_lock);
3845 * @pi: port information structure
3855 ice_cfg_vsi_bw_alloc(struct ice_port_info *pi, u16 vsi_handle, u8 ena_tcmap,
3861 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
3864 ice_acquire_lock(&pi->sched_lock);
3873 tc_node = ice_sched_get_tc_node(pi, tc);
3877 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
3881 status = ice_sched_cfg_node_bw_alloc(pi->hw, vsi_node, rl_type,
3885 status = ice_sched_save_vsi_bw_alloc(pi, vsi_handle, tc,
3891 ice_release_lock(&pi->sched_lock);
3897 * @pi: port information structure
3907 ice_cfg_agg_bw_alloc(struct ice_port_info *pi, u32 agg_id, u8 ena_tcmap,
3912 struct ice_hw *hw = pi->hw;
3916 ice_acquire_lock(&pi->sched_lock);
3935 tc_node = ice_sched_get_tc_node(pi, tc);
3939 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
3947 status = ice_sched_save_agg_bw_alloc(pi, agg_id, tc, rl_type,
3954 ice_release_lock(&pi->sched_lock);
4224 * @pi: port information structure
4231 ice_sched_get_rl_prof_layer(struct ice_port_info *pi, enum ice_rl_type rl_type,
4234 struct ice_hw *hw = pi->hw;
4331 * @pi: port information structure
4341 ice_sched_set_node_bw_dflt(struct ice_port_info *pi,
4351 hw = pi->hw;
4386 * @pi: port information structure
4397 ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node,
4401 struct ice_hw *hw = pi->hw;
4434 * @pi: port information structure
4441 ice_sched_set_node_priority(struct ice_port_info *pi, struct ice_sched_node *node,
4454 return ice_sched_update_elem(pi->hw, node, &buf);
4459 * @pi: port information structure
4466 ice_sched_set_node_weight(struct ice_port_info *pi, struct ice_sched_node *node, u16 weight)
4481 return ice_sched_update_elem(pi->hw, node, &buf);
4486 * @pi: port information structure
4498 ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,
4504 if (!pi)
4506 hw = pi->hw;
4510 layer_num = ice_sched_get_rl_prof_layer(pi, rl_type,
4516 return ice_sched_set_node_bw_dflt(pi, node, rl_type, layer_num);
4517 return ice_sched_set_node_bw(pi, node, rl_type, bw, layer_num);
4522 * @pi: port information structure
4531 ice_sched_set_node_bw_dflt_lmt(struct ice_port_info *pi,
4535 return ice_sched_set_node_bw_lmt(pi, node, rl_type,
4595 * @pi: port information structure
4605 ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
4612 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
4614 ice_acquire_lock(&pi->sched_lock);
4615 q_ctx = ice_get_lan_q_ctx(pi->hw, vsi_handle, tc, q_handle);
4618 node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid);
4620 ice_debug(pi->hw, ICE_DBG_SCHED, "Wrong q_teid\n");
4632 sel_layer = ice_sched_get_rl_prof_layer(pi, rl_type,
4634 if (sel_layer >= pi->hw->num_tx_sched_layers) {
4644 status = ice_sched_set_node_bw_dflt_lmt(pi, node, rl_type);
4646 status = ice_sched_set_node_bw_lmt(pi, node, rl_type, bw);
4652 ice_release_lock(&pi->sched_lock);
4658 * @pi: port information structure
4668 ice_cfg_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
4671 return ice_sched_set_q_bw_lmt(pi, vsi_handle, tc, q_handle, rl_type,
4677 * @pi: port information structure
4686 ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
4689 return ice_sched_set_q_bw_lmt(pi, vsi_handle, tc, q_handle, rl_type,
4695 * @pi: port information structure
4704 ice_sched_save_tc_node_bw(struct ice_port_info *pi, u8 tc,
4711 ice_set_clear_cir_bw(&pi->tc_node_bw_t_info[tc], bw);
4714 ice_set_clear_eir_bw(&pi->tc_node_bw_t_info[tc], bw);
4717 ice_set_clear_shared_bw(&pi->tc_node_bw_t_info[tc], bw);
4730 * @pi: port information structure
4738 ice_sched_set_tc_node_bw_lmt(struct ice_port_info *pi, u8 tc,
4748 ice_acquire_lock(&pi->sched_lock);
4749 tc_node = ice_sched_get_tc_node(pi, tc);
4759 status = ice_sched_update_elem(pi->hw, tc_node, &buf);
4764 status = ice_sched_set_node_bw_dflt_lmt(pi, tc_node, rl_type);
4766 status = ice_sched_set_node_bw_lmt(pi, tc_node, rl_type, bw);
4768 status = ice_sched_save_tc_node_bw(pi, tc, rl_type, bw);
4771 ice_release_lock(&pi->sched_lock);
4777 * @pi: port information structure
4786 ice_cfg_tc_node_bw_lmt(struct ice_port_info *pi, u8 tc,
4789 return ice_sched_set_tc_node_bw_lmt(pi, tc, rl_type, bw);
4794 * @pi: port information structure
4801 ice_cfg_tc_node_bw_dflt_lmt(struct ice_port_info *pi, u8 tc,
4804 return ice_sched_set_tc_node_bw_lmt(pi, tc, rl_type, ICE_SCHED_DFLT_BW);
4809 * @pi: port information structure
4817 ice_sched_save_tc_node_bw_alloc(struct ice_port_info *pi, u8 tc,
4824 ice_set_clear_cir_bw_alloc(&pi->tc_node_bw_t_info[tc],
4828 ice_set_clear_eir_bw_alloc(&pi->tc_node_bw_t_info[tc],
4839 * @pi: port information structure
4849 ice_sched_set_tc_node_bw_alloc(struct ice_port_info *pi, u8 tc,
4857 ice_acquire_lock(&pi->sched_lock);
4858 tc_node = ice_sched_get_tc_node(pi, tc);
4861 status = ice_sched_cfg_node_bw_alloc(pi->hw, tc_node, rl_type,
4865 status = ice_sched_save_tc_node_bw_alloc(pi, tc, rl_type, bw_alloc);
4868 ice_release_lock(&pi->sched_lock);
4874 * @pi: port information structure
4883 ice_cfg_tc_node_bw_alloc(struct ice_port_info *pi, u8 tc,
4886 return ice_sched_set_tc_node_bw_alloc(pi, tc, rl_type, bw_alloc);
4891 * @pi: port information structure
4899 ice_sched_set_agg_bw_dflt_lmt(struct ice_port_info *pi, u16 vsi_handle)
4905 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
4907 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
4919 status = ice_sched_set_node_bw_dflt_lmt(pi, node, ICE_MIN_BW);
4924 status = ice_sched_set_node_bw_dflt_lmt(pi, node, ICE_MAX_BW);
4929 status = ice_sched_set_node_bw_dflt_lmt(pi, node,
4940 * @pi: port information structure
4950 ice_sched_get_node_by_id_type(struct ice_port_info *pi, u32 id,
4960 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
4963 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
4973 tc_node = ice_sched_get_tc_node(pi, tc);
4975 node = ice_sched_get_agg_node(pi, tc_node, id);
4981 node = ice_sched_find_node_by_teid(pi->root, id);
4988 child_node = ice_sched_find_node_by_teid(pi->root, id);
5004 * @pi: port information structure
5015 ice_sched_set_node_bw_lmt_per_tc(struct ice_port_info *pi, u32 id,
5022 if (!pi)
5028 ice_acquire_lock(&pi->sched_lock);
5029 node = ice_sched_get_node_by_id_type(pi, id, agg_type, tc);
5031 ice_debug(pi->hw, ICE_DBG_SCHED, "Wrong id, agg type, or tc\n");
5035 status = ice_sched_set_node_bw_dflt_lmt(pi, node, rl_type);
5037 status = ice_sched_set_node_bw_lmt(pi, node, rl_type, bw);
5040 ice_release_lock(&pi->sched_lock);
5046 * @pi: port information structure
5054 ice_sched_validate_vsi_srl_node(struct ice_port_info *pi, u16 vsi_handle)
5059 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
5068 tc_node = ice_sched_get_tc_node(pi, tc);
5072 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
5081 layer_num = ice_sched_get_rl_prof_layer(pi, rl_type,
5083 if (layer_num >= pi->hw->num_tx_sched_layers)
5097 * @pi: port information structure
5109 ice_sched_set_save_vsi_srl_node_bw(struct ice_port_info *pi, u16 vsi_handle,
5116 status = ice_sched_set_node_bw_dflt_lmt(pi, srl_node, rl_type);
5118 status = ice_sched_set_node_bw_lmt(pi, srl_node, rl_type, bw);
5121 status = ice_sched_save_vsi_bw(pi, vsi_handle, tc, rl_type, bw);
5128 * @pi: port information structure
5141 ice_sched_set_vsi_node_srl_per_tc(struct ice_port_info *pi, u16 vsi_handle,
5148 tc_node = ice_sched_get_tc_node(pi, tc);
5152 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
5156 layer_num = ice_sched_get_rl_prof_layer(pi, ICE_SHARED_BW,
5158 if (layer_num >= pi->hw->num_tx_sched_layers)
5166 status = ice_sched_set_save_vsi_srl_node_bw(pi, vsi_handle, tc,
5172 status = ice_sched_set_save_vsi_srl_node_bw(pi, vsi_handle, tc,
5178 return ice_sched_set_save_vsi_srl_node_bw(pi, vsi_handle, tc, cfg_node,
5184 * @pi: port information structure
5195 ice_sched_set_vsi_bw_shared_lmt(struct ice_port_info *pi, u16 vsi_handle,
5201 if (!pi)
5204 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
5207 ice_acquire_lock(&pi->sched_lock);
5208 status = ice_sched_validate_vsi_srl_node(pi, vsi_handle);
5215 tc_node = ice_sched_get_tc_node(pi, tc);
5219 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
5223 status = ice_sched_set_vsi_node_srl_per_tc(pi, vsi_handle, tc,
5231 ice_release_lock(&pi->sched_lock);
5237 * @pi: port information structure
5245 ice_sched_validate_agg_srl_node(struct ice_port_info *pi, u32 agg_id)
5253 LIST_FOR_EACH_ENTRY(agg_info, &pi->hw->agg_list, ice_sched_agg_info,
5266 tc_node = ice_sched_get_tc_node(pi, tc);
5270 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
5278 layer_num = ice_sched_get_rl_prof_layer(pi, rl_type,
5280 if (layer_num >= pi->hw->num_tx_sched_layers)
5294 * @pi: port information structure
5300 ice_sched_validate_agg_id(struct ice_port_info *pi, u32 agg_id)
5307 status = ice_sched_validate_agg_srl_node(pi, agg_id);
5311 LIST_FOR_EACH_ENTRY_SAFE(agg_info, tmp, &pi->hw->agg_list,
5326 * @pi: port information structure
5338 ice_sched_set_save_agg_srl_node_bw(struct ice_port_info *pi, u32 agg_id, u8 tc,
5345 status = ice_sched_set_node_bw_dflt_lmt(pi, srl_node, rl_type);
5347 status = ice_sched_set_node_bw_lmt(pi, srl_node, rl_type, bw);
5350 status = ice_sched_save_agg_bw(pi, agg_id, tc, rl_type, bw);
5357 * @pi: port information structure
5370 ice_sched_set_agg_node_srl_per_tc(struct ice_port_info *pi, u32 agg_id,
5378 tc_node = ice_sched_get_tc_node(pi, tc);
5382 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
5386 layer_num = ice_sched_get_rl_prof_layer(pi, rl_type,
5388 if (layer_num >= pi->hw->num_tx_sched_layers)
5396 status = ice_sched_set_save_agg_srl_node_bw(pi, agg_id, tc, cfg_node,
5401 status = ice_sched_set_save_agg_srl_node_bw(pi, agg_id, tc, cfg_node,
5406 status = ice_sched_set_save_agg_srl_node_bw(pi, agg_id, tc, cfg_node,
5413 * @pi: port information structure
5425 ice_sched_set_agg_bw_shared_lmt(struct ice_port_info *pi, u32 agg_id,
5431 if (!pi)
5434 ice_acquire_lock(&pi->sched_lock);
5435 status = ice_sched_validate_agg_id(pi, agg_id);
5443 tc_node = ice_sched_get_tc_node(pi, tc);
5447 agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
5451 status = ice_sched_set_agg_node_srl_per_tc(pi, agg_id, tc,
5459 ice_release_lock(&pi->sched_lock);
5465 * @pi: port information structure
5477 ice_sched_set_agg_bw_shared_lmt_per_tc(struct ice_port_info *pi, u32 agg_id,
5483 if (!pi)
5485 ice_acquire_lock(&pi->sched_lock);
5486 status = ice_sched_validate_agg_id(pi, agg_id);
5490 status = ice_sched_set_agg_node_srl_per_tc(pi, agg_id, tc, min_bw,
5494 ice_release_lock(&pi->sched_lock);
5500 * @pi: port information structure
5508 ice_sched_cfg_sibl_node_prio(struct ice_port_info *pi,
5513 struct ice_hw *hw = pi->hw;
5612 struct ice_port_info *pi = hw->port_info;
5627 status = ice_sched_set_node_bw_lmt(pi, node, ICE_MIN_BW,
5640 status = ice_sched_set_node_bw_lmt(pi, node, ICE_MAX_BW,
5653 status = ice_sched_set_node_bw_lmt(pi, node, ICE_SHARED_BW,
5700 * @pi: port info struct
5709 ice_sched_get_ena_tc_bitmap(struct ice_port_info *pi, ice_bitmap_t *tc_bitmap,
5717 (ice_sched_get_tc_node(pi, tc)))
5731 struct ice_port_info *pi = hw->port_info;
5734 ice_acquire_lock(&pi->sched_lock);
5746 ice_sched_get_ena_tc_bitmap(pi,
5765 ice_release_lock(&pi->sched_lock);
5777 struct ice_port_info *pi = hw->port_info;
5780 ice_acquire_lock(&pi->sched_lock);
5790 ice_release_lock(&pi->sched_lock);
5795 * @pi: port information structure
5799 int ice_sched_replay_root_node_bw(struct ice_port_info *pi)
5803 if (!pi->hw)
5805 ice_acquire_lock(&pi->sched_lock);
5807 status = ice_sched_replay_node_bw(pi->hw, pi->root,
5808 &pi->root_node_bw_t_info);
5809 ice_release_lock(&pi->sched_lock);
5815 * @pi: port information structure
5819 int ice_sched_replay_tc_node_bw(struct ice_port_info *pi)
5824 if (!pi->hw)
5826 ice_acquire_lock(&pi->sched_lock);
5830 tc_node = ice_sched_get_tc_node(pi, tc);
5833 status = ice_sched_replay_node_bw(pi->hw, tc_node,
5834 &pi->tc_node_bw_t_info[tc]);
5838 ice_release_lock(&pi->sched_lock);
5856 struct ice_port_info *pi = hw->port_info;
5862 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
5868 tc_node = ice_sched_get_tc_node(pi, tc);
5871 vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
5896 struct ice_port_info *pi = hw->port_info;
5909 ice_sched_get_ena_tc_bitmap(pi, agg_info->replay_tc_bitmap,
5922 ice_sched_get_ena_tc_bitmap(pi, agg_vsi_info->replay_tc_bitmap,
5925 status = ice_sched_assoc_vsi_to_agg(pi, agg_info->agg_id, vsi_handle,
5944 struct ice_port_info *pi = hw->port_info;
5947 ice_acquire_lock(&pi->sched_lock);
5949 ice_release_lock(&pi->sched_lock);
5955 * @pi: port information structure
5962 ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx)
5967 q_node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid);
5970 return ice_sched_replay_node_bw(pi->hw, q_node, &q_ctx->bw_t_info);