Skip to content

Commit

Permalink
net/mlx5: fix metadata and meter split shared tag
Browse files Browse the repository at this point in the history
[ upstream commit 16f4aa5 ]

In the metadata flow split, PMD created the prefix subflow
with removed Queue or RSS action and appended the set tag and
copy table jump actions. If the flow being split for metadata
was the meter prefix subflow, the driver supposed to share the same
meter split tag action for the metadata split flow. There was the wrong
check for preceding meter split tag action, causing append with metadata
split set tag action and resulting the meter suffix subflow was missed
due to tag value mismatch.

This patch adds the checking before copying into extend action list,
to make sure the correct shared tag is used.

Fixes: 8d72fa6 ("net/mlx5: share tag between meter and metadata")

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
jiaweiwsz authored and cpaelzer committed Nov 30, 2021
1 parent d0d1c1e commit b2543bb
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions drivers/net/mlx5/mlx5_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -3685,6 +3685,8 @@ flow_meter_split_prep(struct rte_eth_dev *dev,
* Pointer to the Q/RSS action.
* @param[in] actions_n
* Number of original actions.
* @param[in] mtr_sfx
* Check if it is in meter suffix table.
* @param[out] error
* Perform verbose error reporting if not NULL.
*
Expand All @@ -3697,7 +3699,8 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev,
struct rte_flow_action *split_actions,
const struct rte_flow_action *actions,
const struct rte_flow_action *qrss,
int actions_n, struct rte_flow_error *error)
int actions_n, int mtr_sfx,
struct rte_flow_error *error)
{
struct mlx5_rte_flow_action_set_tag *set_tag;
struct rte_flow_action_jump *jump;
Expand All @@ -3711,15 +3714,15 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev,
* - Add jump to mreg CP_TBL.
* As a result, there will be one more action.
*/
++actions_n;
memcpy(split_actions, actions, sizeof(*split_actions) * actions_n);
/* Count MLX5_RTE_FLOW_ACTION_TYPE_TAG. */
++actions_n;
set_tag = (void *)(split_actions + actions_n);
/*
* If tag action is not set to void(it means we are not the meter
* suffix flow), add the tag action. Since meter suffix flow already
* has the tag added.
* If we are not the meter suffix flow, add the tag action.
* Since meter suffix flow already has the tag added.
*/
if (split_actions[qrss_idx].type != RTE_FLOW_ACTION_TYPE_VOID) {
if (!mtr_sfx) {
/*
* Allocate the new subflow ID. This one is unique within
* device and not shared with representors. Otherwise,
Expand Down Expand Up @@ -3751,6 +3754,12 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev,
MLX5_RTE_FLOW_ACTION_TYPE_TAG,
.conf = set_tag,
};
} else {
/*
* If we are the suffix flow of meter, tag already exist.
* Set the QUEUE/RSS action to void.
*/
split_actions[qrss_idx].type = RTE_FLOW_ACTION_TYPE_VOID;
}
/* JUMP action to jump to mreg copy table (CP_TBL). */
jump = (void *)(set_tag + 1);
Expand Down Expand Up @@ -3926,25 +3935,15 @@ flow_create_split_metadata(struct rte_eth_dev *dev,
RTE_FLOW_ERROR_TYPE_ACTION,
NULL, "no memory to split "
"metadata flow");
/*
* If we are the suffix flow of meter, tag already exist.
* Set the tag action to void.
*/
if (mtr_sfx)
ext_actions[qrss - actions].type =
RTE_FLOW_ACTION_TYPE_VOID;
else
ext_actions[qrss - actions].type =
(enum rte_flow_action_type)
MLX5_RTE_FLOW_ACTION_TYPE_TAG;
/*
* Create the new actions list with removed Q/RSS action
* and appended set tag and jump to register copy table
* (RX_CP_TBL). We should preallocate unique tag ID here
* in advance, because it is needed for set tag action.
*/
qrss_id = flow_mreg_split_qrss_prep(dev, ext_actions, actions,
qrss, actions_n, error);
qrss, actions_n,
mtr_sfx, error);
if (!mtr_sfx && !qrss_id) {
ret = -rte_errno;
goto exit;
Expand Down

0 comments on commit b2543bb

Please sign in to comment.