Skip to content

Commit b5f814c

Browse files
Eli CohenSaeed Mahameed
authored andcommitted
net/mlx5: Avoid configuring eswitch QoS if not supported
Check if QoS is enabled for the eswitch before attempting to configure QoS parameters and emit a netlink error if not supported. Introduce an API to check if QoS is supported for the eswitch. Signed-off-by: Eli Cohen <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Reviewed-by: Paul Blakey <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 31e87b3 commit b5f814c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4521,8 +4521,14 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv,
45214521
int mlx5e_tc_configure_matchall(struct mlx5e_priv *priv,
45224522
struct tc_cls_matchall_offload *ma)
45234523
{
4524+
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
45244525
struct netlink_ext_ack *extack = ma->common.extack;
45254526

4527+
if (!mlx5_esw_qos_enabled(esw)) {
4528+
NL_SET_ERR_MSG_MOD(extack, "QoS is not supported on this device");
4529+
return -EOPNOTSUPP;
4530+
}
4531+
45264532
if (ma->common.prio != 1) {
45274533
NL_SET_ERR_MSG_MOD(extack, "only priority 1 is supported");
45284534
return -EINVAL;

drivers/net/ethernet/mellanox/mlx5/core/eswitch.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,11 @@ int mlx5_esw_create_vport_egress_acl_vlan(struct mlx5_eswitch *esw,
453453
struct mlx5_vport *vport,
454454
u16 vlan_id, u32 flow_action);
455455

456+
static inline bool mlx5_esw_qos_enabled(struct mlx5_eswitch *esw)
457+
{
458+
return esw->qos.enabled;
459+
}
460+
456461
static inline bool mlx5_eswitch_vlan_actions_supported(struct mlx5_core_dev *dev,
457462
u8 vlan_depth)
458463
{

0 commit comments

Comments
 (0)