From: Dariusz Sosnowski <dsosnowski@nvidia.com>
To: Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>, Raslan Darawsheh <rasland@nvidia.com>
Subject: [PATCH 1/9] net/mlx5: use DPDK be64 type in modify header pattern
Date: Wed, 25 Feb 2026 12:59:09 +0100 [thread overview]
Message-ID: <20260225115918.233843-2-dsosnowski@nvidia.com> (raw)
In-Reply-To: <20260225115918.233843-1-dsosnowski@nvidia.com>
mlx5dr.h defines mlx5dr_action_mh_pattern struct.
One of its fields is an array of modify field HW actions,
each of 64 bit size and stored as big endian.
Before this patch, this array was defined using __be64
typedef from "linux/types.h" header file.
This necessitated either inclusion of that header file
or, in case of Windows build, addition of typedef directly
whenever mlx5dr.h was included.
Follow up patches which add lazy allocation of global
HWS actions will add additional source files which would include
mlx5dr.h. To prevent additional includes/typedef definitions
required for __be64, this patch changes this definition to use
DPDK's typedef i.e., rte_be64_t.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr.h | 3 ++-
drivers/net/mlx5/hws/mlx5dr_action.c | 26 +++++++++++++-------------
drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 20 ++++++++++----------
drivers/net/mlx5/hws/mlx5dr_pat_arg.h | 8 ++++----
drivers/net/mlx5/mlx5.h | 2 --
drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
drivers/net/mlx5/mlx5_flow_hw.c | 4 ++--
7 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index c13316305f..d358178e5b 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -5,6 +5,7 @@
#ifndef MLX5DR_H_
#define MLX5DR_H_
+#include <rte_byteorder.h>
#include <rte_flow.h>
struct mlx5dr_context;
@@ -248,7 +249,7 @@ struct mlx5dr_action_mh_pattern {
/* Byte size of modify actions provided by "data" */
size_t sz;
/* PRM format modify actions pattern */
- __be64 *data;
+ rte_be64_t *data;
};
/* In actions that take offset, the offset is unique, pointing to a single
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index b35bf07c3c..439592c5e4 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -369,7 +369,7 @@ mlx5dr_action_create_nat64_copy_state(struct mlx5dr_context *ctx,
struct mlx5dr_action_nat64_attr *attr,
uint32_t flags)
{
- __be64 modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
+ rte_be64_t modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
struct mlx5dr_action_mh_pattern pat[2];
struct mlx5dr_action *action;
uint32_t packet_len_field;
@@ -484,7 +484,7 @@ mlx5dr_action_create_nat64_repalce_state(struct mlx5dr_context *ctx,
uint32_t flags)
{
uint32_t address_prefix[MLX5DR_ACTION_NAT64_HEADER_MINUS_ONE] = {0};
- __be64 modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
+ rte_be64_t modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
struct mlx5dr_action_mh_pattern pat[2];
static struct mlx5dr_action *action;
uint8_t header_size_in_dw;
@@ -575,7 +575,7 @@ mlx5dr_action_create_nat64_copy_proto_state(struct mlx5dr_context *ctx,
struct mlx5dr_action_nat64_attr *attr,
uint32_t flags)
{
- __be64 modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
+ rte_be64_t modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
struct mlx5dr_action_mh_pattern pat[2];
struct mlx5dr_action *action;
uint8_t *action_ptr;
@@ -615,7 +615,7 @@ mlx5dr_action_create_nat64_copy_back_state(struct mlx5dr_context *ctx,
struct mlx5dr_action_nat64_attr *attr,
uint32_t flags)
{
- __be64 modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
+ rte_be64_t modify_action_data[MLX5DR_ACTION_NAT64_MAX_MODIFY_ACTIONS];
struct mlx5dr_action_mh_pattern pat[2];
struct mlx5dr_action *action;
uint32_t packet_len_field;
@@ -2165,7 +2165,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action,
/* All DecapL3 cases require the same max arg size */
arg_obj = mlx5dr_arg_create_modify_header_arg(ctx,
- (__be64 *)mh_data,
+ (rte_be64_t *)mh_data,
num_of_actions,
log_bulk_sz,
action->flags & MLX5DR_ACTION_FLAG_SHARED);
@@ -2177,7 +2177,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action,
mlx5dr_action_prepare_decap_l3_actions(hdrs[i].sz, mh_data, &num_of_actions);
mh_data_size = num_of_actions * MLX5DR_MODIFY_ACTION_SIZE;
- pat_obj = mlx5dr_pat_get_pattern(ctx, (__be64 *)mh_data, mh_data_size);
+ pat_obj = mlx5dr_pat_get_pattern(ctx, (rte_be64_t *)mh_data, mh_data_size);
if (!pat_obj) {
DR_LOG(ERR, "Failed to allocate pattern for DecapL3");
goto free_stc_and_pat;
@@ -2189,7 +2189,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action,
action[i].modify_header.arg_obj = arg_obj;
action[i].modify_header.pat_obj = pat_obj;
action[i].modify_header.require_reparse =
- mlx5dr_pat_require_reparse((__be64 *)mh_data, num_of_actions);
+ mlx5dr_pat_require_reparse((rte_be64_t *)mh_data, num_of_actions);
ret = mlx5dr_action_create_stcs(&action[i], NULL);
if (ret) {
@@ -2304,7 +2304,7 @@ mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
static int
mlx5dr_action_create_modify_header_root(struct mlx5dr_action *action,
size_t actions_sz,
- __be64 *actions)
+ rte_be64_t *actions)
{
enum mlx5dv_flow_table_type ft_type = 0;
struct ibv_context *local_ibv_ctx;
@@ -2897,7 +2897,7 @@ static void *
mlx5dr_action_create_pop_ipv6_route_ext_mhdr1(struct mlx5dr_action *action)
{
struct mlx5dr_action_mh_pattern pattern;
- __be64 cmd[3] = {0};
+ rte_be64_t cmd[3] = {0};
uint16_t mod_id;
mod_id = flow_hw_get_ipv6_route_ext_mod_id_from_ctx(action->ctx, 0);
@@ -2943,7 +2943,7 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr2(struct mlx5dr_action *action)
MLX5_MODI_OUT_DIPV6_31_0
};
struct mlx5dr_action_mh_pattern pattern;
- __be64 cmd[5] = {0};
+ rte_be64_t cmd[5] = {0};
uint16_t mod_id;
uint32_t i;
@@ -3001,7 +3001,7 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action)
MLX5_SET(copy_action_in, cmd, src_field, mod_id);
MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IP_PROTOCOL);
- pattern.data = (__be64 *)cmd;
+ pattern.data = (rte_be64_t *)cmd;
pattern.sz = sizeof(cmd);
return mlx5dr_action_create_modify_header_reparse(action->ctx, 1, &pattern, 0,
@@ -3063,7 +3063,7 @@ mlx5dr_action_create_push_ipv6_route_ext_mhdr1(struct mlx5dr_action *action)
MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IP_PROTOCOL);
MLX5_SET(set_action_in, cmd, data, IPPROTO_ROUTING);
- pattern.data = (__be64 *)cmd;
+ pattern.data = (rte_be64_t *)cmd;
pattern.sz = sizeof(cmd);
return mlx5dr_action_create_modify_header(action->ctx, 1, &pattern, 0,
@@ -3084,7 +3084,7 @@ mlx5dr_action_create_push_ipv6_route_ext_mhdr2(struct mlx5dr_action *action,
struct mlx5dr_action_mh_pattern pattern;
uint32_t *ipv6_dst_addr = NULL;
uint8_t seg_left, next_hdr;
- __be64 cmd[5] = {0};
+ rte_be64_t cmd[5] = {0};
uint16_t mod_id;
uint32_t i;
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index 513549ff3c..dfed5eb47a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -37,7 +37,7 @@ uint32_t mlx5dr_arg_get_arg_size(uint16_t num_of_actions)
return BIT(mlx5dr_arg_get_arg_log_size(num_of_actions));
}
-bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions)
+bool mlx5dr_pat_require_reparse(rte_be64_t *actions, uint16_t num_of_actions)
{
uint16_t i, field;
uint8_t action_id;
@@ -98,9 +98,9 @@ void mlx5dr_pat_uninit_pattern_cache(struct mlx5dr_pattern_cache *cache)
}
static bool mlx5dr_pat_compare_pattern(int cur_num_of_actions,
- __be64 cur_actions[],
+ rte_be64_t cur_actions[],
int num_of_actions,
- __be64 actions[])
+ rte_be64_t actions[])
{
int i;
@@ -129,13 +129,13 @@ static bool mlx5dr_pat_compare_pattern(int cur_num_of_actions,
static struct mlx5dr_pattern_cache_item *
mlx5dr_pat_find_cached_pattern(struct mlx5dr_pattern_cache *cache,
uint16_t num_of_actions,
- __be64 *actions)
+ rte_be64_t *actions)
{
struct mlx5dr_pattern_cache_item *cached_pat;
LIST_FOREACH(cached_pat, &cache->head, next) {
if (mlx5dr_pat_compare_pattern(cached_pat->mh_data.num_of_actions,
- (__be64 *)cached_pat->mh_data.data,
+ (rte_be64_t *)cached_pat->mh_data.data,
num_of_actions,
actions))
return cached_pat;
@@ -147,7 +147,7 @@ mlx5dr_pat_find_cached_pattern(struct mlx5dr_pattern_cache *cache,
static struct mlx5dr_pattern_cache_item *
mlx5dr_pat_get_existing_cached_pattern(struct mlx5dr_pattern_cache *cache,
uint16_t num_of_actions,
- __be64 *actions)
+ rte_be64_t *actions)
{
struct mlx5dr_pattern_cache_item *cached_pattern;
@@ -166,7 +166,7 @@ static struct mlx5dr_pattern_cache_item *
mlx5dr_pat_add_pattern_to_cache(struct mlx5dr_pattern_cache *cache,
struct mlx5dr_devx_obj *pattern_obj,
uint16_t num_of_actions,
- __be64 *actions)
+ rte_be64_t *actions)
{
struct mlx5dr_pattern_cache_item *cached_pattern;
@@ -248,7 +248,7 @@ void mlx5dr_pat_put_pattern(struct mlx5dr_context *ctx,
struct mlx5dr_devx_obj *
mlx5dr_pat_get_pattern(struct mlx5dr_context *ctx,
- __be64 *pattern, size_t pattern_sz)
+ rte_be64_t *pattern, size_t pattern_sz)
{
uint16_t num_of_actions = pattern_sz / MLX5DR_MODIFY_ACTION_SIZE;
struct mlx5dr_pattern_cache_item *cached_pattern;
@@ -458,7 +458,7 @@ mlx5dr_arg_create(struct mlx5dr_context *ctx,
struct mlx5dr_devx_obj *
mlx5dr_arg_create_modify_header_arg(struct mlx5dr_context *ctx,
- __be64 *data,
+ rte_be64_t *data,
uint8_t num_of_actions,
uint32_t log_bulk_sz,
bool write_data)
@@ -477,7 +477,7 @@ mlx5dr_arg_create_modify_header_arg(struct mlx5dr_context *ctx,
return arg_obj;
}
-bool mlx5dr_pat_verify_actions(__be64 pattern[], size_t sz)
+bool mlx5dr_pat_verify_actions(rte_be64_t pattern[], size_t sz)
{
size_t i;
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.h b/drivers/net/mlx5/hws/mlx5dr_pat_arg.h
index c4e0cbc843..3418469962 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.h
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.h
@@ -51,7 +51,7 @@ int mlx5dr_pat_init_pattern_cache(struct mlx5dr_pattern_cache **cache);
void mlx5dr_pat_uninit_pattern_cache(struct mlx5dr_pattern_cache *cache);
-bool mlx5dr_pat_verify_actions(__be64 pattern[], size_t sz);
+bool mlx5dr_pat_verify_actions(rte_be64_t pattern[], size_t sz);
struct mlx5dr_devx_obj *
mlx5dr_arg_create(struct mlx5dr_context *ctx,
@@ -62,14 +62,14 @@ mlx5dr_arg_create(struct mlx5dr_context *ctx,
struct mlx5dr_devx_obj *
mlx5dr_arg_create_modify_header_arg(struct mlx5dr_context *ctx,
- __be64 *data,
+ rte_be64_t *data,
uint8_t num_of_actions,
uint32_t log_bulk_sz,
bool write_data);
struct mlx5dr_devx_obj *
mlx5dr_pat_get_pattern(struct mlx5dr_context *ctx,
- __be64 *pattern,
+ rte_be64_t *pattern,
size_t pattern_sz);
void mlx5dr_pat_put_pattern(struct mlx5dr_context *ctx,
@@ -78,7 +78,7 @@ void mlx5dr_pat_put_pattern(struct mlx5dr_context *ctx,
bool mlx5dr_arg_is_valid_arg_request_size(struct mlx5dr_context *ctx,
uint32_t arg_size);
-bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions);
+bool mlx5dr_pat_require_reparse(rte_be64_t *actions, uint16_t num_of_actions);
void mlx5dr_arg_write(struct mlx5dr_send_engine *queue,
void *comp_data,
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index b83dda5652..e9d855e345 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -37,8 +37,6 @@
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
#ifndef RTE_EXEC_ENV_WINDOWS
#define HAVE_MLX5_HWS_SUPPORT 1
-#else
-#define __be64 uint64_t
#endif
#include "hws/mlx5dr.h"
#endif
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 99ab0125a8..d1bed18077 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -6294,7 +6294,7 @@ mlx5_flow_modify_create_cb(void *tool_ctx, void *cb_ctx)
#ifdef HAVE_MLX5_HWS_SUPPORT
struct mlx5dr_action_mh_pattern pattern = {
.sz = data_len,
- .data = (__be64 *)ref->actions
+ .data = (rte_be64_t *)ref->actions
};
entry->action = mlx5dr_action_create_modify_header(ctx->data2,
1,
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 6ac6825c16..b29909f99d 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -2436,7 +2436,7 @@ mlx5_tbl_translate_modify_header(struct rte_eth_dev *dev,
NULL, "translate modify_header: no memory for modify header context");
rte_memcpy(acts->mhdr, mhdr, sizeof(*mhdr));
if (!mhdr->shared) {
- pattern.data = (__be64 *)acts->mhdr->mhdr_cmds;
+ pattern.data = (rte_be64_t *)acts->mhdr->mhdr_cmds;
typeof(mp_ctx->mh) *mh = &mp_ctx->mh;
uint32_t idx = mh->elements_num;
mh->pattern[mh->elements_num++] = pattern;
@@ -2470,7 +2470,7 @@ mlx5_tbl_ensure_shared_modify_header(struct rte_eth_dev *dev,
uint16_t mhdr_ix = acts->mhdr->pos;
uint32_t flags = mlx5_hw_act_flag[!!attr->group][tbl_type] | MLX5DR_ACTION_FLAG_SHARED;
- pattern.data = (__be64 *)acts->mhdr->mhdr_cmds;
+ pattern.data = (rte_be64_t *)acts->mhdr->mhdr_cmds;
acts->mhdr->action = mlx5dr_action_create_modify_header(priv->dr_ctx, 1,
&pattern, 0, flags);
if (!acts->mhdr->action)
--
2.47.3
next prev parent reply other threads:[~2026-02-25 12:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 11:59 [PATCH 0/9] net/mlx5: lazily allocate HWS actions Dariusz Sosnowski
2026-02-25 11:59 ` Dariusz Sosnowski [this message]
2026-02-25 11:59 ` [PATCH 2/9] net/mlx5/hws: add table type to action flags conversion Dariusz Sosnowski
2026-02-25 11:59 ` [PATCH 3/9] net/mlx5: lazily allocate drop HWS action Dariusz Sosnowski
2026-02-25 11:59 ` [PATCH 4/9] net/mlx5: lazily allocate tag " Dariusz Sosnowski
2026-02-25 11:59 ` [PATCH 5/9] net/mlx5: lazily allocate HWS pop VLAN action Dariusz Sosnowski
2026-02-25 11:59 ` [PATCH 6/9] net/mlx5: lazily allocate HWS push " Dariusz Sosnowski
2026-02-25 11:59 ` [PATCH 7/9] net/mlx5: lazily allocate HWS send to kernel action Dariusz Sosnowski
2026-02-25 11:59 ` [PATCH 8/9] net/mlx5: lazily allocate HWS NAT64 action Dariusz Sosnowski
2026-02-25 11:59 ` [PATCH 9/9] net/mlx5: lazily allocate HWS default miss action Dariusz Sosnowski
2026-03-02 11:22 ` [PATCH 0/9] net/mlx5: lazily allocate HWS actions 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=20260225115918.233843-2-dsosnowski@nvidia.com \
--to=dsosnowski@nvidia.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox