From patchwork Fri Aug 12 17:04:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Wang X-Patchwork-Id: 114865 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81726A0543; Fri, 12 Aug 2022 11:07:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EBE442C25; Fri, 12 Aug 2022 11:07:00 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 713F642C16 for ; Fri, 12 Aug 2022 11:06:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660295218; x=1691831218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3ksR0ZclDXLAAkcVZoOelVwFEfTS4Q4rVQ4y8XLrDnU=; b=VPDRISohi1ebDn3YL9Y2ggXUjnLhSb8PraB/xa7Lu18gXARM/N1C07a5 oMQobYLPBuw3odntHTG5HdE/vTqH9TdC1sR0JqTPpEqEzBVKELahSyeOv v8qxJGz3hnMi6mP8XfsRTlg+n8q6ZznZpdBkDl+Xz2OL3cr0A3Zqp0J4W hW7QIXpcAOGHICzjIk29PmtssU9CTD4Rh8AkcpfT8XaNav2jUcZjEdusR 0zz1QSByvP7CCKFgTE3boqocBBLfBKpNrSLZtRk72oJIOskuWQWW8NGNp MyMCVj4TurTR3s5RguhQRc4+pyp1fhCBwFWBtKe1rtpiOhiyzFcj25uoS A==; X-IronPort-AV: E=McAfee;i="6400,9594,10436"; a="317526446" X-IronPort-AV: E=Sophos;i="5.93,231,1654585200"; d="scan'208";a="317526446" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2022 02:06:58 -0700 X-IronPort-AV: E=Sophos;i="5.93,231,1654585200"; d="scan'208";a="665752701" Received: from intel-cd-odc-gavin.cd.intel.com ([10.240.178.187]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2022 02:06:55 -0700 From: Jie Wang To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, stevex.yang@intel.com, Jie Wang Subject: [PATCH v2 5/5] net/iavf: support priority of flow rule Date: Sat, 13 Aug 2022 01:04:47 +0800 Message-Id: <20220812170447.186992-6-jie1x.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220812170447.186992-1-jie1x.wang@intel.com> References: <20220809062122.1203281-1-jie1x.wang@intel.com> <20220812170447.186992-1-jie1x.wang@intel.com> MIME-Version: 1.0 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 Add flow rule attribute "priority" support for AVF. Lower values denote higher priority, the highest priority for a flow rule is 0. Signed-off-by: Jie Wang --- drivers/net/iavf/iavf_fdir.c | 4 ++++ drivers/net/iavf/iavf_fsub.c | 2 +- drivers/net/iavf/iavf_generic_flow.c | 23 +++++++++++++---------- drivers/net/iavf/iavf_generic_flow.h | 1 + drivers/net/iavf/iavf_hash.c | 5 +++++ drivers/net/iavf/iavf_ipsec_crypto.c | 16 ++++++++++------ 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c index 2e6b3a9097..f5e23da5bc 100644 --- a/drivers/net/iavf/iavf_fdir.c +++ b/drivers/net/iavf/iavf_fdir.c @@ -1551,6 +1551,7 @@ iavf_fdir_parse(struct iavf_adapter *ad, uint32_t array_len, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], + uint32_t priority, void **meta, struct rte_flow_error *error) { @@ -1561,6 +1562,9 @@ iavf_fdir_parse(struct iavf_adapter *ad, memset(filter, 0, sizeof(*filter)); + if (priority >= 1) + return -rte_errno; + item = iavf_search_pattern_match_item(pattern, array, array_len, error); if (!item) return -rte_errno; diff --git a/drivers/net/iavf/iavf_fsub.c b/drivers/net/iavf/iavf_fsub.c index 441bf478be..91193bb010 100644 --- a/drivers/net/iavf/iavf_fsub.c +++ b/drivers/net/iavf/iavf_fsub.c @@ -649,13 +649,13 @@ iavf_fsub_parse(struct iavf_adapter *ad, uint32_t array_len, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], + uint32_t priority, void **meta, struct rte_flow_error *error) { struct iavf_fsub_conf *filter; struct iavf_pattern_match_item *pattern_match_item = NULL; int ret = 0; - uint32_t priority = 0; filter = rte_zmalloc(NULL, sizeof(*filter), 0); if (!filter) { diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c index b04614ba6e..f33c764764 100644 --- a/drivers/net/iavf/iavf_generic_flow.c +++ b/drivers/net/iavf/iavf_generic_flow.c @@ -1785,6 +1785,7 @@ enum rte_flow_item_type iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_tcp[] = { typedef struct iavf_flow_engine * (*parse_engine_t)(struct iavf_adapter *ad, struct rte_flow *flow, struct iavf_parser_list *parser_list, + uint32_t priority, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error); @@ -1951,11 +1952,11 @@ iavf_flow_valid_attr(const struct rte_flow_attr *attr, return -rte_errno; } - /* Not supported */ - if (attr->priority) { + /* support priority for flow subscribe */ + if (attr->priority > 1) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, - attr, "Not support priority."); + attr, "Only support priority 0 and 1."); return -rte_errno; } @@ -2098,6 +2099,7 @@ static struct iavf_flow_engine * iavf_parse_engine_create(struct iavf_adapter *ad, struct rte_flow *flow, struct iavf_parser_list *parser_list, + uint32_t priority, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error) @@ -2111,7 +2113,7 @@ iavf_parse_engine_create(struct iavf_adapter *ad, if (parser_node->parser->parse_pattern_action(ad, parser_node->parser->array, parser_node->parser->array_len, - pattern, actions, &meta, error) < 0) + pattern, actions, priority, &meta, error) < 0) continue; engine = parser_node->parser->engine; @@ -2127,6 +2129,7 @@ static struct iavf_flow_engine * iavf_parse_engine_validate(struct iavf_adapter *ad, struct rte_flow *flow, struct iavf_parser_list *parser_list, + uint32_t priority, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error) @@ -2140,7 +2143,7 @@ iavf_parse_engine_validate(struct iavf_adapter *ad, if (parser_node->parser->parse_pattern_action(ad, parser_node->parser->array, parser_node->parser->array_len, - pattern, actions, &meta, error) < 0) + pattern, actions, priority, &meta, error) < 0) continue; engine = parser_node->parser->engine; @@ -2201,18 +2204,18 @@ iavf_flow_process_filter(struct rte_eth_dev *dev, if (ret) return ret; - *engine = iavf_parse_engine(ad, flow, &vf->rss_parser_list, pattern, - actions, error); + *engine = iavf_parse_engine(ad, flow, &vf->rss_parser_list, + attr->priority, pattern, actions, error); if (*engine) return 0; - *engine = iavf_parse_engine(ad, flow, &vf->dist_parser_list, pattern, - actions, error); + *engine = iavf_parse_engine(ad, flow, &vf->dist_parser_list, + attr->priority, pattern, actions, error); if (*engine) return 0; *engine = iavf_parse_engine(ad, flow, &vf->ipsec_crypto_parser_list, - pattern, actions, error); + attr->priority, pattern, actions, error); if (*engine) return 0; diff --git a/drivers/net/iavf/iavf_generic_flow.h b/drivers/net/iavf/iavf_generic_flow.h index 448facffa5..60d8ab02b4 100644 --- a/drivers/net/iavf/iavf_generic_flow.h +++ b/drivers/net/iavf/iavf_generic_flow.h @@ -471,6 +471,7 @@ typedef int (*parse_pattern_action_t)(struct iavf_adapter *ad, uint32_t array_len, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], + uint32_t priority, void **meta, struct rte_flow_error *error); diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index 42df7c4e48..dea4e0aa0a 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -86,6 +86,7 @@ iavf_hash_parse_pattern_action(struct iavf_adapter *ad, uint32_t array_len, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], + uint32_t priority, void **meta, struct rte_flow_error *error); @@ -1509,6 +1510,7 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad, uint32_t array_len, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], + uint32_t priority, void **meta, struct rte_flow_error *error) { @@ -1517,6 +1519,9 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad, uint64_t phint = IAVF_PHINT_NONE; int ret = 0; + if (priority >= 1) + return -rte_errno; + rss_meta_ptr = rte_zmalloc(NULL, sizeof(*rss_meta_ptr), 0); if (!rss_meta_ptr) { rte_flow_error_set(error, EINVAL, diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c index 75f05ee558..322934b5f6 100644 --- a/drivers/net/iavf/iavf_ipsec_crypto.c +++ b/drivers/net/iavf/iavf_ipsec_crypto.c @@ -1932,16 +1932,20 @@ static struct iavf_flow_engine iavf_ipsec_flow_engine = { static int iavf_ipsec_flow_parse(struct iavf_adapter *ad, - struct iavf_pattern_match_item *array, - uint32_t array_len, - const struct rte_flow_item pattern[], - const struct rte_flow_action actions[], - void **meta, - struct rte_flow_error *error) + struct iavf_pattern_match_item *array, + uint32_t array_len, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + uint32_t priority, + void **meta, + struct rte_flow_error *error) { struct iavf_pattern_match_item *item = NULL; int ret = -1; + if (priority >= 1) + return -rte_errno; + item = iavf_search_pattern_match_item(pattern, array, array_len, error); if (item && item->meta) { uint32_t type = (uint64_t)(item->meta);