[PATCH rdma-core 11/11] verbs: Add ibv_flow_spec_action_handle support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Matan Barak <matanb@xxxxxxxxxxxx>

When we want to link a flow steering rule with an action, we need to
state the action in a flow steering specification. Hence, we add a new
flow steering specification that fits actions.

Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx>
Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---
 kernel-headers/rdma/ib_user_verbs.h | 13 +++++++++++++
 libibverbs/cmd.c                    |  8 ++++++++
 libibverbs/kern-abi.h               |  1 +
 libibverbs/man/ibv_create_flow.3    |  1 +
 libibverbs/verbs.h                  |  8 ++++++++
 5 files changed, 31 insertions(+)

diff --git a/kernel-headers/rdma/ib_user_verbs.h b/kernel-headers/rdma/ib_user_verbs.h
index 48be0c7..365c605 100644
--- a/kernel-headers/rdma/ib_user_verbs.h
+++ b/kernel-headers/rdma/ib_user_verbs.h
@@ -984,6 +984,19 @@ struct ib_uverbs_flow_spec_action_drop {
 	};
 };
 
+struct ib_uverbs_flow_spec_action_handle {
+	union {
+		struct ib_uverbs_flow_spec_hdr hdr;
+		struct {
+			__u32 type;
+			__u16 size;
+			__u16 reserved;
+		};
+	};
+	__u32			      handle;
+	__u32			      reserved1;
+};
+
 struct ib_uverbs_flow_tunnel_filter {
 	__be32 tunnel_id;
 };
diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index 77c91b9..cdebec5 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -1778,6 +1778,14 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 	case IBV_FLOW_SPEC_ACTION_DROP:
 		kern_spec->drop.size = sizeof(struct ib_uverbs_flow_spec_action_drop);
 		break;
+	case IBV_FLOW_SPEC_ACTION_HANDLE: {
+		const struct verbs_flow_action *vaction =
+			container_of((const struct ibv_flow_action *)ib_spec->handle.action,
+				     const struct verbs_flow_action, action);
+		kern_spec->handle.size = sizeof(struct ib_uverbs_flow_spec_action_handle);
+		kern_spec->handle.handle = vaction->handle;
+		break;
+	}
 	default:
 		return EINVAL;
 	}
diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h
index 8e8064a..d9b1a82 100644
--- a/libibverbs/kern-abi.h
+++ b/libibverbs/kern-abi.h
@@ -262,6 +262,7 @@ struct ibv_kern_spec {
 		struct ib_uverbs_flow_spec_tunnel tunnel;
 		struct ib_uverbs_flow_spec_action_tag flow_tag;
 		struct ib_uverbs_flow_spec_action_drop drop;
+		struct ib_uverbs_flow_spec_action_handle handle;
 	};
 };
 
diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3
index 43c0b9c..65de08b 100644
--- a/libibverbs/man/ibv_create_flow.3
+++ b/libibverbs/man/ibv_create_flow.3
@@ -72,6 +72,7 @@ IBV_FLOW_SPEC_VXLAN_TUNNEL             	= 0x50,   /* Flow specification of VXLAN
 IBV_FLOW_SPEC_INNER                    	= 0x100,  /* Flag making L2/L3/L4 specifications to be applied on the inner header */
 IBV_FLOW_SPEC_ACTION_TAG                = 0x1000, /* Action tagging matched packet */
 IBV_FLOW_SPEC_ACTION_DROP               = 0x1001, /* Action dropping matched packet */
+IBV_FLOW_SPEC_ACTION_HANDLE             = 0x1002, /* Carry out an action created by ibv_create_flow_action_xxxx verb */
 .in -8
 };
 .br
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index a595db8..bcbd427 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -1387,6 +1387,7 @@ enum ibv_flow_spec_type {
 	IBV_FLOW_SPEC_INNER		= 0x100,
 	IBV_FLOW_SPEC_ACTION_TAG	= 0x1000,
 	IBV_FLOW_SPEC_ACTION_DROP	= 0x1001,
+	IBV_FLOW_SPEC_ACTION_HANDLE	= 0x1002,
 };
 
 struct ibv_flow_eth_filter {
@@ -1496,6 +1497,12 @@ struct ibv_flow_spec_action_drop {
 	uint16_t  size;
 };
 
+struct ibv_flow_spec_action_handle {
+	enum ibv_flow_spec_type  type;
+	uint16_t  size;
+	const struct ibv_flow_action *action;
+};
+
 struct ibv_flow_spec {
 	union {
 		struct {
@@ -1511,6 +1518,7 @@ struct ibv_flow_spec {
 		struct ibv_flow_spec_tunnel tunnel;
 		struct ibv_flow_spec_action_tag flow_tag;
 		struct ibv_flow_spec_action_drop drop;
+		struct ibv_flow_spec_action_handle handle;
 	};
 };
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux