mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
net/mlx5: qos: Rename vport 'tsar' into 'sched_elem'.
Vports do not use TSARs (Transmit Scheduling ARbiters), which are used for grouping multiple entities together. Use the correct name in variables and functions for clarity. Also move the scheduling context to a local variable in the esw_qos_sched_elem_config function instead of an empty parameter that needs to be provided by all callers. There is no functional change here. Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
016f426a14
commit
158205ca4b
@ -15,14 +15,14 @@ TRACE_EVENT(mlx5_esw_vport_qos_destroy,
|
||||
TP_ARGS(vport),
|
||||
TP_STRUCT__entry(__string(devname, dev_name(vport->dev->device))
|
||||
__field(unsigned short, vport_id)
|
||||
__field(unsigned int, tsar_ix)
|
||||
__field(unsigned int, sched_elem_ix)
|
||||
),
|
||||
TP_fast_assign(__assign_str(devname);
|
||||
__entry->vport_id = vport->vport;
|
||||
__entry->tsar_ix = vport->qos.esw_tsar_ix;
|
||||
__entry->sched_elem_ix = vport->qos.esw_sched_elem_ix;
|
||||
),
|
||||
TP_printk("(%s) vport=%hu tsar_ix=%u\n",
|
||||
__get_str(devname), __entry->vport_id, __entry->tsar_ix
|
||||
TP_printk("(%s) vport=%hu sched_elem_ix=%u\n",
|
||||
__get_str(devname), __entry->vport_id, __entry->sched_elem_ix
|
||||
)
|
||||
);
|
||||
|
||||
@ -31,20 +31,20 @@ DECLARE_EVENT_CLASS(mlx5_esw_vport_qos_template,
|
||||
TP_ARGS(vport, bw_share, max_rate),
|
||||
TP_STRUCT__entry(__string(devname, dev_name(vport->dev->device))
|
||||
__field(unsigned short, vport_id)
|
||||
__field(unsigned int, tsar_ix)
|
||||
__field(unsigned int, sched_elem_ix)
|
||||
__field(unsigned int, bw_share)
|
||||
__field(unsigned int, max_rate)
|
||||
__field(void *, group)
|
||||
),
|
||||
TP_fast_assign(__assign_str(devname);
|
||||
__entry->vport_id = vport->vport;
|
||||
__entry->tsar_ix = vport->qos.esw_tsar_ix;
|
||||
__entry->sched_elem_ix = vport->qos.esw_sched_elem_ix;
|
||||
__entry->bw_share = bw_share;
|
||||
__entry->max_rate = max_rate;
|
||||
__entry->group = vport->qos.group;
|
||||
),
|
||||
TP_printk("(%s) vport=%hu tsar_ix=%u bw_share=%u, max_rate=%u group=%p\n",
|
||||
__get_str(devname), __entry->vport_id, __entry->tsar_ix,
|
||||
TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u group=%p\n",
|
||||
__get_str(devname), __entry->vport_id, __entry->sched_elem_ix,
|
||||
__entry->bw_share, __entry->max_rate, __entry->group
|
||||
)
|
||||
);
|
||||
|
@ -22,9 +22,10 @@ struct mlx5_esw_rate_group {
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx,
|
||||
u32 tsar_ix, u32 max_rate, u32 bw_share)
|
||||
static int esw_qos_sched_elem_config(struct mlx5_core_dev *dev, u32 sched_elem_ix,
|
||||
u32 max_rate, u32 bw_share)
|
||||
{
|
||||
u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
|
||||
u32 bitmask = 0;
|
||||
|
||||
if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling))
|
||||
@ -38,20 +39,17 @@ static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx,
|
||||
return mlx5_modify_scheduling_element_cmd(dev,
|
||||
SCHEDULING_HIERARCHY_E_SWITCH,
|
||||
sched_ctx,
|
||||
tsar_ix,
|
||||
sched_elem_ix,
|
||||
bitmask);
|
||||
}
|
||||
|
||||
static int esw_qos_group_config(struct mlx5_eswitch *esw, struct mlx5_esw_rate_group *group,
|
||||
u32 max_rate, u32 bw_share, struct netlink_ext_ack *extack)
|
||||
{
|
||||
u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
|
||||
struct mlx5_core_dev *dev = esw->dev;
|
||||
int err;
|
||||
|
||||
err = esw_qos_tsar_config(dev, sched_ctx,
|
||||
group->tsar_ix,
|
||||
max_rate, bw_share);
|
||||
err = esw_qos_sched_elem_config(dev, group->tsar_ix, max_rate, bw_share);
|
||||
if (err)
|
||||
NL_SET_ERR_MSG_MOD(extack, "E-Switch modify group TSAR element failed");
|
||||
|
||||
@ -65,20 +63,18 @@ static int esw_qos_vport_config(struct mlx5_eswitch *esw,
|
||||
u32 max_rate, u32 bw_share,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
|
||||
struct mlx5_core_dev *dev = esw->dev;
|
||||
int err;
|
||||
|
||||
if (!vport->qos.enabled)
|
||||
return -EIO;
|
||||
|
||||
err = esw_qos_tsar_config(dev, sched_ctx, vport->qos.esw_tsar_ix,
|
||||
max_rate, bw_share);
|
||||
err = esw_qos_sched_elem_config(dev, vport->qos.esw_sched_elem_ix, max_rate, bw_share);
|
||||
if (err) {
|
||||
esw_warn(esw->dev,
|
||||
"E-Switch modify TSAR vport element failed (vport=%d,err=%d)\n",
|
||||
"E-Switch modify vport scheduling element failed (vport=%d,err=%d)\n",
|
||||
vport->vport, err);
|
||||
NL_SET_ERR_MSG_MOD(extack, "E-Switch modify TSAR vport element failed");
|
||||
NL_SET_ERR_MSG_MOD(extack, "E-Switch modify vport scheduling element failed");
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -357,9 +353,10 @@ static int esw_qos_vport_create_sched_element(struct mlx5_eswitch *esw,
|
||||
err = mlx5_create_scheduling_element_cmd(dev,
|
||||
SCHEDULING_HIERARCHY_E_SWITCH,
|
||||
sched_ctx,
|
||||
&vport->qos.esw_tsar_ix);
|
||||
&vport->qos.esw_sched_elem_ix);
|
||||
if (err) {
|
||||
esw_warn(esw->dev, "E-Switch create TSAR vport element failed (vport=%d,err=%d)\n",
|
||||
esw_warn(vport->dev,
|
||||
"E-Switch create vport scheduling element failed (vport=%d,err=%d)\n",
|
||||
vport->vport, err);
|
||||
return err;
|
||||
}
|
||||
@ -378,9 +375,9 @@ static int esw_qos_update_group_scheduling_element(struct mlx5_eswitch *esw,
|
||||
|
||||
err = mlx5_destroy_scheduling_element_cmd(esw->dev,
|
||||
SCHEDULING_HIERARCHY_E_SWITCH,
|
||||
vport->qos.esw_tsar_ix);
|
||||
vport->qos.esw_sched_elem_ix);
|
||||
if (err) {
|
||||
NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy TSAR vport element failed");
|
||||
NL_SET_ERR_MSG_MOD(extack, "E-Switch destroy vport scheduling element failed");
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -683,9 +680,9 @@ void mlx5_esw_qos_vport_disable(struct mlx5_eswitch *esw, struct mlx5_vport *vpo
|
||||
|
||||
err = mlx5_destroy_scheduling_element_cmd(esw->dev,
|
||||
SCHEDULING_HIERARCHY_E_SWITCH,
|
||||
vport->qos.esw_tsar_ix);
|
||||
vport->qos.esw_sched_elem_ix);
|
||||
if (err)
|
||||
esw_warn(esw->dev, "E-Switch destroy TSAR vport element failed (vport=%d,err=%d)\n",
|
||||
esw_warn(esw->dev, "E-Switch destroy vport scheduling element failed (vport=%d,err=%d)\n",
|
||||
vport->vport, err);
|
||||
|
||||
memset(&vport->qos, 0, sizeof(vport->qos));
|
||||
@ -809,7 +806,7 @@ int mlx5_esw_qos_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, u32
|
||||
err = mlx5_modify_scheduling_element_cmd(esw->dev,
|
||||
SCHEDULING_HIERARCHY_E_SWITCH,
|
||||
ctx,
|
||||
vport->qos.esw_tsar_ix,
|
||||
vport->qos.esw_sched_elem_ix,
|
||||
bitmask);
|
||||
}
|
||||
mutex_unlock(&esw->state_lock);
|
||||
|
@ -213,9 +213,9 @@ struct mlx5_vport {
|
||||
struct mlx5_vport_info info;
|
||||
|
||||
struct {
|
||||
bool enabled;
|
||||
u32 esw_tsar_ix;
|
||||
u32 bw_share;
|
||||
bool enabled;
|
||||
u32 esw_sched_elem_ix;
|
||||
u32 bw_share;
|
||||
u32 min_rate;
|
||||
u32 max_rate;
|
||||
struct mlx5_esw_rate_group *group;
|
||||
|
Loading…
Reference in New Issue
Block a user