DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rongwei Liu <rongweil@nvidia.com>
To: <dev@dpdk.org>, <matan@nvidia.com>, <viacheslavo@nvidia.com>,
	<orika@nvidia.com>, <thomas@monjalon.net>
Cc: <rasland@nvidia.com>
Subject: [PATCH v4 6/6] net/mlx5: add error message
Date: Thu, 23 Feb 2023 14:48:58 +0200	[thread overview]
Message-ID: <20230223124858.1042097-7-rongweil@nvidia.com> (raw)
In-Reply-To: <20230223124858.1042097-1-rongweil@nvidia.com>

When pattern/action template creation fails the testpmd expects error
details.
The driver did not set the error structure and testpmd failed with a
segmentation fault.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 907aab8bf3..b43661674f 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -4570,8 +4570,12 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,
 						       &at->flex_item)) ||
 			     (info->src.field == RTE_FLOW_FIELD_FLEX_ITEM &&
 			      flow_hw_flex_item_acquire(dev, info->src.flex_handle,
-							&at->flex_item)))
+							&at->flex_item))) {
+				rte_flow_error_set(error, rte_errno,
+						   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+						   "Failed to acquire flex item");
 				goto error;
+			}
 		}
 	}
 	at->tmpl = flow_hw_dr_actions_template_create(at);
@@ -4587,6 +4591,9 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,
 			mlx5dr_action_template_destroy(at->tmpl);
 		mlx5_free(at);
 	}
+	rte_flow_error_set(error, rte_errno,
+			   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+			   "Failed to create action template");
 	return NULL;
 }
 
@@ -4936,6 +4943,9 @@ flow_hw_pattern_template_create(struct rte_eth_dev *dev,
 		    (mlx5_alloc_srh_flex_parser(dev))) {
 			claim_zero(mlx5dr_match_template_destroy(it->mt));
 			mlx5_free(it);
+			rte_flow_error_set(error, rte_errno,
+					   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+					   "cannot create IPv6 routing extension support");
 			return NULL;
 		}
 	}
@@ -4948,6 +4958,9 @@ flow_hw_pattern_template_create(struct rte_eth_dev *dev,
 			if (flow_hw_flex_item_acquire(dev, handle, &it->flex_item)) {
 				claim_zero(mlx5dr_match_template_destroy(it->mt));
 				mlx5_free(it);
+				rte_flow_error_set(error, rte_errno,
+						   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+						   "Failed to acquire flex item");
 				return NULL;
 			}
 		}
-- 
2.27.0


  parent reply	other threads:[~2023-02-23 12:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 11:52 [PATCH v1 0/6] add flex item implementation Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 1/6] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 2/6] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 3/6] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 4/6] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 5/6] net/mlx5: return error for sws modify field Rongwei Liu
2023-02-15 11:52 ` [PATCH v1 6/6] doc/mlx5: update mlx5 doc Rongwei Liu
2023-02-22  9:37   ` [PATCH v2 0/6] add flex item implementation Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 1/6] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 2/6] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 3/6] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 4/6] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 5/6] net/mlx5: return error for sws modify field Rongwei Liu
2023-02-22  9:37     ` [PATCH v2 6/6] doc/mlx5: update mlx5 doc Rongwei Liu
2023-02-23  7:06   ` [PATCH v3 0/7] add flex item implementation Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 1/7] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 2/7] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 3/7] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 4/7] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 5/7] net/mlx5: return error for sws modify field Rongwei Liu
2023-02-23  7:06     ` [PATCH v3 6/7] doc/mlx5: update mlx5 doc Rongwei Liu
2023-02-23 12:37       ` Thomas Monjalon
2023-02-23 12:48         ` [PATCH v4 0/6] add flex item implementation Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 1/6] net/mlx5: enable hws flex item create Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 2/6] net/mlx5: add IPv6 protocol as flex item input Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 3/6] net/mlx5/hws: add hws flex item matching support Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 4/6] net/mlx5: add flex item modify field implementation Rongwei Liu
2023-02-23 12:48           ` [PATCH v4 5/6] net/mlx5: return error for sws modify field Rongwei Liu
2023-02-23 12:48           ` Rongwei Liu [this message]
2023-02-27 10:27           ` [PATCH v4 0/6] add flex item implementation Raslan Darawsheh
2023-02-23  7:06     ` [PATCH v3 7/7] net/mlx5: add error message Rongwei Liu

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=20230223124858.1042097-7-rongweil@nvidia.com \
    --to=rongweil@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --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).