From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Subject: Re: [PATCH mlx5-next v1 05/15] net/mlx5: Break encap/decap into two separated flow table creation flags Date: Wed, 5 Sep 2018 10:38:00 -0600 Message-ID: <20180905163800.GA21028@ziepe.ca> References: <20180828111854.14367-1-leon@kernel.org> <20180828111854.14367-6-leon@kernel.org> <20180904220242.GA3895@ziepe.ca> <20180905051025.GC2977@mtr-leonro.mtl.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Doug Ledford , RDMA mailing list , Ariel Levkovich , Mark Bloch , Or Gerlitz , Saeed Mahameed , linux-netdev To: Leon Romanovsky Return-path: Received: from mail-pl1-f195.google.com ([209.85.214.195]:35914 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbeIEVJB (ORCPT ); Wed, 5 Sep 2018 17:09:01 -0400 Received: by mail-pl1-f195.google.com with SMTP id e11-v6so3562545plb.3 for ; Wed, 05 Sep 2018 09:38:03 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180905051025.GC2977@mtr-leonro.mtl.com> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Sep 05, 2018 at 08:10:25AM +0300, Leon Romanovsky wrote: > > > - 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