From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: getelson@nvidia.com, <mkashani@nvidia.com>,
" . .
/patches/upstream-pmd-indirect-actions-list/v2/v2-0000-cover-letter
. patch" <rasland@nvidia.com>,
"Hamdan Igbaria" <hamdani@nvidia.com>,
"Matan Azrad" <matan@nvidia.com>,
"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
"Ori Kam" <orika@nvidia.com>,
"Suanming Mou" <suanmingm@nvidia.com>
Subject: [PATCH v2 01/16] net/mlx5/hws: add support for reformat DevX object
Date: Mon, 16 Oct 2023 21:42:20 +0300 [thread overview]
Message-ID: <20231016184235.200427-1-getelson@nvidia.com> (raw)
In-Reply-To: <20230927191046.405282-1-getelson@nvidia.com>
From: Hamdan Igbaria <hamdani@nvidia.com>
Add support for creation of packet reformat object,
via the ALLOC_PACKET_REFORMAT_CONTEXT command.
Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
---
drivers/common/mlx5/mlx5_prm.h | 39 +++++++++++++++++
drivers/net/mlx5/hws/mlx5dr_cmd.c | 60 ++++++++++++++++++++++++++
drivers/net/mlx5/hws/mlx5dr_cmd.h | 11 +++++
drivers/net/mlx5/hws/mlx5dr_internal.h | 5 +++
drivers/net/mlx5/hws/mlx5dr_send.c | 5 ---
5 files changed, 115 insertions(+), 5 deletions(-)
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 6e181a0eca..4192fff55b 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -1218,6 +1218,8 @@ enum {
MLX5_CMD_OP_CREATE_FLOW_GROUP = 0x933,
MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY = 0x936,
MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c,
+ MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT = 0x93d,
+ MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT = 0x93e,
MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939,
MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b,
MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
@@ -5191,6 +5193,43 @@ struct mlx5_ifc_modify_flow_table_out_bits {
u8 reserved_at_40[0x60];
};
+struct mlx5_ifc_packet_reformat_context_in_bits {
+ u8 reformat_type[0x8];
+ u8 reserved_at_8[0x4];
+ u8 reformat_param_0[0x4];
+ u8 reserved_at_16[0x6];
+ u8 reformat_data_size[0xa];
+
+ u8 reformat_param_1[0x8];
+ u8 reserved_at_40[0x8];
+ u8 reformat_data[6][0x8];
+
+ u8 more_reformat_data[][0x8];
+};
+
+struct mlx5_ifc_alloc_packet_reformat_context_in_bits {
+ u8 opcode[0x10];
+ u8 uid[0x10];
+
+ u8 reserved_at_20[0x10];
+ u8 op_mod[0x10];
+
+ u8 reserved_at_40[0xa0];
+
+ u8 packet_reformat_context[];
+};
+
+struct mlx5_ifc_alloc_packet_reformat_out_bits {
+ u8 status[0x8];
+ u8 reserved_at_8[0x18];
+
+ u8 syndrome[0x20];
+
+ u8 packet_reformat_id[0x20];
+
+ u8 reserved_at_60[0x20];
+};
+
/* CQE format mask. */
#define MLX5E_CQE_FORMAT_MASK 0xc
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index 594c59aee3..0ccbaee961 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -780,6 +780,66 @@ mlx5dr_cmd_sq_create(struct ibv_context *ctx,
return devx_obj;
}
+struct mlx5dr_devx_obj *
+mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx,
+ struct mlx5dr_cmd_packet_reformat_create_attr *attr)
+{
+ uint32_t out[MLX5_ST_SZ_DW(alloc_packet_reformat_out)] = {0};
+ size_t insz, cmd_data_sz, cmd_total_sz;
+ struct mlx5dr_devx_obj *devx_obj;
+ void *prctx;
+ void *pdata;
+ void *in;
+
+ cmd_total_sz = MLX5_ST_SZ_BYTES(alloc_packet_reformat_context_in);
+ cmd_total_sz += MLX5_ST_SZ_BYTES(packet_reformat_context_in);
+ cmd_data_sz = MLX5_FLD_SZ_BYTES(packet_reformat_context_in, reformat_data);
+ insz = align(cmd_total_sz + attr->data_sz - cmd_data_sz, DW_SIZE);
+ in = simple_calloc(1, insz);
+ if (!in) {
+ rte_errno = ENOMEM;
+ return NULL;
+ }
+
+ MLX5_SET(alloc_packet_reformat_context_in, in, opcode,
+ MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT);
+
+ prctx = MLX5_ADDR_OF(alloc_packet_reformat_context_in, in,
+ packet_reformat_context);
+ pdata = MLX5_ADDR_OF(packet_reformat_context_in, prctx, reformat_data);
+
+ MLX5_SET(packet_reformat_context_in, prctx, reformat_type, attr->type);
+ MLX5_SET(packet_reformat_context_in, prctx, reformat_param_0, attr->reformat_param_0);
+ MLX5_SET(packet_reformat_context_in, prctx, reformat_data_size, attr->data_sz);
+ memcpy(pdata, attr->data, attr->data_sz);
+
+ devx_obj = simple_malloc(sizeof(*devx_obj));
+ if (!devx_obj) {
+ DR_LOG(ERR, "Failed to allocate memory for packet reformat object");
+ rte_errno = ENOMEM;
+ goto out_free_in;
+ }
+
+ devx_obj->obj = mlx5_glue->devx_obj_create(ctx, in, insz, out, sizeof(out));
+ if (!devx_obj->obj) {
+ DR_LOG(ERR, "Failed to create packet reformat");
+ rte_errno = errno;
+ goto out_free_devx;
+ }
+
+ devx_obj->id = MLX5_GET(alloc_packet_reformat_out, out, packet_reformat_id);
+
+ simple_free(in);
+
+ return devx_obj;
+
+out_free_devx:
+ simple_free(devx_obj);
+out_free_in:
+ simple_free(in);
+ return NULL;
+}
+
int mlx5dr_cmd_sq_modify_rdy(struct mlx5dr_devx_obj *devx_obj)
{
uint32_t out[MLX5_ST_SZ_DW(modify_sq_out)] = {0};
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h
index 8a495db9b3..f45b6c6b07 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.h
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h
@@ -155,6 +155,13 @@ struct mlx5dr_cmd_allow_other_vhca_access_attr {
uint8_t access_key[ACCESS_KEY_LEN];
};
+struct mlx5dr_cmd_packet_reformat_create_attr {
+ uint8_t type;
+ size_t data_sz;
+ void *data;
+ uint8_t reformat_param_0;
+};
+
struct mlx5dr_cmd_query_ft_caps {
uint8_t max_level;
uint8_t reparse;
@@ -285,6 +292,10 @@ mlx5dr_cmd_forward_tbl_create(struct ibv_context *ctx,
void mlx5dr_cmd_forward_tbl_destroy(struct mlx5dr_cmd_forward_tbl *tbl);
+struct mlx5dr_devx_obj *
+mlx5dr_cmd_packet_reformat_create(struct ibv_context *ctx,
+ struct mlx5dr_cmd_packet_reformat_create_attr *attr);
+
struct mlx5dr_devx_obj *
mlx5dr_cmd_alias_obj_create(struct ibv_context *ctx,
struct mlx5dr_cmd_alias_obj_create_attr *alias_attr);
diff --git a/drivers/net/mlx5/hws/mlx5dr_internal.h b/drivers/net/mlx5/hws/mlx5dr_internal.h
index c3c077667d..3770d28e62 100644
--- a/drivers/net/mlx5/hws/mlx5dr_internal.h
+++ b/drivers/net/mlx5/hws/mlx5dr_internal.h
@@ -91,4 +91,9 @@ static inline uint64_t roundup_pow_of_two(uint64_t n)
return n == 1 ? 1 : 1ULL << log2above(n);
}
+static inline unsigned long align(unsigned long val, unsigned long align)
+{
+ return (val + align - 1) & ~(align - 1);
+}
+
#endif /* MLX5DR_INTERNAL_H_ */
diff --git a/drivers/net/mlx5/hws/mlx5dr_send.c b/drivers/net/mlx5/hws/mlx5dr_send.c
index e58fdeb117..622d574bfa 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.c
+++ b/drivers/net/mlx5/hws/mlx5dr_send.c
@@ -668,11 +668,6 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,
return err;
}
-static inline unsigned long align(unsigned long val, unsigned long align)
-{
- return (val + align - 1) & ~(align - 1);
-}
-
static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx,
struct mlx5dr_send_engine *queue,
struct mlx5dr_send_ring_sq *sq,
--
2.39.2
next prev parent reply other threads:[~2023-10-16 18:43 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 19:10 [PATCH 0/3] net/mlx5: support indirect list actions Gregory Etelson
2023-10-16 18:42 ` Gregory Etelson [this message]
2023-10-16 18:42 ` [PATCH v2 02/16] net/mlx5/hws: support creating of dynamic forward table and FTE Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 03/16] net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 04/16] net/mlx5/hws: add support for mirroring Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 05/16] net/mlx5/hws: allow destination into default miss FT Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 06/16] net/mlx5/hws: support reformat for hws mirror Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 07/16] net/mlx5: reformat HWS code Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 08/16] net/mlx5: support HWS mirror action Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 09/16] net/mlx5: fix mirror action validation Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 10/16] net/mlx5: fix in shared counter and age template action create Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 11/16] net/mlx5: fix modify field expansion for raw DECAP / ENCAP Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 12/16] net/mlx5: refactor HWS code Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 13/16] net/mlx5: fix RTE action location tracking in a template Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 14/16] net/mlx5: fix mirror redirect action Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 15/16] net/mlx5: support indirect list METER_MARK action Gregory Etelson
2023-10-16 18:42 ` [PATCH v2 16/16] net/mlx5: fix METER_MARK indirection list callback Gregory Etelson
2023-10-17 7:56 ` [PATCH v2 01/16] net/mlx5/hws: add support for reformat DevX object Suanming Mou
2023-10-17 7:31 ` [PATCH v2 00/16] net/mlx5: support indirect actions list Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 " Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 01/16] net/mlx5/hws: add support for reformat DevX object Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 02/16] net/mlx5/hws: support creating of dynamic forward table and FTE Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 03/16] net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 04/16] net/mlx5/hws: add support for mirroring Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 05/16] net/mlx5/hws: allow destination into default miss FT Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 06/16] net/mlx5/hws: support reformat for hws mirror Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 07/16] net/mlx5: reformat HWS code Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 08/16] net/mlx5: support HWS mirror action Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 09/16] net/mlx5: fix mirror action validation Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 10/16] net/mlx5: fix in shared counter and age template action create Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 11/16] net/mlx5: fix modify field expansion for raw DECAP / ENCAP Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 12/16] net/mlx5: refactor HWS code Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 13/16] net/mlx5: fix RTE action location tracking in a template Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 14/16] net/mlx5: fix mirror redirect action Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 15/16] net/mlx5: support indirect list METER_MARK action Gregory Etelson
2023-10-17 8:09 ` [PATCH v3 16/16] net/mlx5: fix METER_MARK indirection list callback Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 00/10] net/mlx5: support indirect actions list Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 01/10] net/mlx5/hws: add support for reformat DevX object Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 02/10] net/mlx5/hws: support creating of dynamic forward table and FTE Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 03/10] net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 04/10] net/mlx5/hws: add support for mirroring Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 05/10] net/mlx5/hws: allow destination into default miss FT Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 06/10] net/mlx5/hws: support reformat for hws mirror Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 07/10] net/mlx5: reformat HWS code for HWS mirror action Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 08/10] net/mlx5: support " Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 09/10] net/mlx5: reformat HWS code for indirect list actions Gregory Etelson
2023-10-23 12:42 ` [PATCH v4 10/10] net/mlx5: support indirect list METER_MARK action Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 00/10] net/mlx5: support indirect actions list Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 01/10] net/mlx5/hws: add support for reformat DevX object Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 02/10] net/mlx5/hws: support creating of dynamic forward table and FTE Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 03/10] net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 04/10] net/mlx5/hws: add support for mirroring Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 05/10] net/mlx5/hws: allow destination into default miss FT Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 06/10] net/mlx5/hws: support reformat for hws mirror Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 07/10] net/mlx5: reformat HWS code for HWS mirror action Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 08/10] net/mlx5: support " Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 09/10] net/mlx5: reformat HWS code for indirect list actions Gregory Etelson
2023-10-25 10:27 ` [PATCH v5 10/10] net/mlx5: support indirect list METER_MARK action Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 00/10] net/mlx5: support indirect actions list Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 01/10] net/mlx5/hws: add support for reformat DevX object Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 02/10] net/mlx5/hws: support creating of dynamic forward table and FTE Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 03/10] net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 04/10] net/mlx5/hws: add support for mirroring Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 05/10] net/mlx5/hws: allow destination into default miss FT Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 06/10] net/mlx5/hws: support reformat for hws mirror Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 07/10] net/mlx5: reformat HWS code for HWS mirror action Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 08/10] net/mlx5: support " Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 09/10] net/mlx5: reformat HWS code for indirect list actions Gregory Etelson
2023-10-25 11:22 ` [PATCH v6 10/10] net/mlx5: support indirect list METER_MARK action Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 00/10] net/mlx5: support indirect actions list Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 01/10] net/mlx5/hws: add support for reformat DevX object Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 02/10] net/mlx5/hws: support creating of dynamic forward table and FTE Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 03/10] net/mlx5/hws: add mlx5dr DevX object struct to mlx5dr action Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 04/10] net/mlx5/hws: add support for mirroring Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 05/10] net/mlx5/hws: allow destination into default miss FT Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 06/10] net/mlx5/hws: support reformat for hws mirror Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 07/10] net/mlx5: reformat HWS code for HWS mirror action Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 08/10] net/mlx5: support " Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 09/10] net/mlx5: reformat HWS code for indirect list actions Gregory Etelson
2023-10-26 7:12 ` [PATCH v7 10/10] net/mlx5: support indirect list METER_MARK action Gregory Etelson
2023-10-29 7:53 ` [PATCH v7 00/10] net/mlx5: support indirect actions list Raslan Darawsheh
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=20231016184235.200427-1-getelson@nvidia.com \
--to=getelson@nvidia.com \
--cc=dev@dpdk.org \
--cc=hamdani@nvidia.com \
--cc=matan@nvidia.com \
--cc=mkashani@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@nvidia.com \
--cc=suanmingm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.