DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@6wind.com>
To: liljegren.mats2@gmail.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] eal: fix use of RTE_PTR_ALIGN_CEIL macro on 32bits system
Date: Fri, 28 Feb 2014 09:21:35 +0100	[thread overview]
Message-ID: <1393575696-25289-1-git-send-email-david.marchand@6wind.com> (raw)

Build issue reported by Mats Liljegren :

  CC eal.o
In file included from
/home/lwrt/build/dpdk/lib/librte_eal/linuxapp/eal/eal.c:55:0:
/home/lwrt/build/dpdk/lib/librte_eal/linuxapp/eal/eal.c: In function
‘eal_parse_base_virtaddr’:
/home/lwrt/build/dpdk/i686-default-linuxapp-gcc/include/rte_common.h:133:22:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
  RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)
                      ^
/home/lwrt/build/dpdk/i686-default-linuxapp-gcc/include/rte_common.h:115:10:
note: in definition of macro ‘RTE_PTR_ALIGN_FLOOR’
  (typeof(ptr))rte_align_floor_int((uintptr_t)ptr, align)
          ^
/home/lwrt/build/dpdk/lib/librte_eal/linuxapp/eal/eal.c:566:9: note:
in expansion of macro ‘RTE_PTR_ALIGN_CEIL’
  addr = RTE_PTR_ALIGN_CEIL(addr, RTE_PGSIZE_2M);
         ^
/home/lwrt/build/dpdk/i686-default-linuxapp-gcc/include/rte_common.h:133:22:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
  RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)
                      ^
/home/lwrt/build/dpdk/i686-default-linuxapp-gcc/include/rte_common.h:115:46:
note: in definition of macro ‘RTE_PTR_ALIGN_FLOOR’
  (typeof(ptr))rte_align_floor_int((uintptr_t)ptr, align)
                                              ^
/home/lwrt/build/dpdk/lib/librte_eal/linuxapp/eal/eal.c:566:9: note:
in expansion of macro ‘RTE_PTR_ALIGN_CEIL’
  addr = RTE_PTR_ALIGN_CEIL(addr, RTE_PGSIZE_2M);
         ^
cc1: all warnings being treated as errors

RTE_PTR_ALIGN_CEIL return type is the same as what we give it as input.
So instead of casting the returned value, cast 'addr' which should be the same
as base_virtaddr.

Reported-by: Mats Liljegren <mats.liljegren@enea.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index db0e15c..72b4dd7 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -563,9 +563,9 @@ eal_parse_base_virtaddr(const char *arg)
 #endif
 
 	/* align the addr on 2M boundary */
-	addr = RTE_PTR_ALIGN_CEIL(addr, RTE_PGSIZE_2M);
+	internal_config.base_virtaddr = RTE_PTR_ALIGN_CEIL((uintptr_t)addr,
+	                                                   RTE_PGSIZE_2M);
 
-	internal_config.base_virtaddr = (uintptr_t) addr;
 	return 0;
 }
 
-- 
1.7.10.4

             reply	other threads:[~2014-02-28  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28  8:21 David Marchand [this message]
2014-02-28  8:21 ` [dpdk-dev] [PATCH 2/2] mem: fix build " David Marchand
2014-03-20 14:43   ` Thomas Monjalon
2014-03-20 14:40 ` [dpdk-dev] [PATCH 1/2] eal: fix use of RTE_PTR_ALIGN_CEIL macro " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393575696-25289-1-git-send-email-david.marchand@6wind.com \
    --to=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=liljegren.mats2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).