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 F164AA0508; Thu, 7 Apr 2022 05:01:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 929F342886; Thu, 7 Apr 2022 05:00:00 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id A796E42896 for ; Thu, 7 Apr 2022 04:59:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649300397; x=1680836397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fBgzaIOD6zzfgja63o1WqDlTxtvSSk7LYzPMjdXmZgc=; b=WLwPdCKC0+0n4iCJJ3eJ8gFeIrV0/FmYdalWExHqj/V5mB+eymNzOuH0 tXT5AUkDxoAQiRJ2qzbpZfxUOElESgYiPubiGcJTFDL2MV30MOXn9JL8l NKg+iBQ4GuC8ZQ6GW43Xinm/dygza5cx16RA+eg3/WpeTKQPQWbRkoKrk ZlhFfy5E2LPBBL52gc1nIDsPKZV4tw4O+4bR9vsmbAvkLYz6Y0N/UYdMU 7RRX+3pqZjWhi3wq8ktZK8cVeA7gCRicFWdPDaOG9cWloZl926QAzgY1R jh7SLsU2etNr69Da3gh3JNFuPlqMDZjPrYhEc5f+U/QU5qsM0gKOOcGKe A==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="248738519" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="248738519" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:59:56 -0700 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="570850862" 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; 06 Apr 2022 19:59:54 -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 37/39] net/ice: fix DCF ACL flow engine Date: Thu, 7 Apr 2022 10:57:04 +0000 Message-Id: <20220407105706.18889-38-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220407105706.18889-1-kevinx.liu@intel.com> References: <20220407105706.18889-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 61bb016395..58ccdb53d7 100644 --- a/drivers/net/ice/ice_acl_filter.c +++ b/drivers/net/ice/ice_acl_filter.c @@ -57,6 +57,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) { @@ -1011,17 +1013,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 2d7e4c19f8..18183bb5e6 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -1865,6 +1865,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) { @@ -1888,9 +1894,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; @@ -1977,7 +1992,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); @@ -1989,7 +2004,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); @@ -2000,7 +2015,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); @@ -2009,11 +2024,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