diff options
author | Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> | 2018-03-20 10:58:13 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-03-26 14:18:36 -0400 |
commit | cdedef59deb020e78721d820a5692100128c8c73 (patch) | |
tree | 2bdeeb20d1fadea63eb26501b64bc6eee455f6e8 /drivers/net/ethernet/intel/ice/ice_sched.c | |
parent | 9daf8208dd4dee4e13079bd0520a5fb8d20e8b06 (diff) |
ice: Configure VSIs for Tx/Rx
This patch configures the VSIs to be able to send and receive
packets by doing the following:
1) Initialize flexible parser to extract and include certain
fields in the Rx descriptor.
2) Add Tx queues by programming the Tx queue context (implemented in
ice_vsi_cfg_txqs). Note that adding the queues also enables (starts)
the queues.
3) Add Rx queues by programming Rx queue context (implemented in
ice_vsi_cfg_rxqs). Note that this only adds queues but doesn't start
them. The rings will be started by calling ice_vsi_start_rx_rings on
interface up.
4) Configure interrupts for VSI queues.
5) Implement ice_open and ice_stop.
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@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.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c index 22039f9eb591..e50eebbf78e3 100644 --- a/drivers/net/ethernet/intel/ice/ice_sched.c +++ b/drivers/net/ethernet/intel/ice/ice_sched.c | |||
@@ -463,6 +463,18 @@ void ice_sched_cleanup_all(struct ice_hw *hw) | |||
463 | } | 463 | } |
464 | 464 | ||
465 | /** | 465 | /** |
466 | * ice_sched_get_qgrp_layer - get the current queue group layer number | ||
467 | * @hw: pointer to the hw struct | ||
468 | * | ||
469 | * This function returns the current queue group layer number | ||
470 | */ | ||
471 | static u8 ice_sched_get_qgrp_layer(struct ice_hw *hw) | ||
472 | { | ||
473 | /* It's always total layers - 1, the array is 0 relative so -2 */ | ||
474 | return hw->num_tx_sched_layers - ICE_QGRP_LAYER_OFFSET; | ||
475 | } | ||
476 | |||
477 | /** | ||
466 | * ice_rm_dflt_leaf_node - remove the default leaf node in the tree | 478 | * ice_rm_dflt_leaf_node - remove the default leaf node in the tree |
467 | * @pi: port information structure | 479 | * @pi: port information structure |
468 | * | 480 | * |
@@ -666,3 +678,96 @@ sched_query_out: | |||
666 | devm_kfree(ice_hw_to_dev(hw), buf); | 678 | devm_kfree(ice_hw_to_dev(hw), buf); |
667 | return status; | 679 | return status; |
668 | } | 680 | } |
681 | |||
682 | /** | ||
683 | * ice_sched_get_vsi_info_entry - Get the vsi entry list for given vsi_id | ||
684 | * @pi: port information structure | ||
685 | * @vsi_id: vsi id | ||
686 | * | ||
687 | * This function retrieves the vsi list for the given vsi id | ||
688 | */ | ||
689 | static struct ice_sched_vsi_info * | ||
690 | ice_sched_get_vsi_info_entry(struct ice_port_info *pi, u16 vsi_id) | ||
691 | { | ||
692 | struct ice_sched_vsi_info *list_elem; | ||
693 | |||
694 | if (!pi) | ||
695 | return NULL; | ||
696 | |||
697 | list_for_each_entry(list_elem, &pi->vsi_info_list, list_entry) | ||
698 | if (list_elem->vsi_id == vsi_id) | ||
699 | return list_elem; | ||
700 | return NULL; | ||
701 | } | ||
702 | |||
703 | /** | ||
704 | * ice_sched_find_node_in_subtree - Find node in part of base node subtree | ||
705 | * @hw: pointer to the hw struct | ||
706 | * @base: pointer to the base node | ||
707 | * @node: pointer to the node to search | ||
708 | * | ||
709 | * This function checks whether a given node is part of the base node | ||
710 | * subtree or not | ||
711 | */ | ||
712 | static bool | ||
713 | ice_sched_find_node_in_subtree(struct ice_hw *hw, struct ice_sched_node *base, | ||
714 | struct ice_sched_node *node) | ||
715 | { | ||
716 | u8 i; | ||
717 | |||
718 | for (i = 0; i < base->num_children; i++) { | ||
719 | struct ice_sched_node *child = base->children[i]; | ||
720 | |||
721 | if (node == child) | ||
722 | return true; | ||
723 | if (child->tx_sched_layer > node->tx_sched_layer) | ||
724 | return false; | ||
725 | /* this recursion is intentional, and wouldn't | ||
726 | * go more than 8 calls | ||
727 | */ | ||
728 | if (ice_sched_find_node_in_subtree(hw, child, node)) | ||
729 | return true; | ||
730 | } | ||
731 | return false; | ||
732 | } | ||
733 | |||
734 | /** | ||
735 | * ice_sched_get_free_qparent - Get a free lan or rdma q group node | ||
736 | * @pi: port information structure | ||
737 | * @vsi_id: vsi id | ||
738 | * @tc: branch number | ||
739 | * @owner: lan or rdma | ||
740 | * | ||
741 | * This function retrieves a free lan or rdma q group node | ||
742 | */ | ||
743 | struct ice_sched_node * | ||
744 | ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_id, u8 tc, | ||
745 | u8 owner) | ||
746 | { | ||
747 | struct ice_sched_node *vsi_node, *qgrp_node = NULL; | ||
748 | struct ice_sched_vsi_info *list_elem; | ||
749 | u16 max_children; | ||
750 | u8 qgrp_layer; | ||
751 | |||
752 | qgrp_layer = ice_sched_get_qgrp_layer(pi->hw); | ||
753 | max_children = le16_to_cpu(pi->hw->layer_info[qgrp_layer].max_children); | ||
754 | list_elem = ice_sched_get_vsi_info_entry(pi, vsi_id); | ||
755 | if (!list_elem) | ||
756 | goto lan_q_exit; | ||
757 | vsi_node = list_elem->vsi_node[tc]; | ||
758 | /* validate invalid VSI id */ | ||
759 | if (!vsi_node) | ||
760 | goto lan_q_exit; | ||
761 | /* get the first q group node from VSI sub-tree */ | ||
762 | qgrp_node = ice_sched_get_first_node(pi->hw, vsi_node, qgrp_layer); | ||
763 | while (qgrp_node) { | ||
764 | /* make sure the qgroup node is part of the VSI subtree */ | ||
765 | if (ice_sched_find_node_in_subtree(pi->hw, vsi_node, qgrp_node)) | ||
766 | if (qgrp_node->num_children < max_children && | ||
767 | qgrp_node->owner == owner) | ||
768 | break; | ||
769 | qgrp_node = qgrp_node->sibling; | ||
770 | } | ||
771 | lan_q_exit: | ||
772 | return qgrp_node; | ||
773 | } | ||