mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 14:13:53 +00:00
ice: Add an option to pre-allocate memory for ice_sched_node
devlink-rate API requires a priv object to be allocated when node still doesn't have a parent. This is problematic, because ice_sched_node can't be currently created without a parent. Add an option to pre-allocate memory for ice_sched_node struct. Add new arguments to ice_sched_add() and ice_sched_add_elems() that allow for pre-allocation of memory for ice_sched_node struct. Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
16dfa49406
commit
bdf96d965a
@ -4603,7 +4603,7 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
|
||||
q_ctx->q_teid = le32_to_cpu(node.node_teid);
|
||||
|
||||
/* add a leaf node into scheduler tree queue layer */
|
||||
status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node);
|
||||
status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node, NULL);
|
||||
if (!status)
|
||||
status = ice_sched_replay_q_bw(pi, q_ctx);
|
||||
|
||||
@ -4838,7 +4838,7 @@ ice_ena_vsi_rdma_qset(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
for (i = 0; i < num_qsets; i++) {
|
||||
node.node_teid = buf->rdma_qsets[i].qset_teid;
|
||||
ret = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1,
|
||||
&node);
|
||||
&node, NULL);
|
||||
if (ret)
|
||||
break;
|
||||
qset_teid[i] = le32_to_cpu(node.node_teid);
|
||||
|
@ -1580,7 +1580,7 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
|
||||
/* new TC */
|
||||
status = ice_sched_query_elem(pi->hw, teid2, &elem);
|
||||
if (!status)
|
||||
status = ice_sched_add_node(pi, 1, &elem);
|
||||
status = ice_sched_add_node(pi, 1, &elem, NULL);
|
||||
if (status)
|
||||
break;
|
||||
/* update the TC number */
|
||||
|
@ -143,12 +143,14 @@ ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
* @pi: port information structure
|
||||
* @layer: Scheduler layer of the node
|
||||
* @info: Scheduler element information from firmware
|
||||
* @prealloc_node: preallocated ice_sched_node struct for SW DB
|
||||
*
|
||||
* This function inserts a scheduler node to the SW DB.
|
||||
*/
|
||||
int
|
||||
ice_sched_add_node(struct ice_port_info *pi, u8 layer,
|
||||
struct ice_aqc_txsched_elem_data *info)
|
||||
struct ice_aqc_txsched_elem_data *info,
|
||||
struct ice_sched_node *prealloc_node)
|
||||
{
|
||||
struct ice_aqc_txsched_elem_data elem;
|
||||
struct ice_sched_node *parent;
|
||||
@ -177,7 +179,10 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
node = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*node), GFP_KERNEL);
|
||||
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]) {
|
||||
@ -876,13 +881,15 @@ void ice_sched_cleanup_all(struct ice_hw *hw)
|
||||
* @num_nodes: number of nodes
|
||||
* @num_nodes_added: pointer to num nodes added
|
||||
* @first_node_teid: if new nodes are added then return the TEID of first node
|
||||
* @prealloc_nodes: preallocated nodes struct for software DB
|
||||
*
|
||||
* This function add nodes to HW as well as to SW DB for a given layer
|
||||
*/
|
||||
int
|
||||
ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
|
||||
struct ice_sched_node *parent, u8 layer, u16 num_nodes,
|
||||
u16 *num_nodes_added, u32 *first_node_teid)
|
||||
u16 *num_nodes_added, u32 *first_node_teid,
|
||||
struct ice_sched_node **prealloc_nodes)
|
||||
{
|
||||
struct ice_sched_node *prev, *new_node;
|
||||
struct ice_aqc_add_elem *buf;
|
||||
@ -928,7 +935,11 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
|
||||
*num_nodes_added = num_nodes;
|
||||
/* add nodes to the SW DB */
|
||||
for (i = 0; i < num_nodes; i++) {
|
||||
status = ice_sched_add_node(pi, layer, &buf->generic[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);
|
||||
@ -1023,7 +1034,7 @@ ice_sched_add_nodes_to_hw_layer(struct ice_port_info *pi,
|
||||
}
|
||||
|
||||
return ice_sched_add_elems(pi, tc_node, parent, layer, num_nodes,
|
||||
num_nodes_added, first_node_teid);
|
||||
num_nodes_added, first_node_teid, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1288,7 +1299,7 @@ int ice_sched_init_port(struct ice_port_info *pi)
|
||||
ICE_AQC_ELEM_TYPE_ENTRY_POINT)
|
||||
hw->sw_entry_point_layer = j;
|
||||
|
||||
status = ice_sched_add_node(pi, j, &buf[i].generic[j]);
|
||||
status = ice_sched_add_node(pi, j, &buf[i].generic[j], NULL);
|
||||
if (status)
|
||||
goto err_init_port;
|
||||
}
|
||||
|
@ -83,7 +83,8 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node,
|
||||
int
|
||||
ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
|
||||
struct ice_sched_node *parent, u8 layer, u16 num_nodes,
|
||||
u16 *num_nodes_added, u32 *first_node_teid);
|
||||
u16 *num_nodes_added, u32 *first_node_teid,
|
||||
struct ice_sched_node **prealloc_node);
|
||||
|
||||
int
|
||||
ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,
|
||||
@ -105,7 +106,8 @@ struct ice_sched_node *
|
||||
ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid);
|
||||
int
|
||||
ice_sched_add_node(struct ice_port_info *pi, u8 layer,
|
||||
struct ice_aqc_txsched_elem_data *info);
|
||||
struct ice_aqc_txsched_elem_data *info,
|
||||
struct ice_sched_node *prealloc_node);
|
||||
void
|
||||
ice_sched_update_parent(struct ice_sched_node *new_parent,
|
||||
struct ice_sched_node *node);
|
||||
|
Loading…
Reference in New Issue
Block a user