From: stsp Date: Mon, 13 Feb 2023 15:50:06 +0000 (+0000) Subject: Fix an alignment issue in iwx(4) Rx descriptors. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3a753e3fb00c362056a609248469dbb14e50ab4b;p=openbsd Fix an alignment issue in iwx(4) Rx descriptors. Split a 64-bit field, aligned at a 4-byte boundary, into two 32 bit fields. Our driver does not use this field. Its definition does not matter to us, as long as its size remains correct. Fixes clang-15 warnings, which turn into compilation errors with -Werror. Reported by, and ok tb@ Relevant clang 15 errors are: In file included from /sys/dev/pci/if_iwx.c:151: /sys/dev/pci/if_iwxreg.h:3659:2: error: field within 'struct iwx_rx_mpdu_desc_v1' is less aligned than 'union iwx_rx_mpdu_desc_v1::(anonymous at /sys/dev/pci/if_iwxreg.h:3659:2)' and is usually due to 'struct iwx_rx_mpdu_desc_v1' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] union { ^ /sys/dev/pci/if_iwxreg.h:3626:2: error: field within 'struct iwx_rx_mpdu_desc_v3' is less aligned than 'union iwx_rx_mpdu_desc_v3::(anonymous at /sys/dev/pci/if_iwxreg.h:3626:2)' and is usually due to 'struct iwx_rx_mpdu_desc_v3' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] union { ^ 2 errors generated. --- diff --git a/sys/dev/pci/if_iwxreg.h b/sys/dev/pci/if_iwxreg.h index 732c6f18f61..29dc5cbe965 100644 --- a/sys/dev/pci/if_iwxreg.h +++ b/sys/dev/pci/if_iwxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwxreg.h,v 1.39 2022/05/10 09:11:44 stsp Exp $ */ +/* $OpenBSD: if_iwxreg.h,v 1.40 2023/02/13 15:50:06 stsp Exp $ */ /*- * Based on BSD-licensed source modules in the Linux iwlwifi driver, @@ -3628,7 +3628,8 @@ struct iwx_rx_mpdu_desc_v3 { * TSF value on air rise (INA), only valid if * IWX_RX_MPDU_PHY_TSF_OVERLOAD isn't set */ - uint64_t tsf_on_air_rise; + uint32_t tsf_on_air_rise0; + uint32_t tsf_on_air_rise1; struct { uint32_t phy_data0; @@ -3657,7 +3658,8 @@ struct iwx_rx_mpdu_desc_v1 { uint8_t mac_context; uint32_t gp2_on_air_rise; union { - uint64_t tsf_on_air_rise; + uint32_t tsf_on_air_rise0; + uint32_t tsf_on_air_rise1; struct { uint32_t phy_data0; uint32_t phy_data1;