From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mini-i7.icloud.com (97-94-195-106.dhcp.ftwo.tx.charter.com [97.94.195.106]) by dpdk.org (Postfix) with ESMTP id 57FFA137D for ; Sat, 29 Nov 2014 17:33:38 +0100 (CET) Received: from mini-i7.windriver.com (localhost.localdomain [127.0.0.1]) by mini-i7.icloud.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id sATGXa3N024058 for ; Sat, 29 Nov 2014 10:33:36 -0600 Received: (from keithw@localhost) by mini-i7.windriver.com (8.14.4/8.14.4/Submit) id sATGXaJg024057 for dev@dpdk.org; Sat, 29 Nov 2014 10:33:36 -0600 From: Keith Wiles To: dev@dpdk.org Date: Sat, 29 Nov 2014 10:33:36 -0600 Message-Id: <1417278816-24011-1-git-send-email-keith.wiles@windriver.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [RFC] Clang errors with bit fields and setting value of ~0. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 16:33:38 -0000 error: implicit truncation from 'int' to bitfield changes value from -1 to 127 [-Werror,-Wbitfield-constant-conversion] tx_offload_mask.l2_len = ~0; Converted to use correct bit values tx_offload_mask.l2_len = 0x7f; Signer-off-by: Keith Wiles --- 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..de5ae09 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 = 0xFFFF; } /* 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 = 0x7f; + tx_offload_mask.l3_len = 0x1ff; + tx_offload_mask.l4_len = 0xff; + tx_offload_mask.tso_segsz = 0xffff; 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 = 0x7f; + tx_offload_mask.l3_len = 0x1ff; } 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 = 0x7f; + tx_offload_mask.l3_len = 0x1ff; 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 = 0x7f; + tx_offload_mask.l3_len = 0x1ff; + tx_offload_mask.l4_len = 0xff; 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 = 0x7f; + tx_offload_mask.l3_len = 0x1ff; break; default: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_RSV | -- 1.9.1