From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 4FD41C2FC for ; Fri, 12 Jun 2015 17:15:56 +0200 (CEST) Received: by wgzl5 with SMTP id l5so2096394wgz.3 for ; Fri, 12 Jun 2015 08:15:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-type :content-disposition:in-reply-to; bh=2o4RZe03RTBX5VcUUPF/cfz7P3YNp428LRY1ZHUtAaM=; b=kxsk3fvc95VxisNLjBa22bHzGdM5ntcNemqRRotygXPPRmC7aCgOHed8qM8uLc3lv1 SaukenspGuAHeQXQt1UQY4e4IrALJ6houM9UHMrcGPHSJ4uZAlAjzJYnNUHQ6dYfldlS CB8Ucx0QOtlz1SP4rELE1A6nnTKxJDey08CQgY08G5AdYvlDebeRuBrmtKexeJr5LljN UpFLuDyYim/qmf9fgi8hkH2rccMmtDTFFBT1Pasb327KRCg6KGZGjm/SfK9qoulNVBzQ FqejKSgwcyxfVMEnHxWq9Y6fd2BfbXQ9b7PkZLPfVR8h+WjfPlI3LM7i504R0EaKRIwS S1rg== X-Gm-Message-State: ALoCoQlVvK4DXCURH9sv7uJgpdhlg7Ax8HwPUS8bTy1/0oZD9vwy0o+qbPXj9KebDLO+ZQ569HEz X-Received: by 10.194.206.65 with SMTP id lm1mr27608042wjc.117.1434122156091; Fri, 12 Jun 2015 08:15:56 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.151.210]) by mx.google.com with ESMTPSA id lf4sm6285625wjb.42.2015.06.12.08.15.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 12 Jun 2015 08:15:54 -0700 (PDT) Date: Fri, 12 Jun 2015 17:15:46 +0200 From: Adrien Mazarguil To: Nelio Laranjeiro Message-ID: <20150612151546.GJ12195@6wind.com> Mail-Followup-To: Nelio Laranjeiro , dev@dpdk.org References: <1432304251-8025-1-git-send-email-nelio.laranjeiro@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432304251-8025-1-git-send-email-nelio.laranjeiro@6wind.com> Cc: dev@dpdk.org Subject: Re: [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, 12 Jun 2015 15:15:56 -0000 On Fri, May 22, 2015 at 04:17:31PM +0200, Nelio Laranjeiro wrote: > 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 > Acked-by: Adrien Mazarguil -- Adrien Mazarguil 6WIND