From: Ting Xu <ting.xu@intel.com>
To: dev@dpdk.org
Cc: qi.z.zhang@intel.com, qiming.yang@intel.com,
junfeng.guo@intel.com, Ting Xu <ting.xu@intel.com>
Subject: [dpdk-dev] [PATCH v4 1/2] net/ice/base: support add HW profile for RSS raw flow
Date: Thu, 4 Nov 2021 10:22:27 +0800 [thread overview]
Message-ID: <20211104022228.46086-2-ting.xu@intel.com> (raw)
In-Reply-To: <20211104022228.46086-1-ting.xu@intel.com>
Based on the parser library, we can directly set HW profile and
associate VSI for RSS raw flows. Add symmetric hash configuration
for raw flow.
Signed-off-by: Ting Xu <ting.xu@intel.com>
---
drivers/net/ice/base/ice_flow.c | 109 ++++++++++++++++++++++++++++++++
drivers/net/ice/base/ice_flow.h | 16 +++++
2 files changed, 125 insertions(+)
diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index f699dbbc74..da27d157c0 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -4071,6 +4071,115 @@ ice_rss_update_symm(struct ice_hw *hw,
}
}
+/**
+ * ice_rss_cfg_raw_symm - configure symmetric hash parameters
+ * for raw pattern
+ * @hw: pointer to the hardware structure
+ * @prof: pointer to parser profile
+ * @prof_id: profile ID
+ *
+ * Calculate symmetric hash parameters based on input protocol type.
+ */
+static void
+ice_rss_cfg_raw_symm(struct ice_hw *hw,
+ struct ice_parser_profile *prof, u64 prof_id)
+{
+ u8 src_idx, dst_idx, proto_id;
+ int len, i = 0;
+
+ while (i < prof->fv_num) {
+ proto_id = prof->fv[i].proto_id;
+
+ switch (proto_id) {
+ case ICE_PROT_IPV4_OF_OR_S:
+ len = ICE_FLOW_FLD_SZ_IPV4_ADDR /
+ ICE_FLOW_FV_EXTRACT_SZ;
+ if (prof->fv[i].offset ==
+ ICE_FLOW_FIELD_IPV4_SRC_OFFSET &&
+ prof->fv[i + len].proto_id == proto_id &&
+ prof->fv[i + len].offset ==
+ ICE_FLOW_FIELD_IPV4_DST_OFFSET) {
+ src_idx = i;
+ dst_idx = i + len;
+ i += 2 * len;
+ break;
+ }
+ i++;
+ continue;
+ case ICE_PROT_IPV6_OF_OR_S:
+ len = ICE_FLOW_FLD_SZ_IPV6_ADDR /
+ ICE_FLOW_FV_EXTRACT_SZ;
+ if (prof->fv[i].offset ==
+ ICE_FLOW_FIELD_IPV6_SRC_OFFSET &&
+ prof->fv[i + len].proto_id == proto_id &&
+ prof->fv[i + len].offset ==
+ ICE_FLOW_FIELD_IPV6_DST_OFFSET) {
+ src_idx = i;
+ dst_idx = i + len;
+ i += 2 * len;
+ break;
+ }
+ i++;
+ continue;
+ case ICE_PROT_TCP_IL:
+ case ICE_PROT_UDP_IL_OR_S:
+ case ICE_PROT_SCTP_IL:
+ len = ICE_FLOW_FLD_SZ_PORT /
+ ICE_FLOW_FV_EXTRACT_SZ;
+ if (prof->fv[i].offset ==
+ ICE_FLOW_FIELD_SRC_PORT_OFFSET &&
+ prof->fv[i + len].proto_id == proto_id &&
+ prof->fv[i + len].offset ==
+ ICE_FLOW_FIELD_DST_PORT_OFFSET) {
+ src_idx = i;
+ dst_idx = i + len;
+ i += 2 * len;
+ break;
+ }
+ i++;
+ continue;
+ default:
+ i++;
+ continue;
+ }
+ ice_rss_config_xor(hw, prof_id, src_idx, dst_idx, len);
+ }
+}
+
+/* Max registers index per packet profile */
+#define ICE_SYMM_REG_INDEX_MAX 6
+
+/**
+ * ice_rss_update_raw_symm - update symmetric hash configuration
+ * for raw pattern
+ * @hw: pointer to the hardware structure
+ * @cfg: configure parameters for raw pattern
+ * @id: profile tracking ID
+ *
+ * Update symmetric hash configuration for raw pattern if required.
+ * Otherwise only clear to default.
+ */
+void
+ice_rss_update_raw_symm(struct ice_hw *hw,
+ struct ice_rss_raw_cfg *cfg, u64 id)
+{
+ struct ice_prof_map *map;
+ u8 prof_id, m;
+
+ ice_acquire_lock(&hw->blk[ICE_BLK_RSS].es.prof_map_lock);
+ map = ice_search_prof_id(hw, ICE_BLK_RSS, id);
+ if (map)
+ prof_id = map->prof_id;
+ ice_release_lock(&hw->blk[ICE_BLK_RSS].es.prof_map_lock);
+ if (!map)
+ return;
+ /* clear to default */
+ for (m = 0; m < ICE_SYMM_REG_INDEX_MAX; m++)
+ wr32(hw, GLQF_HSYMM(prof_id, m), 0);
+ if (cfg->symm)
+ ice_rss_cfg_raw_symm(hw, &cfg->prof, prof_id);
+}
+
/**
* ice_add_rss_cfg_sync - add an RSS configuration
* @hw: pointer to the hardware structure
diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h
index dea7b3c0e8..f941ce4333 100644
--- a/drivers/net/ice/base/ice_flow.h
+++ b/drivers/net/ice/base/ice_flow.h
@@ -149,6 +149,13 @@
#define ICE_FLOW_HASH_NAT_T_ESP_IPV6_SPI \
(ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_NAT_T_ESP_SPI)
+#define ICE_FLOW_FIELD_IPV4_SRC_OFFSET 12
+#define ICE_FLOW_FIELD_IPV4_DST_OFFSET 16
+#define ICE_FLOW_FIELD_IPV6_SRC_OFFSET 8
+#define ICE_FLOW_FIELD_IPV6_DST_OFFSET 24
+#define ICE_FLOW_FIELD_SRC_PORT_OFFSET 0
+#define ICE_FLOW_FIELD_DST_PORT_OFFSET 2
+
/* Protocol header fields within a packet segment. A segment consists of one or
* more protocol headers that make up a logical group of protocol headers. Each
* logical group of protocol headers encapsulates or is encapsulated using/by
@@ -493,11 +500,18 @@ struct ice_flow_prof {
struct ice_flow_action *acts;
};
+struct ice_rss_raw_cfg {
+ struct ice_parser_profile prof;
+ bool raw_ena;
+ bool symm;
+};
+
struct ice_rss_cfg {
struct LIST_ENTRY_TYPE l_entry;
/* bitmap of VSIs added to the RSS entry */
ice_declare_bitmap(vsis, ICE_MAX_VSI);
struct ice_rss_hash_cfg hash;
+ struct ice_rss_raw_cfg raw;
};
enum ice_flow_action_type {
@@ -585,5 +599,7 @@ ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle,
enum ice_status
ice_rem_rss_cfg(struct ice_hw *hw, u16 vsi_handle,
const struct ice_rss_hash_cfg *cfg);
+void ice_rss_update_raw_symm(struct ice_hw *hw,
+ struct ice_rss_raw_cfg *cfg, u64 id);
u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs);
#endif /* _ICE_FLOW_H_ */
--
2.17.1
next prev parent reply other threads:[~2021-11-04 2:20 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 7:09 [dpdk-dev] [PATCH v1 0/2] enable protocol agnostic flow offloading in RSS Ting Xu
2021-10-08 7:09 ` [dpdk-dev] [PATCH v1 1/2] net/ice: " Ting Xu
2021-10-08 7:09 ` [dpdk-dev] [PATCH v1 2/2] doc: add protocol agnostic flow offloading for RSS hash Ting Xu
2021-11-01 11:02 ` [dpdk-dev] [PATCH v2 0/3] enable protocol agnostic flow offloading in RSS Ting Xu
2021-11-01 11:02 ` [dpdk-dev] [PATCH v2 1/3] net/ice: " Ting Xu
2021-11-01 11:02 ` [dpdk-dev] [PATCH v2 2/3] " Ting Xu
2021-11-01 11:02 ` [dpdk-dev] [PATCH v2 3/3] doc: add protocol agnostic flow offloading for RSS Ting Xu
2021-11-01 11:05 ` [dpdk-dev] [PATCH v2 0/3] enable protocol agnostic flow offloading in RSS Ting Xu
2021-11-01 11:05 ` [dpdk-dev] [PATCH v2 1/3] net/ice/base: support add HW profile for RSS raw flow Ting Xu
2021-11-01 11:05 ` [dpdk-dev] [PATCH v2 2/3] net/ice: enable protocol agnostic flow offloading in RSS Ting Xu
2021-11-01 11:05 ` [dpdk-dev] [PATCH v2 3/3] doc: add protocol agnostic flow offloading for RSS Ting Xu
2021-11-02 1:49 ` [dpdk-dev] [PATCH v3 0/3] enable protocol agnostic flow offloading in RSS Ting Xu
2021-11-02 1:49 ` [dpdk-dev] [PATCH v3 1/3] net/ice/base: support add HW profile for RSS raw flow Ting Xu
2021-11-02 1:49 ` [dpdk-dev] [PATCH v3 2/3] net/ice: enable protocol agnostic flow offloading in RSS Ting Xu
2021-11-03 14:13 ` Ferruh Yigit
2021-11-04 3:29 ` Xu, Ting
2021-11-02 1:49 ` [dpdk-dev] [PATCH v3 3/3] doc: add protocol agnostic flow offloading for RSS Ting Xu
2021-11-03 12:45 ` [dpdk-dev] [PATCH v3 0/3] enable protocol agnostic flow offloading in RSS Zhang, Qi Z
2021-11-03 14:15 ` Ferruh Yigit
2021-11-04 2:22 ` [dpdk-dev] [PATCH v4 0/2] " Ting Xu
2021-11-04 2:22 ` Ting Xu [this message]
2021-11-04 2:22 ` [dpdk-dev] [PATCH v4 2/2] net/ice: " Ting Xu
2021-11-04 3:31 ` [dpdk-dev] [PATCH v4 0/2] " Zhang, Qi Z
2021-11-05 13:09 ` Thomas Monjalon
2021-11-05 13:18 ` Xu, Ting
2021-11-05 13:23 ` Thomas Monjalon
2021-11-05 14:53 ` Xu, Ting
2021-11-08 2:44 ` Zhang, Qi Z
2021-11-08 19:47 ` Thomas Monjalon
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=20211104022228.46086-2-ting.xu@intel.com \
--to=ting.xu@intel.com \
--cc=dev@dpdk.org \
--cc=junfeng.guo@intel.com \
--cc=qi.z.zhang@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).