[PATCH rdma-core 02/11] verbs: Add flow_action uapi definitions

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

 



From: Matan Barak <matanb@xxxxxxxxxxxx>

Updating rdma-core's kernel headers and verbs_api.h to include the
kernel's flow-action uapi definitions.

This synchronize the user-space with the following kernel commit:
"IB/uverbs: Add flow_action create and destroy verbs"

Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx>
Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---
 debian/libibverbs-dev.install             |  2 +
 kernel-headers/CMakeLists.txt             |  6 ++-
 kernel-headers/rdma/ib_user_ioctl_cmds.h  | 20 ++++++++
 kernel-headers/rdma/ib_user_ioctl_verbs.h | 59 +++++++++++++++++++++++
 libibverbs/CMakeLists.txt                 |  1 +
 libibverbs/verbs.h                        |  1 +
 libibverbs/verbs_api.h                    | 79 +++++++++++++++++++++++++++++++
 7 files changed, 167 insertions(+), 1 deletion(-)
 create mode 100644 libibverbs/verbs_api.h

diff --git a/debian/libibverbs-dev.install b/debian/libibverbs-dev.install
index 1bf56da..2fd279c 100644
--- a/debian/libibverbs-dev.install
+++ b/debian/libibverbs-dev.install
@@ -1,4 +1,5 @@
 usr/include/infiniband/arch.h
+usr/include/infiniband/ib_user_ioctl_verbs.h
 usr/include/infiniband/mlx4dv.h
 usr/include/infiniband/mlx5dv.h
 usr/include/infiniband/opcode.h
@@ -6,6 +7,7 @@ usr/include/infiniband/sa-kern-abi.h
 usr/include/infiniband/sa.h
 usr/include/infiniband/tm_types.h
 usr/include/infiniband/verbs.h
+usr/include/infiniband/verbs_api.h
 usr/lib/*/libibverbs*.so
 usr/lib/*/libmlx4.so
 usr/lib/*/libmlx5.so
diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt
index b0fb343..011c66b 100644
--- a/kernel-headers/CMakeLists.txt
+++ b/kernel-headers/CMakeLists.txt
@@ -6,7 +6,6 @@ publish_internal_headers(rdma
   rdma/i40iw-abi.h
   rdma/ib_user_cm.h
   rdma/ib_user_ioctl_cmds.h
-  rdma/ib_user_ioctl_verbs.h
   rdma/ib_user_mad.h
   rdma/ib_user_sa.h
   rdma/ib_user_verbs.h
@@ -57,3 +56,8 @@ endfunction()
 rdma_kernel_provider_abi(
   rdma/ib_user_verbs.h
   )
+
+publish_headers(infiniband
+  rdma/ib_user_ioctl_verbs.h
+  )
+
diff --git a/kernel-headers/rdma/ib_user_ioctl_cmds.h b/kernel-headers/rdma/ib_user_ioctl_cmds.h
index 77bbbed..500b64a 100644
--- a/kernel-headers/rdma/ib_user_ioctl_cmds.h
+++ b/kernel-headers/rdma/ib_user_ioctl_cmds.h
@@ -53,6 +53,7 @@ enum uverbs_default_objects {
 	UVERBS_OBJECT_XRCD,
 	UVERBS_OBJECT_RWQ_IND_TBL,
 	UVERBS_OBJECT_WQ,
+	UVERBS_OBJECT_FLOW_ACTION,
 };
 
 enum {
@@ -75,9 +76,28 @@ enum uverbs_attrs_destroy_cq_cmd_attr_ids {
 	UVERBS_ATTR_DESTROY_CQ_RESP,
 };
 
+enum uverbs_attrs_create_flow_action_esp {
+	UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE,
+	UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
+	UVERBS_ATTR_FLOW_ACTION_ESP_ESN,
+	UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT,
+	UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY,
+	UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP,
+};
+
+enum uverbs_attrs_destroy_flow_action_esp {
+	UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE,
+};
+
 enum uverbs_methods_cq {
 	UVERBS_METHOD_CQ_CREATE,
 	UVERBS_METHOD_CQ_DESTROY,
 };
 
+enum uverbs_methods_actions_flow_action_ops {
+	UVERBS_METHOD_FLOW_ACTION_ESP_CREATE,
+	UVERBS_METHOD_FLOW_ACTION_DESTROY,
+	UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY,
+};
+
 #endif
diff --git a/kernel-headers/rdma/ib_user_ioctl_verbs.h b/kernel-headers/rdma/ib_user_ioctl_verbs.h
index 3d3a2f0..8d71e71 100644
--- a/kernel-headers/rdma/ib_user_ioctl_verbs.h
+++ b/kernel-headers/rdma/ib_user_ioctl_verbs.h
@@ -40,4 +40,63 @@
 #define RDMA_UAPI_PTR(_type, _name)	_type __attribute__((aligned(8))) _name
 #endif
 
+enum ib_uverbs_flow_action_esp_keymat {
+	IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM,
+};
+
+enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo {
+	IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ,
+};
+
+struct ib_uverbs_flow_action_esp_keymat_aes_gcm {
+	__aligned_u64	iv;
+	__u32		iv_algo; /* Use enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo */
+
+	__u32		salt;
+	__u32		icv_len;
+
+	__u32		key_len;
+	__u32		aes_key[256 / 32];
+};
+
+enum ib_uverbs_flow_action_esp_replay {
+	IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE,
+	IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP,
+};
+
+struct ib_uverbs_flow_action_esp_replay_bmp {
+	__u32	size;
+};
+
+enum ib_uverbs_flow_action_esp_flags {
+	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO	= 0UL << 0,	/* Default */
+	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD	= 1UL << 0,
+
+	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL		= 0UL << 1,	/* Default */
+	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT	= 1UL << 1,
+
+	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT		= 0UL << 2,	/* Default */
+	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT		= 1UL << 2,
+
+	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW	= 1UL << 3,
+};
+
+struct ib_uverbs_flow_action_esp_encap {
+	/* This struct represents a list of pointers to flow_xxxx_filter that
+	 * encapsulates the payload in ESP tunnel mode.
+	 */
+	RDMA_UAPI_PTR(void *, val_ptr); /* pointer to a flow_xxxx_filter */
+	RDMA_UAPI_PTR(struct ib_uverbs_flow_action_esp_encap *, next_ptr);
+	__u16	len;		/* Len of the filter struct val_ptr points to */
+	__u16	type;		/* Use flow_spec_type enum */
+};
+
+struct ib_uverbs_flow_action_esp {
+	__u32		spi;
+	__u32		seq;
+	__u32		tfc_pad;
+	__u32		flags;
+	__aligned_u64	hard_limit_pkts;
+};
+
 #endif
