From: Jie Liu <[email protected]>
The rss->level/key_len/queue_num checks only set the rte_flow_error
but still return 0 (success), so invalid RSS configurations are
accepted instead of being rejected with ENOTSUP.
Return the error code from the validation checks, matching the
behavior in the V3 implementation.
Fixes: 635084db5d57 ("net/sxe2: support VF representors")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
drivers/net/sxe2/sxe2_flow_parse_action.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/sxe2/sxe2_flow_parse_action.c
b/drivers/net/sxe2/sxe2_flow_parse_action.c
index db70b146c6..b0275321be 100644
--- a/drivers/net/sxe2/sxe2_flow_parse_action.c
+++ b/drivers/net/sxe2/sxe2_flow_parse_action.c
@@ -12,7 +12,7 @@
static int32_t sxe2_flow_check_rss_action_attr(const struct
rte_flow_action_rss *rss,
struct rte_flow_error *error)
{
- int32_t ret = ENOTSUP;
+ int32_t ret = -ENOTSUP;
switch (rss->func) {
case RTE_ETH_HASH_FUNCTION_DEFAULT:
case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
@@ -25,15 +25,21 @@ static int32_t sxe2_flow_check_rss_action_attr(const struct
rte_flow_action_rss
goto l_end;
}
- if (rss->level > 2)
+ if (rss->level > 2) {
rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
NULL,
"RSS level is could not be greater than 2");
- if (rss->key_len)
+ goto l_end;
+ }
+ if (rss->key_len) {
rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
NULL,
"a nonzero RSS key_len is not supported");
- if (rss->queue_num)
+ goto l_end;
+ }
+ if (rss->queue_num) {
rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
NULL,
"a non-NULL RSS queue is not supported");
+ goto l_end;
+ }
ret = 0;
l_end:
return ret;
--
2.52.0