[v2,2/2] eal: use define instead of raw flag name

Message ID 41c41b7a73cea7f574bc709e1fb1cd4eed4c72e3.1571930271.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2,1/2] eal/freebsd: add support for base virtaddr option |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation fail apply issues

Commit Message

Anatoly Burakov Oct. 24, 2019, 3:17 p.m. UTC
  We are using '--base-virtaddr' in a few places. We have a define for that,
so use it instead.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/freebsd/eal/eal.c        | 3 ++-
 lib/librte_eal/freebsd/eal/eal_memory.c | 5 ++++-
 lib/librte_eal/linux/eal/eal.c          | 4 ++--
 lib/librte_eal/linux/eal/eal_memory.c   | 3 ++-
 4 files changed, 10 insertions(+), 5 deletions(-)
  

Comments

David Marchand Oct. 24, 2019, 6:59 p.m. UTC | #1
On Thu, Oct 24, 2019 at 5:18 PM Anatoly Burakov
<anatoly.burakov@intel.com> wrote:
>
> We are using '--base-virtaddr' in a few places. We have a define for that,
> so use it instead.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  lib/librte_eal/freebsd/eal/eal.c        | 3 ++-
>  lib/librte_eal/freebsd/eal/eal_memory.c | 5 ++++-
>  lib/librte_eal/linux/eal/eal.c          | 4 ++--
>  lib/librte_eal/linux/eal/eal_memory.c   | 3 ++-
>  4 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
> index c7e1264205..14e1713294 100644
> --- a/lib/librte_eal/freebsd/eal/eal.c
> +++ b/lib/librte_eal/freebsd/eal/eal.c
> @@ -345,7 +345,8 @@ rte_eal_config_reattach(void)
>                 if (mem_config != MAP_FAILED) {
>                         /* errno is stale, don't use */
>                         RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
> -                                         " - please use '--base-virtaddr' option\n",
> +                                         " - please use '--" OPT_BASE_VIRTADDR
> +                                         "' option\n",
>                                 rte_mem_cfg_addr, mem_config);
>                         munmap(mem_config, sizeof(struct rte_mem_config));
>                         return -1;
> diff --git a/lib/librte_eal/freebsd/eal/eal_memory.c b/lib/librte_eal/freebsd/eal/eal_memory.c
> index cd31827c2b..a637127d5e 100644
> --- a/lib/librte_eal/freebsd/eal/eal_memory.c
> +++ b/lib/librte_eal/freebsd/eal/eal_memory.c
> @@ -14,6 +14,8 @@
>  #include <rte_errno.h>
>  #include <rte_log.h>
>  #include <rte_string_fns.h>
> +
> +#include "eal_options.h"
>  #include "eal_private.h"
>  #include "eal_internal_cfg.h"
>  #include "eal_filesystem.h"
> @@ -367,7 +369,8 @@ alloc_va_space(struct rte_memseg_list *msl)
>         addr = eal_get_virtual_area(msl->base_va, &mem_sz, page_sz, 0, flags);
>         if (addr == NULL) {
>                 if (rte_errno == EADDRNOTAVAIL)
> -                       RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - please use '--base-virtaddr' option\n",
> +                       RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - "
> +                               "please use '--" OPT_BASE_VIRTADDR "' option\n",
>                                 (unsigned long long)mem_sz, msl->base_va);
>                 else
>                         RTE_LOG(ERR, EAL, "Cannot reserve memory\n");
> diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
> index ef5dafa94f..13ffabd470 100644
> --- a/lib/librte_eal/linux/eal/eal.c
> +++ b/lib/librte_eal/linux/eal/eal.c
> @@ -435,8 +435,8 @@ rte_eal_config_reattach(void)
>                 if (mem_config != MAP_FAILED) {
>                         /* errno is stale, don't use */
>                         RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
> -                               " - please use '--base-virtaddr' option\n",
> -                               rte_mem_cfg_addr, mem_config);
> +                               " - please use '--" OPT_BASE_VIRTADDR
> +                               "' option\n", rte_mem_cfg_addr, mem_config);
>                         munmap(mem_config, sizeof(struct rte_mem_config));
>                         return -1;
>                 }
> diff --git a/lib/librte_eal/linux/eal/eal_memory.c b/lib/librte_eal/linux/eal/eal_memory.c
> index 8f62c343d6..197c67ac4b 100644
> --- a/lib/librte_eal/linux/eal/eal_memory.c
> +++ b/lib/librte_eal/linux/eal/eal_memory.c
> @@ -832,7 +832,8 @@ alloc_va_space(struct rte_memseg_list *msl)
>         addr = eal_get_virtual_area(msl->base_va, &mem_sz, page_sz, 0, flags);
>         if (addr == NULL) {
>                 if (rte_errno == EADDRNOTAVAIL)
> -                       RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - please use '--base-virtaddr' option\n",
> +                       RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - "
> +                               "please use '--" OPT_BASE_VIRTADDR "' option\n",
>                                 (unsigned long long)mem_sz, msl->base_va);
>                 else
>                         RTE_LOG(ERR, EAL, "Cannot reserve memory\n");
> --
> 2.17.1

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
David Marchand Oct. 25, 2019, 9:36 a.m. UTC | #2
On Thu, Oct 24, 2019 at 8:59 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Thu, Oct 24, 2019 at 5:18 PM Anatoly Burakov
> <anatoly.burakov@intel.com> wrote:
> >
> > We are using '--base-virtaddr' in a few places. We have a define for that,
> > so use it instead.
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> > diff --git a/lib/librte_eal/freebsd/eal/eal_memory.c b/lib/librte_eal/freebsd/eal/eal_memory.c
> > index cd31827c2b..a637127d5e 100644
> > --- a/lib/librte_eal/freebsd/eal/eal_memory.c
> > +++ b/lib/librte_eal/freebsd/eal/eal_memory.c
> > @@ -14,6 +14,8 @@
> >  #include <rte_errno.h>
> >  #include <rte_log.h>
> >  #include <rte_string_fns.h>
> > +
> > +#include "eal_options.h"
> >  #include "eal_private.h"
> >  #include "eal_internal_cfg.h"
> >  #include "eal_filesystem.h"


