patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Moti Haimovsky <motih@mellanox.com>
To: haimoti2000@gmail.com
Cc: Moti Haimovsky <motih@mellanox.com>, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v3 1/2] net/mlx5: fix crashing testpmd on null drv opts
Date: Mon, 10 Jun 2019 20:48:51 +0300	[thread overview]
Message-ID: <51f2f9ff4410bcbd4939f48d9cb7ce2b4fbf17f5.1559049191.git.motih@mellanox.com> (raw)
Message-ID: <20190610174851.w_ld51ZAtbHzehymDq8oKtRO2MZ-xs-1t1QsluIQQtQ@z> (raw)
In-Reply-To: <cover.1559049191.git.motih@mellanox.com>
In-Reply-To: <cover.1559049191.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>
---
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 9887018..e5a8e33 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


  parent reply	other threads:[~2019-06-10 17:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1559042301-73445-1-git-send-email-motih@mellanox.com>
2019-05-28 11:18 ` [dpdk-stable] [PATCH 1/2] net/mlx5: fix testpmd crash on null-flow " Moti Haimovsky
     [not found]   ` <cover.1559044929.git.motih@mellanox.com>
2019-05-28 12:09     ` [dpdk-stable] [PATCH v2 " Moti Haimovsky
     [not found]     ` <cover.1559049191.git.motih@mellanox.com>
2019-05-28 13:23       ` Moti Haimovsky [this message]
2019-06-10 17:48         ` [dpdk-stable] [PATCH v3 1/2] net/mlx5: fix crashing testpmd on null " Moti Haimovsky
2019-06-18 11:15       ` [dpdk-stable] [PATCH v4 " Moti Haimovsky
2019-06-18 11:22       ` Moti Haimovsky
2019-06-18 11:34       ` Moti Haimovsky
2019-06-18 11:40       ` Moti Haimovsky
2019-06-18 11:51       ` Moti Haimovsky
     [not found]       ` <cover.1560918818.git.motih@mellanox.com>
2019-06-19  4:52         ` [dpdk-stable] [PATCH v5 " Moti Haimovsky
2019-07-01  4:38           ` [dpdk-stable] [dpdk-dev] " Slava Ovsiienko
     [not found]       ` <cover.1561973011.git.motih@mellanox.com>
2019-07-01  9:34         ` [dpdk-stable] [PATCH v6 " Moti Haimovsky
2019-06-18 14:56     ` [dpdk-stable] [PATCH v5 " Moti Haimovsky
2019-06-18 15:04     ` Moti Haimovsky
2019-06-18 15:10     ` 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=51f2f9ff4410bcbd4939f48d9cb7ce2b4fbf17f5.1559049191.git.motih@mellanox.com \
    --to=motih@mellanox.com \
    --cc=haimoti2000@gmail.com \
    --cc=stable@dpdk.org \
    /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).