From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 07BA3A00C3; Tue, 19 Apr 2022 10:02:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 584B5427EC; Tue, 19 Apr 2022 10:02:45 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 2AC824014F for ; Tue, 19 Apr 2022 10:02:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650355363; x=1681891363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gh1v6eII7dDuC3s4uXvYW4gRww8iteHKCHnMSXwdTAk=; b=fHwfvFvGHVdV6zxk6Qo8eyI9k3vwR1Uyys9IwmwvOIgSM7NlFZ/cMeNN ygLlc3hYrR2md4HGoRImJcGR7slsNODg9Cw6QeGRRlQF5/70fBbvxMhCj 8tnig+IYH7LGzcuE4oInzEwft3ZfGi04ZCRCzF+l4baBu2RPxzspBx1Pd 2Sr0MZXs+bLCdyVb9/qUXehkf835jonu6eQJY1ED/TU0O14XXs/5/quLk KDbz6i3OA4LwQ1/ev+u/si9yY0LnV91jKHwTN4jmfxXbR3suvvfwUReNY cjgEMgs4/2Itx+mOkHNNDO0A7oqFL+hsF6Xr4dVjAMMuqbrJPl4v6987j A==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="245598852" X-IronPort-AV: E=Sophos;i="5.90,272,1643702400"; d="scan'208";a="245598852" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 01:02:41 -0700 X-IronPort-AV: E=Sophos;i="5.90,272,1643702400"; d="scan'208";a="575978179" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 01:02:39 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Alvin Zhang , Kevin Liu Subject: [PATCH v4 1/2] net/ice: fix DCF ACL flow engine Date: Tue, 19 Apr 2022 16:01:30 +0000 Message-Id: <20220419160131.484677-2-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220419160131.484677-1-kevinx.liu@intel.com> References: <20220413171030.2231163-1-kevinx.liu@intel.com> <20220419160131.484677-1-kevinx.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Alvin Zhang ACL is not a necessary feature for DCF, it may not be supported by the ice kernel driver, so in this patch the program does not return the ACL initiation fails to high level functions, as substitute it prints some error logs, cleans the related resources and unregisters the ACL engine. Fixes: 40d466fa9f76 ("net/ice: support ACL filter in DCF") Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- drivers/net/ice/ice_acl_filter.c | 20 ++++++++++++++---- drivers/net/ice/ice_generic_flow.c | 34 +++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c index 8fe6f5aeb0..20a1f86c43 100644 --- a/drivers/net/ice/ice_acl_filter.c +++ b/drivers/net/ice/ice_acl_filter.c @@ -56,6 +56,8 @@ ice_pattern_match_item ice_acl_pattern[] = { {pattern_eth_ipv4_sctp, ICE_ACL_INSET_ETH_IPV4_SCTP, ICE_INSET_NONE, ICE_INSET_NONE}, }; +static void ice_acl_prof_free(struct ice_hw *hw); + static int ice_acl_prof_alloc(struct ice_hw *hw) { @@ -1007,17 +1009,27 @@ ice_acl_init(struct ice_adapter *ad) ret = ice_acl_setup(pf); if (ret) - return ret; + goto deinit_acl; ret = ice_acl_bitmap_init(pf); if (ret) - return ret; + goto deinit_acl; ret = ice_acl_prof_init(pf); if (ret) - return ret; + goto deinit_acl; - return ice_register_parser(parser, ad); + ret = ice_register_parser(parser, ad); + if (ret) + goto deinit_acl; + + return 0; + +deinit_acl: + ice_deinit_acl(pf); + ice_acl_prof_free(hw); + PMD_DRV_LOG(ERR, "ACL init failed, may not supported!"); + return ret; } static void diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 57eb002bde..cfdc4bd697 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -1817,6 +1817,12 @@ ice_register_flow_engine(struct ice_flow_engine *engine) TAILQ_INSERT_TAIL(&engine_list, engine, node); } +static void +ice_unregister_flow_engine(struct ice_flow_engine *engine) +{ + TAILQ_REMOVE(&engine_list, engine, node); +} + int ice_flow_init(struct ice_adapter *ad) { @@ -1843,9 +1849,18 @@ ice_flow_init(struct ice_adapter *ad) ret = engine->init(ad); if (ret) { - PMD_INIT_LOG(ERR, "Failed to initialize engine %d", - engine->type); - return ret; + /** + * ACL may not supported in kernel driver, + * so just unregister the engine. + */ + if (engine->type == ICE_FLOW_ENGINE_ACL) { + ice_unregister_flow_engine(engine); + } else { + PMD_INIT_LOG(ERR, + "Failed to initialize engine %d", + engine->type); + return ret; + } } } return 0; @@ -1937,7 +1952,7 @@ ice_register_parser(struct ice_flow_parser *parser, list = ice_get_parser_list(parser, ad); if (list == NULL) - return -EINVAL; + goto err; if (ad->devargs.pipe_mode_support) { TAILQ_INSERT_TAIL(list, parser_node, node); @@ -1949,7 +1964,7 @@ ice_register_parser(struct ice_flow_parser *parser, ICE_FLOW_ENGINE_ACL) { TAILQ_INSERT_AFTER(list, existing_node, parser_node, node); - goto DONE; + return 0; } } TAILQ_INSERT_HEAD(list, parser_node, node); @@ -1960,7 +1975,7 @@ ice_register_parser(struct ice_flow_parser *parser, ICE_FLOW_ENGINE_SWITCH) { TAILQ_INSERT_AFTER(list, existing_node, parser_node, node); - goto DONE; + return 0; } } TAILQ_INSERT_HEAD(list, parser_node, node); @@ -1969,11 +1984,14 @@ ice_register_parser(struct ice_flow_parser *parser, } else if (parser->engine->type == ICE_FLOW_ENGINE_ACL) { TAILQ_INSERT_HEAD(list, parser_node, node); } else { - return -EINVAL; + goto err; } } -DONE: return 0; +err: + rte_free(parser_node); + PMD_DRV_LOG(ERR, "%s failed.", __func__); + return -EINVAL; } void -- 2.33.1