DPDK patches and discussions
 help / color / mirror / Atom feed
From: Moti Haimovsky <motih@mellanox.com>
To: rasland@mellanox.com, viacheslavo@mellanox.com
Cc: dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v6 1/2] net/mlx5: fix crashing testpmd on null drv opts
Date: Mon,  1 Jul 2019 12:34:21 +0300	[thread overview]
Message-ID: <f57089a37eb8363dc2819a828787289c4e84bd19.1561973011.git.motih@mellanox.com> (raw)
In-Reply-To: <cover.1561973011.git.motih@mellanox.com>

mlx5 implements mlx5_flow_null_drv_ops to be used when a specific
flow typei/driver is not available or invalid.
This routines return error without modifying the rte_flow_error
parameter passed to them which causes testpmd, for example, to crash.
This commit addresses the issue by modifying the rte_flow_error
parameter in theses routines.

Fixes: 0c76d1c9a18d ("net/mlx5: add abstraction for multiple flow drivers")
Fixes: 684dafe795d0 ("net/mlx5: add flow query abstraction interface")
Cc: stable@dpdk.org

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
v6:
 * Rebased on top of latest commits.

v4,v5:
 * Resend the message from a server not inserting DOS line-termination
   symbols.

v3:
 * Modified patch subject.

v2:
 * Fixed checkpatch warnings.
---
 drivers/net/mlx5/mlx5_flow.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index c03eb4c..251da41 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1694,19 +1694,20 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 		   const struct rte_flow_attr *attr __rte_unused,
 		   const struct rte_flow_item items[] __rte_unused,
 		   const struct rte_flow_action actions[] __rte_unused,
-		   struct rte_flow_error *error __rte_unused)
+		   struct rte_flow_error *error)
 {
-	rte_errno = ENOTSUP;
-	return -rte_errno;
+	return rte_flow_error_set(error, ENOTSUP,
+				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, NULL);
 }
 
 static struct mlx5_flow *
 flow_null_prepare(const struct rte_flow_attr *attr __rte_unused,
 		  const struct rte_flow_item items[] __rte_unused,
 		  const struct rte_flow_action actions[] __rte_unused,
-		  struct rte_flow_error *error __rte_unused)
+		  struct rte_flow_error *error)
 {
-	rte_errno = ENOTSUP;
+	rte_flow_error_set(error, ENOTSUP,
+			   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, NULL);
 	return NULL;
 }
 
@@ -1716,19 +1717,19 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 		    const struct rte_flow_attr *attr __rte_unused,
 		    const struct rte_flow_item items[] __rte_unused,
 		    const struct rte_flow_action actions[] __rte_unused,
-		    struct rte_flow_error *error __rte_unused)
+		    struct rte_flow_error *error)
 {
-	rte_errno = ENOTSUP;
-	return -rte_errno;
+	return rte_flow_error_set(error, ENOTSUP,
+				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, NULL);
 }
 
 static int
 flow_null_apply(struct rte_eth_dev *dev __rte_unused,
 		struct rte_flow *flow __rte_unused,
-		struct rte_flow_error *error __rte_unused)
+		struct rte_flow_error *error)
 {
-	rte_errno = ENOTSUP;
-	return -rte_errno;
+	return rte_flow_error_set(error, ENOTSUP,
+				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, NULL);
 }
 
 static void
@@ -1748,10 +1749,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 		struct rte_flow *flow __rte_unused,
 		const struct rte_flow_action *actions __rte_unused,
 		void *data __rte_unused,
-		struct rte_flow_error *error __rte_unused)
+		struct rte_flow_error *error)
 {
-	rte_errno = ENOTSUP;
-	return -rte_errno;
+	return rte_flow_error_set(error, ENOTSUP,
+				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, NULL);
 }
 
 /* Void driver to protect from null pointer reference. */
-- 
1.8.3.1


  reply	other threads:[~2019-07-01  9:34 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 11:18 [dpdk-dev] [PATCH 0/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-05-28 11:18 ` [dpdk-dev] [PATCH 1/2] net/mlx5: fix testpmd crash on null-flow drv opts Moti Haimovsky
2019-05-28 12:09   ` [dpdk-dev] [PATCH v2 0/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-05-28 12:09     ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix testpmd crash on null-flow drv opts Moti Haimovsky
2019-05-28 12:09     ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-05-28 13:23     ` [dpdk-dev] [PATCH v3 0/2] " Moti Haimovsky
2019-05-28 13:23       ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix crashing testpmd on null drv opts Moti Haimovsky
2019-05-28 13:23       ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-06-18 11:15       ` [dpdk-dev] [PATCH v4 0/2] " Moti Haimovsky
2019-06-18 11:15       ` [dpdk-dev] [PATCH v4 1/2] net/mlx5: fix crashing testpmd on null drv opts Moti Haimovsky
2019-06-18 11:15       ` [dpdk-dev] [PATCH v4 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-07-01  4:36         ` Slava Ovsiienko
2019-06-18 11:51       ` [dpdk-dev] [PATCH v4 0/2] " Moti Haimovsky
2019-06-18 11:51       ` [dpdk-dev] [PATCH v4 1/2] net/mlx5: fix crashing testpmd on null drv opts Moti Haimovsky
2019-06-18 11:51       ` [dpdk-dev] [PATCH v4 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-06-19  4:52       ` [dpdk-dev] [PATCH v5 0/2] " Moti Haimovsky
2019-06-19  4:52         ` [dpdk-dev] [PATCH v5 1/2] net/mlx5: fix crashing testpmd on null drv opts Moti Haimovsky
2019-07-01  4:38           ` Slava Ovsiienko
2019-06-19  4:52         ` [dpdk-dev] [PATCH v5 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-07-01  9:34       ` [dpdk-dev] [PATCH v6 0/2] " Moti Haimovsky
2019-07-01  9:34         ` Moti Haimovsky [this message]
2019-07-01  9:34         ` [dpdk-dev] [PATCH v6 2/2] " Moti Haimovsky
2019-07-01 10:26         ` [dpdk-dev] [Suspected-Phishing][PATCH v6 0/2] " Raslan Darawsheh
2019-06-18 14:56     ` [dpdk-dev] [PATCH v5 " Moti Haimovsky
2019-06-18 14:56     ` [dpdk-dev] [PATCH v5 1/2] net/mlx5: fix crashing testpmd on null drv opts Moti Haimovsky
2019-06-18 14:56     ` [dpdk-dev] [PATCH v5 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-06-18 15:04     ` [dpdk-dev] [PATCH v5 0/2] " Moti Haimovsky
2019-06-18 15:04     ` [dpdk-dev] [PATCH v5 1/2] net/mlx5: fix crashing testpmd on null drv opts Moti Haimovsky
2019-06-18 15:04     ` [dpdk-dev] [PATCH v5 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-06-18 15:10     ` [dpdk-dev] [PATCH v5 0/2] " Moti Haimovsky
2019-06-18 15:10     ` [dpdk-dev] [PATCH v5 1/2] net/mlx5: fix crashing testpmd on null drv opts Moti Haimovsky
2019-06-18 15:10     ` [dpdk-dev] [PATCH v5 2/2] net/mlx5: remove TCF support from PMD Moti Haimovsky
2019-05-28 12:09   ` [dpdk-dev] [PATCH v2] " Moti Haimovsky
2019-05-28 11:18 ` [dpdk-dev] [PATCH 2/2] " Moti Haimovsky

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=f57089a37eb8363dc2819a828787289c4e84bd19.1561973011.git.motih@mellanox.com \
    --to=motih@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=rasland@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@mellanox.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).