Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci add __aligned() to all __packed structures.
details: https://anonhg.NetBSD.org/src/rev/3f241e5515b0
branches: trunk
changeset: 944226:3f241e5515b0
user: ryo <ryo%NetBSD.org@localhost>
date: Thu Sep 24 05:13:03 2020 +0000
description:
add __aligned() to all __packed structures.
suppress warnings, and allow to compiler to generate more efficent code.
diffstat:
sys/dev/pci/if_aq.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diffs (104 lines):
diff -r 38a1626a54b9 -r 3f241e5515b0 sys/dev/pci/if_aq.c
--- a/sys/dev/pci/if_aq.c Thu Sep 24 05:09:46 2020 +0000
+++ b/sys/dev/pci/if_aq.c Thu Sep 24 05:13:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aq.c,v 1.18 2020/09/24 05:09:46 ryo Exp $ */
+/* $NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $ */
/**
* aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.18 2020/09/24 05:09:46 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $");
#ifdef _KERNEL_OPT
#include "opt_if_aq.h"
@@ -653,7 +653,7 @@
uint32_t version;
uint32_t transaction_id;
int32_t error;
-} __packed aq_mailbox_header_t;
+} __packed __aligned(4) aq_mailbox_header_t;
typedef struct aq_hw_stats_s {
uint32_t uprc;
@@ -674,12 +674,12 @@
uint32_t prc;
uint32_t dpc; /* not exists in fw2x_msm_statistics */
uint32_t cprc; /* not exists in fw2x_msm_statistics */
-} __packed aq_hw_stats_s_t;
+} __packed __aligned(4) aq_hw_stats_s_t;
typedef struct fw1x_mailbox {
aq_mailbox_header_t header;
aq_hw_stats_s_t msm;
-} __packed fw1x_mailbox_t;
+} __packed __aligned(4) fw1x_mailbox_t;
typedef struct fw2x_msm_statistics {
uint32_t uprc;
@@ -698,16 +698,16 @@
uint32_t ubtc;
uint32_t ptc;
uint32_t prc;
-} __packed fw2x_msm_statistics_t;
+} __packed __aligned(4) fw2x_msm_statistics_t;
typedef struct fw2x_phy_cable_diag_data {
uint32_t lane_data[4];
-} __packed fw2x_phy_cable_diag_data_t;
+} __packed __aligned(4) fw2x_phy_cable_diag_data_t;
typedef struct fw2x_capabilities {
uint32_t caps_lo;
uint32_t caps_hi;
-} __packed fw2x_capabilities_t;
+} __packed __aligned(4) fw2x_capabilities_t;
typedef struct fw2x_mailbox { /* struct fwHostInterface */
aq_mailbox_header_t header;
@@ -726,7 +726,7 @@
fw2x_capabilities_t caps;
/* ... */
-} __packed fw2x_mailbox_t;
+} __packed __aligned(4) fw2x_mailbox_t;
typedef enum aq_link_speed {
AQ_LINK_NONE = 0,
@@ -768,7 +768,7 @@
struct aq_rx_desc_read {
uint64_t buf_addr;
uint64_t hdr_addr;
-} __packed;
+} __packed __aligned(8);
struct aq_rx_desc_wb {
uint32_t type;
@@ -814,12 +814,12 @@
uint16_t pkt_len;
uint16_t next_desc_ptr;
uint16_t vlan;
-} __packed;
+} __packed __aligned(4);
typedef union aq_rx_desc {
struct aq_rx_desc_read read;
struct aq_rx_desc_wb wb;
-} __packed aq_rx_desc_t;
+} __packed __aligned(8) aq_rx_desc_t;
typedef struct aq_tx_desc {
uint64_t buf_addr;
@@ -844,7 +844,7 @@
#define AQ_TXDESC_CTL2_LEN __BITS(31,14)
#define AQ_TXDESC_CTL2_CTX_EN __BIT(13)
#define AQ_TXDESC_CTL2_CTX_IDX __BIT(12)
-} __packed aq_tx_desc_t;
+} __packed __aligned(8) aq_tx_desc_t;
struct aq_txring {
struct aq_softc *txr_sc;
Home |
Main Index |
Thread Index |
Old Index