aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_sched.c
diff options
context:
space:
mode:
authorAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>2018-09-19 20:23:13 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-10-02 10:13:23 -0400
commit4fb33f3107e194793bf947183f29ddce5d80a19f (patch)
tree28180a6f6d72085556a16f950ae60af85149db5d /drivers/net/ethernet/intel/ice/ice_sched.c
parent5726ca0e5eaad0f194979e66c29c1d22029f1041 (diff)
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: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_sched.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_sched.c151
1 files changed, 48 insertions, 103 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c
index 9c4f408f222d..7cc8aa18a22b 100644
--- a/drivers/net/ethernet/intel/ice/ice_sched.c
+++ b/drivers/net/ethernet/intel/ice/ice_sched.c
@@ -599,9 +599,7 @@ ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,
599static void ice_sched_clear_tx_topo(struct ice_port_info *pi) 599static void ice_sched_clear_tx_topo(struct ice_port_info *pi)
600{ 600{
601 struct ice_sched_agg_info *agg_info; 601 struct ice_sched_agg_info *agg_info;
602 struct ice_sched_vsi_info *vsi_elem;
603 struct ice_sched_agg_info *atmp; 602 struct ice_sched_agg_info *atmp;
604 struct ice_sched_vsi_info *tmp;
605 struct ice_hw *hw; 603 struct ice_hw *hw;
606 604
607 if (!pi) 605 if (!pi)
@@ -620,13 +618,6 @@ static void ice_sched_clear_tx_topo(struct ice_port_info *pi)
620 } 618 }
621 } 619 }
622 620
623 /* remove the vsi list */
624 list_for_each_entry_safe(vsi_elem, tmp, &pi->vsi_info_list,
625 list_entry) {
626 list_del(&vsi_elem->list_entry);
627 devm_kfree(ice_hw_to_dev(hw), vsi_elem);
628 }
629
630 if (pi->root) { 621 if (pi->root) {
631 ice_free_sched_node(pi, pi->root); 622 ice_free_sched_node(pi, pi->root);
632 pi->root = NULL; 623 pi->root = NULL;
@@ -677,31 +668,6 @@ void ice_sched_cleanup_all(struct ice_hw *hw)
677} 668}
678 669
679/** 670/**
680 * ice_sched_create_vsi_info_entry - create an empty new VSI entry
681 * @pi: port information structure
682 * @vsi_id: VSI Id
683 *
684 * This function creates a new VSI entry and adds it to list
685 */
686static struct ice_sched_vsi_info *
687ice_sched_create_vsi_info_entry(struct ice_port_info *pi, u16 vsi_id)
688{
689 struct ice_sched_vsi_info *vsi_elem;
690
691 if (!pi)
692 return NULL;
693
694 vsi_elem = devm_kzalloc(ice_hw_to_dev(pi->hw), sizeof(*vsi_elem),
695 GFP_KERNEL);
696 if (!vsi_elem)
697 return NULL;
698
699 list_add(&vsi_elem->list_entry, &pi->vsi_info_list);
700 vsi_elem->vsi_id = vsi_id;
701 return vsi_elem;
702}
703
704/**
705 * ice_sched_add_elems - add nodes to hw and SW DB 671 * ice_sched_add_elems - add nodes to hw and SW DB
706 * @pi: port information structure 672 * @pi: port information structure
707 * @tc_node: pointer to the branch node 673 * @tc_node: pointer to the branch node
@@ -1072,7 +1038,6 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi)
1072 pi->port_state = ICE_SCHED_PORT_STATE_READY; 1038 pi->port_state = ICE_SCHED_PORT_STATE_READY;
1073 mutex_init(&pi->sched_lock); 1039 mutex_init(&pi->sched_lock);
1074 INIT_LIST_HEAD(&pi->agg_list); 1040 INIT_LIST_HEAD(&pi->agg_list);
1075 INIT_LIST_HEAD(&pi->vsi_info_list);
1076 1041
1077err_init_port: 1042err_init_port:
1078 if (status && pi->root) { 1043 if (status && pi->root) {
@@ -1142,27 +1107,6 @@ sched_query_out:
1142} 1107}
1143 1108
1144/** 1109/**
1145 * ice_sched_get_vsi_info_entry - Get the vsi entry list for given vsi_id
1146 * @pi: port information structure
1147 * @vsi_id: vsi id
1148 *
1149 * This function retrieves the vsi list for the given vsi id
1150 */
1151static struct ice_sched_vsi_info *
1152ice_sched_get_vsi_info_entry(struct ice_port_info *pi, u16 vsi_id)
1153{
1154 struct ice_sched_vsi_info *list_elem;
1155
1156 if (!pi)
1157 return NULL;
1158
1159 list_for_each_entry(list_elem, &pi->vsi_info_list, list_entry)
1160 if (list_elem->vsi_id == vsi_id)
1161 return list_elem;
1162 return NULL;
1163}
1164
1165/**
1166 * ice_sched_find_node_in_subtree - Find node in part of base node subtree 1110 * ice_sched_find_node_in_subtree - Find node in part of base node subtree
1167 * @hw: pointer to the hw struct 1111 * @hw: pointer to the hw struct
1168 * @base: pointer to the base node 1112 * @base: pointer to the base node
@@ -1198,30 +1142,28 @@ ice_sched_find_node_in_subtree(struct ice_hw *hw, struct ice_sched_node *base,
1198/** 1142/**
1199 * ice_sched_get_free_qparent - Get a free lan or rdma q group node 1143 * ice_sched_get_free_qparent - Get a free lan or rdma q group node
1200 * @pi: port information structure 1144 * @pi: port information structure
1201 * @vsi_id: vsi id 1145 * @vsi_handle: software VSI handle
1202 * @tc: branch number 1146 * @tc: branch number
1203 * @owner: lan or rdma 1147 * @owner: lan or rdma
1204 * 1148 *
1205 * This function retrieves a free lan or rdma q group node 1149 * This function retrieves a free lan or rdma q group node
1206 */ 1150 */
1207struct ice_sched_node * 1151struct ice_sched_node *
1208ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_id, u8 tc, 1152ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
1209 u8 owner) 1153 u8 owner)
1210{ 1154{
1211 struct ice_sched_node *vsi_node, *qgrp_node = NULL; 1155 struct ice_sched_node *vsi_node, *qgrp_node = NULL;
1212 struct ice_sched_vsi_info *list_elem; 1156 struct ice_vsi_ctx *vsi_ctx;
1213 u16 max_children; 1157 u16 max_children;
1214 u8 qgrp_layer; 1158 u8 qgrp_layer;
1215 1159
1216 qgrp_layer = ice_sched_get_qgrp_layer(pi->hw); 1160 qgrp_layer = ice_sched_get_qgrp_layer(pi->hw);
1217 max_children = pi->hw->max_children[qgrp_layer]; 1161 max_children = pi->hw->max_children[qgrp_layer];
1218 1162
1219 list_elem = ice_sched_get_vsi_info_entry(pi, vsi_id); 1163 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
1220 if (!list_elem) 1164 if (!vsi_ctx)
1221 goto lan_q_exit; 1165 return NULL;
1222 1166 vsi_node = vsi_ctx->sched.vsi_node[tc];
1223 vsi_node = list_elem->vsi_node[tc];
1224
1225 /* validate invalid VSI id */ 1167 /* validate invalid VSI id */
1226 if (!vsi_node) 1168 if (!vsi_node)
1227 goto lan_q_exit; 1169 goto lan_q_exit;
@@ -1245,14 +1187,14 @@ lan_q_exit:
1245 * ice_sched_get_vsi_node - Get a VSI node based on VSI id 1187 * ice_sched_get_vsi_node - Get a VSI node based on VSI id
1246 * @hw: pointer to the hw struct 1188 * @hw: pointer to the hw struct
1247 * @tc_node: pointer to the TC node 1189 * @tc_node: pointer to the TC node
1248 * @vsi_id: VSI id 1190 * @vsi_handle: software VSI handle
1249 * 1191 *
1250 * This function retrieves a VSI node for a given VSI id from a given 1192 * This function retrieves a VSI node for a given VSI id from a given
1251 * TC branch 1193 * TC branch
1252 */ 1194 */
1253static struct ice_sched_node * 1195static struct ice_sched_node *
1254ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node, 1196ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node,
1255 u16 vsi_id) 1197 u16 vsi_handle)
1256{ 1198{
1257 struct ice_sched_node *node; 1199 struct ice_sched_node *node;
1258 u8 vsi_layer; 1200 u8 vsi_layer;
@@ -1262,7 +1204,7 @@ ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node,
1262 1204
1263 /* Check whether it already exists */ 1205 /* Check whether it already exists */
1264 while (node) { 1206 while (node) {
1265 if (node->vsi_id == vsi_id) 1207 if (node->vsi_handle == vsi_handle)
1266 return node; 1208 return node;
1267 node = node->sibling; 1209 node = node->sibling;
1268 } 1210 }
@@ -1301,7 +1243,7 @@ ice_sched_calc_vsi_child_nodes(struct ice_hw *hw, u16 num_qs, u16 *num_nodes)
1301/** 1243/**
1302 * ice_sched_add_vsi_child_nodes - add VSI child nodes to tree 1244 * ice_sched_add_vsi_child_nodes - add VSI child nodes to tree
1303 * @pi: port information structure 1245 * @pi: port information structure
1304 * @vsi_id: VSI id 1246 * @vsi_handle: software VSI handle
1305 * @tc_node: pointer to the TC node 1247 * @tc_node: pointer to the TC node
1306 * @num_nodes: pointer to the num nodes that needs to be added per layer 1248 * @num_nodes: pointer to the num nodes that needs to be added per layer
1307 * @owner: node owner (lan or rdma) 1249 * @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 * lan and rdma separately. 1252 * lan and rdma separately.
1311 */ 1253 */
1312static enum ice_status 1254static enum ice_status
1313ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, 1255ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
1314 struct ice_sched_node *tc_node, u16 *num_nodes, 1256 struct ice_sched_node *tc_node, u16 *num_nodes,
1315 u8 owner) 1257 u8 owner)
1316{ 1258{
@@ -1323,7 +1265,7 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id,
1323 1265
1324 qgl = ice_sched_get_qgrp_layer(hw); 1266 qgl = ice_sched_get_qgrp_layer(hw);
1325 vsil = ice_sched_get_vsi_layer(hw); 1267 vsil = ice_sched_get_vsi_layer(hw);
1326 parent = ice_sched_get_vsi_node(hw, tc_node, vsi_id); 1268 parent = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
1327 for (i = vsil + 1; i <= qgl; i++) { 1269 for (i = vsil + 1; i <= qgl; i++) {
1328 if (!parent) 1270 if (!parent)
1329 return ICE_ERR_CFG; 1271 return ICE_ERR_CFG;
@@ -1436,7 +1378,7 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw,
1436/** 1378/**
1437 * ice_sched_add_vsi_support_nodes - add VSI supported nodes into tx tree 1379 * ice_sched_add_vsi_support_nodes - add VSI supported nodes into tx tree
1438 * @pi: port information structure 1380 * @pi: port information structure
1439 * @vsi_id: VSI Id 1381 * @vsi_handle: software VSI handle
1440 * @tc_node: pointer to TC node 1382 * @tc_node: pointer to TC node
1441 * @num_nodes: pointer to num nodes array 1383 * @num_nodes: pointer to num nodes array
1442 * 1384 *
@@ -1444,7 +1386,7 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw,
1444 * VSI, its parent and intermediate nodes in below layers 1386 * VSI, its parent and intermediate nodes in below layers
1445 */ 1387 */
1446static enum ice_status 1388static enum ice_status
1447ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_id, 1389ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,
1448 struct ice_sched_node *tc_node, u16 *num_nodes) 1390 struct ice_sched_node *tc_node, u16 *num_nodes)
1449{ 1391{
1450 struct ice_sched_node *parent = tc_node; 1392 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 return ICE_ERR_CFG; 1420 return ICE_ERR_CFG;
1479 1421
1480 if (i == vsil) 1422 if (i == vsil)
1481 parent->vsi_id = vsi_id; 1423 parent->vsi_handle = vsi_handle;
1482 } 1424 }
1483 1425
1484 return 0; 1426 return 0;
@@ -1487,13 +1429,13 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_id,
1487/** 1429/**
1488 * ice_sched_add_vsi_to_topo - add a new VSI into tree 1430 * ice_sched_add_vsi_to_topo - add a new VSI into tree
1489 * @pi: port information structure 1431 * @pi: port information structure
1490 * @vsi_id: VSI Id 1432 * @vsi_handle: software VSI handle
1491 * @tc: TC number 1433 * @tc: TC number
1492 * 1434 *
1493 * This function adds a new VSI into scheduler tree 1435 * This function adds a new VSI into scheduler tree
1494 */ 1436 */
1495static enum ice_status 1437static enum ice_status
1496ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_id, u8 tc) 1438ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc)
1497{ 1439{
1498 u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; 1440 u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 };
1499 struct ice_sched_node *tc_node; 1441 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 ice_sched_calc_vsi_support_nodes(hw, tc_node, num_nodes); 1449 ice_sched_calc_vsi_support_nodes(hw, tc_node, num_nodes);
1508 1450
1509 /* add vsi supported nodes to tc subtree */ 1451 /* add vsi supported nodes to tc subtree */
1510 return ice_sched_add_vsi_support_nodes(pi, vsi_id, tc_node, num_nodes); 1452 return ice_sched_add_vsi_support_nodes(pi, vsi_handle, tc_node,
1453 num_nodes);
1511} 1454}
1512 1455
1513/** 1456/**
1514 * ice_sched_update_vsi_child_nodes - update VSI child nodes 1457 * ice_sched_update_vsi_child_nodes - update VSI child nodes
1515 * @pi: port information structure 1458 * @pi: port information structure
1516 * @vsi_id: VSI Id 1459 * @vsi_handle: software VSI handle
1517 * @tc: TC number 1460 * @tc: TC number
1518 * @new_numqs: new number of max queues 1461 * @new_numqs: new number of max queues
1519 * @owner: owner of this subtree 1462 * @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 * This function updates the VSI child nodes based on the number of queues 1464 * This function updates the VSI child nodes based on the number of queues
1522 */ 1465 */
1523static enum ice_status 1466static enum ice_status
1524ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc, 1467ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
1525 u16 new_numqs, u8 owner) 1468 u8 tc, u16 new_numqs, u8 owner)
1526{ 1469{
1527 u16 prev_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; 1470 u16 prev_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 };
1528 u16 new_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; 1471 u16 new_num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 };
1529 struct ice_sched_node *vsi_node; 1472 struct ice_sched_node *vsi_node;
1530 struct ice_sched_node *tc_node; 1473 struct ice_sched_node *tc_node;
1531 struct ice_sched_vsi_info *vsi; 1474 struct ice_vsi_ctx *vsi_ctx;
1532 enum ice_status status = 0; 1475 enum ice_status status = 0;
1533 struct ice_hw *hw = pi->hw; 1476 struct ice_hw *hw = pi->hw;
1534 u16 prev_numqs; 1477 u16 prev_numqs;
@@ -1538,16 +1481,16 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc,
1538 if (!tc_node) 1481 if (!tc_node)
1539 return ICE_ERR_CFG; 1482 return ICE_ERR_CFG;
1540 1483
1541 vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_id); 1484 vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
1542 if (!vsi_node) 1485 if (!vsi_node)
1543 return ICE_ERR_CFG; 1486 return ICE_ERR_CFG;
1544 1487
1545 vsi = ice_sched_get_vsi_info_entry(pi, vsi_id); 1488 vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);
1546 if (!vsi) 1489 if (!vsi_ctx)
1547 return ICE_ERR_CFG; 1490 return ICE_ERR_PARAM;
1548 1491
1549 if (owner == ICE_SCHED_NODE_OWNER_LAN) 1492 if (owner == ICE_SCHED_NODE_OWNER_LAN)
1550 prev_numqs = vsi->max_lanq[tc]; 1493 prev_numqs = vsi_ctx->sched.max_lanq[tc];
1551 else 1494 else
1552 return ICE_ERR_PARAM; 1495 return ICE_ERR_PARAM;
1553 1496
@@ -1572,13 +1515,13 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc,
1572 for (i = 0; i < ICE_AQC_TOPO_MAX_LEVEL_NUM; i++) 1515 for (i = 0; i < ICE_AQC_TOPO_MAX_LEVEL_NUM; i++)
1573 new_num_nodes[i] -= prev_num_nodes[i]; 1516 new_num_nodes[i] -= prev_num_nodes[i];
1574 1517
1575 status = ice_sched_add_vsi_child_nodes(pi, vsi_id, tc_node, 1518 status = ice_sched_add_vsi_child_nodes(pi, vsi_handle, tc_node,
1576 new_num_nodes, owner); 1519 new_num_nodes, owner);
1577 if (status) 1520 if (status)
1578 return status; 1521 return status;
1579 } 1522 }
1580 1523
1581 vsi->max_lanq[tc] = new_numqs; 1524 vsi_ctx->sched.max_lanq[tc] = new_numqs;
1582 1525
1583 return status; 1526 return status;
1584} 1527}
@@ -1586,7 +1529,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_id, u8 tc,
1586/** 1529/**
1587 * ice_sched_cfg_vsi - configure the new/exisiting VSI 1530 * ice_sched_cfg_vsi - configure the new/exisiting VSI
1588 * @pi: port information structure 1531 * @pi: port information structure
1589 * @vsi_id: VSI Id 1532 * @vsi_handle: software VSI handle
1590 * @tc: TC number 1533 * @tc: TC number
1591 * @maxqs: max number of queues 1534 * @maxqs: max number of queues
1592 * @owner: lan or rdma 1535 * @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 * disabled then suspend the VSI if it is not already. 1540 * disabled then suspend the VSI if it is not already.
1598 */ 1541 */
1599enum ice_status 1542enum ice_status
1600ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_id, u8 tc, u16 maxqs, 1543ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,
1601 u8 owner, bool enable) 1544 u8 owner, bool enable)
1602{ 1545{
1603 struct ice_sched_node *vsi_node, *tc_node; 1546 struct ice_sched_node *vsi_node, *tc_node;
1604 struct ice_sched_vsi_info *vsi; 1547 struct ice_vsi_ctx *vsi_ctx;
1605 enum ice_status status = 0; 1548 enum ice_status status = 0;
1606 struct ice_hw *hw = pi->hw; 1549 struct ice_hw *hw = pi->hw;
1607 1550
1608 tc_node = ice_sched_get_tc_node(pi, tc); 1551 tc_node = ice_sched_get_tc_node(pi, tc);
1609 if (!tc_node) 1552 if (!tc_node)
1610 return ICE_ERR_PARAM; 1553 return ICE_ERR_PARAM;
1611 1554 vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);
1612 vsi = ice_sched_get_vsi_info_entry(pi, vsi_id); 1555 if (!vsi_ctx)
1613 if (!vsi) 1556 return ICE_ERR_PARAM;
1614 vsi = ice_sched_create_vsi_info_entry(pi, vsi_id); 1557 vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
1615 if (!vsi)
1616 return ICE_ERR_NO_MEMORY;
1617
1618 vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_id);
1619 1558
1620 /* suspend the VSI if tc is not enabled */ 1559 /* suspend the VSI if tc is not enabled */
1621 if (!enable) { 1560 if (!enable) {
@@ -1632,20 +1571,26 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_id, u8 tc, u16 maxqs,
1632 1571
1633 /* TC is enabled, if it is a new VSI then add it to the tree */ 1572 /* TC is enabled, if it is a new VSI then add it to the tree */
1634 if (!vsi_node) { 1573 if (!vsi_node) {
1635 status = ice_sched_add_vsi_to_topo(pi, vsi_id, tc); 1574 status = ice_sched_add_vsi_to_topo(pi, vsi_handle, tc);
1636 if (status) 1575 if (status)
1637 return status; 1576 return status;
1638 1577
1639 vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_id); 1578 vsi_node = ice_sched_get_vsi_node(hw, tc_node, vsi_handle);
1640 if (!vsi_node) 1579 if (!vsi_node)
1641 return ICE_ERR_CFG; 1580 return ICE_ERR_CFG;
1642 1581
1643 vsi->vsi_node[tc] = vsi_node; 1582 vsi_ctx->sched.vsi_node[tc] = vsi_node;
1644 vsi_node->in_use = true; 1583 vsi_node->in_use = true;
1584 /* invalidate the max queues whenever VSI gets added first time
1585 * into the scheduler tree (boot or after reset). We need to
1586 * recreate the child nodes all the time in these cases.
1587 */
1588 vsi_ctx->sched.max_lanq[tc] = 0;
1645 } 1589 }
1646 1590
1647 /* update the VSI child nodes */ 1591 /* update the VSI child nodes */
1648 status = ice_sched_update_vsi_child_nodes(pi, vsi_id, tc, maxqs, owner); 1592 status = ice_sched_update_vsi_child_nodes(pi, vsi_handle, tc, maxqs,
1593 owner);
1649 if (status) 1594 if (status)
1650 return status; 1595 return status;
1651 1596