From: Yuying Zhang <yuying.zhang@intel.com>
To: dev@dpdk.org, qi.z.zhang@intel.com
Cc: Yuying Zhang <yuying.zhang@intel.com>
Subject: [PATCH v3 1/2] net/ice/base: add profile validation on switch filter
Date: Wed, 26 Jan 2022 15:57:09 +0000 [thread overview]
Message-ID: <20220126155710.911525-1-yuying.zhang@intel.com> (raw)
In-Reply-To: <http://patchwork.dpdk.org/project/dpdk/patch/20220118145750.718362-1-yuying.zhang@intel.com/>
Profile type was determined without validation when getting
switch field vector bitmap. It caused error when associating
profile id with given recipe if no lookup elements were given.
Add profile validation to check if the profile is existing
before getting bitmap.
Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
drivers/net/ice/base/ice_flex_pipe.c | 11 +++++------
drivers/net/ice/base/ice_flex_type.h | 1 +
drivers/net/ice/base/ice_protocol_type.h | 1 +
drivers/net/ice/base/ice_switch.c | 1 +
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 395787806b..f6a29f87c5 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -1785,8 +1785,12 @@ static enum ice_prof_type
ice_get_sw_prof_type(struct ice_hw *hw, struct ice_fv *fv)
{
u16 i;
+ bool valid_prof = false;
for (i = 0; i < hw->blk[ICE_BLK_SW].es.fvw; i++) {
+ if (fv->ew[i].off != ICE_NAN_OFFSET)
+ valid_prof = true;
+
/* UDP tunnel will have UDP_OF protocol ID and VNI offset */
if (fv->ew[i].prot_id == (u8)ICE_PROT_UDP_OF &&
fv->ew[i].off == ICE_VNI_OFFSET)
@@ -1801,7 +1805,7 @@ ice_get_sw_prof_type(struct ice_hw *hw, struct ice_fv *fv)
return ICE_PROF_TUN_PPPOE;
}
- return ICE_PROF_NON_TUN;
+ return valid_prof ? ICE_PROF_NON_TUN : ICE_PROF_INVALID;
}
/**
@@ -1818,11 +1822,6 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type req_profs,
struct ice_seg *ice_seg;
struct ice_fv *fv;
- if (req_profs == ICE_PROF_ALL) {
- ice_bitmap_set(bm, 0, ICE_MAX_NUM_PROFILES);
- return;
- }
-
ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM);
ice_zero_bitmap(bm, ICE_MAX_NUM_PROFILES);
ice_seg = hw->seg;
diff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h
index 59eeca0a30..09a02fe9ac 100644
--- a/drivers/net/ice/base/ice_flex_type.h
+++ b/drivers/net/ice/base/ice_flex_type.h
@@ -1003,6 +1003,7 @@ struct ice_chs_chg {
#define ICE_FLOW_PTYPE_MAX ICE_XLT1_CNT
enum ice_prof_type {
+ ICE_PROF_INVALID = 0x0,
ICE_PROF_NON_TUN = 0x1,
ICE_PROF_TUN_UDP = 0x2,
ICE_PROF_TUN_GRE = 0x4,
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index cef8354f77..0e6e5990be 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -191,6 +191,7 @@ enum ice_prot_id {
#define ICE_VNI_OFFSET 12 /* offset of VNI from ICE_PROT_UDP_OF */
+#define ICE_NAN_OFFSET 511
#define ICE_MAC_OFOS_HW 1
#define ICE_MAC_IL_HW 4
#define ICE_ETYPE_OL_HW 9
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 1fee790c25..d4cc664ad7 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7779,6 +7779,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
{
switch (type) {
+ case ICE_SW_TUN_AND_NON_TUN:
case ICE_SW_TUN_PROFID_IPV6_ESP:
case ICE_SW_TUN_PROFID_IPV6_AH:
case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
--
2.25.1
next parent reply other threads:[~2022-01-26 7:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <http://patchwork.dpdk.org/project/dpdk/patch/20220118145750.718362-1-yuying.zhang@intel.com/>
2022-01-26 15:57 ` Yuying Zhang [this message]
2022-01-26 15:57 ` [PATCH v3 2/2] net/ice: support drop any and steer all to queue Yuying Zhang
2022-02-09 2:18 ` Zhang, Qi Z
2022-02-10 16:59 ` Ferruh Yigit
2022-02-09 2:15 ` [PATCH v3 1/2] net/ice/base: add profile validation on switch filter 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=20220126155710.911525-1-yuying.zhang@intel.com \
--to=yuying.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@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).