* [PATCH] ixgbe: change assignation of bitfields to fix clang compilation
@ 2014-12-01 10:36 Olivier Matz
[not found] ` <1417430173-24502-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2014-12-01 10:36 UTC (permalink / raw)
To: dev-VfR2kkLFssw
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-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1417430173-24502-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] ixgbe: change assignation of bitfields to fix clang compilation [not found] ` <1417430173-24502-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2014-12-01 10:52 ` Bruce Richardson 2014-12-01 11:20 ` Thomas Monjalon 0 siblings, 1 reply; 3+ messages in thread From: Bruce Richardson @ 2014-12-01 10:52 UTC (permalink / raw) To: Olivier Matz; +Cc: dev-VfR2kkLFssw 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-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> Acked-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > --- > 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 > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ixgbe: change assignation of bitfields to fix clang compilation 2014-12-01 10:52 ` Bruce Richardson @ 2014-12-01 11:20 ` Thomas Monjalon 0 siblings, 0 replies; 3+ messages in thread From: Thomas Monjalon @ 2014-12-01 11:20 UTC (permalink / raw) To: Olivier Matz; +Cc: dev-VfR2kkLFssw > > 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-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> > > Acked-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Applied Thanks -- Thomas ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-01 11:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-01 10:36 [PATCH] ixgbe: change assignation of bitfields to fix clang compilation Olivier Matz
[not found] ` <1417430173-24502-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-12-01 10:52 ` Bruce Richardson
2014-12-01 11:20 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).