DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shiri Kuzin <shirik@nvidia.com>
To: dev@dpdk.org
Cc: viacheslavo@nvidia.com, adrien.mazarguil@6wind.com,
	orika@nvidia.com, ferruh.yigit@intel.com, thomas@monjalon.net,
	rasland@nvidia.com
Subject: [dpdk-dev] [PATCH v5 4/8] common/mlx5: create GENEVE TLV option object with DevX
Date: Tue, 12 Jan 2021 16:02:37 +0200	[thread overview]
Message-ID: <20210112140241.15914-5-shirik@nvidia.com> (raw)
In-Reply-To: <20210112140241.15914-1-shirik@nvidia.com>

TLV object is a special firmware maintained entity used
to support match on GENEVE header extension option.

The TLV object is created with DevX API and accepts
the option class, type and lehgth fields.

The class type and length fields are set using MLX5_SET
and the Devx object is created using mlx5 glue function.

Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/common/mlx5/mlx5_devx_cmds.c          | 56 ++++++++++++++++++-
 drivers/common/mlx5/mlx5_devx_cmds.h          |  5 ++
 .../common/mlx5/rte_common_mlx5_exports.def   |  1 +
 drivers/common/mlx5/version.map               |  1 +
 4 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index ad54432eef..a5275f7ba1 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -2071,7 +2071,6 @@ mlx5_devx_cmd_create_flow_hit_aso_obj(void *ctx, uint32_t pd)
  *
  * @param[in] ctx
  *   Context returned from mlx5 open_device() glue function.
- *
  * @return
  *   The DevX object created, NULL otherwise and rte_errno is set.
  */
@@ -2100,3 +2099,58 @@ mlx5_devx_cmd_alloc_pd(void *ctx)
 	ppd->id = MLX5_GET(alloc_pd_out, out, pd);
 	return ppd;
 }
+
+/**
+ * Create general object of type GENEVE TLV option using DevX API.
+ *
+ * @param[in] ctx
+ *   Context returned from mlx5 open_device() glue function.
+ * @param [in] class
+ *   TLV option variable value of class
+ * @param [in] type
+ *   TLV option variable value of type
+ * @param [in] len
+ *   TLV option variable value of len
+ *
+ * @return
+ *   The DevX object created, NULL otherwise and rte_errno is set.
+ */
+struct mlx5_devx_obj *
+mlx5_devx_cmd_create_geneve_tlv_option(void *ctx,
+		uint16_t class, uint8_t type, uint8_t len)
+{
+	uint32_t in[MLX5_ST_SZ_DW(create_geneve_tlv_option_in)] = {0};
+	uint32_t out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)] = {0};
+	struct mlx5_devx_obj *geneve_tlv_opt_obj = mlx5_malloc(MLX5_MEM_ZERO,
+						   sizeof(*geneve_tlv_opt_obj),
+						   0, SOCKET_ID_ANY);
+
+	if (!geneve_tlv_opt_obj) {
+		DRV_LOG(ERR, "Failed to allocate geneve tlv option object.");
+		rte_errno = ENOMEM;
+		return NULL;
+	}
+	void *hdr = MLX5_ADDR_OF(create_geneve_tlv_option_in, in, hdr);
+	void *opt = MLX5_ADDR_OF(create_geneve_tlv_option_in, in,
+			geneve_tlv_opt);
+	MLX5_SET(general_obj_in_cmd_hdr, hdr, opcode,
+			MLX5_CMD_OP_CREATE_GENERAL_OBJECT);
+	MLX5_SET(general_obj_in_cmd_hdr, hdr, obj_type,
+			MLX5_OBJ_TYPE_GENEVE_TLV_OPT);
+	MLX5_SET(geneve_tlv_option, opt, option_class,
+			rte_be_to_cpu_16(class));
+	MLX5_SET(geneve_tlv_option, opt, option_type, type);
+	MLX5_SET(geneve_tlv_option, opt, option_data_length, len);
+	geneve_tlv_opt_obj->obj = mlx5_glue->devx_obj_create(ctx, in,
+					sizeof(in), out, sizeof(out));
+	if (!geneve_tlv_opt_obj->obj) {
+		rte_errno = errno;
+		DRV_LOG(ERR, "Failed to create Geneve tlv option "
+				"Obj using DevX.");
+		mlx5_free(geneve_tlv_opt_obj);
+		return NULL;
+	}
+	geneve_tlv_opt_obj->id = MLX5_GET(general_obj_out_cmd_hdr, out, obj_id);
+	return geneve_tlv_opt_obj;
+}
+
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index 2286569f37..3a63ff0048 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -486,6 +486,11 @@ __rte_internal
 int mlx5_devx_cmd_register_read(void *ctx, uint16_t reg_id,
 				uint32_t arg, uint32_t *data, uint32_t dw_cnt);
 
