DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v3 1/4] kni: add define guards to avoid multi-inclusion
       [not found] <cover.1644390801.git.liwg06@foxmail.com>
@ 2022-02-09  7:24 ` Weiguo Li
  2022-02-09 13:52   ` Ferruh Yigit
  2022-02-09  7:24 ` [PATCH v3 2/4] eal: " Weiguo Li
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Weiguo Li @ 2022-02-09  7:24 UTC (permalink / raw)
  To: dev

Supplement define guards to prevent multiple inclusion.

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 lib/kni/rte_kni_fifo.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/kni/rte_kni_fifo.h b/lib/kni/rte_kni_fifo.h
index d2ec82fe87..2ff71554c0 100644
--- a/lib/kni/rte_kni_fifo.h
+++ b/lib/kni/rte_kni_fifo.h
@@ -2,7 +2,8 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-
+#ifndef RTE_KNI_FIFO_H
+#define RTE_KNI_FIFO_H
 
 /**
  * @internal when c11 memory model enabled use c11 atomic memory barrier.
@@ -115,3 +116,5 @@ kni_fifo_free_count(struct rte_kni_fifo *fifo)
 	uint32_t fifo_read = __KNI_LOAD_ACQUIRE(&fifo->read);
 	return (fifo_read - fifo_write - 1) & (fifo->len - 1);
 }
+
+#endif /* RTE_KNI_FIFO_H */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 2/4] eal: add define guards to avoid multi-inclusion
       [not found] <cover.1644390801.git.liwg06@foxmail.com>
  2022-02-09  7:24 ` [PATCH v3 1/4] kni: add define guards to avoid multi-inclusion Weiguo Li
@ 2022-02-09  7:24 ` Weiguo Li
  2022-02-09  7:24 ` [PATCH v3 3/4] efd: " Weiguo Li
  2022-02-09  7:24 ` [PATCH v3 4/4] hash: " Weiguo Li
  3 siblings, 0 replies; 6+ messages in thread
From: Weiguo Li @ 2022-02-09  7:24 UTC (permalink / raw)
  To: dev; +Cc: Dmitry Kozlyuk

Supplement define guards to prevent multiple inclusion.

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/eal/include/rte_eal_paging.h        | 5 +++++
 lib/eal/windows/include/rte_virt2phys.h | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
index c60317d0f5..75c4291484 100644
--- a/lib/eal/include/rte_eal_paging.h
+++ b/lib/eal/include/rte_eal_paging.h
@@ -2,6 +2,9 @@
  * Copyright(c) 2020 Dmitry Kozlyuk
  */
 
+#ifndef RTE_EAL_PAGING_H
+#define RTE_EAL_PAGING_H
+
 #include <stdint.h>
 
 #include <rte_compat.h>
@@ -96,3 +99,5 @@ rte_mem_page_size(void);
 __rte_internal
 int
 rte_mem_lock(const void *virt, size_t size);
+
+#endif /* RTE_EAL_PAGING_H */
diff --git a/lib/eal/windows/include/rte_virt2phys.h b/lib/eal/windows/include/rte_virt2phys.h
index 4bb2b4aafe..d0eae33141 100644
--- a/lib/eal/windows/include/rte_virt2phys.h
+++ b/lib/eal/windows/include/rte_virt2phys.h
@@ -2,6 +2,9 @@
  * Copyright (c) 2020 Dmitry Kozlyuk
  */
 
+#ifndef RTE_VIRT2PHYS_H
+#define RTE_VIRT2PHYS_H
+
 /**
  * @file virt2phys driver interface
  */
@@ -32,3 +35,5 @@ DEFINE_GUID(GUID_DEVINTERFACE_VIRT2PHYS,
  */
 #define IOCTL_VIRT2PHYS_TRANSLATE CTL_CODE( \
 	VIRT2PHYS_DEVTYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#endif /* RTE_VIRT2PHYS_H */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 3/4] efd: add define guards to avoid multi-inclusion
       [not found] <cover.1644390801.git.liwg06@foxmail.com>
  2022-02-09  7:24 ` [PATCH v3 1/4] kni: add define guards to avoid multi-inclusion Weiguo Li
  2022-02-09  7:24 ` [PATCH v3 2/4] eal: " Weiguo Li
@ 2022-02-09  7:24 ` Weiguo Li
  2022-02-09  7:24 ` [PATCH v3 4/4] hash: " Weiguo Li
  3 siblings, 0 replies; 6+ messages in thread
From: Weiguo Li @ 2022-02-09  7:24 UTC (permalink / raw)
  To: dev

Supplement define guards to prevent multiple inclusion.

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 lib/efd/rte_efd_x86.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/efd/rte_efd_x86.h b/lib/efd/rte_efd_x86.h
index e2f9dcca88..6e377765f9 100644
--- a/lib/efd/rte_efd_x86.h
+++ b/lib/efd/rte_efd_x86.h
@@ -2,6 +2,9 @@
  * Copyright(c) 2016-2017 Intel Corporation
  */
 
+#ifndef RTE_EFD_X86_H
+#define RTE_EFD_X86_H
+
 /* rte_efd_x86.h
  * This file holds all x86 specific EFD functions
  */
@@ -55,3 +58,5 @@ efd_lookup_internal_avx2(const efd_hashfunc_t *group_hash_idx,
 #endif
 
 }
+
+#endif /* RTE_EFD_X86_H */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 4/4] hash: add define guards to avoid multi-inclusion
       [not found] <cover.1644390801.git.liwg06@foxmail.com>
                   ` (2 preceding siblings ...)
  2022-02-09  7:24 ` [PATCH v3 3/4] efd: " Weiguo Li
@ 2022-02-09  7:24 ` Weiguo Li
  3 siblings, 0 replies; 6+ messages in thread
