diff mbox series

[rdma-core,3/3] mlx5: Add support for DEVX object as a flow destination

Message ID 1539190590-31186-4-git-send-email-yishaih@mellanox.com (mailing list archive)
State Not Applicable
Headers show
Series mlx5: Introduce DEVX APIs | expand

Commit Message

Yishai Hadas Oct. 10, 2018, 4:56 p.m. UTC
A flow destination can be some DEVX object that was previously created,
adds this option as part of mlx5dv_create_flow().

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
---
 providers/mlx5/mlx5dv.h |  2 ++
 providers/mlx5/verbs.c  | 12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/providers/mlx5/mlx5dv.h b/providers/mlx5/mlx5dv.h
index 0385b68..9c39e3c 100644
--- a/providers/mlx5/mlx5dv.h
+++ b/providers/mlx5/mlx5dv.h
@@ -224,6 +224,7 @@  enum mlx5dv_flow_action_type {
 	MLX5DV_FLOW_ACTION_IBV_COUNTER,
 	MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION,
 	MLX5DV_FLOW_ACTION_TAG,
+	MLX5DV_FLOW_ACTION_DEST_DEVX,
 };
 
 struct mlx5dv_flow_action_attr {
@@ -233,6 +234,7 @@  struct mlx5dv_flow_action_attr {
 		struct ibv_counters *counter;
 		struct ibv_flow_action *action;
 		uint32_t tag_value;
+		struct mlx5dv_devx_obj *obj;
 	};
 };
 
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index a8a7fa3..13616ad 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -3775,6 +3775,7 @@  mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
 	int num_flow_actions = 0;
 	struct mlx5_flow *mflow;
 	bool have_qp = false;
+	bool have_dest_devx = false;
 	int ret;
 	int i;
 	DECLARE_COMMAND_BUFFER(cmd, UVERBS_OBJECT_FLOW,
@@ -3799,7 +3800,7 @@  mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
 		type = actions_attr[i].type;
 		switch (type) {
 		case MLX5DV_FLOW_ACTION_DEST_IBV_QP:
-			if (have_qp) {
+			if (have_qp || have_dest_devx) {
 				errno = EOPNOTSUPP;
 				goto err;
 			}
@@ -3820,6 +3821,15 @@  mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
 			flow_actions[num_flow_actions] = vaction->handle;
 			num_flow_actions++;
 			break;
+		case MLX5DV_FLOW_ACTION_DEST_DEVX:
+			if (have_dest_devx || have_qp) {
+				errno = EOPNOTSUPP;
+				goto err;
+			}
+			fill_attr_in_obj(cmd, MLX5_IB_ATTR_CREATE_FLOW_DEST_DEVX,
+					 actions_attr[i].obj->handle);
+			have_dest_devx = true;
+			break;
 		default:
 			errno = EOPNOTSUPP;
 			goto err;