From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, kuba@kernel.org,
Eli Cohen <eli@mellanox.com>, Roi Dayan <roid@mellanox.com>,
Paul Blakey <paulb@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 10/14] net/mlx5: Avoid configuring eswitch QoS if not supported
Date: Tue, 17 Mar 2020 19:47:18 -0700 [thread overview]
Message-ID: <20200318024722.26580-11-saeedm@mellanox.com> (raw)
In-Reply-To: <20200318024722.26580-1-saeedm@mellanox.com>
From: Eli Cohen <eli@mellanox.com>
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 <eli@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 6 ++++++
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index db1aee1d48e3..ddb933aa8d59 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4521,8 +4521,14 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv,
int mlx5e_tc_configure_matchall(struct mlx5e_priv *priv,
struct tc_cls_matchall_offload *ma)
{
+ struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct netlink_ext_ack *extack = ma->common.extack;
+ if (!mlx5_esw_qos_enabled(esw)) {
+ NL_SET_ERR_MSG_MOD(extack, "QoS is not supported on this device");
+ return -EOPNOTSUPP;
+ }
+
if (ma->common.prio != 1) {
NL_SET_ERR_MSG_MOD(extack, "only priority 1 is supported");
return -EINVAL;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index 2318c1cfc434..c18de018c675 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -453,6 +453,11 @@ int mlx5_esw_create_vport_egress_acl_vlan(struct mlx5_eswitch *esw,
struct mlx5_vport *vport,
u16 vlan_id, u32 flow_action);
+static inline bool mlx5_esw_qos_enabled(struct mlx5_eswitch *esw)
+{
+ return esw->qos.enabled;
+}
+
static inline bool mlx5_eswitch_vlan_actions_supported(struct mlx5_core_dev *dev,
u8 vlan_depth)
{
--
2.24.1
next prev parent reply other threads:[~2020-03-18 2:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 2:47 [pull request][net-next 00/14] Mellanox, mlx5 updates 2020-03-17 Saeed Mahameed
2020-03-18 2:47 ` [net-next 01/14] net/mlx5: Add missing inline to stub esw_add_restore_rule Saeed Mahameed
2020-03-18 2:47 ` [net-next 02/14] net/mlx5: E-Switch: Fix using fwd and modify when firmware doesn't support it Saeed Mahameed
2020-03-18 2:47 ` [net-next 03/14] net/mlx5: E-Switch, Skip restore modify header between prios of same chain Saeed Mahameed
2020-03-18 2:47 ` [net-next 04/14] net/mlx5e: CT: remove set but not used variable 'unnew' Saeed Mahameed
2020-03-18 2:47 ` [net-next 05/14] net/mlx5e: CT: Fix insert rules when TC_CT config isn't enabled Saeed Mahameed
2020-03-18 2:47 ` [net-next 06/14] net/mlx5e: CT: Fix stack usage compiler warning Saeed Mahameed
2020-03-18 2:47 ` [net-next 07/14] net/mlx5e: en_tc: Rely just on register loopback for tunnel restoration Saeed Mahameed
2020-03-18 2:47 ` [net-next 08/14] net/mlx5e: Fix rejecting all egress rules not on vlan Saeed Mahameed
2020-03-18 2:47 ` [net-next 09/14] net/mlx5e: Fix devlink port register sequence Saeed Mahameed
2020-03-18 2:47 ` Saeed Mahameed [this message]
2020-03-18 2:47 ` [net-next 11/14] net/mlx5: Don't use termination tables in slow path Saeed Mahameed
2020-03-18 2:47 ` [net-next 12/14] net/mlx5e: Add support for offloading traffic from uplink to uplink Saeed Mahameed
2020-03-18 2:47 ` [net-next 13/14] net/mlx5: Eswitch, enable forwarding back to uplink port Saeed Mahameed
2020-03-18 2:47 ` [net-next 14/14] net/mlx5: Avoid forwarding to other eswitch uplink Saeed Mahameed
2020-03-19 2:14 ` [pull request][net-next 00/14] Mellanox, mlx5 updates 2020-03-17 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200318024722.26580-11-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=davem@davemloft.net \
--cc=eli@mellanox.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulb@mellanox.com \
--cc=roid@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).