All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: kuba@kernel.org, netdev@vger.kernel.org,
	Alex Vesker <valex@mellanox.com>,
	Erez Shitrit <erezsh@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 13/14] net/mlx5: DR, Add support for flow table id destination action
Date: Fri, 13 Mar 2020 18:16:21 -0700	[thread overview]
Message-ID: <20200314011622.64939-14-saeedm@mellanox.com> (raw)
In-Reply-To: <20200314011622.64939-1-saeedm@mellanox.com>

From: Alex Vesker <valex@mellanox.com>

This action allows to go to a flow table based on the table id.
Goto flow table id is required for supporting user space SW.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../mellanox/mlx5/core/steering/dr_action.c    | 18 ++++++++++++++++++
 .../mellanox/mlx5/core/steering/fs_dr.c        | 12 ++++++++++++
 .../mellanox/mlx5/core/steering/mlx5dr.h       |  3 +++
 3 files changed, 33 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
index f899da9f8488..4b323a7ae794 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
@@ -964,6 +964,24 @@ struct mlx5dr_action *mlx5dr_action_create_drop(void)
 	return dr_action_create_generic(DR_ACTION_TYP_DROP);
 }
 
+struct mlx5dr_action *
+mlx5dr_action_create_dest_table_num(struct mlx5dr_domain *dmn, u32 table_num)
+{
+	struct mlx5dr_action *action;
+
+	action = dr_action_create_generic(DR_ACTION_TYP_FT);
+	if (!action)
+		return NULL;
+
+	action->dest_tbl.is_fw_tbl = true;
+	action->dest_tbl.fw_tbl.dmn = dmn;
+	action->dest_tbl.fw_tbl.id = table_num;
+	action->dest_tbl.fw_tbl.type = FS_FT_FDB;
+	refcount_inc(&dmn->refcount);
+
+	return action;
+}
+
 struct mlx5dr_action *
 mlx5dr_action_create_dest_table(struct mlx5dr_table *tbl)
 {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
index d12d3a2d46ab..3b3f5b9d4f95 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
@@ -384,6 +384,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
 	if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
 		list_for_each_entry(dst, &fte->node.children, node.list) {
 			enum mlx5_flow_destination_type type = dst->dest_attr.type;
+			u32 ft_id;
 
 			if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX ||
 			    num_term_actions >= MLX5_FLOW_CONTEXT_ACTION_MAX) {
@@ -420,6 +421,17 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
 
 				num_term_actions++;
 				break;
+			case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM:
+				ft_id = dst->dest_attr.ft_num;
+				tmp_action = mlx5dr_action_create_dest_table_num(domain,
+										 ft_id);
+				if (!tmp_action) {
+					err = -ENOMEM;
+					goto free_actions;
+				}
+				fs_dr_actions[fs_dr_num_actions++] = tmp_action;
+				term_actions[num_term_actions++].dest = tmp_action;
+				break;
 			default:
 				err = -EOPNOTSUPP;
 				goto free_actions;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h
index e09e4ea1b045..1ee10e3e0d52 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h
@@ -76,6 +76,9 @@ int mlx5dr_rule_destroy(struct mlx5dr_rule *rule);
 int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
 				 struct mlx5dr_action *action);
 
+struct mlx5dr_action *
+mlx5dr_action_create_dest_table_num(struct mlx5dr_domain *dmn, u32 table_num);
+
 struct mlx5dr_action *
 mlx5dr_action_create_dest_table(struct mlx5dr_table *table);
 
-- 
2.24.1


  parent reply	other threads:[~2020-03-14  1:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-14  1:16 [pull request][net-next 00/14] Mellanox, mlx5 updates 2020-03-13 Saeed Mahameed
2020-03-14  1:16 ` [net-next 01/14] net/mlx5: E-Switch, Remove redundant check of eswitch manager cap Saeed Mahameed
2020-03-14  1:16 ` [net-next 02/14] net/mlx5: E-Switch, Hold mutex when querying drop counter in legacy mode Saeed Mahameed
2020-03-14  1:16 ` [net-next 03/14] net/mlx5: E-Switch, Remove redundant warning when QoS enable failed Saeed Mahameed
2020-03-14  1:16 ` [net-next 04/14] net/mlx5: E-Switch, Prepare for vport enable/disable refactor Saeed Mahameed
2020-03-14  1:16 ` [net-next 05/14] net/mlx5: E-switch, Make vport setup/cleanup sequence symmetric Saeed Mahameed
2020-03-14  1:16 ` [net-next 06/14] net/mlx5: E-Switch, Introduce per vport configuration for eswitch modes Saeed Mahameed
2020-03-14  1:16 ` [net-next 07/14] net/mlx5: E-Switch, Update VF vports config when num of VFs changed Saeed Mahameed
2020-03-14  2:36   ` Jakub Kicinski
2020-03-14  6:13     ` Saeed Mahameed
2020-03-14  1:16 ` [net-next 08/14] net/mlx5: E-Switch, Refactor unload all reps per rep type Saeed Mahameed
2020-03-14  1:16 ` [net-next 09/14] net/mlx5: Accept flow rules without match Saeed Mahameed
2020-03-14  1:16 ` [net-next 10/14] net/mlx5: E-switch, Annotate termtbl_mutex mutex destroy Saeed Mahameed
2020-03-14  1:16 ` [net-next 11/14] net/mlx5: E-switch, Annotate esw state_lock " Saeed Mahameed
2020-03-14  1:16 ` [net-next 12/14] net/mlx5: Avoid deriving mlx5_core_dev second time Saeed Mahameed
2020-03-14  1:16 ` Saeed Mahameed [this message]
2020-03-14  2:36   ` [net-next 13/14] net/mlx5: DR, Add support for flow table id destination action Jakub Kicinski
2020-03-14  6:23     ` Saeed Mahameed
2020-03-14  9:57     ` Leon Romanovsky
2020-03-14  1:16 ` [net-next 14/14] net/mlx5: DR, Remove unneeded functions deceleration Saeed Mahameed
2020-03-14  2:37 ` [pull request][net-next 00/14] Mellanox, mlx5 updates 2020-03-13 Jakub Kicinski
2020-03-14  4:04   ` 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=20200314011622.64939-14-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=erezsh@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=valex@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.