From: Jeff Guo <jia.guo@intel.com>
To: qi.z.zhang@intel.com, qiming.yang@intel.com
Cc: dev@dpdk.org, jingjing.wu@intel.com, junfeng.guo@intel.com,
beilei.xing@intel.com, simei.su@intel.com, jia.guo@intel.com
Subject: [dpdk-dev] [dpdk-dev v4 2/4] net/ice: support hash for new GTPU protocols
Date: Fri, 3 Jul 2020 11:58:57 +0800 [thread overview]
Message-ID: <20200703035859.87987-3-jia.guo@intel.com> (raw)
In-Reply-To: <20200703035859.87987-1-jia.guo@intel.com>
Support hash flow for the new protoclos of GTPU_EH UPLINK, GTPU_EH
DOWNLINK and GTPU_IP.
Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
drivers/net/ice/ice_hash.c | 67 ++++++++++++++++++++++++++++++--------
1 file changed, 54 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index c95bfffff..2aacd70ec 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -25,6 +25,9 @@
#include "ice_ethdev.h"
#include "ice_generic_flow.h"
+#define ICE_GTPU_EH_DWNLINK 0
+#define ICE_GTPU_EH_UPLINK 1
+
struct rss_type_match_hdr {
uint32_t hdr_mask;
uint64_t eth_rss_hint;
@@ -93,6 +96,10 @@ struct rss_type_match_hdr hint_eth_ipv4_sctp = {
ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER |
ICE_FLOW_SEG_HDR_SCTP,
ETH_RSS_ETH | ETH_RSS_NONFRAG_IPV4_SCTP};
+struct rss_type_match_hdr hint_eth_ipv4_gtpu_ipv4 = {
+ ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV4 |
+ ICE_FLOW_SEG_HDR_IPV_OTHER,
+ ETH_RSS_GTPU | ETH_RSS_IPV4};
struct rss_type_match_hdr hint_eth_ipv4_gtpu_eh_ipv4 = {
ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV4 |
ICE_FLOW_SEG_HDR_IPV_OTHER,
@@ -173,6 +180,8 @@ static struct ice_pattern_match_item ice_hash_pattern_list_comms[] = {
&hint_eth_ipv4_tcp},
{pattern_eth_ipv4_sctp, ICE_INSET_NONE,
&hint_eth_ipv4_sctp},
+ {pattern_eth_ipv4_gtpu_ipv4, ICE_INSET_NONE,
+ &hint_eth_ipv4_gtpu_ipv4},
{pattern_eth_ipv4_gtpu_eh_ipv4, ICE_INSET_NONE,
&hint_eth_ipv4_gtpu_eh_ipv4},
{pattern_eth_ipv4_gtpu_eh_ipv4_udp, ICE_INSET_NONE,
@@ -459,10 +468,15 @@ ice_hash_init(struct ice_adapter *ad)
}
static int
-ice_hash_check_inset(const struct rte_flow_item pattern[],
- struct rte_flow_error *error)
+ice_hash_parse_pattern(struct ice_pattern_match_item *pattern_match_item,
+ const struct rte_flow_item pattern[], void **meta,
+ struct rte_flow_error *error)
{
+ uint32_t hdr_mask = ((struct rss_type_match_hdr *)
+ (pattern_match_item->meta))->hdr_mask;
const struct rte_flow_item *item = pattern;
+ const struct rte_flow_item_gtp_psc *psc;
+ uint32_t hdrs = 0;
for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
if (item->last) {
@@ -472,15 +486,29 @@ ice_hash_check_inset(const struct rte_flow_item pattern[],
return -rte_errno;
}
- /* Ignore spec and mask. */
- if (item->spec || item->mask) {
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_ITEM, item,
- "Invalid spec/mask.");
- return -rte_errno;
+ switch (item->type) {
+ case RTE_FLOW_ITEM_TYPE_GTPU:
+ hdrs |= ICE_FLOW_SEG_HDR_GTPU_IP;
+ break;
+ case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+ psc = item->spec;
+ hdr_mask &= ~ICE_FLOW_SEG_HDR_GTPU_EH;
+ hdrs &= ~ICE_FLOW_SEG_HDR_GTPU_IP;
+ if (!psc)
+ hdrs |= ICE_FLOW_SEG_HDR_GTPU_EH;
+ else if (psc->pdu_type == ICE_GTPU_EH_UPLINK)
+ hdrs |= ICE_FLOW_SEG_HDR_GTPU_UP;
+ else if (psc->pdu_type == ICE_GTPU_EH_DWNLINK)
+ hdrs |= ICE_FLOW_SEG_HDR_GTPU_DWN;
+ break;
+ default:
+ break;
}
}
+ /* Save protocol header to rss_meta. */
+ ((struct rss_meta *)*meta)->pkt_hdr |= hdr_mask | hdrs;
+
return 0;
}
@@ -574,6 +602,22 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
}
}
+ /* update hash field for gtpu-ip and gtpu-eh. */
+ if (rss_type != ETH_RSS_GTPU)
+ break;
+ else if (hash_meta->pkt_hdr & ICE_FLOW_SEG_HDR_GTPU_IP)
+ hash_meta->hash_flds |=
+ BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_IP_TEID);
+ else if (hash_meta->pkt_hdr & ICE_FLOW_SEG_HDR_GTPU_EH)
+ hash_meta->hash_flds |=
+ BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_EH_TEID);
+ else if (hash_meta->pkt_hdr & ICE_FLOW_SEG_HDR_GTPU_DWN)
+ hash_meta->hash_flds |=
+ BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_DWN_TEID);
+ else if (hash_meta->pkt_hdr & ICE_FLOW_SEG_HDR_GTPU_UP)
+ hash_meta->hash_flds |=
+ BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_UP_TEID);
+
break;
case RTE_FLOW_ACTION_TYPE_END:
@@ -619,14 +663,11 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,
goto error;
}
- ret = ice_hash_check_inset(pattern, error);
+ ret = ice_hash_parse_pattern(pattern_match_item, pattern,
+ (void **)&rss_meta_ptr, error);
if (ret)
goto error;
- /* Save protocol header to rss_meta. */
- rss_meta_ptr->pkt_hdr = ((struct rss_type_match_hdr *)
- (pattern_match_item->meta))->hdr_mask;
-
/* Check rss action. */
ret = ice_hash_parse_action(pattern_match_item, actions,
(void **)&rss_meta_ptr, error);
--
2.20.1
next prev parent reply other threads:[~2020-07-03 4:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-12 2:57 [dpdk-dev] net/ice: enable new input set for rss hash Jeff Guo
2020-06-14 15:08 ` [dpdk-dev] [dpdk-dev v2] " Jeff Guo
2020-06-21 14:09 ` [dpdk-dev] [dpdk-dev v3 1/2] app/testpmd: add GTPU to RSS hash commands Jeff Guo
2020-06-21 14:09 ` [dpdk-dev] [dpdk-dev v3 2/2] net/ice: enable new input set for rss hash Jeff Guo
2020-07-01 13:02 ` Zhang, Qi Z
2020-07-03 3:53 ` Jeff Guo
2020-07-03 3:58 ` [dpdk-dev] [dpdk-dev v4 0/4] enable new hash flow for pf Jeff Guo
2020-07-03 3:58 ` [dpdk-dev] [dpdk-dev v4 1/4] net/ice: refactor for pf hash flow Jeff Guo
2020-07-03 3:58 ` Jeff Guo [this message]
2020-07-03 3:58 ` [dpdk-dev] [dpdk-dev v4 3/4] net/ice: enable new input set for rss hash Jeff Guo
2020-07-03 3:58 ` [dpdk-dev] [dpdk-dev v4 4/4] app/testpmd: add GTPU to RSS hash commands Jeff Guo
2020-07-07 5:25 ` [dpdk-dev] [dpdk-dev v5 0/4] enable new hash flow for pf Jeff Guo
2020-07-07 5:25 ` [dpdk-dev] [dpdk-dev v5 1/4] net/ice: refactor for pf hash flow Jeff Guo
2020-07-07 14:24 ` Ferruh Yigit
2020-07-07 5:25 ` [dpdk-dev] [dpdk-dev v5 2/4] net/ice: support hash for new GTPU protocols Jeff Guo
2020-07-07 5:25 ` [dpdk-dev] [dpdk-dev v5 3/4] net/ice: enable new input set for rss hash Jeff Guo
2020-07-07 5:25 ` [dpdk-dev] [dpdk-dev v5 4/4] app/testpmd: add GTPU to RSS hash commands Jeff Guo
2020-07-07 9:31 ` [dpdk-dev] [dpdk-dev v5 0/4] enable new hash flow for pf 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=20200703035859.87987-3-jia.guo@intel.com \
--to=jia.guo@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=junfeng.guo@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=simei.su@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).