From: Weiguo Li @ 2022-02-09  7:24 UTC (permalink / raw)
  To: dev

Supplement define guards to prevent multiple inclusion.

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 lib/hash/rte_cmp_arm64.h | 5 +++++
 lib/hash/rte_cmp_x86.h   | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/lib/hash/rte_cmp_arm64.h b/lib/hash/rte_cmp_arm64.h
index e9e26f9abd..ecf0ea3e6f 100644
--- a/lib/hash/rte_cmp_arm64.h
+++ b/lib/hash/rte_cmp_arm64.h
@@ -2,6 +2,9 @@
  * Copyright(c) 2015 Cavium, Inc
  */
 
+#ifndef RTE_CMP_ARM64_H
+#define RTE_CMP_ARM64_H
+
 /* Functions to compare multiple of 16 byte keys (up to 128 bytes) */
 static int
 rte_hash_k16_cmp_eq(const void *key1, const void *key2,
@@ -83,3 +86,5 @@ rte_hash_k128_cmp_eq(const void *key1, const void *key2, size_t key_len)
 		rte_hash_k64_cmp_eq((const char *) key1 + 64,
 				(const char *) key2 + 64, key_len);
 }
+
+#endif /* RTE_CMP_ARM64_H */
diff --git a/lib/hash/rte_cmp_x86.h b/lib/hash/rte_cmp_x86.h
index 13a5836351..3b3b3860b1 100644
--- a/lib/hash/rte_cmp_x86.h
+++ b/lib/hash/rte_cmp_x86.h
@@ -2,6 +2,9 @@
  * Copyright(c) 2015 Intel Corporation
  */
 
+#ifndef RTE_CMP_X86_H
+#define RTE_CMP_X86_H
+
 #include <rte_vect.h>
 
 /* Functions to compare multiple of 16 byte keys (up to 128 bytes) */
@@ -74,3 +77,5 @@ rte_hash_k128_cmp_eq(const void *key1, const void *key2, size_t key_len)
 		rte_hash_k64_cmp_eq((const char *) key1 + 64,
 				(const char *) key2 + 64, key_len);
 }
+
+#endif /* RTE_CMP_X86_H */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/4] kni: add define guards to avoid multi-inclusion
  2022-02-09  7:24 ` [PATCH v3 1/4] kni: add define guards to avoid multi-inclusion Weiguo Li
@ 2022-02-09 13:52   ` Ferruh Yigit
  2022-02-22 14:48     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2022-02-09 13:52 UTC (permalink / raw)
  To: Weiguo Li; +Cc: dev

On 2/9/2022 7:24 AM, Weiguo Li wrote:
> Supplement define guards to prevent multiple inclusion.
> 

It is kind of private header and only 'rte_kni.c' includes it,
that is why missing guards doesn't cause trouble but no harm/objection
to have them.

> Signed-off-by: Weiguo Li <liwg06@foxmail.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

> ---
>   lib/kni/rte_kni_fifo.h | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/kni/rte_kni_fifo.h b/lib/kni/rte_kni_fifo.h
> index d2ec82fe87..2ff71554c0 100644
> --- a/lib/kni/rte_kni_fifo.h
> +++ b/lib/kni/rte_kni_fifo.h
> @@ -2,7 +2,8 @@
>    * Copyright(c) 2010-2014 Intel Corporation
>    */
>   
> -
> +#ifndef RTE_KNI_FIFO_H
> +#define RTE_KNI_FIFO_H

It doesn't really differ much but other kni header guards wrapped with '_',
I don't now why.
If there will be a new version can you please apply the same here to have
consistency, like:
#ifndef _RTE_KNI_FIFO_H_

>   
>   /**
>    * @internal when c11 memory model enabled use c11 atomic memory barrier.
> @@ -115,3 +116,5 @@ kni_fifo_free_count(struct rte_kni_fifo *fifo)
>   	uint32_t fifo_read = __KNI_LOAD_ACQUIRE(&fifo->read);
>   	return (fifo_read - fifo_write - 1) & (fifo->len - 1);
>   }
> +
> +#endif /* RTE_KNI_FIFO_H */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/4] kni: add define guards to avoid multi-inclusion
  2022-02-09 13:52   ` Ferruh Yigit
@ 2022-02-22 14:48     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2022-02-22 14:48 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Weiguo Li, dev

09/02/2022 14:52, Ferruh Yigit:
> On 2/9/2022 7:24 AM, Weiguo Li wrote:
> > +#ifndef RTE_KNI_FIFO_H
> > +#define RTE_KNI_FIFO_H
> 
> It doesn't really differ much but other kni header guards wrapped with '_',
> I don't now why.

No good reason I think.

> If there will be a new version can you please apply the same here to have
> consistency, like:
> #ifndef _RTE_KNI_FIFO_H_

I think consistency is not important here.
We should not add underscores where not needed,
it gives a false impression of reserved keywords.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-22 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1644390801.git.liwg06@foxmail.com>
2022-02-09  7:24 ` [PATCH v3 1/4] kni: add define guards to avoid multi-inclusion Weiguo Li
2022-02-09 13:52   ` Ferruh Yigit
2022-02-22 14:48     ` Thomas Monjalon
2022-02-09  7:24 ` [PATCH v3 2/4] eal: " Weiguo Li
2022-02-09  7:24 ` [PATCH v3 3/4] efd: " Weiguo Li
2022-02-09  7:24 ` [PATCH v3 4/4] hash: " Weiguo Li

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).