return min(MLX5E_QOS_MAX_LEAF_NODES, mlx5_qos_max_leaf_nodes(mdev));
}
-int mlx5e_qos_cur_leaf_nodes(struct mlx5e_htb *htb)
+int mlx5e_htb_cur_leaf_nodes(struct mlx5e_htb *htb)
{
int last;
#define MLX5E_HTB_CLASSID_ROOT 0xffffffff
static struct mlx5e_qos_node *
-mlx5e_sw_node_create_leaf(struct mlx5e_htb *htb, u16 classid, u16 qid,
- struct mlx5e_qos_node *parent)
+mlx5e_htb_node_create_leaf(struct mlx5e_htb *htb, u16 classid, u16 qid,
+ struct mlx5e_qos_node *parent)
{
struct mlx5e_qos_node *node;
return node;
}
-static struct mlx5e_qos_node *mlx5e_sw_node_create_root(struct mlx5e_htb *htb)
+static struct mlx5e_qos_node *mlx5e_htb_node_create_root(struct mlx5e_htb *htb)
{
struct mlx5e_qos_node *node;
return node;
}
-static struct mlx5e_qos_node *mlx5e_sw_node_find(struct mlx5e_htb *htb, u32 classid)
+static struct mlx5e_qos_node *mlx5e_htb_node_find(struct mlx5e_htb *htb, u32 classid)
{
struct mlx5e_qos_node *node = NULL;
return node;
}
-static struct mlx5e_qos_node *mlx5e_sw_node_find_rcu(struct mlx5e_htb *htb, u32 classid)
+static struct mlx5e_qos_node *mlx5e_htb_node_find_rcu(struct mlx5e_htb *htb, u32 classid)
{
struct mlx5e_qos_node *node = NULL;
return node;
}
-static void mlx5e_sw_node_delete(struct mlx5e_htb *htb, struct mlx5e_qos_node *node)
+static void mlx5e_htb_node_delete(struct mlx5e_htb *htb, struct mlx5e_qos_node *node)
{
hash_del_rcu(&node->hnode);
if (node->qid != MLX5E_QOS_QID_INNER) {
return (chs->params.num_channels + is_ptp) * mlx5e_get_dcb_num_tc(&chs->params) + qid;
}
-int mlx5e_get_txq_by_classid(struct mlx5e_htb *htb, u16 classid)
+int mlx5e_htb_get_txq_by_classid(struct mlx5e_htb *htb, u16 classid)
{
struct mlx5e_qos_node *node;
u16 qid;
rcu_read_lock();
- node = mlx5e_sw_node_find_rcu(htb, classid);
+ node = mlx5e_htb_node_find_rcu(htb, classid);
if (!node) {
res = -ENOENT;
goto out;
goto err_cancel_selq;
}
- root = mlx5e_sw_node_create_root(htb);
+ root = mlx5e_htb_node_create_root(htb);
if (IS_ERR(root)) {
err = PTR_ERR(root);
goto err_free_queues;
return 0;
err_sw_node_delete:
- mlx5e_sw_node_delete(htb, root);
+ mlx5e_htb_node_delete(htb, root);
err_free_queues:
if (opened)
mlx5e_selq_prepare_htb(htb->selq, 0, 0);
mlx5e_selq_apply(htb->selq);
- root = mlx5e_sw_node_find(htb, MLX5E_HTB_CLASSID_ROOT);
+ root = mlx5e_htb_node_find(htb, MLX5E_HTB_CLASSID_ROOT);
if (!root) {
qos_err(htb->mdev, "Failed to find the root node in the QoS tree\n");
return -ENOENT;
if (err)
qos_err(htb->mdev, "Failed to destroy root node %u, err = %d\n",
root->hw_id, err);
- mlx5e_sw_node_delete(htb, root);
+ mlx5e_htb_node_delete(htb, root);
mlx5e_qos_deactivate_all_queues(&priv->channels);
mlx5e_qos_close_all_queues(&priv->channels);
return qid;
}
- parent = mlx5e_sw_node_find(htb, parent_classid);
+ parent = mlx5e_htb_node_find(htb, parent_classid);
if (!parent)
return -EINVAL;
- node = mlx5e_sw_node_create_leaf(htb, classid, qid, parent);
+ node = mlx5e_htb_node_create_leaf(htb, classid, qid, parent);
if (IS_ERR(node))
return PTR_ERR(node);
NL_SET_ERR_MSG_MOD(extack, "Firmware error when creating a leaf node.");
qos_err(htb->mdev, "Failed to create a leaf node (class %04x), err = %d\n",
classid, err);
- mlx5e_sw_node_delete(htb, node);
+ mlx5e_htb_node_delete(htb, node);
return err;
}
qos_dbg(htb->mdev, "TC_HTB_LEAF_TO_INNER classid %04x, upcoming child %04x, rate %llu, ceil %llu\n",
classid, child_classid, rate, ceil);
- node = mlx5e_sw_node_find(htb, classid);
+ node = mlx5e_htb_node_find(htb, classid);
if (!node)
return -ENOENT;
}
/* Intentionally reuse the qid for the upcoming first child. */
- child = mlx5e_sw_node_create_leaf(htb, child_classid, node->qid, node);
+ child = mlx5e_htb_node_create_leaf(htb, child_classid, node->qid, node);
if (IS_ERR(child)) {
err = PTR_ERR(child);
goto err_destroy_hw_node;
/* No fail point. */
qid = node->qid;
- /* Pairs with mlx5e_get_txq_by_classid. */
+ /* Pairs with mlx5e_htb_get_txq_by_classid. */
WRITE_ONCE(node->qid, MLX5E_QOS_QID_INNER);
if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
err_delete_sw_node:
child->qid = MLX5E_QOS_QID_INNER;
- mlx5e_sw_node_delete(htb, child);
+ mlx5e_htb_node_delete(htb, child);
err_destroy_hw_node:
tmp_err = mlx5_qos_destroy_node(htb->mdev, new_hw_id);
return err;
}
-static struct mlx5e_qos_node *mlx5e_sw_node_find_by_qid(struct mlx5e_htb *htb, u16 qid)
+static struct mlx5e_qos_node *mlx5e_htb_node_find_by_qid(struct mlx5e_htb *htb, u16 qid)
{
struct mlx5e_qos_node *node = NULL;
int bkt;
qos_dbg(htb->mdev, "TC_HTB_LEAF_DEL classid %04x\n", *classid);
- node = mlx5e_sw_node_find(htb, *classid);
+ node = mlx5e_htb_node_find(htb, *classid);
if (!node)
return -ENOENT;
qos_warn(htb->mdev, "Failed to destroy leaf node %u (class %04x), err = %d\n",
node->hw_id, *classid, err);
- mlx5e_sw_node_delete(htb, node);
+ mlx5e_htb_node_delete(htb, node);
- moved_qid = mlx5e_qos_cur_leaf_nodes(htb);
+ moved_qid = mlx5e_htb_cur_leaf_nodes(htb);
if (moved_qid == 0) {
/* The last QoS SQ was just destroyed. */
WARN(moved_qid == qid, "Can't move node with qid %u to itself", qid);
qos_dbg(htb->mdev, "Moving QoS SQ %u to %u\n", moved_qid, qid);
- node = mlx5e_sw_node_find_by_qid(htb, moved_qid);
+ node = mlx5e_htb_node_find_by_qid(htb, moved_qid);
WARN(!node, "Could not find a node with qid %u to move to queue %u",
moved_qid, qid);
qos_dbg(htb->mdev, "TC_HTB_LEAF_DEL_LAST%s classid %04x\n",
force ? "_FORCE" : "", classid);
- node = mlx5e_sw_node_find(htb, classid);
+ node = mlx5e_htb_node_find(htb, classid);
if (!node)
return -ENOENT;
/* Store qid for reuse and prevent clearing the bit. */
qid = node->qid;
- /* Pairs with mlx5e_get_txq_by_classid. */
+ /* Pairs with mlx5e_htb_get_txq_by_classid. */
WRITE_ONCE(node->qid, MLX5E_QOS_QID_INNER);
if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
node->hw_id, classid, err);
parent = node->parent;
- mlx5e_sw_node_delete(htb, node);
+ mlx5e_htb_node_delete(htb, node);
node = parent;
WRITE_ONCE(node->qid, qid);
}
static int
-mlx5e_qos_update_children(struct mlx5e_htb *htb, struct mlx5e_qos_node *node,
+mlx5e_htb_update_children(struct mlx5e_htb *htb, struct mlx5e_qos_node *node,
struct netlink_ext_ack *extack)
{
struct mlx5e_qos_node *child;
qos_dbg(htb->mdev, "TC_HTB_LEAF_MODIFY classid %04x, rate %llu, ceil %llu\n",
classid, rate, ceil);
- node = mlx5e_sw_node_find(htb, classid);
+ node = mlx5e_htb_node_find(htb, classid);
if (!node)
return -ENOENT;
node->max_average_bw = max_average_bw;
if (ceil_changed)
- err = mlx5e_qos_update_children(htb, node, extack);
+ err = mlx5e_htb_update_children(htb, node, extack);
return err;
}
return mlx5e_htb_node_modify(htb, htb_qopt->classid, htb_qopt->rate, htb_qopt->ceil,
htb_qopt->extack);
case TC_HTB_LEAF_QUERY_QUEUE:
- res = mlx5e_get_txq_by_classid(htb, htb_qopt->classid);
+ res = mlx5e_htb_get_txq_by_classid(htb, htb_qopt->classid);
if (res < 0)
return res;
htb_qopt->qid = res;