/* The TEID is same as that of the start_node */ if (ICE_TXSCHED_GET_NODE_TEID(start_node) == teid) return start_node;
/* The node has no children or is at the max layer */ if (!start_node->num_children ||
start_node->tx_sched_layer >= ICE_AQC_TOPO_MAX_LEVEL_NUM ||
start_node->info.data.elem_type == ICE_AQC_ELEM_TYPE_LEAF) return NULL;
/* Check if TEID matches to any of the children nodes */ for (i = 0; i < start_node->num_children; i++) if (ICE_TXSCHED_GET_NODE_TEID(start_node->children[i]) == teid) return start_node->children[i];
/* Search within each child's sub-tree */ for (i = 0; i < start_node->num_children; i++) { struct ice_sched_node *tmp;
tmp = ice_sched_find_node_by_teid(start_node->children[i],
teid); if (tmp) return tmp;
}
/* A valid parent node should be there */
parent = ice_sched_find_node_by_teid(pi->root,
le32_to_cpu(info->parent_teid)); if (!parent) {
ice_debug(hw, ICE_DBG_SCHED, "Parent Node not found for parent_teid=0x%x\n",
le32_to_cpu(info->parent_teid)); return -EINVAL;
}
/* query the current node information from FW before adding it *totheSWDB
*/
status = ice_sched_query_elem(hw, le32_to_cpu(info->node_teid), &elem); if (status) return status;
if (prealloc_node)
node = prealloc_node; else
node = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*node), GFP_KERNEL); if (!node) return -ENOMEM; if (hw->max_children[layer]) {
node->children = devm_kcalloc(ice_hw_to_dev(hw),
hw->max_children[layer], sizeof(*node->children), GFP_KERNEL); if (!node->children) {
devm_kfree(ice_hw_to_dev(hw), node); return -ENOMEM;
}
}
if (!pi || !pi->root) return NULL; for (i = 0; i < pi->root->num_children; i++) if (pi->root->children[i]->tc_num == tc) return pi->root->children[i]; return NULL;
}
/* Free the children before freeing up the parent node *Theparentarrayisupdatedbelowandthatshiftsthenodes *inthearray.Soalwayspickthefirstchildifnumchildren>0
*/ while (node->num_children)
ice_free_sched_node(pi, node->children[0]);
/* Leaf, TC and root nodes can't be deleted by SW */ if (node->tx_sched_layer >= hw->sw_entry_point_layer &&
node->info.data.elem_type != ICE_AQC_ELEM_TYPE_TC &&
node->info.data.elem_type != ICE_AQC_ELEM_TYPE_ROOT_PORT &&
node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF) {
u32 teid = le32_to_cpu(node->info.node_teid);
ice_sched_remove_elems(hw, node->parent, teid);
}
parent = node->parent; /* root has no parent */ if (parent) { struct ice_sched_node *p;
/* update the parent */ for (i = 0; i < parent->num_children; i++) if (parent->children[i] == node) { for (j = i + 1; j < parent->num_children; j++)
parent->children[j - 1] =
parent->children[j];
parent->num_children--; break;
}
p = ice_sched_get_first_node(pi, node, node->tx_sched_layer); while (p) { if (p->sibling == node) {
p->sibling = node->sibling; break;
}
p = p->sibling;
}
/* update the sibling head if head is getting removed */ if (pi->sib_head[node->tc_num][node->tx_sched_layer] == node)
pi->sib_head[node->tc_num][node->tx_sched_layer] =
node->sibling;
}
*num_nodes_added = num_nodes; /* add nodes to the SW DB */ for (i = 0; i < num_nodes; i++) { if (prealloc_nodes)
status = ice_sched_add_node(pi, layer, &buf->generic[i], prealloc_nodes[i]); else
status = ice_sched_add_node(pi, layer, &buf->generic[i], NULL);
if (status) {
ice_debug(hw, ICE_DBG_SCHED, "add nodes in SW DB failed status =%d\n",
status); break;
}
teid = le32_to_cpu(buf->generic[i].node_teid);
new_node = ice_sched_find_node_by_teid(parent, teid); if (!new_node) {
ice_debug(hw, ICE_DBG_SCHED, "Node is missing for teid =%d\n", teid); break;
}
if (!parent || layer < pi->hw->sw_entry_point_layer) return -EINVAL;
/* max children per node per layer */
max_child_nodes = pi->hw->max_children[parent->tx_sched_layer];
/* current number of children + required nodes exceed max children */ if ((parent->num_children + num_nodes) > max_child_nodes) { /* Fail if the parent is a TC node */ if (parent == tc_node) return -EIO; return -ENOSPC;
}
status = ice_sched_add_nodes_to_hw_layer(pi, tc_node, parent,
layer, new_num_nodes,
first_teid_ptr,
&num_added); if (!status)
*num_nodes_added += num_added; /* added more nodes than requested ? */ if (*num_nodes_added > num_nodes) {
ice_debug(pi->hw, ICE_DBG_SCHED, "added extra nodes %d %d\n", num_nodes,
*num_nodes_added);
status = -EIO; break;
} /* break if all the nodes are added successfully */ if (!status && (*num_nodes_added == num_nodes)) break; /* break if the error is not max limit */ if (status && status != -ENOSPC) break; /* Exceeded the max children */
max_child_nodes = pi->hw->max_children[parent->tx_sched_layer]; /* utilize all the spaces if the parent is not full */ if (parent->num_children < max_child_nodes) {
new_num_nodes = max_child_nodes - parent->num_children;
} else { /* This parent is full, *trythenextavailablesibling.
*/
parent = ice_sched_find_next_vsi_node(parent); /* Don't modify the first node TEID memory if the *firstnodewasaddedalreadyintheabovecall. *Insteadsendsometempmemoryforallother *recursivecalls.
*/ if (num_added)
first_teid_ptr = &temp;
/** *ice_sched_get_qgrp_layer-getthecurrentqueuegrouplayernumber *@hw:pointertotheHWstruct * *Thisfunctionreturnsthecurrentqueuegrouplayernumber
*/ static u8 ice_sched_get_qgrp_layer(struct ice_hw *hw)
{ /* It's always total layers - 1, the array is 0 relative so -2 */ return hw->num_tx_sched_layers - ICE_QGRP_LAYER_OFFSET;
}
/** *ice_sched_get_vsi_layer-getthecurrentVSIlayernumber *@hw:pointertotheHWstruct * *ThisfunctionreturnsthecurrentVSIlayernumber
*/
u8 ice_sched_get_vsi_layer(struct ice_hw *hw)
{ /* Num Layers VSI layer *96 *74 *5orlesssw_entry_point_layer
*/ /* calculate the VSI layer based on number of layers. */ if (hw->num_tx_sched_layers == ICE_SCHED_9_LAYERS) return hw->num_tx_sched_layers - ICE_VSI_LAYER_OFFSET; elseif (hw->num_tx_sched_layers == ICE_SCHED_5_LAYERS) /* qgroup and VSI layers are same */ return hw->num_tx_sched_layers - ICE_QGRP_LAYER_OFFSET; return hw->sw_entry_point_layer;
}
/** *ice_sched_get_agg_layer-getthecurrentaggregatorlayernumber *@hw:pointertotheHWstruct * *Thisfunctionreturnsthecurrentaggregatorlayernumber
*/
u8 ice_sched_get_agg_layer(struct ice_hw *hw)
{ /* Num Layers aggregator layer *94 *7orlesssw_entry_point_layer
*/ /* calculate the aggregator layer based on number of layers. */ if (hw->num_tx_sched_layers == ICE_SCHED_9_LAYERS) return hw->num_tx_sched_layers - ICE_AGG_LAYER_OFFSET; else return hw->sw_entry_point_layer;
}
/* remove the default nodes except TC and root nodes */
node = pi->root; while (node) { if (node->tx_sched_layer >= pi->hw->sw_entry_point_layer &&
node->info.data.elem_type != ICE_AQC_ELEM_TYPE_TC &&
node->info.data.elem_type != ICE_AQC_ELEM_TYPE_ROOT_PORT) {
ice_free_sched_node(pi, node); break;
}
if (!node->num_children) break;
node = node->children[0];
}
}
/** *ice_sched_init_port-InitializeschedulerbyqueryinginformationfromFW *@pi:portinfostructureforthetreetocleanup * *ThisfunctionistheinitialcalltofindthetotalnumberofTxscheduler *resources,defaulttopologycreatedbyfirmwareandstoringtheinformation *inSWDB.
*/ int ice_sched_init_port(struct ice_port_info *pi)
{ struct ice_aqc_get_topo_elem *buf; struct ice_hw *hw;
u8 num_branches;
u16 num_elems; int status;
u8 i, j;
if (!pi) return -EINVAL;
hw = pi->hw;
/* Query the Default Topology from FW */
buf = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL); if (!buf) return -ENOMEM;
/* Query default scheduling tree topology */
status = ice_aq_get_dflt_topo(hw, pi->lport, buf, ICE_AQ_MAX_BUF_LEN,
&num_branches, NULL); if (status) goto err_init_port;
/* num_branches should be between 1-8 */ if (num_branches < 1 || num_branches > ICE_TXSCHED_MAX_BRANCHES) {
ice_debug(hw, ICE_DBG_SCHED, "num_branches unexpected %d\n",
num_branches);
status = -EINVAL; goto err_init_port;
}
/* get the number of elements on the default/first branch */
num_elems = le16_to_cpu(buf[0].hdr.num_elems);
/* num_elems should always be between 1-9 */ if (num_elems < 1 || num_elems > ICE_AQC_TOPO_MAX_LEVEL_NUM) {
ice_debug(hw, ICE_DBG_SCHED, "num_elems unexpected %d\n",
num_elems);
status = -EINVAL; goto err_init_port;
}
/* If the last node is a leaf node then the index of the queue group *layeristwolessthanthenumberofelements.
*/ if (num_elems > 2 && buf[0].generic[num_elems - 1].data.elem_type ==
ICE_AQC_ELEM_TYPE_LEAF)
pi->last_node_teid =
le32_to_cpu(buf[0].generic[num_elems - 2].node_teid); else
pi->last_node_teid =
le32_to_cpu(buf[0].generic[num_elems - 1].node_teid);
/* Insert the Tx Sched root node */
status = ice_sched_add_root_node(pi, &buf[0].generic[0]); if (status) goto err_init_port;
/* Parse the default tree and cache the information */ for (i = 0; i < num_branches; i++) {
num_elems = le16_to_cpu(buf[i].hdr.num_elems);
/* Skip root element as already inserted */ for (j = 1; j < num_elems; j++) { /* update the sw entry point */ if (buf[0].generic[j].data.elem_type ==
ICE_AQC_ELEM_TYPE_ENTRY_POINT)
hw->sw_entry_point_layer = j;
status = ice_sched_add_node(pi, j, &buf[i].generic[j], NULL); if (status) goto err_init_port;
}
}
/* Remove the default nodes. */ if (pi->root)
ice_sched_rm_dflt_nodes(pi);
/* initialize the port for handling the scheduler tree */
pi->port_state = ICE_SCHED_PORT_STATE_READY;
mutex_init(&pi->sched_lock); for (i = 0; i < ICE_AQC_TOPO_MAX_LEVEL_NUM; i++)
INIT_LIST_HEAD(&pi->rl_prof_list[i]);
/* max sibling group size of current layer refers to the max children *ofthebelowlayernode. *layer1nodemaxchildrenwillbelayer2maxsiblinggroupsize *layer2nodemaxchildrenwillbelayer3maxsiblinggroupsize *andsoon.Thisarraywillbepopulatedfromroot(index0)to *qgrouplayer7.Leafnodehasnochildren.
*/ for (i = 0; i < hw->num_tx_sched_layers - 1; i++) {
max_sibl = buf->layer_props[i + 1].max_sibl_grp_sz;
hw->max_children[i] = le16_to_cpu(max_sibl);
}
hw->layer_info = devm_kmemdup(ice_hw_to_dev(hw), buf->layer_props,
(hw->num_tx_sched_layers * sizeof(*hw->layer_info)),
GFP_KERNEL); if (!hw->layer_info) {
status = -ENOMEM; goto sched_query_out;
}
if (!qgrp_node) return qgrp_node;
min_children = qgrp_node->num_children; if (!min_children) return qgrp_node;
min_qgrp = qgrp_node; /* scan all queue groups until find a node which has less than the *minimumnumberofchildren.Thiswayallqueuegroupnodesget *equalnumberofsharesandactive.Thebandwidthwillbeequally *distributedacrossallqueues.
*/ while (qgrp_node) { /* make sure the qgroup node is part of the VSI subtree */ if (ice_sched_find_node_in_subtree(pi->hw, vsi_node, qgrp_node)) if (qgrp_node->num_children < min_children &&
qgrp_node->owner == owner) { /* replace the new min queue group node */
min_qgrp = qgrp_node;
min_children = min_qgrp->num_children; /* break if it has no children, */ if (!min_children) break;
}
qgrp_node = qgrp_node->sibling;
} return min_qgrp;
}
vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle); if (!vsi_ctx) return NULL;
vsi_node = vsi_ctx->sched.vsi_node[tc]; /* validate invalid VSI ID */ if (!vsi_node) return NULL;
/* If the queue group and VSI layer are same then queues *areallattacheddirectlytoVSI
*/ if (qgrp_layer == vsi_layer) return vsi_node;
/* get the first queue group node from VSI sub-tree */
qgrp_node = ice_sched_get_first_node(pi, vsi_node, qgrp_layer); while (qgrp_node) { struct ice_sched_node *next_vsi_node;
/* make sure the qgroup node is part of the VSI subtree */ if (ice_sched_find_node_in_subtree(pi->hw, vsi_node, qgrp_node)) if (qgrp_node->num_children < max_children &&
qgrp_node->owner == owner) break;
qgrp_node = qgrp_node->sibling; if (qgrp_node) continue;
next_vsi_node = ice_sched_find_next_vsi_node(vsi_node); if (!next_vsi_node) break;
/* calculate num nodes from queue group to VSI layer */ for (i = qgl; i > vsil; i--) { /* round to the next integer if there is a remainder */
num = DIV_ROUND_UP(num, hw->max_children[i]);
/* need at least one node */
num_nodes[i] = num ? num : 1;
}
}
qgl = ice_sched_get_qgrp_layer(hw);
vsil = ice_sched_get_vsi_layer(hw);
parent = ice_sched_get_vsi_node(pi, tc_node, vsi_handle); for (i = vsil + 1; i <= qgl; i++) { int status;
if (!parent) return -EIO;
status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,
num_nodes[i],
&first_node_teid,
&num_added); if (status || num_nodes[i] != num_added) return -EIO;
/* The newly added node can be a new parent for the next *layernodes
*/ if (num_added) {
parent = ice_sched_find_node_by_teid(tc_node,
first_node_teid);
node = parent; while (node) {
node->owner = owner;
node = node->sibling;
}
} else {
parent = parent->children[0];
}
}
vsil = ice_sched_get_vsi_layer(pi->hw); for (i = vsil; i >= pi->hw->sw_entry_point_layer; i--) /* Add intermediate nodes if TC has no children and *needatleastonenodeforVSI
*/ if (!tc_node->num_children || i == vsil) {
num_nodes[i]++;
} else { /* If intermediate nodes are reached max children *thenaddanewone.
*/
node = ice_sched_get_first_node(pi, tc_node, (u8)i); /* scan all the siblings */ while (node) { if (node->num_children < pi->hw->max_children[i]) break;
node = node->sibling;
}
/* tree has one intermediate node to add this new VSI. *Sononeedtocalculatesupportednodesforbelow *layers.
*/ if (node) break; /* all the nodes are full, allocate a new one */
num_nodes[i]++;
}
}
vsil = ice_sched_get_vsi_layer(pi->hw); for (i = pi->hw->sw_entry_point_layer; i <= vsil; i++) { int status;
status = ice_sched_add_nodes_to_layer(pi, tc_node, parent,
i, num_nodes[i],
&first_node_teid,
&num_added); if (status || num_nodes[i] != num_added) return -EIO;
/* The newly added node can be a new parent for the next *layernodes
*/ if (num_added)
parent = ice_sched_find_node_by_teid(tc_node,
first_node_teid); else
parent = parent->children[0];
if (!parent) return -EIO;
/* Do not modify the VSI handle for already existing VSI nodes, *(ifnonewVSInodewasaddedtothetree). *AssigntheVSIhandleonlytonewlyaddedVSInodes.
*/ if (i == vsil && num_added)
parent->vsi_handle = vsi_handle;
}
tc_node = ice_sched_get_tc_node(pi, tc); if (!tc_node) return -EIO;
vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle); if (!vsi_node) return -EIO;
vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle); if (!vsi_ctx) return -EINVAL;
if (owner == ICE_SCHED_NODE_OWNER_LAN)
prev_numqs = vsi_ctx->sched.max_lanq[tc]; else
prev_numqs = vsi_ctx->sched.max_rdmaq[tc]; /* num queues are not changed or less than the previous number */ if (new_numqs <= prev_numqs) return status; if (owner == ICE_SCHED_NODE_OWNER_LAN) {
status = ice_alloc_lan_q_ctx(hw, vsi_handle, tc, new_numqs); if (status) return status;
} else {
status = ice_alloc_rdma_q_ctx(hw, vsi_handle, tc, new_numqs); if (status) return status;
}
/* Never decrease the number of queues in the tree. Update the tree *onlyifnumberofqueues>previousnumberofqueues.Thismay *leavesomeextranodesinthetreeifnumberofqueues<previous *numberbutthatwouldn'tharmanything.Removingthoseextranodes *maycomplicatethecodeifthosenodesarepartofSRLor *individuallyratelimited. *Also,addtherequiredVSIsupportnodesiftheexistingonescannot *handletherequestednewnumberofqueues.
*/
status = ice_sched_add_vsi_support_nodes(pi, vsi_handle, tc_node,
new_num_nodes); if (status) return status;
status = ice_sched_add_vsi_child_nodes(pi, vsi_handle, tc_node,
new_num_nodes, owner); if (status) return status; if (owner == ICE_SCHED_NODE_OWNER_LAN)
vsi_ctx->sched.max_lanq[tc] = new_numqs; else
vsi_ctx->sched.max_rdmaq[tc] = new_numqs;
ice_debug(pi->hw, ICE_DBG_SCHED, "add/config VSI %d\n", vsi_handle);
tc_node = ice_sched_get_tc_node(pi, tc); if (!tc_node) return -EINVAL;
vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle); if (!vsi_ctx) return -EINVAL;
vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
/* suspend the VSI if TC is not enabled */ if (!enable) { if (vsi_node && vsi_node->in_use) {
u32 teid = le32_to_cpu(vsi_node->info.node_teid);
status = ice_sched_suspend_resume_elems(hw, 1, &teid, true); if (!status)
vsi_node->in_use = false;
} return status;
}
/* TC is enabled, if it is a new VSI then add it to the tree */ if (!vsi_node) {
status = ice_sched_add_vsi_to_topo(pi, vsi_handle, tc); if (status) return status;
vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle); if (!vsi_node) return -EIO;
vsi_ctx->sched.vsi_node[tc] = vsi_node;
vsi_node->in_use = true; /* invalidate the max queues whenever VSI gets added first time *intotheschedulertree(bootorafterreset).Weneedto *recreatethechildnodesallthetimeinthesecases.
*/
vsi_ctx->sched.max_lanq[tc] = 0;
vsi_ctx->sched.max_rdmaq[tc] = 0;
}
/* update the VSI child nodes */
status = ice_sched_update_vsi_child_nodes(pi, vsi_handle, tc, maxqs,
owner); if (status) return status;
/* TC is enabled, resume the VSI if it is in the suspend state */ if (!vsi_node->in_use) {
u32 teid = le32_to_cpu(vsi_node->info.node_teid);
status = ice_sched_suspend_resume_elems(hw, 1, &teid, false); if (!status)
vsi_node->in_use = true;
}
for (i = 0; i < node->num_children; i++) if (ice_sched_is_leaf_node_present(node->children[i])) returntrue; /* check for a leaf node */ return (node->info.data.elem_type == ICE_AQC_ELEM_TYPE_LEAF);
}
/* Is it VSI parent layer ? */ if (l == vsil - 1) return (node->num_children < hw->max_children[l]) ? node : NULL;
/* We have intermediate nodes. Let's walk through the subtree. If the *intermediatenodehasspacetoaddanewnodethenclearthecount
*/ if (node->num_children < hw->max_children[l])
num_nodes[l] = 0; /* The below recursive call is intentional and wouldn't go more than *2or3iterations.
*/
for (i = 0; i < node->num_children; i++) { struct ice_sched_node *parent;
parent = ice_sched_get_free_vsi_parent(hw, node->children[i],
num_nodes); if (parent) return parent;
}
/* update the old parent children */ for (i = 0; i < old_parent->num_children; i++) if (old_parent->children[i] == node) { for (j = i + 1; j < old_parent->num_children; j++)
old_parent->children[j - 1] =
old_parent->children[j];
old_parent->num_children--; break;
}
/* now move the node to a new parent */
new_parent->children[new_parent->num_children++] = node;
node->parent = new_parent;
node->info.parent_teid = new_parent->info.node_teid;
}
/* set intermediate node count to 1 between aggregator and VSI layers */ for (i = aggl + 1; i < vsil; i++)
num_nodes[i] = 1;
/* Check if the aggregator subtree has any free node to add the VSI */ for (i = 0; i < agg_node->num_children; i++) {
parent = ice_sched_get_free_vsi_parent(pi->hw,
agg_node->children[i],
num_nodes); if (parent) goto move_nodes;
}
/* add new nodes */
parent = agg_node; for (i = aggl + 1; i < vsil; i++) {
status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,
num_nodes[i],
&first_node_teid,
&num_nodes_added); if (status || num_nodes[i] != num_nodes_added) return -EIO;
/* The newly added node can be a new parent for the next *layernodes
*/ if (num_nodes_added)
parent = ice_sched_find_node_by_teid(tc_node,
first_node_teid); else
parent = parent->children[0];
tc_node = ice_sched_get_tc_node(pi, tc); if (!tc_node) return -EIO;
agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id); if (!agg_node) return -ENOENT;
/* Can't remove the aggregator node if it has children */ if (ice_sched_is_agg_inuse(pi, agg_node)) return -EBUSY;
/* need to remove the whole subtree if aggregator node is the *onlychild.
*/ while (agg_node->tx_sched_layer > hw->sw_entry_point_layer) { struct ice_sched_node *parent = agg_node->parent;
tc_node = ice_sched_get_tc_node(pi, tc); if (!tc_node) return -EIO;
agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id); /* Does Agg node already exist ? */ if (agg_node) return status;
aggl = ice_sched_get_agg_layer(hw);
/* need one node in Agg layer */
num_nodes[aggl] = 1;
/* Check whether the intermediate nodes have space to add the *newaggregator.Iftheyarefull,thenSWneedstoallocateanew *intermediatenodeonthoselayers
*/ for (i = hw->sw_entry_point_layer; i < aggl; i++) {
parent = ice_sched_get_first_node(pi, tc_node, i);
/* scan all the siblings */ while (parent) { if (parent->num_children < hw->max_children[i]) break;
parent = parent->sibling;
}
/* all the nodes are full, reserve one for this layer */ if (!parent)
num_nodes[i]++;
}
/* add the aggregator node */
parent = tc_node; for (i = hw->sw_entry_point_layer; i <= aggl; i++) { if (!parent) return -EIO;
status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,
num_nodes[i],
&first_node_teid,
&num_nodes_added); if (status || num_nodes[i] != num_nodes_added) return -EIO;
/* The newly added node can be a new parent for the next *layernodes
*/ if (num_nodes_added) {
parent = ice_sched_find_node_by_teid(tc_node,
first_node_teid); /* register aggregator ID with the aggregator node */ if (parent && i == aggl)
parent->agg_id = agg_id;
} else {
parent = parent->children[0];
}
}
agg_info = ice_get_agg_info(hw, agg_id); if (!agg_info) { /* Create new entry for new aggregator ID */
agg_info = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*agg_info),
GFP_KERNEL); if (!agg_info) return -ENOMEM;
if (!ice_is_vsi_valid(pi->hw, vsi_handle)) return -EINVAL;
agg_info = ice_get_agg_info(hw, agg_id); if (!agg_info) return -EINVAL; /* If the VSI is already part of another aggregator then update *itsVSIinfolist
*/
old_agg_info = ice_get_vsi_agg_info(hw, vsi_handle); if (old_agg_info && old_agg_info != agg_info) { struct ice_sched_agg_vsi_info *vtmp;
/* check if entry already exist */
agg_vsi_info = ice_get_agg_vsi_info(agg_info, vsi_handle); if (!agg_vsi_info) { /* Create new entry for VSI under aggregator list */
agg_vsi_info = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*agg_vsi_info), GFP_KERNEL); if (!agg_vsi_info) return -EINVAL;
/* add VSI ID into the aggregator list */
agg_vsi_info->vsi_handle = vsi_handle;
list_add(&agg_vsi_info->list_entry, &agg_info->agg_vsi_list);
} /* Move VSI node to new aggregator node for requested TC(s) */
ice_for_each_traffic_class(tc) { if (!ice_is_tc_ena(*tc_bitmap, tc)) continue;
/* Move VSI to new aggregator */
status = ice_sched_move_vsi_to_agg(pi, vsi_handle, agg_id, tc); if (status) break;
set_bit(tc, agg_vsi_info->tc_bitmap); if (old_agg_vsi_info)
clear_bit(tc, old_agg_vsi_info->tc_bitmap);
} if (old_agg_vsi_info && !old_agg_vsi_info->tc_bitmap[0]) {
list_del(&old_agg_vsi_info->list_entry);
devm_kfree(ice_hw_to_dev(pi->hw), old_agg_vsi_info);
} return status;
}
buf = *info; /* Parent TEID is reserved field in this aq call */
buf.parent_teid = 0; /* Element type is reserved field in this aq call */
buf.data.elem_type = 0; /* Flags is reserved field in this aq call */
buf.data.flags = 0;
/* Update HW DB */ /* Configure element node */
status = ice_aq_cfg_sched_elems(hw, num_elems, &buf, sizeof(buf),
&elem_cfgd, NULL); if (status || elem_cfgd != num_elems) {
ice_debug(hw, ICE_DBG_SCHED, "Config sched elem error\n"); return -EIO;
}
/* Config success case */ /* Now update local SW DB */ /* Only copy the data portion of info buffer */
node->info.data = info->data; return status;
}
/* Multiplier value */
mv_tmp = div64_long(bytes_per_sec * ICE_RL_PROF_MULTIPLIER,
ts_rate);
/* Round to the nearest ICE_RL_PROF_MULTIPLIER */
mv = round_up_64bit(mv_tmp, ICE_RL_PROF_MULTIPLIER);
/* First multiplier value greater than the given *accuracybytes
*/ if (mv > ICE_RL_PROF_ACCURACY_BYTES) {
encode = i;
found = true; break;
}
} if (found) {
u16 wm;
if (!pi || layer_num >= pi->hw->num_tx_sched_layers) return NULL; switch (rl_type) { case ICE_MIN_BW:
profile_type = ICE_AQC_RL_PROFILE_TYPE_CIR; break; case ICE_MAX_BW:
profile_type = ICE_AQC_RL_PROFILE_TYPE_EIR; break; case ICE_SHARED_BW:
profile_type = ICE_AQC_RL_PROFILE_TYPE_SRL; break; default: return NULL;
}
hw = pi->hw;
list_for_each_entry(rl_prof_elem, &pi->rl_prof_list[layer_num],
list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) ==
profile_type && rl_prof_elem->bw == bw) /* Return existing profile ID info */ return rl_prof_elem;
/* Create new profile ID */
rl_prof_elem = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*rl_prof_elem),
GFP_KERNEL);
if (!rl_prof_elem) return NULL;
status = ice_sched_bw_to_rl_profile(hw, bw, &rl_prof_elem->profile); if (status) goto exit_add_rl_prof;
rl_prof_elem->bw = bw; /* layer_num is zero relative, and fw expects level from 1 to 9 */
rl_prof_elem->profile.level = layer_num + 1;
rl_prof_elem->profile.flags = profile_type;
rl_prof_elem->profile.max_burst_size = cpu_to_le16(hw->max_burst_size);
/* Create new entry in HW DB */
buf = &rl_prof_elem->profile;
status = ice_aq_add_rl_profile(hw, num_profiles, buf, sizeof(*buf),
&profiles_added, NULL); if (status || profiles_added != num_profiles) goto exit_add_rl_prof;
/* Good entry - add in the list */
rl_prof_elem->prof_id_ref = 0;
list_add(&rl_prof_elem->list_entry, &pi->rl_prof_list[layer_num]); return rl_prof_elem;
if (layer_num >= pi->hw->num_tx_sched_layers) return -EINVAL; /* Check the existing list for RL profile */
list_for_each_entry(rl_prof_elem, &pi->rl_prof_list[layer_num],
list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) ==
profile_type &&
le16_to_cpu(rl_prof_elem->profile.profile_id) ==
profile_id) { if (rl_prof_elem->prof_id_ref)
rl_prof_elem->prof_id_ref--;
/* Remove old profile ID from database */
status = ice_sched_del_rl_profile(pi->hw, rl_prof_elem); if (status && status != -EBUSY)
ice_debug(pi->hw, ICE_DBG_SCHED, "Remove rl profile failed\n"); break;
} if (status == -EBUSY)
status = 0; return status;
}
/** *ice_sched_set_eir_srl_excl-setEIR/SRLexclusiveness *@pi:portinformationstructure *@node:pointertonodestructure *@layer_num:layernumberwhereratelimitprofilesaresaved *@rl_type:ratelimittypemin,max,orshared *@bw:bandwidthvalue * *Thisfunctionpreparesnodeelement'sbandwidthtoSRLorEIRexclusively. *EIRBWandSharedBWprofilesaremutuallyexclusiveandhenceonlyoneof *themmaybesetforanygivenelement.Thisfunctionneedstobecalled *withtheschedulerlockheld.
*/ staticint
ice_sched_set_eir_srl_excl(struct ice_port_info *pi, struct ice_sched_node *node,
u8 layer_num, enum ice_rl_type rl_type, u32 bw)
{ if (rl_type == ICE_SHARED_BW) { /* SRL node passed in this case, it may be different node */ if (bw == ICE_SCHED_DFLT_BW) /* SRL being removed, ice_sched_cfg_node_bw_lmt() *enablesEIRtodefault.EIRisnotsetinthis *case,sonoadditionalactionisrequired.
*/ return0;
/* SRL being configured, set EIR to default here. *ice_sched_cfg_node_bw_lmt()disables* *SRL
*/ returnp, ICE_MAX_BW,
layer_num);
} elseif (rl_type == ICE_MAX_BW &&
node->info.data.valid_sections & ICE_AQC_ELEM_VALID_SHARED) { /* Remove Shared profile. Set default shared BW call sharedprofileforanodejava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
*/ return ice_sched_set_node_bw_dflt(pi, node,
ICE_SHARED_BW,
layer_num);
} return java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 54
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** void(idpf_hwhwstructcqjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 *@pi:portqforqueuetobecreated njava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 19 *@rl_type:ratelimittype*iferrorsoccurjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 binKbps-sec *GFP_KERNEL
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *IDfromlocaldatabase.Thecaller*@:pointerhardwarestruct
*/ int
ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, enum ice_rl_type rl_type, u32 bw, u8 layer_num)
{ struct ice_aqc_rl_profile_info *rl_prof_info; struct ice_hw * * destroyed.Thismustbe priortojava.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 74
u16 old_id, structidpf_ctlq_create_infoq_infojava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
rl_prof_info (i ,bw ) if (!rl_prof_info) return status;*idpf_ctlq_send-commandControl CTQ)
rl_prof_id = le16_to_cpu(rl_prof_info-> q_sg: pointer to array of queuemessages to be sent
/* Save existing RL prof ID for later clean up */
old_id = ice_sched_get_node_rl_prof_id(node, rl_type); /* Configure BW scheduling parameters */
status int (truct *w, struct idpf_ctlq_infocqjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 if (status)
status
/* New changes has been applied */ /* Increment the profile ID reference count */
rl_prof_info->prof_id_ref++;
/* Check for old ID removal */ if ((old_id == java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
old_id }else
(->ext_to_use+;
/** *ice_sched_set_node_priority-*@sg_status:(utput)pointertopointerarraypopulated;needs *@pi:portinformationstructure *@node:treenode *@priority:number0-7representingpriorityamongsiblings * *Thisfunctionsetspriorityofanodeamongit'ssiblings.
*/ int
ice_sched_set_node_priority(struct e_port_info *pi,struct ice_sched_node *ode,
priority
{
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 struct * idpf_ctlq_post_rx_buffs - to
buf = node->info;
data = &buf.data;
function DMAbuffers thering
data->generic |= FIELD_PREP(ICE_AQC_ELEM_GENERIC_PRIO_M, priority);
returnice_sched_update_elem(i>, node &buf);
}
/** java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 52 *java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 34 *:treejava.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19 :number1200representingweightforjava.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52 * *ThisfunctionsetsweightofthenodeforWFQalgorithm.
*/ int
ice_sched_set_node_weight(struct
{ struct ice_aqc_txsched_elem_data bufcq-rx_buff] =i; struct ice_aqc_txsched_elem *data;
buf = node- cpu_to_le32upper_32_bitscq>.[]->a);
data
data->valid_sections = ICE_AQC_ELEM_VALID_CIR | ICE_AQC_ELEM_VALID_EIR | * Wrap to end of end ring since current ntp is 0 */
data-
data->eir_bw.bw_alloc = cpu_to_le16(weight);
data->generic |= FIELD_PREP(ICE_AQC_ELEM_GENERIC_SP_M, 0x0 java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 46
return ice_sched_update_elem(pi->hw, node, &buf
}
* nodes BWlimit
* @pi: port for (i = 0; i < num_to_clean java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
* @node: tree node
* @rl_type: rate limit type min, max, or shared IDPF_CTLQ_FLAG_FTYPE_PF) >
* @bw: java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
*
*Itupdates node'BWlimit like RL of CIR,
* java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ int
ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node, enum ice_rl_type rl_type, u32
{ struct ice_sched_node *cfg_node = node; int status;
struct ice_hw *hw;
u8 layer_num;
if (!pi) return -EINVAL;
hw = pi->hw; /* Remove unused RL profile IDs from HW and SW DB */
ice_sched_rm_unused_rl_prof(pi);
layer_num = ice_sched_get_rl_prof_layer(pi, rl_type,
node->tx_sched_layer); if (layer_num >= hw->num_tx_sched_layers) return -EINVAL;
if (rl_type == ICE_SHARED_BW) { /* SRL node may be different */
cfg_node = ice_sched_get_srl_node(node, layer_num); if (!cfg_node) return -EIO;
} /* EIR BW and Shared BW profiles are mutually exclusive and *henceonlyoneofthemmaybesetforanygivenelement
*/
status = ice_sched_set_eir_srl_excl(pi, cfg_node, layer_num, rl_type,
bw); if (status) return status; if (bw == ICE_SCHED_DFLT_BW) return ice_sched_set_node_bw_dflt(pi, cfg_node, rl_type,
layer_num); return ice_sched_set_node_bw(pi, cfg_node, rl_type, bw, layer_num);
}
/* Some TC(s) may be missing after reset, adjust for replay */
ice_for_each_traffic_class(tc) if (ice_is_tc_ena(*tc_bitmap, tc) &&
(ice_sched_get_tc_node(pi, tc)))
set_bit(tc, ena_tc_bitmap);
}
bitmap_zero(replay_bitmap, ICE_MAX_TRAFFIC_CLASS); if (!ice_is_vsi_valid(hw, vsi_handle)) return -EINVAL;
agg_info = ice_get_vsi_agg_info(hw, vsi_handle); if (!agg_info) return0; /* Not present in list - default Agg case */
agg_vsi_info = ice_get_agg_vsi_info(agg_info, vsi_handle); if (!agg_vsi_info) return0; /* Not present in list - default Agg case */
ice_sched_get_ena_tc_bitmap(pi, agg_info->replay_tc_bitmap,
replay_bitmap); /* Replay aggregator node associated to vsi_handle */
status = ice_sched_cfg_agg(hw->port_info, agg_info->agg_id,
ICE_AGG_TYPE_AGG, replay_bitmap); if (status) return status;
bitmap_zero(replay_bitmap, ICE_MAX_TRAFFIC_CLASS);
ice_sched_get_ena_tc_bitmap(pi, agg_vsi_info->replay_tc_bitmap,
replay_bitmap); /* Move this VSI (vsi_handle) to above aggregator */ return ice_sched_assoc_vsi_to_agg(pi, agg_info->agg_id, vsi_handle,
replay_bitmap);
}
/* Following also checks the presence of node in tree */
q_node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid); if (!q_node) return -EINVAL; return ice_sched_replay_node_bw(pi->hw, q_node, &q_ctx->bw_t_info);
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.150Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.