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 67BECA0550; Wed, 7 Sep 2022 07:11:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BD61427F1; Wed, 7 Sep 2022 07:11:27 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id C3E4A427EB for ; Wed, 7 Sep 2022 07:11:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662527485; x=1694063485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gVoyauOnQLCXr0vfeC8DaAoxRZdXUuz8GSxEikAtako=; b=fSeOhWLHj4Y/JmJIDCQKoA8qSTmR0AMOWERFX8t+4R5Q3PdfGa7xOx7t S3fR6nh2VWw0Xtp02RLBUU4cp7Had/tZ6qpxfD7J83Ux72CTjirvPnkw2 XHcx+yKsLHtV1fSHTMfScCQpXhs11wJyeZD7j4/gFbdcOEaO47HwkfvB7 u+Dgy7e4K9rdpPKMJRBxT207PBJfKDLWUY5kaHPZ/VQ7IrIdi9FIxYEYX eLhqggX97K6RhFSOW49GmFKPxxpcRs19cJb3zkW/46H+fGXmoKt+i+M3O MlmMgoOTX76IJHdYgk8NpUSS6p1lkaweiEapkUZY9kElfJJrCr13aiNhF Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="283779080" X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="283779080" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 22:11:24 -0700 X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="676013001" 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; 06 Sep 2022 22:11:22 -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 v5 2/5] net/iavf: add flow subscription to AVF Date: Wed, 7 Sep 2022 13:10:37 +0800 Message-Id: <20220907051040.119588-3-jie1x.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220907051040.119588-1-jie1x.wang@intel.com> References: <20220809062122.1203281-1-jie1x.wang@intel.com> <20220907051040.119588-1-jie1x.wang@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 Add the skeletal code of flow subscription to AVF driver. Signed-off-by: Jie Wang --- doc/guides/rel_notes/release_22_11.rst | 4 + drivers/net/iavf/iavf_fsub.c | 112 +++++++++++++++++++++++++ drivers/net/iavf/iavf_generic_flow.c | 17 +++- drivers/net/iavf/iavf_generic_flow.h | 1 + drivers/net/iavf/iavf_vchnl.c | 1 + drivers/net/iavf/meson.build | 1 + 6 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 drivers/net/iavf/iavf_fsub.c diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 8c021cf050..bb77a03e24 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated Intel iavf driver.** + + * Added flow subscription support. + Removed Items ------------- diff --git a/drivers/net/iavf/iavf_fsub.c b/drivers/net/iavf/iavf_fsub.c new file mode 100644 index 0000000000..17f9bb2976 --- /dev/null +++ b/drivers/net/iavf/iavf_fsub.c @@ -0,0 +1,112 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "iavf_generic_flow.h" + + +static struct iavf_flow_parser iavf_fsub_parser; + +static struct iavf_pattern_match_item iavf_fsub_pattern_list[] = {}; + +static int +iavf_fsub_create(__rte_unused struct iavf_adapter *ad, + __rte_unused struct rte_flow *flow, + __rte_unused void *meta, + __rte_unused struct rte_flow_error *error) +{ + return -rte_errno; +} + +static int +iavf_fsub_destroy(__rte_unused struct iavf_adapter *ad, + __rte_unused struct rte_flow *flow, + __rte_unused struct rte_flow_error *error) +{ + return -rte_errno; +} + +static int +iavf_fsub_validation(__rte_unused struct iavf_adapter *ad, + __rte_unused struct rte_flow *flow, + __rte_unused void *meta, + __rte_unused struct rte_flow_error *error) +{ + return -rte_errno; +}; + +static int +iavf_fsub_parse(__rte_unused struct iavf_adapter *ad, + __rte_unused struct iavf_pattern_match_item *array, + __rte_unused uint32_t array_len, + __rte_unused const struct rte_flow_item pattern[], + __rte_unused const struct rte_flow_action actions[], + __rte_unused void **meta, + __rte_unused struct rte_flow_error *error) +{ + return -rte_errno; +} + +static int +iavf_fsub_init(struct iavf_adapter *ad) +{ + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad); + struct iavf_flow_parser *parser; + + if (!vf->vf_res) + return -EINVAL; + + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_FSUB_PF) + parser = &iavf_fsub_parser; + else + return -ENOTSUP; + + return iavf_register_parser(parser, ad); +} + +static void +iavf_fsub_uninit(struct iavf_adapter *ad) +{ + iavf_unregister_parser(&iavf_fsub_parser, ad); +} + +static struct +iavf_flow_engine iavf_fsub_engine = { + .init = iavf_fsub_init, + .uninit = iavf_fsub_uninit, + .create = iavf_fsub_create, + .destroy = iavf_fsub_destroy, + .validation = iavf_fsub_validation, + .type = IAVF_FLOW_ENGINE_FSUB, +}; + +static struct +iavf_flow_parser iavf_fsub_parser = { + .engine = &iavf_fsub_engine, + .array = iavf_fsub_pattern_list, + .array_len = RTE_DIM(iavf_fsub_pattern_list), + .parse_pattern_action = iavf_fsub_parse, + .stage = IAVF_FLOW_STAGE_DISTRIBUTOR, +}; + +RTE_INIT(iavf_fsub_engine_init) +{ + iavf_register_flow_engine(&iavf_fsub_engine); +} diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c index e1a611e319..b04614ba6e 100644 --- a/drivers/net/iavf/iavf_generic_flow.c +++ b/drivers/net/iavf/iavf_generic_flow.c @@ -1866,6 +1866,8 @@ iavf_register_parser(struct iavf_flow_parser *parser, { struct iavf_parser_list *list = NULL; struct iavf_flow_parser_node *parser_node; + struct iavf_flow_parser_node *existing_node; + void *temp; struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad); parser_node = rte_zmalloc("iavf_parser", sizeof(*parser_node), 0); @@ -1880,14 +1882,26 @@ iavf_register_parser(struct iavf_flow_parser *parser, TAILQ_INSERT_TAIL(list, parser_node, node); } else if (parser->engine->type == IAVF_FLOW_ENGINE_FDIR) { list = &vf->dist_parser_list; + RTE_TAILQ_FOREACH_SAFE(existing_node, list, node, temp) { + if (existing_node->parser->engine->type == + IAVF_FLOW_ENGINE_FSUB) { + TAILQ_INSERT_AFTER(list, existing_node, + parser_node, node); + goto DONE; + } + } TAILQ_INSERT_HEAD(list, parser_node, node); } else if (parser->engine->type == IAVF_FLOW_ENGINE_IPSEC_CRYPTO) { list = &vf->ipsec_crypto_parser_list; TAILQ_INSERT_HEAD(list, parser_node, node); + } else if (parser->engine->type == IAVF_FLOW_ENGINE_FSUB) { + list = &vf->dist_parser_list; + TAILQ_INSERT_HEAD(list, parser_node, node); } else { return -EINVAL; } +DONE: return 0; } @@ -1902,7 +1916,8 @@ iavf_unregister_parser(struct iavf_flow_parser *parser, if (parser->engine->type == IAVF_FLOW_ENGINE_HASH) list = &vf->rss_parser_list; - else if (parser->engine->type == IAVF_FLOW_ENGINE_FDIR) + else if ((parser->engine->type == IAVF_FLOW_ENGINE_FDIR) || + (parser->engine->type == IAVF_FLOW_ENGINE_FSUB)) list = &vf->dist_parser_list; if (list == NULL) diff --git a/drivers/net/iavf/iavf_generic_flow.h b/drivers/net/iavf/iavf_generic_flow.h index 52eb1caf29..448facffa5 100644 --- a/drivers/net/iavf/iavf_generic_flow.h +++ b/drivers/net/iavf/iavf_generic_flow.h @@ -480,6 +480,7 @@ enum iavf_flow_engine_type { IAVF_FLOW_ENGINE_IPSEC_CRYPTO, IAVF_FLOW_ENGINE_FDIR, IAVF_FLOW_ENGINE_HASH, + IAVF_FLOW_ENGINE_FSUB, IAVF_FLOW_ENGINE_MAX, }; diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 21bd1e2193..6d84add423 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -502,6 +502,7 @@ iavf_get_vf_resource(struct iavf_adapter *adapter) VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC | VIRTCHNL_VF_OFFLOAD_FDIR_PF | VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF | + VIRTCHNL_VF_OFFLOAD_FSUB_PF | VIRTCHNL_VF_OFFLOAD_REQ_QUEUES | VIRTCHNL_VF_OFFLOAD_CRC | VIRTCHNL_VF_OFFLOAD_VLAN_V2 | diff --git a/drivers/net/iavf/meson.build b/drivers/net/iavf/meson.build index 2da37de662..6df771f917 100644 --- a/drivers/net/iavf/meson.build +++ b/drivers/net/iavf/meson.build @@ -16,6 +16,7 @@ sources = files( 'iavf_hash.c', 'iavf_tm.c', 'iavf_ipsec_crypto.c', + 'iavf_fsub.c', ) if arch_subdir == 'x86' -- 2.25.1