From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: getelson@nvidia.com, <mkashani@nvidia.com>,
rasland@nvidia.com, "Suanming Mou" <suanmingm@nvidia.com>,
"Matan Azrad" <matan@nvidia.com>,
"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
"Ori Kam" <orika@nvidia.com>
Subject: [PATCH v6 07/10] net/mlx5: reformat HWS code for HWS mirror action
Date: Wed, 25 Oct 2023 14:22:28 +0300 [thread overview]
Message-ID: <20231025112232.201606-8-getelson@nvidia.com> (raw)
In-Reply-To: <20231025112232.201606-1-getelson@nvidia.com>
Reformat HWS code for HWS mirror action.
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++---------------
1 file changed, 39 insertions(+), 31 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 6fcf654e4a..b2215fb5cf 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -4548,6 +4548,17 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
[RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT,
};
+static inline void
+action_template_set_type(struct rte_flow_actions_template *at,
+ enum mlx5dr_action_type *action_types,
+ unsigned int action_src, uint16_t *curr_off,
+ enum mlx5dr_action_type type)
+{
+ at->actions_off[action_src] = *curr_off;
+ action_types[*curr_off] = type;
+ *curr_off = *curr_off + 1;
+}
+
static int
flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,
unsigned int action_src,
@@ -4565,9 +4576,8 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,
type = mask->type;
switch (type) {
case RTE_FLOW_ACTION_TYPE_RSS:
- at->actions_off[action_src] = *curr_off;
- action_types[*curr_off] = MLX5DR_ACTION_TYP_TIR;
- *curr_off = *curr_off + 1;
+ action_template_set_type(at, action_types, action_src, curr_off,
+ MLX5DR_ACTION_TYP_TIR);
break;
case RTE_FLOW_ACTION_TYPE_AGE:
case RTE_FLOW_ACTION_TYPE_COUNT:
@@ -4575,23 +4585,20 @@ flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,
* Both AGE and COUNT action need counter, the first one fills
* the action_types array, and the second only saves the offset.
*/
- if (*cnt_off == UINT16_MAX) {
- *cnt_off = *curr_off;
- action_types[*cnt_off] = MLX5DR_ACTION_TYP_CTR;
- *curr_off = *curr_off + 1;
- }
+ if (*cnt_off == UINT16_MAX)
+ action_template_set_type(at, action_types,
+ action_src, curr_off,
+ MLX5DR_ACTION_TYP_CTR);
at->actions_off[action_src] = *cnt_off;
break;
case RTE_FLOW_ACTION_TYPE_CONNTRACK:
- at->actions_off[action_src] = *curr_off;
- action_types[*curr_off] = MLX5DR_ACTION_TYP_ASO_CT;
- *curr_off = *curr_off + 1;
+ action_template_set_type(at, action_types, action_src, curr_off,
+ MLX5DR_ACTION_TYP_ASO_CT);
break;
case RTE_FLOW_ACTION_TYPE_QUOTA:
case RTE_FLOW_ACTION_TYPE_METER_MARK:
- at->actions_off[action_src] = *curr_off;
- action_types[*curr_off] = MLX5DR_ACTION_TYP_ASO_METER;
- *curr_off = *curr_off + 1;
+ action_template_set_type(at, action_types, action_src, curr_off,
+ MLX5DR_ACTION_TYP_ASO_METER);
break;
default:
DRV_LOG(WARNING, "Unsupported shared action type: %d", type);
@@ -5101,31 +5108,32 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,
at->reformat_off = UINT16_MAX;
at->mhdr_off = UINT16_MAX;
at->rx_cpy_pos = pos;
- /*
- * mlx5 PMD hacks indirect action index directly to the action conf.
- * The rte_flow_conv() function copies the content from conf pointer.
- * Need to restore the indirect action index from action conf here.
- */
for (i = 0; actions->type != RTE_FLOW_ACTION_TYPE_END;
actions++, masks++, i++) {
- if (actions->type == RTE_FLOW_ACTION_TYPE_INDIRECT) {
+ const struct rte_flow_action_modify_field *info;
+
+ switch (actions->type) {
+ /*
+ * mlx5 PMD hacks indirect action index directly to the action conf.
+ * The rte_flow_conv() function copies the content from conf pointer.
+ * Need to restore the indirect action index from action conf here.
+ */
+ case RTE_FLOW_ACTION_TYPE_INDIRECT:
at->actions[i].conf = actions->conf;
at->masks[i].conf = masks->conf;
- }
- if (actions->type == RTE_FLOW_ACTION_TYPE_MODIFY_FIELD) {
- const struct rte_flow_action_modify_field *info = actions->conf;
-
+ break;
+ case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
+ info = actions->conf;
if ((info->dst.field == RTE_FLOW_FIELD_FLEX_ITEM &&
flow_hw_flex_item_acquire(dev, info->dst.flex_handle,
&at->flex_item)) ||
- (info->src.field == RTE_FLOW_FIELD_FLEX_ITEM &&
- flow_hw_flex_item_acquire(dev, info->src.flex_handle,
- &at->flex_item))) {
- rte_flow_error_set(error, rte_errno,
- RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
- "Failed to acquire flex item");
+ (info->src.field == RTE_FLOW_FIELD_FLEX_ITEM &&
+ flow_hw_flex_item_acquire(dev, info->src.flex_handle,
+ &at->flex_item)))
goto error;
- }
+ break;
+ default:
+ break;
}
}
at->tmpl = flow_hw_dr_actions_template_create(at);
--
2.39.2
next prev parent reply other threads:[~2023-10-25 11:24 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 ` [PATCH v2 01/16] net/mlx5/hws: add support for reformat DevX object Gregory Etelson
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 ` Gregory Etelson [this message]
2023-10-25 11:22 ` [PATCH v6 08/10] net/mlx5: support HWS mirror action 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=20231025112232.201606-8-getelson@nvidia.com \
--to=getelson@nvidia.com \
--cc=dev@dpdk.org \
--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 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).