+__rte_internal
+struct mlx5_devx_obj *
+mlx5_devx_cmd_create_geneve_tlv_option(void *ctx,
+		uint16_t class, uint8_t type, uint8_t len);
+
 /**
  * Create virtio queue counters object DevX API.
  *
diff --git a/drivers/common/mlx5/rte_common_mlx5_exports.def b/drivers/common/mlx5/rte_common_mlx5_exports.def
index 9b7b7f4eae..1a7e54462d 100644
--- a/drivers/common/mlx5/rte_common_mlx5_exports.def
+++ b/drivers/common/mlx5/rte_common_mlx5_exports.def
@@ -34,6 +34,7 @@ EXPORTS
 	mlx5_devx_cmd_register_read
 	mlx5_devx_get_out_command_status
 	mlx5_devx_cmd_create_flow_hit_aso_obj
+	mlx5_devx_cmd_create_geneve_tlv_option
 
 	mlx5_get_dbr
 	mlx5_glue
diff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map
index fb3952bbc6..7de8006b89 100644
--- a/drivers/common/mlx5/version.map
+++ b/drivers/common/mlx5/version.map
@@ -23,6 +23,7 @@ INTERNAL {
 	mlx5_devx_cmd_create_virtio_q_counters;
 	mlx5_devx_cmd_create_virtq;
         mlx5_devx_cmd_create_flow_hit_aso_obj;
+	mlx5_devx_cmd_create_geneve_tlv_option;
 	mlx5_devx_cmd_destroy;
 	mlx5_devx_cmd_flow_counter_alloc;
 	mlx5_devx_cmd_flow_counter_query;
-- 
2.21.0


  parent reply	other threads:[~2021-01-12 14:04 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210105175358-16712-1-shirik@nvidia.com>
2021-01-07  8:38 ` [dpdk-dev] [PATCH v3 0/8] ethdev: introduce GENEVE header TLV option item Shiri Kuzin
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 1/8] lib/librte_ethdev: " Shiri Kuzin
2021-01-10 10:58     ` Ori Kam
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 2/8] app/testpmd: add GENEVE option item support Shiri Kuzin
2021-01-08 12:10     ` Suanming Mou
2021-01-08 12:21       ` Slava Ovsiienko
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 3/8] common/mlx5: check GENEVE TLV support in HCA attributes Shiri Kuzin
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 4/8] common/mlx5: create GENEVE TLV option object with DevX Shiri Kuzin
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 5/8] net/mlx5: create GENEVE TLV option management Shiri Kuzin
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 6/8] net/mlx5: add GENEVE TLV option flow validation Shiri Kuzin
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 7/8] net/mlx5: add GENEVE TLV option flow translation Shiri Kuzin
2021-01-07  8:38   ` [dpdk-dev] [PATCH v3 8/8] doc: update GENEVE TLV option support Shiri Kuzin
2021-01-11 14:26   ` [dpdk-dev] [PATCH v4 0/8] ethdev: introduce GENEVE header TLV option item Shiri Kuzin
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 1/8] lib/librte_ethdev: " Shiri Kuzin
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 2/8] app/testpmd: add GENEVE option item support Shiri Kuzin
2021-01-11 15:44       ` Ori Kam
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 3/8] common/mlx5: check GENEVE TLV support in HCA attributes Shiri Kuzin
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 4/8] common/mlx5: create GENEVE TLV option object with DevX Shiri Kuzin
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 5/8] net/mlx5: create GENEVE TLV option management Shiri Kuzin
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 6/8] net/mlx5: add GENEVE TLV option flow validation Shiri Kuzin
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 7/8] net/mlx5: add GENEVE TLV option flow translation Shiri Kuzin
2021-01-11 14:26     ` [dpdk-dev] [PATCH v4 8/8] doc: update GENEVE TLV option support Shiri Kuzin
2021-01-12 14:02     ` [dpdk-dev] [PATCH v5 0/8] ethdev: introduce GENEVE header TLV option item Shiri Kuzin
2021-01-12 14:02       ` [dpdk-dev] [PATCH v5 1/8] lib/librte_ethdev: " Shiri Kuzin
2021-01-12 14:02       ` [dpdk-dev] [PATCH v5 2/8] app/testpmd: add GENEVE option item support Shiri Kuzin
2021-01-12 14:02       ` [dpdk-dev] [PATCH v5 3/8] common/mlx5: check GENEVE TLV support in HCA attributes Shiri Kuzin
2021-01-12 14:02       ` Shiri Kuzin [this message]
2021-01-12 14:02       ` [dpdk-dev] [PATCH v5 5/8] net/mlx5: create GENEVE TLV option management Shiri Kuzin
2021-01-12 14:02       ` [dpdk-dev] [PATCH v5 6/8] net/mlx5: add GENEVE TLV option flow validation Shiri Kuzin
2021-01-12 14:02       ` [dpdk-dev] [PATCH v5 7/8] net/mlx5: add GENEVE TLV option flow translation Shiri Kuzin
2021-01-12 14:02       ` [dpdk-dev] [PATCH v5 8/8] doc: update GENEVE TLV option support Shiri Kuzin
2021-01-14  7:07       ` [dpdk-dev] [PATCH v6 0/9] ethdev: introduce GENEVE header TLV option item Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 1/9] lib/librte_ethdev: " Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 2/9] app/testpmd: add GENEVE option item support Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 3/9] app/testpmd: add GENEVE header option length support Shiri Kuzin
2021-01-14 14:36           ` Ori Kam
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 4/9] common/mlx5: check GENEVE TLV support in HCA attributes Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 5/9] common/mlx5: create GENEVE TLV option object with DevX Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 6/9] net/mlx5: create GENEVE TLV option management Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 7/9] net/mlx5: add GENEVE TLV option flow validation Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 8/9] net/mlx5: add GENEVE TLV option flow translation Shiri Kuzin
2021-01-14  7:07         ` [dpdk-dev] [PATCH v6 9/9] doc: update GENEVE TLV option support Shiri Kuzin
2021-01-15  1:33         ` [dpdk-dev] [PATCH v6 0/9] ethdev: introduce GENEVE header TLV option item Ferruh Yigit
2021-01-17  9:19           ` Shiri Kuzin
2021-01-17 10:21         ` [dpdk-dev] [PATCH v7 " Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 1/9] lib/librte_ethdev: " Shiri Kuzin
2021-01-18 14:29             ` Ferruh Yigit
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 2/9] app/testpmd: add GENEVE option item support Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 3/9] app/testpmd: add GENEVE header option length support Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 4/9] common/mlx5: check GENEVE TLV support in HCA attributes Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 5/9] common/mlx5: create GENEVE TLV option object with DevX Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 6/9] net/mlx5: create GENEVE TLV option management Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 7/9] net/mlx5: add GENEVE TLV option flow validation Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 8/9] net/mlx5: add GENEVE TLV option flow translation Shiri Kuzin
2021-01-17 10:21           ` [dpdk-dev] [PATCH v7 9/9] doc: update GENEVE TLV option support Shiri Kuzin
2021-01-18 14:30           ` [dpdk-dev] [PATCH v7 0/9] ethdev: introduce GENEVE header TLV option item Ferruh Yigit
2021-01-18 14:34           ` Ferruh Yigit

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=20210112140241.15914-5-shirik@nvidia.com \
    --to=shirik@nvidia.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --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).