* [dpdk-dev] [PATCH v4] net/iavf: reject floating RSS attribute
@ 2020-09-16 6:20 Qi Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Qi Zhang @ 2020-09-16 6:20 UTC (permalink / raw)
To: beilei.xing; +Cc: dev, junfeng.guo, jia.guo, Qi Zhang
For RSS attribute don't have an associated RSS type, we need
to reject it.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
v4:
- refine macros
v3:
- add missing floating l2 rss attribute check
v2:
- fix checkpatch warning.
drivers/net/iavf/iavf_hash.c | 75 +++++++++++++++++++++++++-----------
1 file changed, 53 insertions(+), 22 deletions(-)
diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 61466c072..b95f393d0 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -766,6 +766,52 @@ static uint64_t invalid_rss_comb[] = {
RTE_ETH_RSS_L3_PRE96
};
+struct rss_attr_type {
+ uint64_t attr;
+ uint64_t type;
+};
+
+#define VALID_RSS_IPV4 (ETH_RSS_IPV4 | \
+ ETH_RSS_NONFRAG_IPV4_UDP | \
+ ETH_RSS_NONFRAG_IPV4_TCP | \
+ ETH_RSS_NONFRAG_IPV4_SCTP)
+
+#define VALID_RSS_IPV6 (ETH_RSS_IPV6 | \
+ ETH_RSS_NONFRAG_IPV6_UDP | \
+ ETH_RSS_NONFRAG_IPV6_TCP | \
+ ETH_RSS_NONFRAG_IPV6_SCTP)
+
+#define VALID_RSS_IPV4_L4 (ETH_RSS_NONFRAG_IPV4_UDP | \
+ ETH_RSS_NONFRAG_IPV4_TCP | \
+ ETH_RSS_NONFRAG_IPV4_SCTP)
+
+#define VALID_RSS_IPV6_L4 (ETH_RSS_NONFRAG_IPV6_UDP | \
+ ETH_RSS_NONFRAG_IPV6_TCP | \
+ ETH_RSS_NONFRAG_IPV6_SCTP)
+
+#define VALID_RSS_ATTR (ETH_RSS_L3_SRC_ONLY | \
+ ETH_RSS_L3_DST_ONLY | \
+ ETH_RSS_L4_SRC_ONLY | \
+ ETH_RSS_L4_DST_ONLY | \
+ ETH_RSS_L2_SRC_ONLY | \
+ ETH_RSS_L2_DST_ONLY | \
+ RTE_ETH_RSS_L3_PRE64)
+
+#define INVALID_RSS_ATTR (RTE_ETH_RSS_L3_PRE32 | \
+ RTE_ETH_RSS_L3_PRE40 | \
+ RTE_ETH_RSS_L3_PRE48 | \
+ RTE_ETH_RSS_L3_PRE56 | \
+ RTE_ETH_RSS_L3_PRE96)
+
+static struct rss_attr_type rss_attr_to_valid_type[] = {
+ {ETH_RSS_L2_SRC_ONLY | ETH_RSS_L2_DST_ONLY, ETH_RSS_ETH},
+ {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY, VALID_RSS_IPV4 | VALID_RSS_IPV6},
+ {ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY, VALID_RSS_IPV4_L4 | VALID_RSS_IPV6_L4},
+ /* current ipv6 prefix only supports prefix 64 bits*/
+ {RTE_ETH_RSS_L3_PRE64, VALID_RSS_IPV6},
+ {INVALID_RSS_ATTR, 0}
+};
+
static bool
iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
{
@@ -777,31 +823,16 @@ iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
return true;
}
- /* current ipv6 prefix only supports prefix 64 bits*/
-#define _invalid_prefix_ (RTE_ETH_RSS_L3_PRE32 | \
- RTE_ETH_RSS_L3_PRE40 | \
- RTE_ETH_RSS_L3_PRE48 | \
- RTE_ETH_RSS_L3_PRE56 | \
- RTE_ETH_RSS_L3_PRE96)
+ /* check invalid RSS attribute */
+ for (i = 0; i < RTE_DIM(rss_attr_to_valid_type); i++) {
+ struct rss_attr_type *rat = &rss_attr_to_valid_type[i];
- if (rss_type & _invalid_prefix_)
- return true;
+ if (rat->attr & rss_type && !(rat->type & rss_type))
+ return true;
+ }
/* check not allowed RSS type */
-#define _RSS_ATTR_ (ETH_RSS_L3_SRC_ONLY | \
- ETH_RSS_L3_DST_ONLY | \
- ETH_RSS_L4_SRC_ONLY | \
- ETH_RSS_L4_DST_ONLY | \
- ETH_RSS_L2_SRC_ONLY | \
- ETH_RSS_L2_DST_ONLY | \
- RTE_ETH_RSS_L3_PRE32 | \
- RTE_ETH_RSS_L3_PRE40 | \
- RTE_ETH_RSS_L3_PRE48 | \
- RTE_ETH_RSS_L3_PRE56 | \
- RTE_ETH_RSS_L3_PRE64 | \
- RTE_ETH_RSS_L3_PRE96)
-
- rss_type &= ~_RSS_ATTR_;
+ rss_type &= ~VALID_RSS_ATTR;
return ((rss_type & allow_rss_type) != rss_type);
}
--
2.25.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v4] net/iavf: reject floating RSS attribute
@ 2020-09-16 6:26 Qi Zhang
2020-09-17 4:35 ` Guo, Junfeng
0 siblings, 1 reply; 4+ messages in thread
From: Qi Zhang @ 2020-09-16 6:26 UTC (permalink / raw)
To: beilei.xing; +Cc: dev, junfeng.guo, jia.guo, Qi Zhang
For RSS attribute don't have an associated RSS type, we need
to reject it.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
v4:
- refine macros
v3:
- add missing floating l2 rss attribute check
v2:
- fix checkpatch warning.
drivers/net/iavf/iavf_hash.c | 70 ++++++++++++++++++++++++------------
1 file changed, 48 insertions(+), 22 deletions(-)
diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 61466c072..325c35e02 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -766,6 +766,47 @@ static uint64_t invalid_rss_comb[] = {
RTE_ETH_RSS_L3_PRE96
};
+struct rss_attr_type {
+ uint64_t attr;
+ uint64_t type;
+};
+
+#define VALID_RSS_IPV4_L4 (ETH_RSS_NONFRAG_IPV4_UDP | \
+ ETH_RSS_NONFRAG_IPV4_TCP | \
+ ETH_RSS_NONFRAG_IPV4_SCTP)
+
+#define VALID_RSS_IPV6_L4 (ETH_RSS_NONFRAG_IPV6_UDP | \
+ ETH_RSS_NONFRAG_IPV6_TCP | \
+ ETH_RSS_NONFRAG_IPV6_SCTP)
+
+#define VALID_RSS_IPV4 (ETH_RSS_IPV4 | VALID_RSS_IPV4_L4)
+#define VALID_RSS_IPV6 (ETH_RSS_IPV6 | VALID_RSS_IPV6_L4)
+#define VALID_RSS_L3 (VALID_RSS_IPV4 | VALID_RSS_IPV6)
+#define VALID_RSS_L4 (VALID_RSS_IPV4_L4 | VALID_RSS_IPV6_L4)
+
+#define VALID_RSS_ATTR (ETH_RSS_L3_SRC_ONLY | \
+ ETH_RSS_L3_DST_ONLY | \
+ ETH_RSS_L4_SRC_ONLY | \
+ ETH_RSS_L4_DST_ONLY | \
+ ETH_RSS_L2_SRC_ONLY | \
+ ETH_RSS_L2_DST_ONLY | \
+ RTE_ETH_RSS_L3_PRE64)
+
+#define INVALID_RSS_ATTR (RTE_ETH_RSS_L3_PRE32 | \
+ RTE_ETH_RSS_L3_PRE40 | \
+ RTE_ETH_RSS_L3_PRE48 | \
+ RTE_ETH_RSS_L3_PRE56 | \
+ RTE_ETH_RSS_L3_PRE96)
+
+static struct rss_attr_type rss_attr_to_valid_type[] = {
+ {ETH_RSS_L2_SRC_ONLY | ETH_RSS_L2_DST_ONLY, ETH_RSS_ETH},
+ {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY, VALID_RSS_L3},
+ {ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY, VALID_RSS_L4},
+ /* current ipv6 prefix only supports prefix 64 bits*/
+ {RTE_ETH_RSS_L3_PRE64, VALID_RSS_IPV6},
+ {INVALID_RSS_ATTR, 0}
+};
+
static bool
iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
{
@@ -777,31 +818,16 @@ iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
return true;
}
- /* current ipv6 prefix only supports prefix 64 bits*/
-#define _invalid_prefix_ (RTE_ETH_RSS_L3_PRE32 | \
- RTE_ETH_RSS_L3_PRE40 | \
- RTE_ETH_RSS_L3_PRE48 | \
- RTE_ETH_RSS_L3_PRE56 | \
- RTE_ETH_RSS_L3_PRE96)
+ /* check invalid RSS attribute */
+ for (i = 0; i < RTE_DIM(rss_attr_to_valid_type); i++) {
+ struct rss_attr_type *rat = &rss_attr_to_valid_type[i];
- if (rss_type & _invalid_prefix_)
- return true;
+ if (rat->attr & rss_type && !(rat->type & rss_type))
+ return true;
+ }
/* check not allowed RSS type */
-#define _RSS_ATTR_ (ETH_RSS_L3_SRC_ONLY | \
- ETH_RSS_L3_DST_ONLY | \
- ETH_RSS_L4_SRC_ONLY | \
- ETH_RSS_L4_DST_ONLY | \
- ETH_RSS_L2_SRC_ONLY | \
- ETH_RSS_L2_DST_ONLY | \
- RTE_ETH_RSS_L3_PRE32 | \
- RTE_ETH_RSS_L3_PRE40 | \
- RTE_ETH_RSS_L3_PRE48 | \
- RTE_ETH_RSS_L3_PRE56 | \
- RTE_ETH_RSS_L3_PRE64 | \
- RTE_ETH_RSS_L3_PRE96)
-
- rss_type &= ~_RSS_ATTR_;
+ rss_type &= ~VALID_RSS_ATTR;
return ((rss_type & allow_rss_type) != rss_type);
}
--
2.25.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/iavf: reject floating RSS attribute
2020-09-16 6:26 Qi Zhang
@ 2020-09-17 4:35 ` Guo, Junfeng
2020-09-17 5:18 ` Zhang, Qi Z
0 siblings, 1 reply; 4+ messages in thread
From: Guo, Junfeng @ 2020-09-17 4:35 UTC (permalink / raw)
To: Zhang, Qi Z, Xing, Beilei; +Cc: dev, Guo, Jia
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, September 16, 2020 14:27
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Guo, Junfeng <junfeng.guo@intel.com>; Guo, Jia
> <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH v4] net/iavf: reject floating RSS attribute
>
> For RSS attribute don't have an associated RSS type, we need
> to reject it.
>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>
> v4:
> - refine macros
>
> v3:
> - add missing floating l2 rss attribute check
>
> v2:
> - fix checkpatch warning.
>
> drivers/net/iavf/iavf_hash.c | 70 ++++++++++++++++++++++++------------
> 1 file changed, 48 insertions(+), 22 deletions(-)
>
> --
> 2.25.4
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
Regards,
Junfeng Guo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/iavf: reject floating RSS attribute
2020-09-17 4:35 ` Guo, Junfeng
@ 2020-09-17 5:18 ` Zhang, Qi Z
0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2020-09-17 5:18 UTC (permalink / raw)
To: Guo, Junfeng, Xing, Beilei; +Cc: dev, Guo, Jia
> -----Original Message-----
> From: Guo, Junfeng <junfeng.guo@intel.com>
> Sent: Thursday, September 17, 2020 12:35 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
> Subject: RE: [PATCH v4] net/iavf: reject floating RSS attribute
>
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Wednesday, September 16, 2020 14:27
> > To: Xing, Beilei <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Guo, Junfeng <junfeng.guo@intel.com>; Guo, Jia
> > <jia.guo@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [PATCH v4] net/iavf: reject floating RSS attribute
> >
> > For RSS attribute don't have an associated RSS type, we need to reject
> > it.
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >
> > v4:
> > - refine macros
> >
> > v3:
> > - add missing floating l2 rss attribute check
> >
> > v2:
> > - fix checkpatch warning.
> >
> > drivers/net/iavf/iavf_hash.c | 70
> > ++++++++++++++++++++++++------------
> > 1 file changed, 48 insertions(+), 22 deletions(-)
> >
> > --
> > 2.25.4
>
> Acked-by: Junfeng Guo <junfeng.guo@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
>
> Regards,
> Junfeng Guo
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-17 5:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 6:20 [dpdk-dev] [PATCH v4] net/iavf: reject floating RSS attribute Qi Zhang
2020-09-16 6:26 Qi Zhang
2020-09-17 4:35 ` Guo, Junfeng
2020-09-17 5:18 ` Zhang, Qi Z
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).