diff --git a/libibverbs/CMakeLists.txt b/libibverbs/CMakeLists.txt
index 6fdec63..04f5b1b 100644
--- a/libibverbs/CMakeLists.txt
+++ b/libibverbs/CMakeLists.txt
@@ -5,6 +5,7 @@ publish_headers(infiniband
   sa.h
   verbs.h
   tm_types.h
+  verbs_api.h
   )
 
 publish_internal_headers(infiniband
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index af82a8d..b4bb85d 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -43,6 +43,7 @@
 #include <string.h>
 #include <linux/types.h>
 #include <stdint.h>
+#include <infiniband/verbs_api.h>
 
 #ifdef __cplusplus
 #include <limits>
diff --git a/libibverbs/verbs_api.h b/libibverbs/verbs_api.h
new file mode 100644
index 0000000..71f8abd
--- /dev/null
+++ b/libibverbs/verbs_api.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2017, Mellanox Technologies inc.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef VERBS_API_H
+#define VERBS_API_H
+
+#if UINTPTR_MAX == UINT32_MAX
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define RDMA_UAPI_PTR(_type, _name) union {				\
+				       struct {_type _name;		\
+					       __u32 _name ##_reserved;	\
+				       };				\
+				       __aligned_u64 _name ## _data_u64; }	\
+				       __attribute__((aligned(8)))
+#else
+#define RDMA_UAPI_PTR(_type, _name) union {				\
+				       struct {__u32 _name ##_reserved;	\
+					       _type _name;		\
+				       };				\
+				       __aligned_u64 _name ## _data_u64; }	\
+				       __attribute__((aligned(8)))
+#endif
+#elif UINTPTR_MAX != UINT64_MAX
+#error "Pointer size not supported"
+#endif
+
+#include <infiniband/ib_user_ioctl_verbs.h>
+
+#define ibv_flow_action_esp_keymat			ib_uverbs_flow_action_esp_keymat
+#define IBV_FLOW_ACTION_ESP_KEYMAT_AES_GCM              IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM
+#define ibv_flow_action_esp_keymat_aes_gcm_iv_algo      ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo
+#define IBV_FLOW_ACTION_IV_ALGO_SEQ                     IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ
+#define ibv_flow_action_esp_keymat_aes_gcm              ib_uverbs_flow_action_esp_keymat_aes_gcm
+#define ibv_flow_action_esp_replay                      ib_uverbs_flow_action_esp_replay
+#define IBV_FLOW_ACTION_ESP_REPLAY_NONE                 IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE
+#define IBV_FLOW_ACTION_ESP_REPLAY_BMP                  IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP
+#define ibv_flow_action_esp_replay_bmp                  ib_uverbs_flow_action_esp_replay_bmp
+#define ibv_flow_action_esp_flags                       ib_uverbs_flow_action_esp_flags
+#define IBV_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO         IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO
+#define IBV_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD          IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD
+#define IBV_FLOW_ACTION_ESP_FLAGS_TUNNEL                IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL
+#define IBV_FLOW_ACTION_ESP_FLAGS_TRANSPORT             IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT
+#define IBV_FLOW_ACTION_ESP_FLAGS_DECRYPT               IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT
+#define IBV_FLOW_ACTION_ESP_FLAGS_ENCRYPT               IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT
+#define IBV_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW        IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW
+#define ibv_flow_action_esp_encap                       ib_uverbs_flow_action_esp_encap
+#define ibv_flow_action_esp                             ib_uverbs_flow_action_esp
+
+#endif
+
-- 
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