From: Erez Shitrit <erezsh@nvidia.com>
To: <erezsh@nvidia.com>, <valex@nvidia.com>, <viacheslavo@nvidia.com>,
<thomas@monjalon.net>, <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>, <orika@nvidia.com>,
Yevgeny Kliteynik <kliteyn@nvidia.com>
Subject: [PATCH V1 07/11] net/mlx5/hws: added command to create alias objects
Date: Sun, 18 Dec 2022 17:08:48 +0200 [thread overview]
Message-ID: <20221218150853.2167280-8-erezsh@nvidia.com> (raw)
In-Reply-To: <20221218150853.2167280-1-erezsh@nvidia.com>
From: Yevgeny Kliteynik <kliteyn@nvidia.com>
Added support for a command that can create alias objects - objects
that are accessed across VHCA.
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
---
drivers/common/mlx5/mlx5_prm.h | 23 ++++++++++++++--
drivers/net/mlx5/hws/mlx5dr_cmd.c | 44 +++++++++++++++++++++++++++++++
drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 ++++++++
3 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 9d36645949..fd1ad55f1f 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -3135,9 +3135,10 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits {
u8 obj_id[0x20];
union {
struct {
- u8 reserved_at_60[0x3];
+ u8 alias_object[0x1];
+ u8 reserved_at_61[0x2];
u8 log_obj_range[0x5];
- u8 reserved_at_58[0x18];
+ u8 reserved_at_68[0x18];
};
u8 obj_offset[0x20];
};
@@ -3234,6 +3235,19 @@ struct mlx5_ifc_rtc_bits {
u8 reserved_at_180[0x280];
};
+struct mlx5_ifc_alias_context_bits {
+ u8 vhca_id_to_be_accessed[0x10];
+ u8 reserved_at_10[0xd];
+ u8 status[0x3];
+ u8 object_id_to_be_accessed[0x20];
+ u8 reserved_at_40[0x40];
+ union {
+ u8 access_key_raw[0x100];
+ u8 access_key[8][0x20];
+ };
+ u8 metadata[0x80];
+};
+
enum mlx5_ifc_stc_action_type {
MLX5_IFC_STC_ACTION_TYPE_NOP = 0x00,
MLX5_IFC_STC_ACTION_TYPE_COPY = 0x05,
@@ -3478,6 +3492,11 @@ struct mlx5_ifc_create_header_modify_pattern_in_bits {
struct mlx5_ifc_header_modify_pattern_in_bits pattern;
};
+struct mlx5_ifc_create_alias_obj_in_bits {
+ struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
+ struct mlx5_ifc_alias_context_bits alias_ctx;
+};
+
enum {
MLX5_CRYPTO_KEY_SIZE_128b = 0x0,
MLX5_CRYPTO_KEY_SIZE_256b = 0x1,
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index b120be2d88..9b9f70c933 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -744,6 +744,50 @@ int mlx5dr_cmd_allow_other_vhca_access(struct ibv_context *ctx,
return 0;
}
+struct mlx5dr_devx_obj *
+mlx5dr_cmd_alias_obj_create(struct ibv_context *ctx,
+ struct mlx5dr_cmd_alias_obj_create_attr *alias_attr)
+{
+ uint32_t out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)] = {0};
+ uint32_t in[MLX5_ST_SZ_DW(create_alias_obj_in)] = {0};
+ struct mlx5dr_devx_obj *devx_obj;
+ void *attr;
+ void *key;
+
+ devx_obj = simple_malloc(sizeof(*devx_obj));
+ if (!devx_obj) {
+ DR_LOG(ERR, "Failed to allocate memory for ALIAS general object");
+ rte_errno = ENOMEM;
+ return NULL;
+ }
+
+ attr = MLX5_ADDR_OF(create_alias_obj_in, in, hdr);
+ MLX5_SET(general_obj_in_cmd_hdr,
+ attr, opcode, MLX5_CMD_OP_CREATE_GENERAL_OBJECT);
+ MLX5_SET(general_obj_in_cmd_hdr,
+ attr, obj_type, alias_attr->obj_type);
+ MLX5_SET(general_obj_in_cmd_hdr, attr, alias_object, 1);
+
+ attr = MLX5_ADDR_OF(create_alias_obj_in, in, alias_ctx);
+ MLX5_SET(alias_context, attr, vhca_id_to_be_accessed, alias_attr->vhca_id);
+ MLX5_SET(alias_context, attr, object_id_to_be_accessed, alias_attr->obj_id);
+
+ key = MLX5_ADDR_OF(alias_context, attr, access_key);
+ memcpy(key, alias_attr->access_key, sizeof(alias_attr->access_key));
+
+ devx_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out, sizeof(out));
+ if (!devx_obj->obj) {
+ DR_LOG(ERR, "Failed to create ALIAS OBJ");
+ simple_free(devx_obj);
+ rte_errno = errno;
+ return NULL;
+ }
+
+ devx_obj->id = MLX5_GET(general_obj_out_cmd_hdr, out, obj_id);
+
+ return devx_obj;
+}
+
int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
struct mlx5dr_cmd_query_caps *caps)
{
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h
index ea6ced9d27..824ca5e846 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.h
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h
@@ -46,6 +46,13 @@ struct mlx5dr_cmd_rtc_create_attr {
bool is_jumbo;
};
+struct mlx5dr_cmd_alias_obj_create_attr {
+ uint32_t obj_id;
+ uint16_t vhca_id;
+ uint16_t obj_type;
+ uint8_t access_key[32];
+};
+
struct mlx5dr_cmd_stc_create_attr {
uint8_t log_obj_range;
uint8_t table_type;
@@ -217,6 +224,10 @@ mlx5dr_cmd_header_modify_pattern_create(struct ibv_context *ctx,
uint32_t pattern_length,
uint8_t *actions);
+struct mlx5dr_devx_obj *
+mlx5dr_cmd_alias_obj_create(struct ibv_context *ctx,
+ struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
+
int mlx5dr_cmd_sq_modify_rdy(struct mlx5dr_devx_obj *devx_obj);
int mlx5dr_cmd_query_ib_port(struct ibv_context *ctx,
--
2.18.2
next prev parent reply other threads:[~2022-12-21 10:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-18 15:08 [PATCH V1 00/11] Support resource sharing among ibv_devices Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 01/11] mailmap: add new contributors to the list Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 02/11] net/mlx5/hws: add capabilities fields for vhca access Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 03/11] net/mlx5/hws: remove wrong PRM capability macros Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 04/11] net/mlx5/hws: add PRM definitions for cross-vhca capabilities Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 05/11] net/mlx5/hws: read " Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 06/11] net/mlx5/hws: added allow-other-vhca-access command Erez Shitrit
2022-12-18 15:08 ` Erez Shitrit [this message]
2022-12-18 15:08 ` [PATCH V1 08/11] net/mlx5/hws: add vhca identifier ID to the caps Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 09/11] net/mlx5/hws: support shared ibv-context with local one Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 10/11] net/mlx5/hws: support actions while shared resources is used Erez Shitrit
2022-12-18 15:08 ` [PATCH V1 11/11] net/mlx5/hws: add debug details for cross gvmi Erez Shitrit
2022-12-27 15:49 ` Slava Ovsiienko
2022-12-19 8:24 [PATCH V1 00/11] Support resource sharing among ibv_devices Erez Shitrit
2022-12-19 8:24 ` [PATCH V1 07/11] net/mlx5/hws: added command to create alias objects Erez Shitrit
2022-12-27 15:48 ` Slava Ovsiienko
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=20221218150853.2167280-8-erezsh@nvidia.com \
--to=erezsh@nvidia.com \
--cc=dev@dpdk.org \
--cc=kliteyn@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=suanmingm@nvidia.com \
--cc=thomas@monjalon.net \
--cc=valex@nvidia.com \
--cc=viacheslavo@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).