From: Jie Wang <jie1x.wang@intel.com>
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 <jie1x.wang@intel.com>
Subject: [PATCH v3 2/5] net/iavf: add flow subscription to AVF
Date: Wed, 31 Aug 2022 02:05:11 +0800 [thread overview]
Message-ID: <20220830180514.693175-3-jie1x.wang@intel.com> (raw)
In-Reply-To: <20220830180514.693175-1-jie1x.wang@intel.com>
Add the skeletal code of flow subscription to AVF driver.
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
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 <sys/queue.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <rte_debug.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_log.h>
+#include <rte_malloc.h>
+#include <rte_eth_ctrl.h>
+#include <rte_tailq.h>
+#include <rte_flow_driver.h>
+#include <rte_flow.h>
+#include <iavf.h>
+#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
next prev parent reply other threads:[~2022-08-30 10:08 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-09 6:21 [PATCH 0/2] support flow subscription Jie Wang
2022-08-09 6:21 ` [PATCH 1/2] common/iavf: " Jie Wang
2022-08-09 6:21 ` [PATCH 2/2] net/iavf: enable flow subscription rule support for AVF Jie Wang
2022-08-12 17:04 ` [PATCH v2 0/5] support flow subscription Jie Wang
2022-08-12 17:04 ` [PATCH v2 1/5] common/iavf: " Jie Wang
2022-08-12 17:04 ` [PATCH v2 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-08-12 17:04 ` [PATCH v2 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-08-12 17:04 ` [PATCH v2 4/5] net/iavf: support flow subscription rule Jie Wang
2022-08-12 17:04 ` [PATCH v2 5/5] net/iavf: support priority of flow rule Jie Wang
2022-08-30 18:05 ` [PATCH v3 0/5] support flow subscription Jie Wang
2022-08-30 18:05 ` [PATCH v3 1/5] common/iavf: " Jie Wang
2022-08-30 18:05 ` Jie Wang [this message]
2022-08-30 18:05 ` [PATCH v3 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-06 7:30 ` Zhang, Qi Z
2022-08-30 18:05 ` [PATCH v3 4/5] net/iavf: support flow subscription rule Jie Wang
2022-08-30 18:05 ` [PATCH v3 5/5] net/iavf: support priority of flow rule Jie Wang
2022-08-31 10:56 ` [PATCH v3 0/5] support flow subscription Ferruh Yigit
2022-08-31 12:28 ` Zhang, Qi Z
2022-08-31 12:53 ` Ferruh Yigit
2022-09-01 0:59 ` Zhang, Qi Z
2022-09-07 3:35 ` [PATCH v4 " Jie Wang
2022-09-07 3:35 ` [PATCH v4 1/5] common/iavf: " Jie Wang
2022-09-07 3:35 ` [PATCH v4 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-09-07 3:35 ` [PATCH v4 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-07 3:35 ` [PATCH v4 4/5] net/iavf: support flow subscription rule Jie Wang
2022-09-07 3:35 ` [PATCH v4 5/5] net/iavf: support priority of flow rule Jie Wang
2022-09-07 4:38 ` [PATCH v4 0/5] support flow subscription Jie Wang
2022-09-07 4:38 ` [PATCH v4 1/5] common/iavf: " Jie Wang
2022-09-07 4:38 ` [PATCH v4 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-09-07 4:38 ` [PATCH v4 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-07 4:38 ` [PATCH v4 4/5] net/iavf: support flow subscription rule Jie Wang
2022-09-07 4:38 ` [PATCH v4 5/5] net/iavf: support priority of flow rule Jie Wang
2022-09-07 5:10 ` [PATCH v5 0/5] support flow subscription Jie Wang
2022-09-07 5:10 ` [PATCH v5 1/5] common/iavf: " Jie Wang
2022-09-07 5:10 ` [PATCH v5 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-09-07 5:10 ` [PATCH v5 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-07 5:27 ` Zhang, Qi Z
2022-09-07 5:10 ` [PATCH v5 4/5] net/iavf: support flow subscription rule Jie Wang
2022-09-07 5:10 ` [PATCH v5 5/5] net/iavf: support priority of flow rule Jie Wang
2022-09-07 5:28 ` [PATCH v5 0/5] support flow subscription Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220830180514.693175-3-jie1x.wang@intel.com \
--to=jie1x.wang@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=stevex.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).