From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id C2FBD7F07
 for <dev@dpdk.org>; Mon,  1 Dec 2014 11:52:58 +0100 (CET)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by orsmga103.jf.intel.com with ESMTP; 01 Dec 2014 02:49:36 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.07,493,1413270000"; d="scan'208";a="646136079"
Received: from bricha3-mobl3.ger.corp.intel.com ([10.243.20.36])
 by orsmga002.jf.intel.com with SMTP; 01 Dec 2014 02:52:51 -0800
Received: by  (sSMTP sendmail emulation); Mon, 01 Dec 2014 10:52:50 +0025
Date: Mon, 1 Dec 2014 10:52:50 +0000
From: Bruce Richardson <bruce.richardson@intel.com>
To: Olivier Matz <olivier.matz@6wind.com>
Message-ID: <20141201105250.GA4856@bricha3-MOBL3>
References: <1417430173-24502-1-git-send-email-olivier.matz@6wind.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1417430173-24502-1-git-send-email-olivier.matz@6wind.com>
Organization: Intel Shannon Ltd.
User-Agent: Mutt/1.5.23 (2014-03-12)
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] ixgbe: change assignation of bitfields to
 fix clang compilation
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 01 Dec 2014 10:52:59 -0000

On Mon, Dec 01, 2014 at 11:36:13AM +0100, Olivier Matz wrote:
> Commit 1224decaa44b3dba58e0a524fd0383969929c575 changed the way
> the bitfields are assigned in ixgbe, example:
> 
>   tx_offload_mask.l2_len = ~0;
> 
> This result in a compilation error with clang:
> 
>    error: implicit truncation from 'int' to bitfield
>     changes value from -1 to 127 [-Werror,-Wbitfield-constant-conversion]
> 
> Replacing the '=' with a '|=' fixes the issue.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> index 8559ef6..5c36bff 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> @@ -381,7 +381,7 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
>  	mss_l4len_idx |= (ctx_idx << IXGBE_ADVTXD_IDX_SHIFT);
>  
>  	if (ol_flags & PKT_TX_VLAN_PKT) {
> -		tx_offload_mask.vlan_tci = ~0;
> +		tx_offload_mask.vlan_tci |= ~0;
>  	}
>  
>  	/* check if TCP segmentation required for this packet */
> @@ -391,17 +391,17 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
>  			IXGBE_ADVTXD_TUCMD_L4T_TCP |
>  			IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;
>  
> -		tx_offload_mask.l2_len = ~0;
> -		tx_offload_mask.l3_len = ~0;
> -		tx_offload_mask.l4_len = ~0;
> -		tx_offload_mask.tso_segsz = ~0;
> +		tx_offload_mask.l2_len |= ~0;
> +		tx_offload_mask.l3_len |= ~0;
> +		tx_offload_mask.l4_len |= ~0;
> +		tx_offload_mask.tso_segsz |= ~0;
>  		mss_l4len_idx |= tx_offload.tso_segsz << IXGBE_ADVTXD_MSS_SHIFT;
>  		mss_l4len_idx |= tx_offload.l4_len << IXGBE_ADVTXD_L4LEN_SHIFT;
>  	} else { /* no TSO, check if hardware checksum is needed */
>  		if (ol_flags & PKT_TX_IP_CKSUM) {
>  			type_tucmd_mlhl = IXGBE_ADVTXD_TUCMD_IPV4;
> -			tx_offload_mask.l2_len = ~0;
> -			tx_offload_mask.l3_len = ~0;
> +			tx_offload_mask.l2_len |= ~0;
> +			tx_offload_mask.l3_len |= ~0;
>  		}
>  
>  		switch (ol_flags & PKT_TX_L4_MASK) {
> @@ -409,23 +409,23 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
>  			type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP |
>  				IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;
>  			mss_l4len_idx |= sizeof(struct udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT;
> -			tx_offload_mask.l2_len = ~0;
> -			tx_offload_mask.l3_len = ~0;
> +			tx_offload_mask.l2_len |= ~0;
> +			tx_offload_mask.l3_len |= ~0;
>  			break;
>  		case PKT_TX_TCP_CKSUM:
>  			type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP |
>  				IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;
>  			mss_l4len_idx |= sizeof(struct tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT;
> -			tx_offload_mask.l2_len = ~0;
> -			tx_offload_mask.l3_len = ~0;
> -			tx_offload_mask.l4_len = ~0;
> +			tx_offload_mask.l2_len |= ~0;
> +			tx_offload_mask.l3_len |= ~0;
> +			tx_offload_mask.l4_len |= ~0;
>  			break;
>  		case PKT_TX_SCTP_CKSUM:
>  			type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP |
>  				IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT;
>  			mss_l4len_idx |= sizeof(struct sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT;
> -			tx_offload_mask.l2_len = ~0;
> -			tx_offload_mask.l3_len = ~0;
> +			tx_offload_mask.l2_len |= ~0;
> +			tx_offload_mask.l3_len |= ~0;
>  			break;
>  		default:
>  			type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_RSV |
> -- 
> 2.1.0
>