@@ -18,3 +18,4 @@ libmlx5.so.1 ibverbs-providers #MINVER#
mlx5dv_create_qp@MLX5_1.3 16
mlx5dv_create_wq@MLX5_1.3 16
mlx5dv_get_clock_info@MLX5_1.4 17
+ mlx5dv_create_flow_action_esp@MLX5_1.5 18
@@ -1,5 +1,7 @@
usr/include/infiniband/arch.h
usr/include/infiniband/ib_user_ioctl_verbs.h
+usr/include/infiniband/mlx5_api.h
+usr/include/infiniband/mlx5_user_ioctl_verbs.h
usr/include/infiniband/mlx4dv.h
usr/include/infiniband/mlx5dv.h
usr/include/infiniband/opcode.h
@@ -11,6 +11,7 @@ publish_internal_headers(rdma
rdma/ib_user_verbs.h
rdma/mlx4-abi.h
rdma/mlx5-abi.h
+ rdma/mlx5_user_ioctl_cmds.h
rdma/mthca-abi.h
rdma/nes-abi.h
rdma/ocrdma-abi.h
@@ -59,5 +60,6 @@ rdma_kernel_provider_abi(
publish_headers(infiniband
rdma/ib_user_ioctl_verbs.h
+ rdma/mlx5_user_ioctl_verbs.h
)
new file mode 100644
@@ -0,0 +1,44 @@
+/*
+ * 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 MLX5_USER_IOCTL_CMDS_H
+#define MLX5_USER_IOCTL_CMDS_H
+
+#include <rdma/ib_user_ioctl_cmds.h>
+
+enum mlx5_ib_create_flow_action_attrs {
+ /* This attribute belong to the driver namespace */
+ MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS = (1U << UVERBS_ID_NS_SHIFT),
+};
+
+#endif
+
new file mode 100644
@@ -0,0 +1,43 @@
+/*
+ * 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 MLX5_USER_IOCTL_VERBS_H
+#define MLX5_USER_IOCTL_VERBS_H
+
+#include <linux/types.h>
+
+enum mlx5_ib_uapi_flow_action_flags {
+ MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA = 1 << 0,
+};
+
+#endif
+
@@ -11,7 +11,7 @@ if (MLX5_MW_DEBUG)
endif()
rdma_shared_provider(mlx5 libmlx5.map
- 1 1.4.${PACKAGE_VERSION}
+ 1 1.5.${PACKAGE_VERSION}
buf.c
cq.c
dbrec.c
@@ -23,4 +23,5 @@ rdma_shared_provider(mlx5 libmlx5.map
publish_headers(infiniband
mlx5dv.h
+ mlx5_api.h
)
@@ -28,3 +28,8 @@ MLX5_1.4 {
global:
mlx5dv_get_clock_info;
} MLX5_1.3;
+
+MLX5_1.5 {
+ global:
+ mlx5dv_create_flow_action_esp;
+} MLX5_1.4;
@@ -1,4 +1,5 @@
rdma_man_pages(
+ mlx5dv_flow_action_esp.3.md
mlx5dv_get_clock_info.3
mlx5dv_init_obj.3
mlx5dv_query_device.3
new file mode 100644
@@ -0,0 +1,60 @@
+---
+layout: page
+title: mlx5dv_flow_action_esp(3)
+section: 3
+tagline: Verbs
+---
+
+# NAME
+
+mlx5dv_flow_action_esp(3) -- Flow action esp for mlx5 provider(3)
+
+# SYNOPSIS
+
+```c
+#include <infiniband/mlx5/mlx5dv.h>
+
+struct ibv_flow_action *
+mlx5dv_create_flow_action_esp(struct ibv_context *ctx,
+ struct ibv_flow_action_esp_attr *esp,
+ struct mlx5dv_flow_action_esp *mlx5_attr);
+```
+
+# DESCRIPTION
+
+Create an IPSEC ESP flow steering action.
+This verb is identical to *ibv_create_flow_action_esp* verb, but allows mlx5 specific flags.
+
+# ARGUMENTS
+
+Please see *ibv_flow_action_esp(3)* man page for *ctx* and *esp*.
+
+## *mlx5_attr* argument
+
+```c
+struct mlx5dv_flow_action_esp {
+ uint64_t comp_mask; /* Use enum mlx5dv_flow_action_esp_mask */
+ uint32_t action_flags; /* Use enum mlx5dv_flow_action_flags */
+};
+```
+
+*comp_mask*
+: Bitmask specifying what fields in the structure are valid (*enum mlx5dv_flow_action_esp_mask*).
+
+*action_flags*
+: A bitwise OR of the various values described below.
+
+ *MLX5DV_FLOW_ACTION_FLAGS_REQUIRE_METADATA*:
+ Each received and transmitted packet using offload is expected to carry metadata in the form of a L2 header
+ with ethernet type 0x8CE4, followed by 6 bytes of data and the original packet ethertype.
+
+# NOTE
+
+The ESN is expected to be placed in the IV field for egress packets.
+The 64 bit sequence number is written in big-endian over the 64 bit IV field.
+There is no need to call modify to update the ESN window on egress when this DV is used.
+
+# SEE ALSO
+
+*ibv_flow_action_esp(3)*, *RFC 4106*
+
new file mode 100644
@@ -0,0 +1,41 @@
+/*
+ * 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 MLX5_API_H
+#define MLX5_API_H
+
+#include <infiniband/mlx5_user_ioctl_verbs.h>
+
+#define mlx5dv_flow_action_flags mlx5_ib_uapi_flow_action_flags
+#define MLX5DV_FLOW_ACTION_FLAGS_REQUIRE_METADATA MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA
+
+#endif
@@ -45,6 +45,7 @@
#include <infiniband/verbs.h>
#include <infiniband/tm_types.h>
+#include <infiniband/mlx5_api.h>
#ifdef __cplusplus
extern "C" {
@@ -171,6 +172,20 @@ struct mlx5dv_qp_init_attr {
struct ibv_qp *mlx5dv_create_qp(struct ibv_context *context,
struct ibv_qp_init_attr_ex *qp_attr,
struct mlx5dv_qp_init_attr *mlx5_qp_attr);
+
+enum mlx5dv_flow_action_esp_mask {
+ MLX5DV_FLOW_ACTION_ESP_MASK_FLAGS = 1 << 0,
+};
+
+struct mlx5dv_flow_action_esp {
+ uint64_t comp_mask; /* Use enum mlx5dv_flow_action_esp_mask */
+ uint32_t action_flags; /* Use enum mlx5dv_flow_action_flags */
+};
+
+struct ibv_flow_action *mlx5dv_create_flow_action_esp(struct ibv_context *ctx,
+ struct ibv_flow_action_esp_attr *esp,
+ struct mlx5dv_flow_action_esp *mlx5_attr);
+
/*
* Most device capabilities are exported by ibv_query_device(...),
* but there is HW device-specific information which is important
@@ -46,6 +46,8 @@
#include <util/compiler.h>
#include <util/mmio.h>
+#include <rdma/ib_user_ioctl_cmds.h>
+#include <rdma/mlx5_user_ioctl_cmds.h>
#include "mlx5.h"
#include "mlx5-abi.h"
@@ -2998,6 +3000,33 @@ struct ibv_flow_action *mlx5_create_flow_action_esp(struct ibv_context *ctx,
return _mlx5_create_flow_action_esp(ctx, attr, NULL);
}
+struct ibv_flow_action *mlx5dv_create_flow_action_esp(struct ibv_context *ctx,
+ struct ibv_flow_action_esp_attr *esp,
+ struct mlx5dv_flow_action_esp *mlx5_attr)
+{
+ DECLARE_COMMAND_BUFFER_LINK(driver_attr, UVERBS_OBJECT_FLOW_ACTION,
+ UVERBS_METHOD_FLOW_ACTION_ESP_CREATE, 1,
+ NULL);
+
+ if (!check_comp_mask(mlx5_attr->comp_mask,
+ MLX5DV_FLOW_ACTION_ESP_MASK_FLAGS)) {
+ errno = EOPNOTSUPP;
+ return NULL;
+ }
+
+ if (mlx5_attr->comp_mask & MLX5DV_FLOW_ACTION_ESP_MASK_FLAGS) {
+ if (!check_comp_mask(mlx5_attr->action_flags,
+ MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA)) {
+ errno = EOPNOTSUPP;
+ return NULL;
+ }
+ fill_attr_in_uint64(driver_attr, MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS,
+ mlx5_attr->action_flags);
+ }
+
+ return _mlx5_create_flow_action_esp(ctx, esp, driver_attr);
+}
+
int mlx5_modify_flow_action_esp(struct ibv_flow_action *action,
struct ibv_flow_action_esp_attr *attr)
{