diff mbox series

[net-next,v1] i40e: Disallow ip4 and ip6 l4_4_bytes

Message ID 20220729113452.858783-1-kamil.maziarz@intel.com
State Changes Requested
Headers show
Series [net-next,v1] i40e: Disallow ip4 and ip6 l4_4_bytes | expand

Commit Message

Kamil Maziarz July 29, 2022, 11:34 a.m. UTC
Return -EOPNOTSUPP, when user requests l4_4_bytes for raw IP4 or
IP6 flow director filters. Flow director does not support filtering
on l4 bytes for PCTYPEs used by IP4 and IP6 filters.
Without this patch, user could create filters with l4_4_bytes fields,
which did not do any filtering on L4, but only on L3 fields.

Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Kamil Maziarz  <kamil.maziarz@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Tony Nguyen Aug. 2, 2022, 10:25 p.m. UTC | #1
On 7/29/2022 4:34 AM, Kamil Maziarz wrote:
> Return -EOPNOTSUPP, when user requests l4_4_bytes for raw IP4 or
> IP6 flow director filters. Flow director does not support filtering
> on l4 bytes for PCTYPEs used by IP4 and IP6 filters.
> Without this patch, user could create filters with l4_4_bytes fields,
> which did not do any filtering on L4, but only on L3 fields.
> 

Is there a reason you're not targeting net with this?

> Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
> Signed-off-by: Kamil Maziarz  <kamil.maziarz@intel.com>

I presume Przemyslaw is the author, in which case, you need to edit this 
to patch to reflect it. If you are the author, your name should be first.

Also, there is extra space between your name and email.

> ---
>   drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++----------
>   1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index 156e92c43780..6695dbe61a04 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -4447,11 +4447,7 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,
>   			return -EOPNOTSUPP;
>   
>   		/* First 4 bytes of L4 header */
> -		if (usr_ip4_spec->l4_4_bytes == htonl(0xFFFFFFFF))
> -			new_mask |= I40E_L4_SRC_MASK | I40E_L4_DST_MASK;
> -		else if (!usr_ip4_spec->l4_4_bytes)
> -			new_mask &= ~(I40E_L4_SRC_MASK | I40E_L4_DST_MASK);
> -		else
> +		if (usr_ip4_spec->l4_4_bytes)
>   			return -EOPNOTSUPP;
>   
>   		/* Filtering on Type of Service is not supported. */
> @@ -4490,11 +4486,7 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,
>   		else
>   			return -EOPNOTSUPP;
>   
> -		if (usr_ip6_spec->l4_4_bytes == htonl(0xFFFFFFFF))
> -			new_mask |= I40E_L4_SRC_MASK | I40E_L4_DST_MASK;
> -		else if (!usr_ip6_spec->l4_4_bytes)
> -			new_mask &= ~(I40E_L4_SRC_MASK | I40E_L4_DST_MASK);
> -		else
> +		if (usr_ip6_spec->l4_4_bytes)
>   			return -EOPNOTSUPP;
>   
>   		/* Filtering on Traffic class is not supported. */
 >
 > ---------------------------------------------------------------------
 > Intel Technology Poland sp. z o.o.

<snip>

Please remove the footer
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 156e92c43780..6695dbe61a04 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -4447,11 +4447,7 @@  static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,
 			return -EOPNOTSUPP;
 
 		/* First 4 bytes of L4 header */
-		if (usr_ip4_spec->l4_4_bytes == htonl(0xFFFFFFFF))
-			new_mask |= I40E_L4_SRC_MASK | I40E_L4_DST_MASK;
-		else if (!usr_ip4_spec->l4_4_bytes)
-			new_mask &= ~(I40E_L4_SRC_MASK | I40E_L4_DST_MASK);
-		else
+		if (usr_ip4_spec->l4_4_bytes)
 			return -EOPNOTSUPP;
 
 		/* Filtering on Type of Service is not supported. */
@@ -4490,11 +4486,7 @@  static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,
 		else
 			return -EOPNOTSUPP;
 
-		if (usr_ip6_spec->l4_4_bytes == htonl(0xFFFFFFFF))
-			new_mask |= I40E_L4_SRC_MASK | I40E_L4_DST_MASK;
-		else if (!usr_ip6_spec->l4_4_bytes)
-			new_mask &= ~(I40E_L4_SRC_MASK | I40E_L4_DST_MASK);
-		else
+		if (usr_ip6_spec->l4_4_bytes)
 			return -EOPNOTSUPP;
 
 		/* Filtering on Traffic class is not supported. */