From: Suanming Mou <suanmingm@nvidia.com>
To: Dariusz Sosnowski <dsosnowski@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Ori Kam <orika@nvidia.com>, Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>
Subject: [PATCH 2/4] net/mlx5: rename modify copy destination to destination
Date: Thu, 14 Dec 2023 11:04:25 +0800 [thread overview]
Message-ID: <20231214030428.363471-3-suanmingm@nvidia.com> (raw)
In-Reply-To: <20231214030428.363471-1-suanmingm@nvidia.com>
In the mlx5_flow_field_id_to_modify_info() function, for the coming
new ADD_FILED operation will also use that dcopy as ADD_FIELD's
destination.
This commit renames the dcopy to dest which makes things much clearer.
Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
---
drivers/net/mlx5/mlx5_flow.h | 2 +-
drivers/net/mlx5/mlx5_flow_dv.c | 34 +++++++++++++++++----------------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 6dde9de688..120609c595 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -2834,7 +2834,7 @@ void mlx5_flow_field_id_to_modify_info
const struct rte_flow_attr *attr, struct rte_flow_error *error);
int flow_dv_convert_modify_action(struct rte_flow_item *item,
struct field_modify_info *field,
- struct field_modify_info *dcopy,
+ struct field_modify_info *dest,
struct mlx5_flow_dv_modify_hdr_resource *resource,
uint32_t type, struct rte_flow_error *error);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4e2095dcfe..272dbca00f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -363,8 +363,10 @@ mlx5_update_vlan_vid_pcp(const struct rte_flow_action *action,
* For MLX5_MODIFICATION_TYPE_SET specifies destination field.
* For MLX5_MODIFICATION_TYPE_ADD specifies destination field.
* For MLX5_MODIFICATION_TYPE_COPY specifies source field.
- * @param[in] dcopy
- * Destination field info for MLX5_MODIFICATION_TYPE_COPY in @type.
+ * For MLX5_MODIFICATION_TYPE_ADD_FIELD specifies source field.
+ * @param[in] dest
+ * Destination field info for MLX5_MODIFICATION_TYPE_COPY and
+ * MLX5_MODIFICATION_TYPE_ADD_FIELD in @type.
* Negative offset value sets the same offset as source offset.
* size field is ignored, value is taken from source field.
* @param[in,out] resource
@@ -380,7 +382,7 @@ mlx5_update_vlan_vid_pcp(const struct rte_flow_action *action,
int
flow_dv_convert_modify_action(struct rte_flow_item *item,
struct field_modify_info *field,
- struct field_modify_info *dcopy,
+ struct field_modify_info *dest,
struct mlx5_flow_dv_modify_hdr_resource *resource,
uint32_t type, struct rte_flow_error *error)
{
@@ -401,7 +403,7 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,
uint32_t mask;
uint32_t data;
bool next_field = true;
- bool next_dcopy = true;
+ bool next_dest = true;
if (i >= MLX5_MAX_MODIFY_NUM)
return rte_flow_error_set(error, EINVAL,
@@ -432,20 +434,20 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,
0 : size_b,
};
if (type == MLX5_MODIFICATION_TYPE_COPY) {
- MLX5_ASSERT(dcopy);
- actions[i].dst_field = dcopy->id;
+ MLX5_ASSERT(dest);
+ actions[i].dst_field = dest->id;
actions[i].dst_offset =
- (int)dcopy->offset < 0 ? off_b : dcopy->offset;
+ (int)dest->offset < 0 ? off_b : dest->offset;
/* Convert entire record to big-endian format. */
actions[i].data1 = rte_cpu_to_be_32(actions[i].data1);
/*
* Destination field overflow. Copy leftovers of
* a source field to the next destination field.
*/
- if ((size_b > dcopy->size * CHAR_BIT - dcopy->offset) &&
- dcopy->size != 0) {
+ if ((size_b > dest->size * CHAR_BIT - dest->offset) &&
+ dest->size != 0) {
actions[i].length =
- dcopy->size * CHAR_BIT - dcopy->offset;
+ dest->size * CHAR_BIT - dest->offset;
carry_b += actions[i].length;
next_field = false;
} else {
@@ -455,12 +457,12 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,
* Not enough bits in a source filed to fill a
* destination field. Switch to the next source.
*/
- if ((size_b < dcopy->size * CHAR_BIT - dcopy->offset) &&
+ if ((size_b < dest->size * CHAR_BIT - dest->offset) &&
((size_b == field->size * CHAR_BIT - off_b) ||
field->is_flex)) {
actions[i].length = size_b;
- dcopy->offset += actions[i].length;
- next_dcopy = false;
+ dest->offset += actions[i].length;
+ next_dest = false;
}
} else {
MLX5_ASSERT(item->spec);
@@ -475,11 +477,11 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,
/* Convert entire record to expected big-endian format. */
actions[i].data0 = rte_cpu_to_be_32(actions[i].data0);
if ((type != MLX5_MODIFICATION_TYPE_COPY ||
- dcopy->id != (enum mlx5_modification_field)UINT32_MAX) &&
+ dest->id != (enum mlx5_modification_field)UINT32_MAX) &&
field->id != (enum mlx5_modification_field)UINT32_MAX)
++i;
- if (next_dcopy && type == MLX5_MODIFICATION_TYPE_COPY)
- ++dcopy;
+ if (next_dest && type == MLX5_MODIFICATION_TYPE_COPY)
+ ++dest;
if (next_field)
++field;
} while (field->size);
--
2.34.1
next prev parent reply other threads:[~2023-12-14 3:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 3:04 [PATCH 0/4] net/mlx5: add modify field ADD fields support Suanming Mou
2023-12-14 3:04 ` [PATCH 1/4] net/mlx5: add TCP/IP length modify field Suanming Mou
2023-12-14 11:35 ` Ori Kam
2023-12-14 11:36 ` Ori Kam
2023-12-14 3:04 ` Suanming Mou [this message]
2023-12-14 11:37 ` [PATCH 2/4] net/mlx5: rename modify copy destination to destination Ori Kam
2023-12-14 3:04 ` [PATCH 3/4] net/mlx5: add modify field action ADD fields support Suanming Mou
2023-12-14 11:38 ` Ori Kam
2023-12-14 3:04 ` [PATCH 4/4] net/mlx5: add modify field action ADD fields validation Suanming Mou
2023-12-14 11:39 ` Ori Kam
2024-01-07 12:37 ` [PATCH 0/4] net/mlx5: add modify field ADD fields support 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=20231214030428.363471-3-suanmingm@nvidia.com \
--to=suanmingm@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@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).