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 v2 08/20] net/ice/base: init protocol group table for parser
Date: Fri, 17 Sep 2021 22:43:10 +0800 [thread overview]
Message-ID: <20210917144322.3141886-9-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20210917144322.3141886-1-qi.z.zhang@intel.com>
Parse DDP section ICE_SID_RXPARSER_PROTO_GRP into an array of
ice_proto_grp_item.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/ice/base/ice_parser.c | 11 +++
drivers/net/ice/base/ice_parser.h | 3 +
drivers/net/ice/base/ice_proto_grp.c | 108 +++++++++++++++++++++++++++
drivers/net/ice/base/ice_proto_grp.h | 23 ++++++
drivers/net/ice/base/meson.build | 1 +
5 files changed, 146 insertions(+)
create mode 100644 drivers/net/ice/base/ice_proto_grp.c
create mode 100644 drivers/net/ice/base/ice_proto_grp.h
diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c
index ed624d613a..a4ca7dd545 100644
--- a/drivers/net/ice/base/ice_parser.c
+++ b/drivers/net/ice/base/ice_parser.c
@@ -15,6 +15,7 @@
#define ICE_SID_RXPARSER_BOOST_TCAM_ENTRY_SIZE 88
#define ICE_SID_RXPARSER_MARKER_TYPE_ENTRY_SIZE 24
#define ICE_SID_RXPARSER_MARKER_GRP_ENTRY_SIZE 8
+#define ICE_SID_RXPARSER_PROTO_GRP_ENTRY_SIZE 24
#define ICE_SEC_LBL_DATA_OFFSET 2
#define ICE_SID_LBL_ENTRY_SIZE 66
@@ -80,6 +81,9 @@ void *ice_parser_sect_item_get(u32 sect_type, void *section,
case ICE_SID_RXPARSER_MARKER_GRP:
size = ICE_SID_RXPARSER_MARKER_GRP_ENTRY_SIZE;
break;
+ case ICE_SID_RXPARSER_PROTO_GRP:
+ size = ICE_SID_RXPARSER_PROTO_GRP_ENTRY_SIZE;
+ break;
default:
return NULL;
}
@@ -225,6 +229,12 @@ enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr)
goto err;
}
+ p->proto_grp_table = ice_proto_grp_table_get(hw);
+ if (!p->proto_grp_table) {
+ status = ICE_ERR_PARAM;
+ goto err;
+ }
+
*psr = p;
return ICE_SUCCESS;
err:
@@ -248,6 +258,7 @@ void ice_parser_destroy(struct ice_parser *psr)
ice_free(psr->hw, psr->bst_lbl_table);
ice_free(psr->hw, psr->ptype_mk_tcam_table);
ice_free(psr->hw, psr->mk_grp_table);
+ ice_free(psr->hw, psr->proto_grp_table);
ice_free(psr->hw, psr);
}
diff --git a/drivers/net/ice/base/ice_parser.h b/drivers/net/ice/base/ice_parser.h
index b390eecb2b..ac4139abd7 100644
--- a/drivers/net/ice/base/ice_parser.h
+++ b/drivers/net/ice/base/ice_parser.h
@@ -11,6 +11,7 @@
#include "ice_bst_tcam.h"
#include "ice_ptype_mk.h"
#include "ice_mk_grp.h"
+#include "ice_proto_grp.h"
struct ice_parser {
struct ice_hw *hw; /* pointer to the hardware structure */
@@ -35,6 +36,8 @@ struct ice_parser {
struct ice_ptype_mk_tcam_item *ptype_mk_tcam_table;
/* load data from section ICE_SID_RXPARSER_MARKER_GRP */
struct ice_mk_grp_item *mk_grp_table;
+ /* load data from section ICE_SID_RXPARSER_PROTO_GRP */
+ struct ice_proto_grp_item *proto_grp_table;
};
enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr);
diff --git a/drivers/net/ice/base/ice_proto_grp.c b/drivers/net/ice/base/ice_proto_grp.c
new file mode 100644
index 0000000000..69d5d9a18a
--- /dev/null
+++ b/drivers/net/ice/base/ice_proto_grp.c
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2021 Intel Corporation
+ */
+
+#include "ice_common.h"
+#include "ice_parser_util.h"
+
+#define ICE_PROTO_GRP_TABLE_SIZE 192
+
+static void _proto_off_dump(struct ice_hw *hw, struct ice_proto_off *po,
+ int idx)
+{
+ ice_info(hw, "proto %d\n", idx);
+ ice_info(hw, "\tpolarity = %d\n", po->polarity);
+ ice_info(hw, "\tproto_id = %d\n", po->proto_id);
+ ice_info(hw, "\toffset = %d\n", po->offset);
+}
+
+/**
+ * ice_proto_grp_dump - dump a proto group item info
+ * @ice_hw: pointer to the hardware structure
+ * @item: proto group item to dump
+ */
+void ice_proto_grp_dump(struct ice_hw *hw, struct ice_proto_grp_item *item)
+{
+ int i;
+
+ ice_info(hw, "index = %d\n", item->idx);
+
+ for (i = 0; i < ICE_PROTO_COUNT_PER_GRP; i++)
+ _proto_off_dump(hw, &item->po[i], i);
+}
+
+/** The function parses a 22 bits Protocol entry with below format:
+ * BIT 0: Polarity of Protocol Offset (po->polarity)
+ * BIT 1-8: Protocol ID (po->proto_id)
+ * BIT 9-11: reserved
+ * BIT 12-21: Protocol Offset (po->offset)
+ */
+static void _proto_off_parse(struct ice_proto_off *po, u32 data)
+{
+ po->polarity = (data & 0x1) != 0;
+ po->proto_id = (u8)((data >> 1) & 0xff);
+ po->offset = (u16)((data >> 12) & 0x3ff);
+}
+
+/** The function parses a 192 bits Protocol Group Table entry with below
+ * format:
+ * BIT 0-21: Protocol 0 (grp->po[0])
+ * BIT 22-43: Protocol 1 (grp->po[1])
+ * BIT 44-65: Protocol 2 (grp->po[2])
+ * BIT 66-87: Protocol 3 (grp->po[3])
+ * BIT 88-109: Protocol 4 (grp->po[4])
+ * BIT 110-131:Protocol 5 (grp->po[5])
+ * BIT 132-153:Protocol 6 (grp->po[6])
+ * BIT 154-175:Protocol 7 (grp->po[7])
+ * BIT 176-191:reserved
+ */
+static void _proto_grp_parse_item(struct ice_hw *hw, u16 idx, void *item,
+ void *data, int size)
+{
+ struct ice_proto_grp_item *grp = (struct ice_proto_grp_item *)item;
+ u8 *buf = (u8 *)data;
+ u32 d32;
+
+ grp->idx = idx;
+
+ d32 = *(u32 *)buf;
+ _proto_off_parse(&grp->po[0], d32);
+
+ d32 = (*(u32 *)&buf[2] >> 6);
+ _proto_off_parse(&grp->po[1], d32);
+
+ d32 = (*(u32 *)&buf[5] >> 4);
+ _proto_off_parse(&grp->po[2], d32);
+
+ d32 = (*(u32 *)&buf[8] >> 2);
+ _proto_off_parse(&grp->po[3], d32);
+
+ d32 = *(u32 *)&buf[11];
+ _proto_off_parse(&grp->po[4], d32);
+
+ d32 = (*(u32 *)&buf[13] >> 6);
+ _proto_off_parse(&grp->po[5], d32);
+
+ d32 = (*(u32 *)&buf[16] >> 4);
+ _proto_off_parse(&grp->po[6], d32);
+
+ d32 = (*(u32 *)&buf[19] >> 2);
+ _proto_off_parse(&grp->po[7], d32);
+
+ if (hw->debug_mask & ICE_DBG_PARSER)
+ ice_proto_grp_dump(hw, grp);
+}
+
+/**
+ * ice_proto_grp_table_get - create a proto group table
+ * @ice_hw: pointer to the hardware structure
+ */
+struct ice_proto_grp_item *ice_proto_grp_table_get(struct ice_hw *hw)
+{
+ return (struct ice_proto_grp_item *)
+ ice_parser_create_table(hw, ICE_SID_RXPARSER_PROTO_GRP,
+ sizeof(struct ice_proto_grp_item),
+ ICE_PROTO_GRP_TABLE_SIZE,
+ ice_parser_sect_item_get,
+ _proto_grp_parse_item, false);
+}
diff --git a/drivers/net/ice/base/ice_proto_grp.h b/drivers/net/ice/base/ice_proto_grp.h
new file mode 100644
index 0000000000..88d84505dd
--- /dev/null
+++ b/drivers/net/ice/base/ice_proto_grp.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2021 Intel Corporation
+ */
+
+#ifndef _ICE_PROTO_GRP_H_
+#define _ICE_PROTO_GRP_H_
+
+#define ICE_PROTO_COUNT_PER_GRP 8
+
+struct ice_proto_off {
+ bool polarity; /* true: positive, false: nagtive */
+ u8 proto_id;
+ u16 offset;
+};
+
+struct ice_proto_grp_item {
+ u16 idx;
+ struct ice_proto_off po[ICE_PROTO_COUNT_PER_GRP];
+};
+
+void ice_proto_grp_dump(struct ice_hw *hw, struct ice_proto_grp_item *item);
+struct ice_proto_grp_item *ice_proto_grp_table_get(struct ice_hw *hw);
+#endif /* _ICE_PROTO_GRP_H_ */
diff --git a/drivers/net/ice/base/meson.build b/drivers/net/ice/base/meson.build
index df021b12dd..8da942a2be 100644
--- a/drivers/net/ice/base/meson.build
+++ b/drivers/net/ice/base/meson.build
@@ -22,6 +22,7 @@ sources = [
'ice_bst_tcam.c',
'ice_ptype_mk.c',
'ice_mk_grp.c',
+ 'ice_proto_grp.c',
]
error_cflags = [
--
2.26.2
next prev parent reply other threads:[~2021-09-17 14:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 14:43 [dpdk-dev] [PATCH v2 00/20] ice/base: add parser module Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 01/20] net/ice/base: add parser create and destroy skeleton Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 02/20] net/ice/base: init imem table for parser Qi Zhang
2021-09-21 12:51 ` Zhang, Qi Z
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 03/20] net/ice/base: init metainit " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 04/20] net/ice/base: init parse graph cam " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 05/20] net/ice/base: init boost TCAM " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 06/20] net/ice/base: init ptype marker " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 07/20] net/ice/base: init marker group " Qi Zhang
2021-09-17 14:43 ` Qi Zhang [this message]
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 09/20] net/ice/base: init flag redirect " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 10/20] net/ice/base: init XLT key builder " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 11/20] net/ice/base: add parser runtime skeleton Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 12/20] net/ice/base: add helper function for boost TCAM match Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 13/20] net/ice/base: add helper functions for parse graph key matching Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 14/20] net/ice/base: add helper function for ptype markers match Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 15/20] net/ice/base: add helper function to redirect flags Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 16/20] net/ice/base: add helper function to aggregate flags Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 17/20] net/ice/base: add parser execution main loop Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 18/20] net/ice/base: support double VLAN mode configure for parser Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 19/20] net/ice/base: add tunnel port support " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 20/20] net/ice/base: add API for parser profile initialization Qi Zhang
2021-09-18 1:59 ` [dpdk-dev] [PATCH v2 00/20] ice/base: add parser module Guo, Junfeng
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=20210917144322.3141886-9-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).