From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 47EB6A00E6 for ; Mon, 10 Jun 2019 19:49:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C2B41C116; Mon, 10 Jun 2019 19:49:13 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 17F3D1C116 for ; Mon, 10 Jun 2019 19:49:12 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from motih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 10 Jun 2019 20:49:07 +0300 Received: from r-vnc11.mtr.labs.mlnx (r-vnc11.mtr.labs.mlnx [10.208.0.123]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x5AHms9I018957; Mon, 10 Jun 2019 20:49:07 +0300 From: Moti Haimovsky To: haimoti2000@gmail.com Cc: Moti Haimovsky , stable@dpdk.org Date: Mon, 10 Jun 2019 20:48:51 +0300 Message-Id: <51f2f9ff4410bcbd4939f48d9cb7ce2b4fbf17f5.1559049191.git.motih@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-stable] [PATCH v3 1/2] net/mlx5: fix crashing testpmd on null drv opts X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190610174851.w_ld51ZAtbHzehymDq8oKtRO2MZ-xs-1t1QsluIQQtQ@z> 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 --- 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