linux-kernelorg-stable/drivers/net/ethernet/intel
Pavan Kumar Linga f0588b157f idpf: avoid compiler padding in virtchnl2_ptype struct
In the arm random config file, kconfig option 'CONFIG_AEABI' is
disabled which results in adding the compiler flag '-mabi=apcs-gnu'.
This causes the compiler to add padding in virtchnl2_ptype
structure to align it to 8 bytes, resulting in the following
size check failure:

include/linux/build_bug.h:78:41: error: static assertion failed: "(6) == sizeof(struct virtchnl2_ptype)"
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                         ^~~~~~~~~~~~~~
include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
      77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ^~~~~~~~~~~~~~~
drivers/net/ethernet/intel/idpf/virtchnl2.h:26:9: note: in expansion of macro 'static_assert'
      26 |         static_assert((n) == sizeof(struct X))
         |         ^~~~~~~~~~~~~
drivers/net/ethernet/intel/idpf/virtchnl2.h:982:1: note: in expansion of macro 'VIRTCHNL2_CHECK_STRUCT_LEN'
     982 | VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~

Avoid the compiler padding by using "__packed" structure
attribute for the virtchnl2_ptype struct. Also align the
structure by using "__aligned(2)" for better code optimization.

Fixes: 0d7502a9b4 ("virtchnl: add virtchnl version 2 ops")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312220250.ufEm8doQ-lkp@intel.com
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Tested-by: Krishneil Singh  <krishneil.k.singh@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20240131222241.2087516-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-02-01 09:10:41 -08:00
..
e1000 intel: legacy: field get conversion 2023-12-18 11:20:43 -08:00
e1000e e1000e: correct maximum frequency adjustment values 2024-01-29 10:01:08 -08:00
fm10k intel: legacy: field get conversion 2023-12-18 11:20:43 -08:00
i40e i40e: update xdp_rxq_info::frag_size for ZC enabled Rx queue 2024-01-24 16:24:07 -08:00
iavf iavf: field get conversion 2023-12-18 11:20:43 -08:00
ice ice: update xdp_rxq_info::frag_size for ZC enabled Rx queue 2024-01-24 16:24:07 -08:00
idpf idpf: avoid compiler padding in virtchnl2_ptype struct 2024-02-01 09:10:41 -08:00
igb intel: legacy: field get conversion 2023-12-18 11:20:43 -08:00
igbvf intel: legacy: field get conversion 2023-12-18 11:20:43 -08:00
igc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
ixgbe ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550() 2024-01-29 10:02:01 -08:00
ixgbevf net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops 2023-12-13 22:07:16 -08:00
Kconfig ice: read internal temperature sensor 2023-12-05 11:40:12 +01:00
Makefile idpf: add SRIOV support and other ndo_ops 2023-09-13 14:59:24 -07:00
e100.c e100: replace deprecated strncpy with strscpy 2023-10-18 18:10:17 -07:00