Hit build issue on FreeBSD:
In file included from ../lib/librte_eal/freebsd/eal/eal_memory.c:18:0:
../lib/librte_eal/common/eal_options.h:79:15: error: 'struct
internal_config' declared inside parameter list will not be visible
outside of this definition or declaration [-Werror]
        struct internal_config *conf);
               ^~~~~~~~~~~~~~~

Fixed order of header inclusion.


Applied, thanks.


--
David Marchand
  

Patch

diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
index c7e1264205..14e1713294 100644
--- a/lib/librte_eal/freebsd/eal/eal.c
+++ b/lib/librte_eal/freebsd/eal/eal.c
@@ -345,7 +345,8 @@  rte_eal_config_reattach(void)
 		if (mem_config != MAP_FAILED) {
 			/* errno is stale, don't use */
 			RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
-					  " - please use '--base-virtaddr' option\n",
+					  " - please use '--" OPT_BASE_VIRTADDR
+					  "' option\n",
 				rte_mem_cfg_addr, mem_config);
 			munmap(mem_config, sizeof(struct rte_mem_config));
 			return -1;
diff --git a/lib/librte_eal/freebsd/eal/eal_memory.c b/lib/librte_eal/freebsd/eal/eal_memory.c
index cd31827c2b..a637127d5e 100644
--- a/lib/librte_eal/freebsd/eal/eal_memory.c
+++ b/lib/librte_eal/freebsd/eal/eal_memory.c
@@ -14,6 +14,8 @@ 
 #include <rte_errno.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+
+#include "eal_options.h"
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
 #include "eal_filesystem.h"
@@ -367,7 +369,8 @@  alloc_va_space(struct rte_memseg_list *msl)
 	addr = eal_get_virtual_area(msl->base_va, &mem_sz, page_sz, 0, flags);
 	if (addr == NULL) {
 		if (rte_errno == EADDRNOTAVAIL)
-			RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - please use '--base-virtaddr' option\n",
+			RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - "
+				"please use '--" OPT_BASE_VIRTADDR "' option\n",
 				(unsigned long long)mem_sz, msl->base_va);
 		else
 			RTE_LOG(ERR, EAL, "Cannot reserve memory\n");
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index ef5dafa94f..13ffabd470 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -435,8 +435,8 @@  rte_eal_config_reattach(void)
 		if (mem_config != MAP_FAILED) {
 			/* errno is stale, don't use */
 			RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
-				" - please use '--base-virtaddr' option\n",
-				rte_mem_cfg_addr, mem_config);
+				" - please use '--" OPT_BASE_VIRTADDR
+				"' option\n", rte_mem_cfg_addr, mem_config);
 			munmap(mem_config, sizeof(struct rte_mem_config));
 			return -1;
 		}
diff --git a/lib/librte_eal/linux/eal/eal_memory.c b/lib/librte_eal/linux/eal/eal_memory.c
index 8f62c343d6..197c67ac4b 100644
--- a/lib/librte_eal/linux/eal/eal_memory.c
+++ b/lib/librte_eal/linux/eal/eal_memory.c
@@ -832,7 +832,8 @@  alloc_va_space(struct rte_memseg_list *msl)
 	addr = eal_get_virtual_area(msl->base_va, &mem_sz, page_sz, 0, flags);
 	if (addr == NULL) {
 		if (rte_errno == EADDRNOTAVAIL)
-			RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - please use '--base-virtaddr' option\n",
+			RTE_LOG(ERR, EAL, "Could not mmap %llu bytes at [%p] - "
+				"please use '--" OPT_BASE_VIRTADDR "' option\n",
 				(unsigned long long)mem_sz, msl->base_va);
 		else
 			RTE_LOG(ERR, EAL, "Cannot reserve memory\n");