From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: junfeng.guo@intel.com, dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH v3 01/20] net/ice/base: add parser create and destroy skeleton
Date: Tue, 21 Sep 2021 21:19:50 +0800 [thread overview]
Message-ID: <20210921132009.3461020-2-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20210921132009.3461020-1-qi.z.zhang@intel.com>
Add new parser module which can parse a packet in binary
and generate information like ptype, protocol/offset pairs
and flags which can be used to feed the FXP profile creation
directly.
The patch added skeleton of the parser instance create and
destroy APIs:
ice_parser_create
ice_parser_destroy
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
---
drivers/net/ice/base/ice_common.h | 1 +
drivers/net/ice/base/ice_flex_pipe.c | 2 +-
drivers/net/ice/base/ice_flex_pipe.h | 5 ++++
drivers/net/ice/base/ice_parser.c | 34 ++++++++++++++++++++++++++++
drivers/net/ice/base/ice_parser.h | 14 ++++++++++++
drivers/net/ice/base/meson.build | 1 +
6 files changed, 56 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/ice/base/ice_parser.c
create mode 100644 drivers/net/ice/base/ice_parser.h
diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h
index 1d8882c279..a3cbf4fb05 100644
--- a/drivers/net/ice/base/ice_common.h
+++ b/drivers/net/ice/base/ice_common.h
@@ -8,6 +8,7 @@
#include "ice_type.h"
#include "ice_nvm.h"
#include "ice_flex_pipe.h"
+#include "ice_parser.h"
#include "ice_switch.h"
#include "ice_fdir.h"
diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 3631ddba2c..703c3e0416 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -284,7 +284,7 @@ ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
* indicates a base offset of 10, and the index for the entry is 2, then
* section handler function should set the offset to 10 + 2 = 12.
*/
-static void *
+void *
ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
u32 sect_type, u32 *offset,
void *(*handler)(u32 sect_type, void *section,
diff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h
index b690be75fc..045a77c607 100644
--- a/drivers/net/ice/base/ice_flex_pipe.h
+++ b/drivers/net/ice/base/ice_flex_pipe.h
@@ -94,4 +94,9 @@ void ice_pkg_buf_free(struct ice_hw *hw, struct ice_buf_build *bld);
enum ice_status
ice_set_key(u8 *key, u16 size, u8 *val, u8 *upd, u8 *dc, u8 *nm, u16 off,
u16 len);
+void *
+ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
+ u32 sect_type, u32 *offset,
+ void *(*handler)(u32 sect_type, void *section,
+ u32 index, u32 *offset));
#endif /* _ICE_FLEX_PIPE_H_ */
diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c
new file mode 100644
index 0000000000..c08decaf0d
--- /dev/null
+++ b/drivers/net/ice/base/ice_parser.c
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2021 Intel Corporation
+ */
+
+#include "ice_common.h"
+
+/**
+ * ice_parser_create - create a parser instance
+ * @hw: pointer to the hardware structure
+ * @psr: output parameter for a new parser instance be created
+ */
+enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr)
+{
+ struct ice_parser *p;
+
+ p = (struct ice_parser *)ice_malloc(hw, sizeof(struct ice_parser));
+
+ if (!p)
+ return ICE_ERR_NO_MEMORY;
+
+ p->hw = hw;
+
+ *psr = p;
+ return ICE_SUCCESS;
+}
+
+/**
+ * ice_parser_destroy - destroy a parser instance
+ * @psr: pointer to a parser instance
+ */
+void ice_parser_destroy(struct ice_parser *psr)
+{
+ ice_free(psr->hw, psr);
+}
diff --git a/drivers/net/ice/base/ice_parser.h b/drivers/net/ice/base/ice_parser.h
new file mode 100644
index 0000000000..5964bf4e49
--- /dev/null
+++ b/drivers/net/ice/base/ice_parser.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2021 Intel Corporation
+ */
+
+#ifndef _ICE_PARSER_H_
+#define _ICE_PARSER_H_
+
+struct ice_parser {
+ struct ice_hw *hw; /* pointer to the hardware structure */
+};
+
+enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr);
+void ice_parser_destroy(struct ice_parser *psr);
+#endif /* _ICE_PARSER_H_ */
diff --git a/drivers/net/ice/base/meson.build b/drivers/net/ice/base/meson.build
index be9713dfa1..2b0af54a5c 100644
--- a/drivers/net/ice/base/meson.build
+++ b/drivers/net/ice/base/meson.build
@@ -15,6 +15,7 @@ sources = [
'ice_acl_ctrl.c',
'ice_vlan_mode.c',
'ice_ptp_hw.c',
+ 'ice_parser.c',
]
error_cflags = [
--
2.26.2
next prev parent reply other threads:[~2021-09-21 13:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-21 13:19 [dpdk-dev] [PATCH v3 00/20] ice/base: add parser module Qi Zhang
2021-09-21 13:19 ` Qi Zhang [this message]
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 02/20] net/ice/base: init imem table for parser Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 03/20] net/ice/base: init metainit " Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 04/20] net/ice/base: init parse graph cam " Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 05/20] net/ice/base: init boost TCAM " Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 06/20] net/ice/base: init ptype marker " Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 07/20] net/ice/base: init marker group " Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 08/20] net/ice/base: init protocol " Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 09/20] net/ice/base: init flag redirect " Qi Zhang
2021-09-21 13:19 ` [dpdk-dev] [PATCH v3 10/20] net/ice/base: init XLT key builder " Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 11/20] net/ice/base: add parser runtime skeleton Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 12/20] net/ice/base: add helper function for boost TCAM match Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 13/20] net/ice/base: add helper functions for parse graph key matching Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 14/20] net/ice/base: add helper function for ptype markers match Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 15/20] net/ice/base: add helper function to redirect flags Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 16/20] net/ice/base: add helper function to aggregate flags Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 17/20] net/ice/base: add parser execution main loop Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 18/20] net/ice/base: support double VLAN mode configure for parser Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 19/20] net/ice/base: add tunnel port support " Qi Zhang
2021-09-21 13:20 ` [dpdk-dev] [PATCH v3 20/20] net/ice/base: add API for parser profile initialization Qi Zhang
2021-09-21 13:32 ` [dpdk-dev] [PATCH v3 00/20] ice/base: add parser module Zhang, Qi Z
2021-09-28 12:23 ` Ferruh Yigit
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=20210921132009.3461020-2-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=junfeng.guo@intel.com \
--cc=qiming.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).