Re: [PATCH v3 net-next] net: flow_dissector: Use 64bits for used_keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 29, 2023 at 04:52:15AM +0530, Ratheesh Kannoth wrote:
> As 32bits of dissector->used_keys are exhausted,
> increase the size to 64bits.
> 
> This is base change for ESP/AH flow dissector patch.
> Please find patch and discussions at
> https://lore.kernel.org/netdev/ZMDNjD46BvZ5zp5I@xxxxxxxxxxxx/T/#t
> 
> Signed-off-by: Ratheesh Kannoth <rkannoth@xxxxxxxxxxx>
> Reviewed-by: Petr Machata <petrm@xxxxxxxxxx> # for mlxsw
> Tested-by: Petr Machata <petrm@xxxxxxxxxx>
> Reviewed-by: Martin Habets <habetsm.xilinx@xxxxxxxxx>
> Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
> 
> ---
> ChangeLog
> 
> v2 -> v3: commit message subject line fix as per comment of Petr Machata
> v1 -> v2: Commit message typo fix.
> v0 -> v1: Fix errors reported by kernel test robot
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c
> index 2b80fe73549d..8c531f4ec912 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c
> @@ -221,16 +221,21 @@ mlx5_ct_fs_smfs_destroy(struct mlx5_ct_fs *fs)
>  }
>  
>  static inline bool
> -mlx5_tc_ct_valid_used_dissector_keys(const u32 used_keys)
> +mlx5_tc_ct_valid_used_dissector_keys(const u64 used_keys)
>  {
> -#define DISS_BIT(name) BIT(FLOW_DISSECTOR_KEY_ ## name)
> -	const u32 basic_keys = DISS_BIT(BASIC) | DISS_BIT(CONTROL) | DISS_BIT(META);
> -	const u32 ipv4_tcp = basic_keys | DISS_BIT(IPV4_ADDRS) | DISS_BIT(PORTS) | DISS_BIT(TCP);
> -	const u32 ipv6_tcp = basic_keys | DISS_BIT(IPV6_ADDRS) | DISS_BIT(PORTS) | DISS_BIT(TCP);
> -	const u32 ipv4_udp = basic_keys | DISS_BIT(IPV4_ADDRS) | DISS_BIT(PORTS);
> -	const u32 ipv6_udp = basic_keys | DISS_BIT(IPV6_ADDRS) | DISS_BIT(PORTS);
> -	const u32 ipv4_gre = basic_keys | DISS_BIT(IPV4_ADDRS);
> -	const u32 ipv6_gre = basic_keys | DISS_BIT(IPV6_ADDRS);
> +#define DISS_BIT(name) BIT_ULL(FLOW_DISSECTOR_KEY_ ## name)
> +	const u64 basic_keys = DISS_BIT(BASIC) | DISS_BIT(CONTROL) |
> +				DISS_BIT(META);
> +	const u64 ipv4_tcp = basic_keys | DISS_BIT(IPV4_ADDRS) |
> +				DISS_BIT(PORTS) | DISS_BIT(TCP);
> +	const u64 ipv6_tcp = basic_keys | DISS_BIT(IPV6_ADDRS) |
> +				DISS_BIT(PORTS) | DISS_BIT(TCP);
> +	const u64 ipv4_udp = basic_keys | DISS_BIT(IPV4_ADDRS) |
> +				DISS_BIT(PORTS);
> +	const u64 ipv6_udp = basic_keys | DISS_BIT(IPV6_ADDRS) |
> +				 DISS_BIT(PORTS);
> +	const u64 ipv4_gre = basic_keys | DISS_BIT(IPV4_ADDRS);
> +	const u64 ipv6_gre = basic_keys | DISS_BIT(IPV6_ADDRS);
>  
>  	return (used_keys == ipv4_tcp || used_keys == ipv4_udp || used_keys == ipv6_tcp ||
>  		used_keys == ipv6_udp || used_keys == ipv4_gre || used_keys == ipv6_gre);

Probably leaving the style alone here, and just changing the types,
would have been a better choice. Anyway...



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux