From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 186E6A00C5; Fri, 8 May 2020 10:59:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E11971DA2F; Fri, 8 May 2020 10:58:59 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 365AD1DA25 for ; Fri, 8 May 2020 10:58:58 +0200 (CEST) IronPort-SDR: wnx++gAecvxW348oGzsLYlgUvJKx3eGDnxrD/hpYwyPHXn9Ow/KXygvx4JJc/tcUGtfcgGFeU5 efM8IS6LzekA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 01:58:57 -0700 IronPort-SDR: hEMFKXtB0yJo38IOiUlElauO/IpE5VREtSEkhNR8NNxlWjSj+jeoyvuFNbp/wUeU+IfHHimNx7 sXhHF8Q4xFeQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,367,1583222400"; d="scan'208";a="264232030" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga006.jf.intel.com with ESMTP; 08 May 2020 01:58:55 -0700 From: Jeff Guo To: beilei.xing@intel.com, xiaolong.ye@intel.com, qiming.yang@intel.com, jingjing.wu@intel.com Cc: qi.z.zhang@intel.com, dev@dpdk.org, wenzhuo.lu@intel.com, jia.guo@intel.com Date: Fri, 8 May 2020 16:58:30 -0400 Message-Id: <20200508205830.52437-1-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/iavf: fix rte flow error log issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When processing a rte flow, such as creating a parse engine, or creating or destroying a rss rule, if they are failed, they all need to construct the flow error structure before return the error message back to app. If not so, it will cause app crash when app printing the message out of a flow error. Fixes: 7be10c3004be ("net/iavf: add RSS configuration for VF") Fixes: ff2d0c345c3b ("net/iavf: support generic flow API") Signed-off-by: Jeff Guo --- drivers/net/iavf/iavf_generic_flow.c | 10 +++++++--- drivers/net/iavf/iavf_hash.c | 12 ++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c index bca1ffeb3..64695f246 100644 --- a/drivers/net/iavf/iavf_generic_flow.c +++ b/drivers/net/iavf/iavf_generic_flow.c @@ -868,14 +868,18 @@ iavf_flow_process_filter(struct rte_eth_dev *dev, *engine = iavf_parse_engine(ad, flow, &vf->rss_parser_list, pattern, actions, error); - if (*engine != NULL) + if (*engine) return 0; *engine = iavf_parse_engine(ad, flow, &vf->dist_parser_list, pattern, actions, error); - if (*engine == NULL) - return -EINVAL; + if (!*engine) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Failed to create parser engine."); + return -rte_errno; + } return 0; } diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index 97370aa19..8263a663b 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -1111,7 +1111,11 @@ iavf_hash_create(__rte_unused struct iavf_adapter *ad, flow->rule = rss_cfg; } else { PMD_DRV_LOG(ERR, "fail to add RSS configure"); + rte_flow_error_set(error, -ret, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Failed to add rss rule."); rte_free(rss_cfg); + return -rte_errno; } rte_free(meta); @@ -1130,9 +1134,13 @@ iavf_hash_destroy(__rte_unused struct iavf_adapter *ad, rss_cfg = (struct virtchnl_rss_cfg *)flow->rule; ret = iavf_add_del_rss_cfg(ad, rss_cfg, false); - if (ret) + if (ret) { PMD_DRV_LOG(ERR, "fail to del RSS configure"); - + rte_flow_error_set(error, -ret, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Failed to delete rss rule."); + return -rte_errno; + } return ret; } -- 2.20.1