net/mlx5: non template - fix validation for GENEVE options
PATCH 1/2 net/mlx5: non template - fix validation for GENEVE options
For non-template API on top of HWS,
geneve options parser is created by the pmd and not by the user, therefore during validation , the parser is not yet created.
The fix is to ignore the validation of geneve options in case the rule is a non-template rule.
The parser will be created later during rule create.
--- drivers/net/mlx5/mlx5_flow_hw.c | 35 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +26 -9
@@ -8475,10 +8475,11 @@ struct mlx5_hw_pattern_validation_ctx { };static int -flow_hw_pattern_validate (struct rte_eth_dev *dev, +__flow_hw_pattern_validate (struct rte_eth_dev *dev,const struct rte_flow_pattern_template_attr *attr,const struct rte_flow_item items[],uint64_t *item_flags, +bool nt_flow,struct rte_flow_error *error) {struct mlx5_priv *priv = dev->data->dev_private;
@@ -8646,10 +8647,16 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,case RTE_FLOW_ITEM_TYPE_GENEVE_OPT : { last_item =MLX5_FLOW_LAYER_GENEVE_OPT ; - ret =mlx5_flow_geneve_tlv_option_validate (priv, item, - error); -if (ret <0 ) -return ret; +/* +* For non template the parser is internally created before +* the flow creation. +*/ +if (!nt_flow) { + ret =mlx5_flow_geneve_tlv_option_validate (priv, item, + error); +if (ret <0 ) +return ret; + }break ; }case RTE_FLOW_ITEM_TYPE_COMPARE :
@@ -8913,6 +8920,16 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,return 1 +RTE_PTR_DIFF (item, items) /sizeof (item[0 ]); } +static int +flow_hw_pattern_validate (struct rte_eth_dev *dev, +const struct rte_flow_pattern_template_attr *attr, +const struct rte_flow_item items[], +uint64_t *item_flags, +struct rte_flow_error *error) +{ +return __flow_hw_pattern_validate (dev, attr, items, item_flags, false, error); +} +/* * Verify that the tested flow patterns fits STE size limit in HWS group. *
@@ -14252,8 +14269,8 @@ static uintptr_t flow_hw_list_create(struct rte_eth_dev *dev, };/* Validate application items only */ - ret =flow_hw_pattern_validate (dev, &pattern_template_attr, items, - &item_flags, error); + ret =__flow_hw_pattern_validate (dev, &pattern_template_attr, items, + &item_flags, true, error);if (ret <0 )return 0 ;
@@ -15388,8 +15405,8 @@ flow_hw_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,if (external) {/* Validate application items only */ - ret =flow_hw_pattern_validate (dev, &pattern_template_attr, items, - &item_flags, error); + ret =__flow_hw_pattern_validate (dev, &pattern_template_attr, items, + &item_flags, true, error);if (ret <0 )return -rte_errno; }
Signature · 1 line
2.21.0
PATCH 2/2 net/mlx5: fix coverity warning
gre_item was dereferenced w/o checking it's value. added a check to verify if null before using the pointer.
--- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow.c +4 -4
@@ -3333,10 +3333,10 @@ mlx5_flow_validate_item_gre_key(const struct rte_eth_dev *dev,return rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ITEM , item,"GRE key following a wrong item" ); - gre_mask = gre_item->mask; + gre_mask = gre_item ? gre_item->mask :NULL ;if (!gre_mask) gre_mask = &rte_flow_item_gre_mask; - gre_spec = gre_item->spec; + gre_spec = gre_item ? gre_item->spec :NULL ;if (gre_spec && (gre_mask->c_rsvd0_ver &RTE_BE16 (0x2000 )) && !(gre_spec->c_rsvd0_ver &RTE_BE16 (0x2000 ))) return rte_flow_error_set(error, EINVAL,
@@ -3379,8 +3379,8 @@ mlx5_flow_validate_item_gre_option(struct rte_eth_dev *dev,const struct rte_flow_item *gre_item, struct rte_flow_error *error) { - const struct rte_flow_item_gre *gre_spec = gre_item->spec; -const struct rte_flow_item_gre *gre_mask = gre_item->mask; + const struct rte_flow_item_gre *gre_spec = gre_item ? gre_item->spec : NULL; +const struct rte_flow_item_gre *gre_mask = gre_item ? gre_item->mask :NULL ;const struct rte_flow_item_gre_opt *spec = item->spec;const struct rte_flow_item_gre_opt *mask = item->mask;struct mlx5_priv *priv = dev->data->dev_private;
Signature · 1 line
2.21.0
Hi, it looks like your patch was affected by an infrastructure issue at the DPDK Community Lab and has a false failure test result on DPDK patchwork. Issuing a retest to correct this:
Recheck-request: iol-intel-Functional
Hi,
Quoted 8 lines · Maayan Kashani
For non-template API on top of HWS,
geneve options parser is created by the pmd and not by the user, therefore during validation , the parser is not yet created.The fix is to ignore the validation of geneve options in case the rule is a non-template rule.
The parser will be created later during rule create.
Quoted 5 lines
Fixes 80c676259a04 ("net/mlx5: validate HWS template items")Signed-off-by Maayan Kashani <[email protected]>Acked-by Bing Zhao <[email protected]>
Series applied to next-net-mlx,
Signature · 2 lines
Kindest regards Raslan Darawsheh