[dpdk-dev,v1,1/1] enic: fix local ol_flags variable

Message ID 1462868793-3176-1-git-send-email-piotrx.t.azarewicz@intel.com
State Superseded, archived
Delegated to: Bruce Richardson
Headers show

Commit Message

Piotr Azarewicz May 10, 2016, 8:26 a.m.
Expand local ol_flags field to 64-bits.

The offload flags field (ol_flags) in rte_mbuf structure is 64-bits, so
local copy of it must be 64-bits too. Moreover bit comparison between
16-bits variable and 64-bits value make no sense.

CID 13218 : Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: ol_flags & (18014398509481984ULL /* 1ULL
<< 54 */) is always 0 regardless of the values of its operands. This
occurs as the logical operand of if.

Coverity issue: 13218
Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
---
 drivers/net/enic/enic.h        |    2 +-
 drivers/net/enic/enic_ethdev.c |    2 +-
 drivers/net/enic/enic_main.c   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 09f3853..1bea120 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -191,7 +191,7 @@  extern unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
 extern void enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
 			  struct rte_mbuf *tx_pkt, unsigned short len,
 			  uint8_t sop, uint8_t eop, uint8_t cq_entry,
-			  uint16_t ol_flags, uint16_t vlan_tag);
+			  uint64_t ol_flags, uint16_t vlan_tag);
 
 extern void enic_post_wq_index(struct vnic_wq *wq);
 extern int enic_probe(struct enic *enic);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6bea940..29c5e1c 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -533,7 +533,7 @@  static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct vnic_wq *wq = (struct vnic_wq *)tx_queue;
 	struct enic *enic = vnic_dev_priv(wq->vdev);
 	unsigned short vlan_id;
-	unsigned short ol_flags;
+	uint64_t ol_flags;
 	uint8_t last_seg, eop;
 	unsigned int host_tx_descs = 0;
 
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 60fe765..a78d0ec 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -180,7 +180,7 @@  void enic_post_wq_index(struct vnic_wq *wq)
 void enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
 		   struct rte_mbuf *tx_pkt, unsigned short len,
 		   uint8_t sop, uint8_t eop, uint8_t cq_entry,
-		   uint16_t ol_flags, uint16_t vlan_tag)
+		   uint64_t ol_flags, uint16_t vlan_tag)
 {
 	struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
 	uint16_t mss = 0;