Re: [PATCH mlx5-next v1 05/15] net/mlx5: Break encap/decap into two separated flow table creation flags
From: Jason Gunthorpe <jgg@ziepe.ca>
Date: 2018-09-05 21:09:01
Also in:
linux-rdma
From: Jason Gunthorpe <jgg@ziepe.ca>
Date: 2018-09-05 21:09:01
Also in:
linux-rdma
On Wed, Sep 05, 2018 at 08:10:25AM +0300, Leon Romanovsky wrote:
quoted
quoted
- int en_encap_decap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN); + int en_encap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN_ENCAP); + int en_decap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);Yuk, please don't use !!. bool en_decap = flags & MLX5_FLOW_TABLE_TUNNEL_EN_DECAP;We need to provide en_encap and en_decap as an input to MLX5_SET(...) which is passed to FW as 0 or 1. Boolean type is declared in C as int and treated as zero for false and any other value for true,
No, that isn't right, the kernel uses C99's _Bool intrinsic type, which is guaranteed to only hold 0 or 1 by the compiler. See types.h: typedef _Bool bool; Jason