[v2,31/83] net/tap: move alignment attribute on types

Message ID 1713211485-9021-32-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers
Series move alignment attribute on types |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff April 15, 2024, 8:03 p.m. UTC
  Move location of __rte_aligned(a) to new conventional location. The new
placement between {struct,union} and the tag allows the desired
alignment to be imparted on the type regardless of the toolchain being
used for both C and C++. Additionally, it avoids confusion by Doxygen
when generating documentation.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/tap/tap_bpf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger May 2, 2024, 6:33 p.m. UTC | #1
On Mon, 15 Apr 2024 13:03:53 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> Move location of __rte_aligned(a) to new conventional location. The new
> placement between {struct,union} and the tag allows the desired
> alignment to be imparted on the type regardless of the toolchain being
> used for both C and C++. Additionally, it avoids confusion by Doxygen
> when generating documentation.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  drivers/net/tap/tap_bpf.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/tap/tap_bpf.h b/drivers/net/tap/tap_bpf.h
> index 0d38bc1..d843792 100644
> --- a/drivers/net/tap/tap_bpf.h
> +++ b/drivers/net/tap/tap_bpf.h
> @@ -50,7 +50,7 @@ enum bpf_map_type {
>  };
>  
>  /* union of anonymous structs used with TAP BPF commands */
> -union bpf_attr {
> +union __rte_aligned(8) bpf_attr {
>  	/* BPF_MAP_CREATE command */
>  	struct {
>  		__u32	map_type;
> @@ -84,7 +84,7 @@ enum bpf_map_type {
>  		__u32		kern_version;
>  		__u32		prog_flags;
>  	};
> -} __rte_aligned(8);
> +};
>  
>  #ifndef __NR_bpf
>  # if defined(__i386__)

This file is removed in the BPF fix patchset.
  

Patch

diff --git a/drivers/net/tap/tap_bpf.h b/drivers/net/tap/tap_bpf.h
index 0d38bc1..d843792 100644
--- a/drivers/net/tap/tap_bpf.h
+++ b/drivers/net/tap/tap_bpf.h
@@ -50,7 +50,7 @@  enum bpf_map_type {
 };
 
 /* union of anonymous structs used with TAP BPF commands */
-union bpf_attr {
+union __rte_aligned(8) bpf_attr {
 	/* BPF_MAP_CREATE command */
 	struct {
 		__u32	map_type;
@@ -84,7 +84,7 @@  enum bpf_map_type {
 		__u32		kern_version;
 		__u32		prog_flags;
 	};
-} __rte_aligned(8);
+};
 
 #ifndef __NR_bpf
 # if defined(__i386__)