netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: jiri@resnulli.us
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	dsahern@gmail.com, Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [RFC net-next 6/8] mlx5: use tc_can_offload_cls()
Date: Tue, 23 Jan 2018 13:33:38 -0800	[thread overview]
Message-ID: <20180123213340.19235-7-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180123213340.19235-1-jakub.kicinski@netronome.com>

Make use of tc_can_offload_cls() to report error in case
ethtool tc offload flag is not set or chain unsupported.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +----
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c  | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 8530c770c873..6e4273a3da9b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2944,7 +2944,7 @@ static int mlx5e_setup_tc_mqprio(struct net_device *netdev,
 static int mlx5e_setup_tc_cls_flower(struct mlx5e_priv *priv,
 				     struct tc_cls_flower_offload *cls_flower)
 {
-	if (cls_flower->common.chain_index)
+	if (!tc_can_offload_cls(priv->netdev, &cls_flower->common))
 		return -EOPNOTSUPP;
 
 	switch (cls_flower->command) {
@@ -2964,9 +2964,6 @@ int mlx5e_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
 {
 	struct mlx5e_priv *priv = cb_priv;
 
-	if (!tc_can_offload(priv->netdev))
-		return -EOPNOTSUPP;
-
 	switch (type) {
 	case TC_SETUP_CLSFLOWER:
 		return mlx5e_setup_tc_cls_flower(priv, type_data);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 10fa6a18fcf9..db05e8220e05 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -719,7 +719,7 @@ static int
 mlx5e_rep_setup_tc_cls_flower(struct mlx5e_priv *priv,
 			      struct tc_cls_flower_offload *cls_flower)
 {
-	if (cls_flower->common.chain_index)
+	if (!tc_can_offload_cls(priv->netdev, &cls_flower->common))
 		return -EOPNOTSUPP;
 
 	switch (cls_flower->command) {
@@ -739,9 +739,6 @@ static int mlx5e_rep_setup_tc_cb(enum tc_setup_type type, void *type_data,
 {
 	struct mlx5e_priv *priv = cb_priv;
 
-	if (!tc_can_offload(priv->netdev))
-		return -EOPNOTSUPP;
-
 	switch (type) {
 	case TC_SETUP_CLSFLOWER:
 		return mlx5e_rep_setup_tc_cls_flower(priv, type_data);
-- 
2.15.1

  parent reply	other threads:[~2018-01-23 21:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 21:33 [RFC net-next 0/8] use tc_can_offload_extack() throughout the drivers Jakub Kicinski
2018-01-23 21:33 ` [RFC net-next 1/8] pkt_cls: make tc_can_offload_extack() check chain index Jakub Kicinski
2018-01-24  8:28   ` Jiri Pirko
2018-01-24  8:53     ` Jakub Kicinski
2018-01-23 21:33 ` [RFC net-next 2/8] bnxt: use tc_can_offload_cls() Jakub Kicinski
2018-01-23 21:33 ` [RFC net-next 3/8] nfp: flower: " Jakub Kicinski
2018-01-23 21:33 ` [RFC net-next 4/8] cxgb4: " Jakub Kicinski
2018-01-23 21:33 ` [RFC net-next 5/8] ixgbe: " Jakub Kicinski
2018-01-23 21:33 ` Jakub Kicinski [this message]
2018-01-23 21:33 ` [RFC net-next 7/8] mlxsw: " Jakub Kicinski
2018-01-23 21:33 ` [RFC net-next 8/8] cls_bpf: drivers: don't try to use extack before callback type is validated Jakub Kicinski
2018-01-24 10:25 ` [RFC net-next 0/8] use tc_can_offload_extack() throughout the drivers Jiri Pirko

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=20180123213340.19235-7-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=dsahern@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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).