From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by dpdk.org (Postfix) with ESMTP id 0FDFAC31A for ; Fri, 22 May 2015 16:18:17 +0200 (CEST) Received: by wicmx19 with SMTP id mx19so49019447wic.0 for ; Fri, 22 May 2015 07:18:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=fLaw3OGOb988Nd2sn7LGZf1v5rfQ+WG0E8XPrUnOs64=; b=cWz1QT7mijrf7XCaxZ1UuW61uXODHMIlFqALuWYMPl1PCUbQGqLY6i3rbPERLWM+QK nbf/mOMwuaMvSurZg1oXrzRhRIFIT/Ysg6bEkMsl+ItzExVKVnIcDjkse6f/y93iLMaF 8uGgevb0uMenTrDRy7F6W/aJ15coBSmFdnrCCHWrtMFIYszyu+o1BmhtYFb/rAx8/Xfv DYSqdLOQhtD2F54zVsLwfGKgGP1vT3Yyb96rmqBHcptkOw/wRDd1qlZ92RXGTYlxeUy+ zaQsy98DA5jD+R12L9lMQd6h5hTP1XDYIZhBbeQYEqEIiCkXSZrc65c2MSNJ2x6ioOzl kg8g== X-Gm-Message-State: ALoCoQkGeU1vQw5W8OnirkjL9b6G/b2YVYj5gUn763Htz6SwgXu9C5uShEqAkt8XDqSPnZLLxmS5 X-Received: by 10.180.20.115 with SMTP id m19mr8182358wie.11.1432304296901; Fri, 22 May 2015 07:18:16 -0700 (PDT) Received: from vasco.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id l6sm7931473wib.18.2015.05.22.07.18.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 May 2015 07:18:16 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Date: Fri, 22 May 2015 16:17:31 +0200 Message-Id: <1432304251-8025-1-git-send-email-nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 1.7.10.4 X-Mailman-Approved-At: Fri, 22 May 2015 16:21:46 +0200 Subject: [dpdk-dev] [PATCH] mlx4: fix compilation warnings for 32 bit 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: Fri, 22 May 2015 14:18:17 -0000 Fix warning messages "cast to pointer from integer of different size" when compiling DPDK in 32 bit with Mellanox PMD. SGE addresses are 64 bit integers, converting them to pointers must be done through uintptr_t to avoid compilation warnings when those have a different size. Signed-off-by: Nelio Laranjeiro --- lib/librte_pmd_mlx4/mlx4.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/librte_pmd_mlx4/mlx4.c b/lib/librte_pmd_mlx4/mlx4.c index fa749f4..b0b1c50 100644 --- a/lib/librte_pmd_mlx4/mlx4.c +++ b/lib/librte_pmd_mlx4/mlx4.c @@ -832,8 +832,8 @@ txq_free_elts(struct txq *txq) if (WR_ID(elt->wr.wr_id).offset == 0) continue; - rte_pktmbuf_free((void *)(elt->sges[0].addr - - WR_ID(elt->wr.wr_id).offset)); + rte_pktmbuf_free((void *)((uintptr_t)elt->sges[0].addr - + WR_ID(elt->wr.wr_id).offset)); } rte_free(elts); } @@ -1067,7 +1067,8 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) /* Clean up old buffer. */ if (likely(WR_ID(wr->wr_id).offset != 0)) { struct rte_mbuf *tmp = (void *) - (elt->sges[0].addr - WR_ID(wr->wr_id).offset); + ((uintptr_t)elt->sges[0].addr - + WR_ID(wr->wr_id).offset); /* Faster than rte_pktmbuf_free(). */ do { @@ -1143,7 +1144,8 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) /* Update SGE. */ sge->addr = (uintptr_t)rte_pktmbuf_mtod(buf, char *); if (txq->priv->vf) - rte_prefetch0((volatile void *)sge->addr); + rte_prefetch0((volatile void *) + (uintptr_t)sge->addr); sge->length = DATA_LEN(buf); sge->lkey = lkey; #if (MLX4_PMD_MAX_INLINE > 0) || defined(MLX4_PMD_SOFT_COUNTERS) @@ -1742,7 +1744,8 @@ rxq_alloc_elts(struct rxq *rxq, unsigned int elts_n, struct rte_mbuf **pool) /* Make sure elts index and SGE mbuf pointer can be deduced * from WR ID. */ if ((WR_ID(wr->wr_id).id != i) || - ((void *)(sge->addr - WR_ID(wr->wr_id).offset) != buf)) { + ((void *)((uintptr_t)sge->addr - + WR_ID(wr->wr_id).offset) != buf)) { ERROR("%p: cannot store index and offset in WR ID", (void *)rxq); sge->addr = 0; @@ -1769,8 +1772,8 @@ error: if (elt->sge.addr == 0) continue; assert(WR_ID(elt->wr.wr_id).id == i); - buf = (void *) - (elt->sge.addr - WR_ID(elt->wr.wr_id).offset); + buf = (void *)((uintptr_t)elt->sge.addr - + WR_ID(elt->wr.wr_id).offset); rte_pktmbuf_free_seg(buf); } rte_free(elts); @@ -1805,7 +1808,8 @@ rxq_free_elts(struct rxq *rxq) if (elt->sge.addr == 0) continue; assert(WR_ID(elt->wr.wr_id).id == i); - buf = (void *)(elt->sge.addr - WR_ID(elt->wr.wr_id).offset); + buf = (void *)((uintptr_t)elt->sge.addr - + WR_ID(elt->wr.wr_id).offset); rte_pktmbuf_free_seg(buf); } rte_free(elts); @@ -2508,8 +2512,8 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) uint32_t len = wc->byte_len; struct rxq_elt *elt = &(*elts)[WR_ID(wr_id).id]; struct ibv_recv_wr *wr = &elt->wr; - struct rte_mbuf *seg = - (void *)(elt->sge.addr - WR_ID(wr_id).offset); + struct rte_mbuf *seg = (void *)((uintptr_t)elt->sge.addr - + WR_ID(wr_id).offset); struct rte_mbuf *rep; /* Sanity checks. */ @@ -2891,7 +2895,8 @@ rxq_rehash(struct rte_eth_dev *dev, struct rxq *rxq) for (i = 0; (i != elemof(*elts)); ++i) { struct rxq_elt *elt = &(*elts)[i]; struct rte_mbuf *buf = (void *) - (elt->sge.addr - WR_ID(elt->wr.wr_id).offset); + ((uintptr_t)elt->sge.addr - + WR_ID(elt->wr.wr_id).offset); assert(WR_ID(elt->wr.wr_id).id == i); pool[k++] = buf; -- 1.7.10.4