aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_sched.c
diff options
context:
space:
mode:
authorAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>2018-10-26 13:41:02 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-11-13 12:09:26 -0500
commit10e03a22de45699b6208592b85437d87a4741b9b (patch)
tree2abc1122b454f570aac8f90afd168a24062dd7ef /drivers/net/ethernet/intel/ice/ice_sched.c
parentb354e98f49ce84b969e2c0e2bb44d026ea3c4900 (diff)
ice: Remove node before releasing VSI
Before releasing the VSI, remove the VSI scheduler node. If not, the node is left in the scheduler tree and, on subsequent load, the scheduler tree contains the node so it does not set it in vsi_ctx. This, later, causes the node to not be found in ice_sched_get_free_qparent which leads to a "Failed to set LAN Tx queue context, error: -1". To remove the scheduler node, this patch introduces ice_rm_vsi_lan_cfg and related helpers. 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.c108
1 files changed, 107 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c
index 7cc8aa18a22b..7e807b0e7514 100644
--- a/drivers/net/ethernet/intel/ice/ice_sched.c
+++ b/drivers/net/ethernet/intel/ice/ice_sched.c
@@ -1527,7 +1527,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
1527} 1527}
1528 1528
1529/** 1529/**
1530 * ice_sched_cfg_vsi - configure the new/exisiting VSI 1530 * ice_sched_cfg_vsi - configure the new/existing VSI
1531 * @pi: port information structure 1531 * @pi: port information structure
1532 * @vsi_handle: software VSI handle 1532 * @vsi_handle: software VSI handle
1533 * @tc: TC number 1533 * @tc: TC number
@@ -1605,3 +1605,109 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,
1605 1605
1606 return status; 1606 return status;
1607} 1607}
1608
1609/**
1610 * ice_sched_rm_agg_vsi_entry - remove agg related VSI info entry
1611 * @pi: port information structure
1612 * @vsi_handle: software VSI handle
1613 *
1614 * This function removes single aggregator VSI info entry from
1615 * aggregator list.
1616 */
1617static void
1618ice_sched_rm_agg_vsi_info(struct ice_port_info *pi, u16 vsi_handle)
1619{
1620 struct ice_sched_agg_info *agg_info;
1621 struct ice_sched_agg_info *atmp;
1622
1623 list_for_each_entry_safe(agg_info, atmp, &pi->agg_list, list_entry) {
1624 struct ice_sched_agg_vsi_info *agg_vsi_info;
1625 struct ice_sched_agg_vsi_info *vtmp;
1626
1627 list_for_each_entry_safe(agg_vsi_info, vtmp,
1628 &agg_info->agg_vsi_list, list_entry)
1629 if (agg_vsi_info->vsi_handle == vsi_handle) {
1630 list_del(&agg_vsi_info->list_entry);
1631 devm_kfree(ice_hw_to_dev(pi->hw),
1632 agg_vsi_info);
1633 return;
1634 }
1635 }
1636}
1637
1638/**
1639 * ice_sched_rm_vsi_cfg - remove the VSI and its children nodes
1640 * @pi: port information structure
1641 * @vsi_handle: software VSI handle
1642 * @owner: LAN or RDMA
1643 *
1644 * This function removes the VSI and its LAN or RDMA children nodes from the
1645 * scheduler tree.
1646 */
1647static enum ice_status
1648ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)
1649{
1650 enum ice_status status = ICE_ERR_PARAM;
1651 struct ice_vsi_ctx *vsi_ctx;
1652 u8 i, j = 0;
1653
1654 if (!ice_is_vsi_valid(pi->hw, vsi_handle))
1655 return status;
1656 mutex_lock(&pi->sched_lock);
1657 vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
1658 if (!vsi_ctx)
1659 goto exit_sched_rm_vsi_cfg;
1660
1661 for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) {
1662 struct ice_sched_node *vsi_node, *tc_node;
1663
1664 tc_node = ice_sched_get_tc_node(pi, i);
1665 if (!tc_node)
1666 continue;
1667
1668 vsi_node = ice_sched_get_vsi_node(pi->hw, tc_node, vsi_handle);
1669 if (!vsi_node)
1670 continue;
1671
1672 while (j < vsi_node->num_children) {
1673 if (vsi_node->children[j]->owner == owner) {
1674 ice_free_sched_node(pi, vsi_node->children[j]);
1675
1676 /* reset the counter again since the num
1677 * children will be updated after node removal
1678 */
1679 j = 0;
1680 } else {
1681 j++;
1682 }
1683 }
1684 /* remove the VSI if it has no children */
1685 if (!vsi_node->num_children) {
1686 ice_free_sched_node(pi, vsi_node);
1687 vsi_ctx->sched.vsi_node[i] = NULL;
1688
1689 /* clean up agg related vsi info if any */
1690 ice_sched_rm_agg_vsi_info(pi, vsi_handle);
1691 }
1692 if (owner == ICE_SCHED_NODE_OWNER_LAN)
1693 vsi_ctx->sched.max_lanq[i] = 0;
1694 }
1695 status = 0;
1696
1697exit_sched_rm_vsi_cfg:
1698 mutex_unlock(&pi->sched_lock);
1699 return status;
1700}
1701
1702/**
1703 * ice_rm_vsi_lan_cfg - remove VSI and its LAN children nodes
1704 * @pi: port information structure
1705 * @vsi_handle: software VSI handle
1706 *
1707 * This function clears the VSI and its LAN children nodes from scheduler tree
1708 * for all TCs.
1709 */
1710enum ice_status ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle)
1711{
1712 return ice_sched_rm_vsi_cfg(pi, vsi_handle, ICE_SCHED_NODE_OWNER_LAN);
1713}