net/ice: fix invalid RSS type
diff mbox series

Message ID 1594275994-318254-1-git-send-email-simei.su@intel.com
State Superseded, archived
Delegated to: Qi Zhang
Headers show
Series
  • net/ice: fix invalid RSS type
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK

Commit Message

Simei Su July 9, 2020, 6:26 a.m. UTC
When a RSS rule with only RSS type modifirer L2/L3/L4 SRC/DST_ONLY,
it should return failure. This patch adds invalid RSS type check.

Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow")

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/ice/ice_hash.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Qi Zhang July 9, 2020, 6:46 a.m. UTC | #1
> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Thursday, July 9, 2020 2:27 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>; Su, Simei
> <simei.su@intel.com>
> Subject: [PATCH] net/ice: fix invalid RSS type
> 
> When a RSS rule with only RSS type modifirer L2/L3/L4 SRC/DST_ONLY, it
> should return failure. This patch adds invalid RSS type check.
> 
> Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow")
> 
> Signed-off-by: Simei Su <simei.su@intel.com>
> ---
>  drivers/net/ice/ice_hash.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index
> cbd6116..777bd6d 100644
> --- a/drivers/net/ice/ice_hash.c
> +++ b/drivers/net/ice/ice_hash.c
> @@ -721,6 +721,11 @@ struct ice_hash_match_type ice_hash_type_list[] = {
>  			 * of the same level.
>  			 */
>  			rss_type = rte_eth_rss_hf_refine(rss_type);
> +			/* Check if only L2/L3/L4 src/dst-only exists. */
> +			if ((rss_type & 0xffffffff) == 0)

Why 0xffffffff? We should not hard code.

> +				return rte_flow_error_set(error, ENOTSUP,
> +					RTE_FLOW_ERROR_TYPE_ACTION, action,
> +					"rss type with only L2/L3/L4 src/dst only is invalid");
> 
>  			combine_type = ETH_RSS_L2_SRC_ONLY |
>  					ETH_RSS_L2_DST_ONLY |
> --
> 1.8.3.1
Simei Su July 9, 2020, 7:32 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Thursday, July 9, 2020 2:47 PM
> To: Su, Simei <simei.su@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
> Subject: RE: [PATCH] net/ice: fix invalid RSS type
> 
> 
> 
> > -----Original Message-----
> > From: Su, Simei <simei.su@intel.com>
> > Sent: Thursday, July 9, 2020 2:27 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>; Su, Simei
> > <simei.su@intel.com>
> > Subject: [PATCH] net/ice: fix invalid RSS type
> >
> > When a RSS rule with only RSS type modifirer L2/L3/L4 SRC/DST_ONLY, it
> > should return failure. This patch adds invalid RSS type check.
> >
> > Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow")
> >
> > Signed-off-by: Simei Su <simei.su@intel.com>
> > ---
> >  drivers/net/ice/ice_hash.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
> > index cbd6116..777bd6d 100644
> > --- a/drivers/net/ice/ice_hash.c
> > +++ b/drivers/net/ice/ice_hash.c
> > @@ -721,6 +721,11 @@ struct ice_hash_match_type ice_hash_type_list[] =
> {
> >  			 * of the same level.
> >  			 */
> >  			rss_type = rte_eth_rss_hf_refine(rss_type);
> > +			/* Check if only L2/L3/L4 src/dst-only exists. */
> > +			if ((rss_type & 0xffffffff) == 0)
> 
> Why 0xffffffff? We should not hard code.

 Ok, got it. My purpose is to check if rss type is 0 except SRC/DST_ONLY bit to make sure there exist ipv4, ipv6, udp, tcp or sctp type, etc. I will modify it in v2. Thanks.

Br
Simei

> 
> > +				return rte_flow_error_set(error, ENOTSUP,
> > +					RTE_FLOW_ERROR_TYPE_ACTION, action,
> > +					"rss type with only L2/L3/L4 src/dst only is invalid");
> >
> >  			combine_type = ETH_RSS_L2_SRC_ONLY |
> >  					ETH_RSS_L2_DST_ONLY |
> > --
> > 1.8.3.1
>

Patch
diff mbox series

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index cbd6116..777bd6d 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -721,6 +721,11 @@  struct ice_hash_match_type ice_hash_type_list[] = {
 			 * of the same level.
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
+			/* Check if only L2/L3/L4 src/dst-only exists. */
+			if ((rss_type & 0xffffffff) == 0)
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"rss type with only L2/L3/L4 src/dst only is invalid");
 
 			combine_type = ETH_RSS_L2_SRC_ONLY |
 					ETH_RSS_L2_DST_ONLY |