Skip to contentSkip to conversation

fix packing of structs when building with MSVC

PATCH Superseded Tyler Retzlaff 9 participants 318 messages Mar 20, 2024 – Jan 15, 2025 Page 3 of 4

Subsystems (6)
lore
Share & tools
lore
#228 lore raw

PATCH v9 6/30 drivers/baseband: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/baseband/acc/acc_common.h             | 52 +++++++++----------
 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   | 16 +++---
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |  4 +-
 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  |  8 +--
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  | 12 ++---
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    | 32 ++++++------
 6 files changed, 62 insertions(+), 62 deletions(-)
drivers/baseband/acc/acc_common.h +26 -26
index bf218332be..a49b154a0c 100644
@@ -160,7 +160,7 @@ extern int acc_common_logtype;
 	RTE_LOG_LINE(level, ACC_COMMON, __VA_ARGS__)
 
 /* ACC100 DMA Descriptor triplet */
-struct acc_dma_triplet {
+struct __rte_packed_begin acc_dma_triplet {
 	uint64_t address;
 	uint32_t blen:20,
 		res0:4,
@@ -168,7 +168,7 @@ struct acc_dma_triplet {
 		dma_ext:1,
 		res1:2,
 		blkid:4;
-} __rte_packed;
+} __rte_packed_end;
 
 
 /* ACC100 Queue Manager Enqueue PCI Register */
@@ -183,7 +183,7 @@ union acc_enqueue_reg_fmt {
 };
 
 /* FEC 4G Uplink Frame Control Word */
-struct __rte_packed acc_fcw_td {
+struct __rte_packed_begin acc_fcw_td {
 	uint8_t fcw_ver:4,
 		num_maps:4; /* Unused in ACC100 */
 	uint8_t filler:6, /* Unused in ACC100 */
@@ -220,10 +220,10 @@ struct __rte_packed acc_fcw_td {
 				rsrvd4:10;
 		};
 	};
-};
+} __rte_packed_end;
 
 /* FEC 4G Downlink Frame Control Word */
-struct __rte_packed acc_fcw_te {
+struct __rte_packed_begin acc_fcw_te {
 	uint16_t k_neg;
 	uint16_t k_pos;
 	uint8_t c_neg;
@@ -251,10 +251,10 @@ struct __rte_packed acc_fcw_te {
 	uint8_t code_block_mode:1,
 		rsrvd8:7;
 	uint64_t rsrvd9;
-};
+} __rte_packed_end;
 
 /* FEC 5GNR Downlink Frame Control Word */
-struct __rte_packed acc_fcw_le {
+struct __rte_packed_begin acc_fcw_le {
 	uint32_t FCWversion:4,
 		qm:4,
 		nfiller:11,
@@ -279,10 +279,10 @@ struct __rte_packed acc_fcw_le {
 	uint32_t res6;
 	uint32_t res7;
 	uint32_t res8;
-};
+} __rte_packed_end;
 
 /* FEC 5GNR Uplink Frame Control Word */
-struct __rte_packed acc_fcw_ld {
+struct __rte_packed_begin acc_fcw_ld {
 	uint32_t FCWversion:4,
 		qm:4,
 		nfiller:11,
@@ -326,10 +326,10 @@ struct __rte_packed acc_fcw_ld {
 		tb_crc_select:2, /* Not supported in ACC100 */
 		dec_llrclip:2,  /* Not supported in VRB1 */
 		tb_trailer_size:20; /* Not supported in ACC100 */
-};
+} __rte_packed_end;
 
 /* FFT Frame Control Word */
-struct __rte_packed acc_fcw_fft {
+struct __rte_packed_begin acc_fcw_fft {
 	uint32_t in_frame_size:16,
 		leading_pad_size:16;
 	uint32_t out_frame_size:16,
@@ -351,10 +351,10 @@ struct __rte_packed acc_fcw_fft {
 		power_shift:4,
 		power_en:1,
 		res:19;
-};
+} __rte_packed_end;
 
 /* FFT Frame Control Word. */
-struct __rte_packed acc_fcw_fft_3 {
+struct __rte_packed_begin acc_fcw_fft_3 {
 	uint32_t in_frame_size:16,
 		leading_pad_size:16;
 	uint32_t out_frame_size:16,
@@ -381,11 +381,11 @@ struct __rte_packed acc_fcw_fft_3 {
 	uint16_t cs_theta_0[ACC_MAX_CS];
 	uint32_t cs_theta_d[ACC_MAX_CS];
 	int8_t cs_time_offset[ACC_MAX_CS];
-};
+} __rte_packed_end;
 
 
 /* MLD-TS Frame Control Word */
-struct __rte_packed acc_fcw_mldts {
+struct __rte_packed_begin acc_fcw_mldts {
 	uint32_t fcw_version:4,
 		res0:12,
 		nrb:13, /* 1 to 1925 */
@@ -409,7 +409,7 @@ struct __rte_packed acc_fcw_mldts {
 	uint32_t pad2;
 	uint32_t pad3;
 	uint32_t pad4;
-};
+} __rte_packed_end;
 
 /* DMA Response Descriptor */
 union acc_dma_rsp_desc {
@@ -435,7 +435,7 @@ union acc_dma_rsp_desc {
 };
 
 /* DMA Request Descriptor */
-struct __rte_packed acc_dma_req_desc {
+struct __rte_packed_begin acc_dma_req_desc {
 	union {
 		struct{
 			uint32_t type:4,
@@ -496,7 +496,7 @@ struct __rte_packed acc_dma_req_desc {
 		};
 		uint64_t pad3[ACC_DMA_DESC_PADDINGS]; /* pad to 64 bits */
 	};
-};
+} __rte_packed_end;
 
 /* ACC100 DMA Descriptor */
 union acc_dma_desc {
@@ -506,7 +506,7 @@ union acc_dma_desc {
 };
 
 /* Union describing Info Ring entry */
-union acc_info_ring_data {
+union __rte_packed_begin acc_info_ring_data {
 	uint32_t val;
 	struct {
 		union {
@@ -534,25 +534,25 @@ union acc_info_ring_data {
 		uint32_t loop_vrb2: 1;
 		uint32_t valid_vrb2: 1;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_packed acc_pad_ptr {
+struct __rte_packed_begin acc_pad_ptr {
 	void *op_addr;
 	uint64_t pad1;  /* pad to 64 bits */
-};
+} __rte_packed_end;
 
-struct __rte_packed acc_ptrs {
+struct __rte_packed_begin acc_ptrs {
 	struct acc_pad_ptr ptr[ACC_COMPANION_PTRS];
-};
+} __rte_packed_end;
 
 /* Union describing Info Ring entry */
-union acc_harq_layout_data {
+union __rte_packed_begin acc_harq_layout_data {
 	uint32_t val;
 	struct {
 		uint16_t offset;
 		uint16_t size0;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Structure with details about RTE_BBDEV_EVENT_DEQUEUE event. It's passed to
drivers/baseband/fpga_5gnr_fec/agx100_pmd.h +8 -8
index 5e562376c9..06332c780b 100644
@@ -49,7 +49,7 @@ enum {
 };
 
 /* AGX100 TX Slice Descriptor. */
-struct __rte_packed agx100_input_slice_desc {
+struct __rte_packed_begin agx100_input_slice_desc {
 	uint32_t input_start_addr_lo;
 	uint32_t input_start_addr_hi;
 	uint32_t input_slice_length:21,
@@ -58,10 +58,10 @@ struct __rte_packed agx100_input_slice_desc {
 		start_of_pkt:1;
 	uint32_t input_slice_time_stamp:31,
 		input_c:1;
-};
+} __rte_packed_end;
 
 /* AGX100 RX Slice Descriptor. */
-struct __rte_packed agx100_output_slice_desc {
+struct __rte_packed_begin agx100_output_slice_desc {
 	uint32_t output_start_addr_lo;
 	uint32_t output_start_addr_hi;
 	uint32_t output_slice_length:21,
@@ -70,10 +70,10 @@ struct __rte_packed agx100_output_slice_desc {
 		start_of_pkt:1;
 	uint32_t output_slice_time_stamp:31,
 		output_c:1;
-};
+} __rte_packed_end;
 
 /* AGX100 DL DMA Encoding Request Descriptor. */
-struct __rte_packed agx100_dma_enc_desc {
+struct __rte_packed_begin agx100_dma_enc_desc {
 	uint32_t done:1, /**< 0: not completed 1: completed. */
 		rsrvd0:17,
 		error_msg:2,
@@ -161,10 +161,10 @@ struct __rte_packed agx100_dma_enc_desc {
 		uint8_t sw_ctxt[AGX100_RING_DESC_LEN_UNIT_BYTES *
 					(AGX100_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* AGX100 UL DMA Decoding Request Descriptor. */
-struct __rte_packed agx100_dma_dec_desc {
+struct __rte_packed_begin agx100_dma_dec_desc {
 	uint32_t done:1, /**< 0: not completed 1: completed. */
 		tb_crc_pass:1, /**< 0: doesn't pass 1: pass. */
 		cb_crc_all_pass:1, /**< 0: doesn't pass 1: pass. */
@@ -262,7 +262,7 @@ struct __rte_packed agx100_dma_dec_desc {
 		uint8_t sw_ctxt[AGX100_RING_DESC_LEN_UNIT_BYTES *
 					(AGX100_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* AGX100 DMA Descriptor. */
 union agx100_dma_desc {
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +2 -2
index 10a19e4dec..80db1b8832 100644
@@ -89,7 +89,7 @@ enum {
 };
 
 /* FPGA 5GNR Ring Control Register. */
-struct __rte_packed fpga_5gnr_ring_ctrl_reg {
+struct __rte_packed_begin fpga_5gnr_ring_ctrl_reg {
 	uint64_t ring_base_addr;
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
@@ -107,7 +107,7 @@ struct __rte_packed fpga_5gnr_ring_ctrl_reg {
 	uint16_t rsrvd3;
 	uint16_t head_point;
 	uint16_t rsrvd4;
-};
+} __rte_packed_end;
 
 /* Private data structure for each FPGA 5GNR device. */
 struct fpga_5gnr_fec_device {
drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h +4 -4
index 9a488ae8d6..e845a6e2b8 100644
@@ -46,7 +46,7 @@ enum {
 };
 
 /* VC 5GNR FPGA FEC DMA Encoding Request Descriptor. */
-struct __rte_packed vc_5gnr_dma_enc_desc {
+struct __rte_packed_begin vc_5gnr_dma_enc_desc {
 	uint32_t done:1,
 		rsrvd0:7,
 		error:4,
@@ -84,10 +84,10 @@ struct __rte_packed vc_5gnr_dma_enc_desc {
 		uint8_t sw_ctxt[VC_5GNR_RING_DESC_LEN_UNIT_BYTES *
 					(VC_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* VC 5GNR FPGA DPC FEC DMA Decoding Request Descriptor. */
-struct __rte_packed vc_5gnr_dma_dec_desc {
+struct __rte_packed_begin vc_5gnr_dma_dec_desc {
 	uint32_t done:1,
 		iter:5,
 		et_pass:1,
@@ -128,7 +128,7 @@ struct __rte_packed vc_5gnr_dma_dec_desc {
 
 		uint32_t sw_ctxt[8 * (VC_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* Vista Creek 5GNR DMA Descriptor. */
 union vc_5gnr_dma_desc {
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +6 -6
index ed21a18b62..04c1f95180 100644
@@ -114,7 +114,7 @@ enum {
 };
 
 /* FPGA LTE FEC DMA Encoding Request Descriptor */
-struct __rte_packed fpga_dma_enc_desc {
+struct __rte_packed_begin fpga_dma_enc_desc {
 	uint32_t done:1,
 		rsrvd0:11,
 		error:4,
@@ -148,10 +148,10 @@ struct __rte_packed fpga_dma_enc_desc {
 		uint8_t sw_ctxt[FPGA_RING_DESC_LEN_UNIT_BYTES *
 					(FPGA_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* FPGA LTE FEC DMA Decoding Request Descriptor */
-struct __rte_packed fpga_dma_dec_desc {
+struct __rte_packed_begin fpga_dma_dec_desc {
 	uint32_t done:1,
 		iter:5,
 		rsrvd0:2,
@@ -188,7 +188,7 @@ struct __rte_packed fpga_dma_dec_desc {
 
 		uint32_t sw_ctxt[8 * (FPGA_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* FPGA LTE DMA Descriptor */
 union fpga_dma_desc {
@@ -197,7 +197,7 @@ union fpga_dma_desc {
 };
 
 /* FPGA LTE FEC Ring Control Register */
-struct __rte_packed fpga_ring_ctrl_reg {
+struct __rte_packed_begin fpga_ring_ctrl_reg {
 	uint64_t ring_base_addr;
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
@@ -216,7 +216,7 @@ struct __rte_packed fpga_ring_ctrl_reg {
 	uint16_t head_point;
 	uint16_t rsrvd4;
 
-};
+} __rte_packed_end;
 
 /* Private data structure for each FPGA FEC device */
 struct fpga_lte_fec_device {
drivers/baseband/la12xx/bbdev_la12xx_ipc.h +16 -16
index b6a7f677d0..a855c43efa 100644
@@ -93,7 +93,7 @@ typedef struct {
 #define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
 
 /** buffer ring common metadata */
-typedef struct ipc_bd_ring_md {
+typedef struct __rte_packed_begin ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
 					  *  which flip for each Ring wrapping
 					  */
@@ -102,10 +102,10 @@ typedef struct ipc_bd_ring_md {
 					  */
 	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
 	uint32_t msg_size;	/**< Size of the each buffer */
-} __rte_packed ipc_br_md_t;
+} __rte_packed_end ipc_br_md_t;
 
 /** IPC buffer descriptor */
-typedef struct ipc_buffer_desc {
+typedef struct __rte_packed_begin ipc_buffer_desc {
 	union {
 		uint64_t host_virt;	/**< msg's host virtual address */
 		struct {
@@ -115,9 +115,9 @@ typedef struct ipc_buffer_desc {
 	};
 	uint32_t modem_ptr;	/**< msg's modem physical address */
 	uint32_t len;		/**< msg len */
-} __rte_packed ipc_bd_t;
+} __rte_packed_end ipc_bd_t;
 
-typedef struct ipc_channel {
+typedef struct __rte_packed_begin ipc_channel {
 	uint32_t ch_id;		/**< Channel id */
 	ipc_br_md_t md;			/**< Metadata for BD ring */
 	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
@@ -134,22 +134,22 @@ typedef struct ipc_channel {
 					  * circular buffer size
 					  */
 	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
-} __rte_packed ipc_ch_t;
+} __rte_packed_end ipc_ch_t;
 
-typedef struct ipc_instance {
+typedef struct __rte_packed_begin ipc_instance {
 	uint32_t instance_id;		/**< instance id, use to init this
 					  * instance by ipc_init API
 					  */
 	uint32_t initialized;		/**< Set in ipc_init */
 	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
 		/**< Channel descriptors in this instance */
-} __rte_packed ipc_instance_t;
+} __rte_packed_end ipc_instance_t;
 
-typedef struct ipc_metadata {
+typedef struct __rte_packed_begin ipc_metadata {
 	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
 	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
 	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
-} __rte_packed ipc_metadata_t;
+} __rte_packed_end ipc_metadata_t;
 
 typedef struct ipc_channel_us_priv {
 	int32_t		eventfd;
@@ -221,24 +221,24 @@ struct bbdev_ipc_dequeue_op {
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
  */
-typedef struct host_ipc_params {
+typedef struct __rte_packed_begin host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
 	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
-} __rte_packed host_ipc_params_t;
+} __rte_packed_end host_ipc_params_t;
 
-struct hif_ipc_regs {
+struct __rte_packed_begin hif_ipc_regs {
 	uint32_t ipc_mdata_offset;
 	uint32_t ipc_mdata_size;
-} __rte_packed;
+} __rte_packed_end;
 
-struct gul_hif {
+struct __rte_packed_begin gul_hif {
 	uint32_t ver;
 	uint32_t hif_ver;
 	uint32_t status;
 	volatile uint32_t host_ready;
 	volatile uint32_t mod_ready;
 	struct hif_ipc_regs ipc_regs;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif
Signature · 1 line
2.47.0.vfs.0.3
#229 lore raw

PATCH v9 7/30 drivers/bus: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/bus/dpaa/include/fsl_bman.h  |  20 ++--
 drivers/bus/dpaa/include/fsl_fman.h  |   4 +-
 drivers/bus/dpaa/include/fsl_qman.h  | 160 +++++++++++++--------------
 drivers/bus/ifpga/bus_ifpga_driver.h |   8 +-
 drivers/bus/vmbus/rte_vmbus_reg.h    | 108 +++++++++---------
 5 files changed, 150 insertions(+), 150 deletions(-)
drivers/bus/dpaa/include/fsl_bman.h +10 -10
index 34d7eb32ce..c0760149e1 100644
@@ -86,7 +86,7 @@ static inline dma_addr_t bm_buf_addr(const struct bm_buffer *buf)
 	} while (0)
 
 /* See 1.5.3.5.4: "Release Command" */
-struct bm_rcr_entry {
+struct __rte_packed_begin bm_rcr_entry {
 	union {
 		struct {
 			u8 __dont_write_directly__verb;
@@ -95,7 +95,7 @@ struct bm_rcr_entry {
 		};
 		struct bm_buffer bufs[8];
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_RCR_VERB_VBIT		0x80
 #define BM_RCR_VERB_CMD_MASK		0x70	/* one of two values; */
 #define BM_RCR_VERB_CMD_BPID_SINGLE	0x20
@@ -104,20 +104,20 @@ struct bm_rcr_entry {
 
 /* See 1.5.3.1: "Acquire Command" */
 /* See 1.5.3.2: "Query Command" */
-struct bm_mcc_acquire {
+struct __rte_packed_begin bm_mcc_acquire {
 	u8 bpid;
 	u8 __reserved1[62];
-} __packed;
-struct bm_mcc_query {
+} __rte_packed_end;
+struct __rte_packed_begin bm_mcc_query {
 	u8 __reserved2[63];
-} __packed;
-struct bm_mc_command {
+} __rte_packed_end;
+struct __rte_packed_begin bm_mc_command {
 	u8 __dont_write_directly__verb;
 	union {
 		struct bm_mcc_acquire acquire;
 		struct bm_mcc_query query;
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_MCC_VERB_VBIT		0x80
 #define BM_MCC_VERB_CMD_MASK		0x70	/* where the verb contains; */
 #define BM_MCC_VERB_CMD_ACQUIRE		0x10
@@ -136,7 +136,7 @@ struct bm_pool_state {
 	} as, ds;
 };
 
-struct bm_mc_result {
+struct __rte_packed_begin bm_mc_result {
 	union {
 		struct {
 			u8 verb;
@@ -152,7 +152,7 @@ struct bm_mc_result {
 		} acquire;
 		struct bm_pool_state query;
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_MCR_VERB_VBIT		0x80
 #define BM_MCR_VERB_CMD_MASK		BM_MCC_VERB_CMD_MASK
 #define BM_MCR_VERB_CMD_ACQUIRE		BM_MCC_VERB_CMD_ACQUIRE
drivers/bus/dpaa/include/fsl_fman.h +2 -2
index 5a9750ad0c..7acdcfc7f0 100644
@@ -12,7 +12,7 @@
 /* Status field in FD is updated on Rx side by FMAN with following information.
  * Refer to field description in FM BG.
  */
-struct fm_status_t {
+struct __rte_packed_begin fm_status_t {
 	unsigned int reserved0:3;
 	unsigned int dcl4c:1; /* Don't Check L4 Checksum */
 	unsigned int reserved1:1;
@@ -38,7 +38,7 @@ struct fm_status_t {
 	unsigned int phe:1; /* Header Error during parsing */
 	unsigned int frdr:1; /* Frame Dropped by disabled port */
 	unsigned int reserved5:4;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Set MAC address for a particular interface */
 __rte_internal
drivers/bus/dpaa/include/fsl_qman.h +80 -80

426 lines not on this page · raw message

drivers/bus/ifpga/bus_ifpga_driver.h +4 -4
index af151ffd4b..56ce34c91d 100644
@@ -29,10 +29,10 @@ struct rte_afu_driver;
 
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
-struct rte_afu_uuid {
+struct __rte_packed_begin rte_afu_uuid {
 	uint64_t uuid_low;
 	uint64_t uuid_high;
-} __rte_packed;
+} __rte_packed_end;
 
 #define IFPGA_BUS_DEV_PORT_MAX 4
 
@@ -40,10 +40,10 @@ struct rte_afu_uuid {
  * A structure describing an ID for a AFU driver. Each driver provides a
  * table of these IDs for each device that it supports.
  */
-struct rte_afu_id {
+struct __rte_packed_begin rte_afu_id {
 	struct rte_afu_uuid uuid;
 	int      port; /**< port number */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * A structure PR (Partial Reconfiguration) configuration AFU driver.
drivers/bus/vmbus/rte_vmbus_reg.h +54 -54

285 lines not on this page · raw message

Signature · 1 line
2.47.0.vfs.0.3
#230 lore raw

PATCH v9 8/30 drivers/common: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/common/cnxk/hw/sdp.h                |   4 +-
 drivers/common/cnxk/roc_npc.h               |  16 +--
 drivers/common/cnxk/roc_npc_mcam_dump.c     |   4 +-
 drivers/common/cnxk/roc_platform.h          |   3 +-
 drivers/common/dpaax/compat.h               |   3 -
 drivers/common/iavf/iavf_osdep.h            |   8 +-
 drivers/common/iavf/virtchnl_inline_ipsec.h |  44 +++----
 drivers/common/idpf/base/idpf_osdep.h       |   8 +-
 drivers/common/mlx5/mlx5_common_mr.h        |  16 +--
 drivers/common/mlx5/mlx5_common_utils.h     |   4 +-
 drivers/common/mlx5/mlx5_prm.h              | 120 ++++++++++----------
 drivers/common/qat/qat_adf/icp_qat_fw_la.h  |   8 +-
 drivers/common/qat/qat_common.h             |   8 +-
 13 files changed, 122 insertions(+), 124 deletions(-)
drivers/common/cnxk/hw/sdp.h +2 -2
index 686f516097..5792f309d7 100644
@@ -156,7 +156,7 @@
 #define SDP_VF_R_OUT_INT_LEVELS_TIMET (32)
 
 /* SDP Instruction Header */
-struct sdp_instr_ih {
+struct __plt_packed_begin sdp_instr_ih {
 	/* Data Len */
 	uint64_t tlen : 16;
 
@@ -177,6 +177,6 @@ struct sdp_instr_ih {
 
 	/* Reserved2 */
 	uint64_t rsvd2 : 1;
-} __plt_packed;
+} __plt_packed_end;
 
 #endif /* __SDP_HW_H_  */
drivers/common/cnxk/roc_npc.h +8 -8
index bf8c65aa9c..f7a1e5d810 100644
@@ -97,10 +97,10 @@ struct roc_npc_flow_item_eth {
 	uint32_t reserved : 31; /**< Reserved, must be zero. */
 };
 
-struct roc_vlan_hdr {
+struct __plt_packed_begin roc_vlan_hdr {
 	uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */
 	uint16_t eth_proto; /**< Ethernet type of encapsulated frame. */
-} __plt_packed;
+} __plt_packed_end;
 
 struct roc_npc_flow_item_vlan {
 	union {
@@ -115,23 +115,23 @@ struct roc_npc_flow_item_vlan {
 	uint32_t reserved : 31; /**< Reserved, must be zero. */
 };
 
-struct roc_ipv6_hdr {
+struct __plt_packed_begin roc_ipv6_hdr {
 	uint32_t vtc_flow;    /**< IP version, traffic class & flow label. */
 	uint16_t payload_len; /**< IP payload size, including ext. headers */
 	uint8_t proto;	      /**< Protocol, next header. */
 	uint8_t hop_limits;   /**< Hop limits. */
 	uint8_t src_addr[16]; /**< IP address of source host. */
 	uint8_t dst_addr[16]; /**< IP address of destination host(s). */
-} __plt_packed;
+} __plt_packed_end;
 
-struct roc_ipv6_fragment_ext {
+struct __plt_packed_begin roc_ipv6_fragment_ext {
 	uint8_t next_header; /**< Next header type */
 	uint8_t reserved;    /**< Reserved */
 	uint16_t frag_data;  /**< All fragmentation data */
 	uint32_t id;	     /**< Packet ID */
-} __plt_packed;
+} __plt_packed_end;
 
-struct roc_ipv6_routing_ext {
+struct __plt_packed_begin roc_ipv6_routing_ext {
 	uint8_t next_hdr;	/**< Protocol, next header. */
 	uint8_t hdr_len;	/**< Header length. */
 	uint8_t type;		/**< Extension header type. */
@@ -145,7 +145,7 @@ struct roc_ipv6_routing_ext {
 		};
 	};
 	/* Next are 128-bit IPv6 address fields to describe segments. */
-} __plt_packed;
+} __plt_packed_end;
 
 struct roc_flow_item_ipv6_ext {
 	uint8_t next_hdr; /**< Next header. */
drivers/common/cnxk/roc_npc_mcam_dump.c +2 -2
index ebd2dd69c2..27a63cc92d 100644
@@ -35,7 +35,7 @@
 #define NIX_TX_VTAGACT_VTAG1_OP_MASK	 GENMASK(45, 44)
 #define NIX_TX_VTAGACT_VTAG1_DEF_MASK	 GENMASK(57, 48)
 
-struct npc_rx_parse_nibble_s {
+struct __plt_packed_begin npc_rx_parse_nibble_s {
 	uint16_t chan : 3;
 	uint16_t errlev : 1;
 	uint16_t errcode : 2;
@@ -56,7 +56,7 @@ struct npc_rx_parse_nibble_s {
 	uint16_t lgtype : 1;
 	uint16_t lhflags : 2;
 	uint16_t lhtype : 1;
-} __plt_packed;
+} __plt_packed_end;
 
 static const char *const intf_str[] = {
 	"NIX-RX",
drivers/common/cnxk/roc_platform.h +2 -1
index df4f88f288..d6f3ea9acc 100644
@@ -97,7 +97,8 @@
 
 #define __plt_cache_aligned __rte_cache_aligned
 #define __plt_always_inline __rte_always_inline
-#define __plt_packed	    __rte_packed
+#define __plt_packed_begin	__rte_packed_begin
+#define __plt_packed_end	__rte_packed_end
 #define __plt_unused	    __rte_unused
 #define __roc_api	    __rte_internal
 #define plt_iova_t	    rte_iova_t
drivers/common/dpaax/compat.h +0 -3
index a7df70d5e6..d59207245c 100644
@@ -53,9 +53,6 @@
 #ifndef __always_unused
 #define __always_unused	__rte_unused
 #endif
-#ifndef __packed
-#define __packed	__rte_packed
-#endif
 #ifndef noinline
 #define noinline	__rte_noinline
 #endif
drivers/common/iavf/iavf_osdep.h +4 -4
index 1f2b7889cb..1b0ca933cc 100644
@@ -158,17 +158,17 @@ do {                                                            \
 } while (0)
 
 /* memory allocation tracking */
-struct iavf_dma_mem {
+struct __rte_packed_begin iavf_dma_mem {
 	void *va;
 	u64 pa;
 	u32 size;
 	const void *zone;
-} __rte_packed;
+} __rte_packed_end;
 
-struct iavf_virt_mem {
+struct __rte_packed_begin iavf_virt_mem {
 	void *va;
 	u32 size;
-} __rte_packed;
+} __rte_packed_end;
 
 #define iavf_allocate_dma_mem(h, m, unused, s, a) \
 			iavf_allocate_dma_mem_d(h, m, s, a)
drivers/common/iavf/virtchnl_inline_ipsec.h +22 -22

153 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h +4 -4
index 250f0ec500..7b43df3079 100644
@@ -182,17 +182,17 @@ static inline uint64_t idpf_read_addr64(volatile void *addr)
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
-struct idpf_dma_mem {
+struct __rte_packed_begin idpf_dma_mem {
 	void *va;
 	u64 pa;
 	u32 size;
 	const void *zone;
-} __rte_packed;
+} __rte_packed_end;
 
-struct idpf_virt_mem {
+struct __rte_packed_begin idpf_virt_mem {
 	void *va;
 	u32 size;
-} __rte_packed;
+} __rte_packed_end;
 
 #define idpf_malloc(h, s)	rte_zmalloc(NULL, s, 0)
 #define idpf_calloc(h, c, s)	rte_zmalloc(NULL, (c) * (s), 0)
drivers/common/mlx5/mlx5_common_mr.h +8 -8
index a7f1042037..cf7c685e9b 100644
@@ -49,36 +49,36 @@ struct mlx5_mr {
 };
 
 /* Cache entry for Memory Region. */
-struct mr_cache_entry {
+struct __rte_packed_begin mr_cache_entry {
 	uintptr_t start; /* Start address of MR. */
 	uintptr_t end; /* End address of MR. */
 	uint32_t lkey; /* rte_cpu_to_be_32(lkey). */
-} __rte_packed;
+} __rte_packed_end;
 
 /* MR Cache table for Binary search. */
-struct mlx5_mr_btree {
+struct __rte_packed_begin mlx5_mr_btree {
 	uint32_t len; /* Number of entries. */
 	uint32_t size; /* Total number of entries. */
 	struct mr_cache_entry (*table)[];
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_common_device;
 
 /* Per-queue MR control descriptor. */
-struct mlx5_mr_ctrl {
+struct __rte_packed_begin mlx5_mr_ctrl {
 	uint32_t *dev_gen_ptr; /* Generation number of device to poll. */
 	uint32_t cur_gen; /* Generation number saved to flush caches. */
 	uint16_t mru; /* Index of last hit entry in top-half cache. */
 	uint16_t head; /* Index of the oldest entry in top-half cache. */
 	struct mr_cache_entry cache[MLX5_MR_CACHE_N]; /* Cache for top-half. */
 	struct mlx5_mr_btree cache_bh; /* Cache for bottom-half. */
-} __rte_packed;
+} __rte_packed_end;
 
 LIST_HEAD(mlx5_mr_list, mlx5_mr);
 LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg);
 
 /* Global per-device MR cache. */
-struct mlx5_mr_share_cache {
+struct __rte_packed_begin mlx5_mr_share_cache {
 	uint32_t dev_gen; /* Generation number to flush local caches. */
 	rte_rwlock_t rwlock; /* MR cache Lock. */
 	rte_rwlock_t mprwlock; /* Mempool Registration Lock. */
@@ -88,7 +88,7 @@ struct mlx5_mr_share_cache {
 	struct mlx5_mempool_reg_list mempool_reg_list; /* Mempool database. */
 	mlx5_reg_mr_t reg_mr_cb; /* Callback to reg_mr func */
 	mlx5_dereg_mr_t dereg_mr_cb; /* Callback to dereg_mr func */
-} __rte_packed;
+} __rte_packed_end;
 
 /* Multi-Packet RQ buffer header. */
 struct __rte_cache_aligned mlx5_mprq_buf {
drivers/common/mlx5/mlx5_common_utils.h +2 -2
index 9139bc6829..e56f367bf2 100644
@@ -27,7 +27,7 @@ struct mlx5_list;
  * Structure of the entry in the mlx5 list, user should define its own struct
  * that contains this in order to store the data.
  */
-struct mlx5_list_entry {
+struct __rte_packed_begin mlx5_list_entry {
 	LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */
 	alignas(8) RTE_ATOMIC(uint32_t) ref_cnt; /* 0 means, entry is invalid. */
 	uint32_t lcore_idx;
@@ -35,7 +35,7 @@ struct mlx5_list_entry {
 		struct mlx5_list_entry *gentry;
 		uint32_t bucket_idx;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct __rte_cache_aligned mlx5_list_cache {
 	LIST_HEAD(mlx5_list_head, mlx5_list_entry) h;
drivers/common/mlx5/mlx5_prm.h +60 -60

334 lines not on this page · raw message

drivers/common/qat/qat_adf/icp_qat_fw_la.h +4 -4
index fe32b66c50..835674d91b 100644
@@ -357,7 +357,7 @@ struct icp_qat_fw_cipher_auth_cd_ctrl_hdr {
 #define ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET 24
 #define ICP_QAT_FW_CIPHER_REQUEST_PARAMETERS_OFFSET (0)
 
-struct icp_qat_fw_la_cipher_req_params {
+struct __rte_packed_begin icp_qat_fw_la_cipher_req_params {
 	uint32_t cipher_offset;
 	uint32_t cipher_length;
 	union {
@@ -372,9 +372,9 @@ struct icp_qat_fw_la_cipher_req_params {
 	uint16_t spc_aad_sz;
 	uint8_t reserved;
 	uint8_t spc_auth_res_sz;
-} __rte_packed;
+} __rte_packed_end;
 
-struct icp_qat_fw_la_auth_req_params {
+struct __rte_packed_begin icp_qat_fw_la_auth_req_params {
 	uint32_t auth_off;
 	uint32_t auth_len;
 	union {
@@ -389,7 +389,7 @@ struct icp_qat_fw_la_auth_req_params {
 	uint8_t resrvd1;
 	uint8_t hash_state_sz;
 	uint8_t auth_res_sz;
-} __rte_packed;
+} __rte_packed_end;
 
 struct icp_qat_fw_la_auth_req_params_resrvd_flds {
 	uint32_t resrvd[ICP_QAT_FW_NUM_LONGWORDS_6];
drivers/common/qat/qat_common.h +4 -4
index 703534dc15..51d20267bd 100644
@@ -57,11 +57,11 @@ enum qat_svc_list {
 };
 
 /**< Common struct for scatter-gather list operations */
-struct qat_flat_buf {
+struct __rte_packed_begin qat_flat_buf {
 	uint32_t len;
 	uint32_t resrvd;
 	uint64_t addr;
-} __rte_packed;
+} __rte_packed_end;
 
 #define qat_sgl_hdr  struct { \
 	uint64_t resrvd; \
@@ -70,11 +70,11 @@ struct qat_flat_buf {
 }
 
 __extension__
-struct __rte_cache_aligned qat_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_sgl {
 	qat_sgl_hdr;
 	/* flexible array of flat buffers*/
 	struct qat_flat_buf buffers[0];
-} __rte_packed;
+} __rte_packed_end;
 
 /** Common, i.e. not service-specific, statistics */
 struct qat_common_stats {
Signature · 1 line
2.47.0.vfs.0.3
#231 lore raw

PATCH v9 9/30 drivers/compress: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/compress/qat/qat_comp.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/compress/qat/qat_comp.h +2 -2
index 1da4770b1c..18d5fd4b02 100644
@@ -50,10 +50,10 @@ struct array_of_ptrs {
 	phys_addr_t pointer[0];
 };
 
-struct __rte_cache_aligned qat_inter_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_inter_sgl {
 	qat_sgl_hdr;
 	struct qat_flat_buf buffers[QAT_NUM_BUFS_IN_IM_SGL];
-} __rte_packed;
+} __rte_packed_end;
 
 
 struct qat_comp_op_cookie {
Signature · 1 line
2.47.0.vfs.0.3
#232 lore raw

PATCH v9 10/30 drivers/crypto: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/crypto/caam_jr/caam_jr.c             |  4 +-
 drivers/crypto/caam_jr/caam_jr_desc.h        | 64 ++++++++++----------
 drivers/crypto/caam_jr/caam_jr_hw_specific.h | 48 +++++++--------
 drivers/crypto/dpaa_sec/dpaa_sec.h           | 12 ++--
 drivers/crypto/ionic/ionic_crypto_if.h       | 36 +++++------
 drivers/crypto/mlx5/mlx5_crypto.h            |  8 +--
 drivers/crypto/mlx5/mlx5_crypto_gcm.c        |  4 +-
 drivers/crypto/qat/qat_sym.h                 |  8 +--
 drivers/crypto/qat/qat_sym_session.h         |  4 +-
 9 files changed, 94 insertions(+), 94 deletions(-)
drivers/crypto/caam_jr/caam_jr.c +2 -2
index 4082b3f422..a57dc56b80 100644
@@ -53,10 +53,10 @@ static enum sec_driver_state_e g_driver_state = SEC_DRIVER_STATE_IDLE;
 static int g_job_rings_no;
 static int g_job_rings_max;
 
-struct sec_outring_entry {
+struct __rte_packed_begin sec_outring_entry {
 	phys_addr_t desc;	/* Pointer to completed descriptor */
 	uint32_t status;	/* Status for completed descriptor */
-} __rte_packed;
+} __rte_packed_end;
 
 /* virtual address conversin when mempool support is available for ctx */
 static inline phys_addr_t
drivers/crypto/caam_jr/caam_jr_desc.h +32 -32

139 lines not on this page · raw message

drivers/crypto/caam_jr/caam_jr_hw_specific.h +24 -24

103 lines not on this page · raw message

drivers/crypto/dpaa_sec/dpaa_sec.h +6 -6
index 64d9e22159..d78cad818a 100644
@@ -62,8 +62,8 @@ enum dpaa_sec_op_type {
 #define DPAA_SEC_MAX_DESC_SIZE  64
 /* code or cmd block to caam */
 struct sec_cdb {
-	struct {
-		union {
+	struct __rte_packed_begin {
+		union __rte_packed_begin {
 			uint32_t word;
 			struct {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -76,9 +76,9 @@ struct sec_cdb {
 				uint16_t rsvd63_48;
 #endif
 			} field;
-		} __packed hi;
+		} __rte_packed_end hi;
 
-		union {
+		union __rte_packed_begin {
 			uint32_t word;
 			struct {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -101,8 +101,8 @@ struct sec_cdb {
 				unsigned int rsvd31_30:2;
 #endif
 			} field;
-		} __packed lo;
-	} __packed sh_hdr;
+		} __rte_packed_end lo;
+	} __rte_packed_end sh_hdr;
 
 	uint32_t sh_desc[DPAA_SEC_MAX_DESC_SIZE];
 };
drivers/crypto/ionic/ionic_crypto_if.h +18 -18
index ea418f3d4b..b152079fdf 100644
@@ -263,13 +263,13 @@ struct iocpt_lif_setattr_cmd {
 	u8     opcode;
 	u8     attr;
 	__le16 lif_index;
-	union {
+	union __rte_packed_begin {
 		u8	state;
 		char	name[IOCPT_IFNAMSIZ];
 		__le64	features;
 		u8	stats_ctl;
 		u8	rsvd[60];
-	} __rte_packed;
+	} __rte_packed_end;
 };
 
 /**
@@ -283,10 +283,10 @@ struct iocpt_lif_setattr_comp {
 	u8     status;
 	u8     rsvd;
 	__le16 comp_index;
-	union {
+	union __rte_packed_begin {
 		__le64	features;
 		u8	rsvd2[11];
-	} __rte_packed;
+	} __rte_packed_end;
 	u8     color;
 };
 
@@ -316,11 +316,11 @@ struct iocpt_lif_getattr_comp {
 	u8     status;
 	u8     rsvd;
 	__le16 comp_index;
-	union {
+	union __rte_packed_begin {
 		u8	state;
 		__le64	features;
 		u8	rsvd2[11];
-	} __rte_packed;
+	} __rte_packed_end;
 	u8     color;
 };
 
@@ -396,7 +396,7 @@ struct iocpt_q_identify_comp {
  * @cq_ring_base: Completion queue ring base address
  * @sg_ring_base: Scatter/Gather ring base address
  */
-struct iocpt_q_init_cmd {
+struct __rte_packed_begin iocpt_q_init_cmd {
 	u8     opcode;
 	u8     type;
 	__le16 lif_index;
@@ -417,7 +417,7 @@ struct iocpt_q_init_cmd {
 	__le64 cq_ring_base;
 	__le64 sg_ring_base;
 	u8     rsvd2[20];
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * struct iocpt_q_init_comp - Queue init command completion
@@ -469,7 +469,7 @@ enum iocpt_desc_opcode {
  * @intr_ctx_addr:   Completion interrupt context address
  * @intr_ctx_data:   Completion interrupt context data
  */
-struct iocpt_crypto_desc {
+struct __rte_packed_begin iocpt_crypto_desc {
 	uint8_t  opcode;
 	uint8_t  flags;
 	uint8_t  num_src_dst_sgs;
@@ -481,7 +481,7 @@ struct iocpt_crypto_desc {
 	__le32   session_tag;
 	__le64   intr_ctx_addr;
 	__le64   intr_ctx_data;
-} __rte_packed;
+} __rte_packed_end;
 
 static inline uint8_t iocpt_encode_nsge_src_dst(uint8_t src, uint8_t dst)
 {
@@ -765,14 +765,14 @@ struct iocpt_log_event {
  * @queue_count:    Queue counts per queue-type
  */
 union iocpt_lif_config {
-	struct {
+	struct __rte_packed_begin {
 		u8     state;
 		u8     rsvd[3];
 		char   name[IOCPT_IFNAMSIZ];
 		u8     rsvd2[12];
 		__le64 features;
 		__le32 queue_count[IOCPT_QTYPE_MAX];
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[56];
 };
 
@@ -876,14 +876,14 @@ union iocpt_dev_info_regs {
  * @data:            Opcode-specific side-data
  */
 union iocpt_dev_cmd_regs {
-	struct {
+	struct __rte_packed_begin {
 		u32    doorbell;
 		u32    done;
 		union iocpt_dev_cmd         cmd;
 		union iocpt_dev_cmd_comp    comp;
 		u8     rsvd[48];
 		u32    data[478];
-	} __rte_packed;
+	} __rte_packed_end;
 	u32    words[512];
 };
 
@@ -893,10 +893,10 @@ union iocpt_dev_cmd_regs {
  * @devcmd:          Device command registers
  */
 union iocpt_dev_regs {
-	struct {
+	struct __rte_packed_begin {
 		union iocpt_dev_info_regs info;
 		union iocpt_dev_cmd_regs  devcmd;
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[1024];
 };
 
@@ -971,7 +971,7 @@ union iocpt_dev_identity {
  * @config:             LIF config struct with features, q counts
  */
 union iocpt_lif_identity {
-	struct {
+	struct __rte_packed_begin {
 		__le64 features;
 
 		u8 version;
@@ -980,7 +980,7 @@ union iocpt_lif_identity {
 		__le32 max_nb_sessions;
 		u8 rsvd2[120];
 		union iocpt_lif_config config;
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[90];
 };
 
drivers/crypto/mlx5/mlx5_crypto.h +4 -4
index 547bb490e2..f9f127e9e6 100644
@@ -32,9 +32,9 @@ enum mlx5_crypto_mode {
 	MLX5_CRYPTO_IPSEC_OPT,
 };
 
-struct mlx5_crypto_ipsec_mem {
+struct __rte_packed_begin mlx5_crypto_ipsec_mem {
 	uint8_t mem[MLX5_CRYPTO_GCM_IPSEC_IV_SIZE];
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_crypto_priv {
 	TAILQ_ENTRY(mlx5_crypto_priv) next;
@@ -108,7 +108,7 @@ struct mlx5_crypto_devarg_params {
 	enum mlx5_crypto_mode crypto_mode;
 };
 
-struct mlx5_crypto_session {
+struct __rte_packed_begin mlx5_crypto_session {
 	union {
 		/**< AES-XTS configuration. */
 		struct {
@@ -145,7 +145,7 @@ struct mlx5_crypto_session {
 	/**< Initialisation Vector length. */
 	struct mlx5_crypto_dek *dek; /**< Pointer to dek struct. */
 	uint32_t dek_id; /**< DEK ID */
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_crypto_dek_ctx {
 	struct rte_crypto_sym_xform *xform;
drivers/crypto/mlx5/mlx5_crypto_gcm.c +2 -2
index cd21605bd2..89f32c7722 100644
@@ -62,10 +62,10 @@ struct mlx5_crypto_gcm_data {
 	uint32_t dst_mkey;
 };
 
-struct mlx5_crypto_gcm_tag_cpy_info {
+struct __rte_packed_begin mlx5_crypto_gcm_tag_cpy_info {
 	void *digest;
 	uint8_t tag_len;
-} __rte_packed;
+} __rte_packed_end;
 
 static struct rte_cryptodev_capabilities mlx5_crypto_gcm_caps[] = {
 	{
drivers/crypto/qat/qat_sym.h +4 -4
index eedf5de755..2a04bd9425 100644
@@ -103,10 +103,10 @@
 
 struct qat_sym_session;
 
-struct __rte_cache_aligned qat_sym_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_sym_sgl {
 	qat_sgl_hdr;
 	struct qat_flat_buf buffers[QAT_SYM_SGL_MAX_NUMBER];
-} __rte_packed;
+} __rte_packed_end;
 
 struct qat_sym_op_cookie {
 	struct qat_sym_sgl qat_sgl_src;
@@ -116,8 +116,8 @@ struct qat_sym_op_cookie {
 	union {
 		/* Used for Single-Pass AES-GMAC only */
 		struct {
-			alignas(RTE_CACHE_LINE_SIZE) struct icp_qat_hw_cipher_algo_blk cd_cipher
-					__rte_packed;
+			alignas(RTE_CACHE_LINE_SIZE) struct __rte_packed_begin
+					 icp_qat_hw_cipher_algo_blk cd_cipher __rte_packed_end;
 			phys_addr_t cd_phys_addr;
 		} spc_gmac;
 	} opt;
drivers/crypto/qat/qat_sym_session.h +2 -2
index f2634774ec..2ca6c8ddf5 100644
@@ -92,7 +92,7 @@ typedef int (*qat_sym_build_request_t)(void *in_op, struct qat_sym_session *ctx,
 		uint8_t *out_msg, void *op_cookie);
 
 /* Common content descriptor */
-struct __rte_cache_aligned qat_sym_cd {
+struct __rte_cache_aligned __rte_packed_begin qat_sym_cd {
 	struct icp_qat_hw_cipher_algo_blk cipher;
 	union {
 		struct icp_qat_hw_auth_algo_blk hash;
@@ -100,7 +100,7 @@ struct __rte_cache_aligned qat_sym_cd {
 		struct icp_qat_hw_gen3_crc_cd crc_gen3;
 		struct icp_qat_hw_gen4_crc_cd crc_gen4;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct qat_sym_session {
 	enum icp_qat_fw_la_cmd_id qat_cmd;
Signature · 1 line
2.47.0.vfs.0.3
#233 lore raw

PATCH v9 11/30 drivers/dma: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/dma/dpaa/dpaa_qdma.h    | 20 ++++++++++----------
 drivers/dma/dpaa2/dpaa2_qdma.h  | 16 ++++++++--------
 drivers/dma/ioat/ioat_hw_defs.h |  4 ++--
 3 files changed, 20 insertions(+), 20 deletions(-)
drivers/dma/dpaa/dpaa_qdma.h +10 -10
index 91eaf1455a..0b08909221 100644
@@ -119,7 +119,7 @@
 	(((fsl_qdma_engine)->block_offset) * (x))
 
 /* qDMA Command Descriptor Formats */
-struct fsl_qdma_comp_cmd_desc {
+struct __rte_packed_begin fsl_qdma_comp_cmd_desc {
 	uint8_t status;
 	uint32_t rsv0:22;
 	uint32_t ser:1;
@@ -132,9 +132,9 @@ struct fsl_qdma_comp_cmd_desc {
 	uint8_t queue:3;
 	uint8_t rsv4:3;
 	uint8_t dd:2;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_comp_sg_desc {
+struct __rte_packed_begin fsl_qdma_comp_sg_desc {
 	uint32_t offset:13;
 	uint32_t rsv0:19;
 	uint32_t length:30;
@@ -143,9 +143,9 @@ struct fsl_qdma_comp_sg_desc {
 	uint32_t addr_lo;
 	uint8_t addr_hi;
 	uint32_t rsv1:24;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_sdf {
+struct __rte_packed_begin fsl_qdma_sdf {
 	uint32_t rsv0;
 	uint32_t ssd:12;
 	uint32_t sss:12;
@@ -160,9 +160,9 @@ struct fsl_qdma_sdf {
 	uint32_t sqos:3;
 	uint32_t ns:1;
 	uint32_t srttype:4;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_ddf {
+struct __rte_packed_begin fsl_qdma_ddf {
 	uint32_t rsv0;
 	uint32_t dsd:12;
 	uint32_t dss:12;
@@ -177,7 +177,7 @@ struct fsl_qdma_ddf {
 	uint32_t dqos:3;
 	uint32_t ns:1;
 	uint32_t dwttype:4;
-} __rte_packed;
+} __rte_packed_end;
 
 struct fsl_qdma_df {
 	struct fsl_qdma_sdf sdf;
@@ -186,7 +186,7 @@ struct fsl_qdma_df {
 
 #define FSL_QDMA_SG_MAX_ENTRY 64
 #define FSL_QDMA_MAX_DESC_NUM (FSL_QDMA_SG_MAX_ENTRY * QDMA_QUEUE_SIZE)
-struct fsl_qdma_cmpd_ft {
+struct __rte_packed_begin fsl_qdma_cmpd_ft {
 	struct fsl_qdma_comp_sg_desc desc_buf;
 	struct fsl_qdma_comp_sg_desc desc_sbuf;
 	struct fsl_qdma_comp_sg_desc desc_dbuf;
@@ -197,7 +197,7 @@ struct fsl_qdma_cmpd_ft {
 	uint64_t phy_ssge;
 	uint64_t phy_dsge;
 	uint64_t phy_df;
-} __rte_packed;
+} __rte_packed_end;
 
 #define FSL_QDMA_ERR_REG_STATUS_OFFSET 0xe00
 
drivers/dma/dpaa2/dpaa2_qdma.h +8 -8
index 0fd1debaf8..e2d2eb4fa8 100644
@@ -39,7 +39,7 @@
 #define DPAA2_QDMA_BMT_DISABLE 0x0
 
 /** Source/Destination Descriptor */
-struct qdma_sdd {
+struct __rte_packed_begin qdma_sdd {
 	uint32_t rsv;
 	/** Stride configuration */
 	uint32_t stride;
@@ -85,7 +85,7 @@ struct qdma_sdd {
 			uint32_t wrttype:4;
 		} write_cmd;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 #define QDMA_SG_FMT_SDB	0x0 /* single data buffer */
 #define QDMA_SG_FMT_FDS	0x1 /* frame data section */
@@ -96,7 +96,7 @@ struct qdma_sdd {
 #define QDMA_SG_BMT_ENABLE DPAA2_QDMA_BMT_ENABLE
 #define QDMA_SG_BMT_DISABLE DPAA2_QDMA_BMT_DISABLE
 
-struct qdma_sg_entry {
+struct __rte_packed_begin qdma_sg_entry {
 	uint32_t addr_lo;		/* address 0:31 */
 	uint32_t addr_hi:17;	/* address 32:48 */
 	uint32_t rsv:15;
@@ -122,7 +122,7 @@ struct qdma_sg_entry {
 			uint32_t f:1;
 		} ctrl;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct dpaa2_qdma_rbp {
 	uint32_t use_ultrashort:1;
@@ -213,19 +213,19 @@ enum {
 	DPAA2_QDMA_MAX_SDD
 };
 
-struct qdma_cntx_fle_sdd {
+struct __rte_packed_begin qdma_cntx_fle_sdd {
 	struct qbman_fle fle[DPAA2_QDMA_MAX_FLE];
 	struct qdma_sdd sdd[DPAA2_QDMA_MAX_SDD];
-} __rte_packed;
+} __rte_packed_end;
 
-struct qdma_cntx_sg {
+struct __rte_packed_begin qdma_cntx_sg {
 	struct qdma_cntx_fle_sdd fle_sdd;
 	struct qdma_sg_entry sg_src_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	struct qdma_sg_entry sg_dst_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	uint16_t cntx_idx[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	uint16_t job_nb;
 	uint16_t rsv[3];
-} __rte_packed;
+} __rte_packed_end;
 
 #define DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flag) \
 	((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAAX_QDMA_SG_IDX_ADDR_MASK)))
drivers/dma/ioat/ioat_hw_defs.h +2 -2
index 11893951f2..dbfbc50f70 100644
@@ -52,7 +52,7 @@ extern "C" {
 #define	IOAT_DMACAP_PQ		(1 << 9)
 #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
 
-struct ioat_registers {
+struct __rte_packed_begin ioat_registers {
 	uint8_t		chancnt;
 	uint8_t		xfercap;
 	uint8_t		genctrl;
@@ -75,7 +75,7 @@ struct ioat_registers {
 	uint8_t		reserved2[0x8];	/* 0xA0 */
 	uint32_t	chanerr;	/* 0xA8 */
 	uint32_t	chanerrmask;	/* 0xAC */
-} __rte_packed;
+} __rte_packed_end;
 
 #define IOAT_CHANCMD_RESET	0x20
 #define IOAT_CHANCMD_SUSPEND	0x04
Signature · 1 line
2.47.0.vfs.0.3
#234 lore raw

PATCH v9 12/30 drivers/event: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/event/octeontx/timvf_evdev.c |  4 ++--
 drivers/event/octeontx/timvf_evdev.h | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/event/octeontx/timvf_evdev.c +2 -2
index 82f17144a6..b404b1db61 100644
@@ -9,10 +9,10 @@ RTE_LOG_REGISTER_SUFFIX(otx_logtype_timvf, timer, NOTICE);
 
 static struct rte_eventdev *event_dev;
 
-struct __rte_packed timvf_mbox_dev_info {
+struct __rte_packed_begin timvf_mbox_dev_info {
 	uint64_t ring_active[4];
 	uint64_t clk_freq;
-};
+} __rte_packed_end;
 
 /* Response messages */
 enum {
drivers/event/octeontx/timvf_evdev.h +6 -6
index 44a4ee41c4..e9152424ab 100644
@@ -123,7 +123,7 @@ enum timvf_clk_src {
 };
 
 /* TIM_MEM_BUCKET */
-struct __rte_aligned(8) tim_mem_bucket {
+struct __rte_aligned(8) __rte_packed_begin tim_mem_bucket {
 	uint64_t first_chunk;
 	union {
 		RTE_ATOMIC(uint64_t) w1;
@@ -139,19 +139,19 @@ struct __rte_aligned(8) tim_mem_bucket {
 	};
 	uint64_t current_chunk;
 	uint64_t pad;
-} __rte_packed;
+} __rte_packed_end;
 
-struct tim_mem_entry {
+struct __rte_packed_begin tim_mem_entry {
 	uint64_t w0;
 	uint64_t wqe;
-} __rte_packed;
+} __rte_packed_end;
 
-struct timvf_ctrl_reg {
+struct __rte_packed_begin timvf_ctrl_reg {
 	uint64_t rctrl0;
 	uint64_t rctrl1;
 	uint64_t rctrl2;
 	uint8_t use_pmu;
-} __rte_packed;
+} __rte_packed_end;
 
 struct timvf_ring;
 
Signature · 1 line
2.47.0.vfs.0.3
#235 lore raw

PATCH v9 13/30 drivers/mempool: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/mempool/octeontx/octeontx_fpavf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/mempool/octeontx/octeontx_fpavf.c +8 -8
index 966fee8bfe..6cd0fc057f 100644
@@ -46,20 +46,20 @@ struct octeontx_mbox_fpa_cfg {
 	uint64_t	aura_cfg;
 };
 
-struct __rte_packed gen_req {
+struct __rte_packed_begin gen_req {
 	uint32_t	value;
-};
+} __rte_packed_end;
 
-struct __rte_packed idn_req {
+struct __rte_packed_begin idn_req {
 	uint8_t	domain_id;
-};
+} __rte_packed_end;
 
-struct __rte_packed gen_resp {
+struct __rte_packed_begin gen_resp {
 	uint16_t	domain_id;
 	uint16_t	vfid;
-};
+} __rte_packed_end;
 
-struct __rte_packed dcfg_resp {
+struct __rte_packed_begin dcfg_resp {
 	uint8_t	sso_count;
 	uint8_t	ssow_count;
 	uint8_t	fpa_count;
@@ -67,7 +67,7 @@ struct __rte_packed dcfg_resp {
 	uint8_t	tim_count;
 	uint8_t	net_port_count;
 	uint8_t	virt_port_count;
-};
+} __rte_packed_end;
 
 #define FPA_MAX_POOL	32
 #define FPA_PF_PAGE_SZ	4096
Signature · 1 line
2.47.0.vfs.0.3
#236 lore raw

PATCH v9 14/30 drivers/net: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/net/ark/ark_ddm.h                     |    4 +-
 drivers/net/ark/ark_pktchkr.h                 |    8 +-
 drivers/net/ark/ark_pktdir.h                  |    5 +-
 drivers/net/ark/ark_pktgen.h                  |    4 +-
 drivers/net/ark/ark_udm.h                     |    4 +-
 drivers/net/atlantic/hw_atl/hw_atl_utils.h    |  120 +-
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |    8 +-
 drivers/net/avp/rte_avp_common.h              |   12 +-
 drivers/net/bnxt/bnxt.h                       |    8 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h        | 3344 ++++++++---------
 drivers/net/bnxt/tf_core/tf_resources.h       |   32 +-
 drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c   |   20 +-
 drivers/net/bonding/rte_eth_bond_8023ad.h     |   32 +-
 drivers/net/cnxk/cn10k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn20k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn9k_ethdev.h                |    4 +-
 drivers/net/cnxk/cnxk_rep_msg.h               |   64 +-
 drivers/net/dpaa/dpaa_rxtx.h                  |   28 +-
 drivers/net/dpaa/fmlib/fm_ext.h               |    4 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h  |    4 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   16 +-
 drivers/net/enic/base/vnic_devcmd.h           |   40 +-
 drivers/net/enic/base/vnic_flowman.h          |  120 +-
 drivers/net/gve/base/gve_desc.h               |   16 +-
 drivers/net/gve/base/gve_desc_dqo.h           |   32 +-
 drivers/net/gve/base/gve_osdep.h              |    3 -
 drivers/net/hns3/hns3_mbx.h                   |    8 +-
 drivers/net/hns3/hns3_rxtx.h                  |    4 +-
 drivers/net/i40e/base/i40e_osdep.h            |    8 +-
 drivers/net/iavf/iavf_ipsec_crypto.h          |   10 +-
 drivers/net/iavf/iavf_rxtx.c                  |    2 +-
 drivers/net/ice/base/ice_osdep.h              |   11 +-
 drivers/net/ionic/ionic_if.h                  |   72 +-
 drivers/net/memif/memif.h                     |   36 +-
 drivers/net/mlx4/mlx4_mr.h                    |   12 +-
 drivers/net/mlx5/hws/mlx5dr.h                 |    4 +-
 drivers/net/mlx5/mlx5.h                       |    4 +-
 drivers/net/mlx5/mlx5_flow.h                  |   16 +-
 drivers/net/mlx5/mlx5_hws_cnt.h               |    4 +-
 drivers/net/mlx5/mlx5_utils.h                 |   16 +-
 drivers/net/netvsc/hn_nvs.h                   |   72 +-
 drivers/net/netvsc/ndis.h                     |    8 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.h      |    4 +-
 drivers/net/nfp/flower/nfp_flower_flow.h      |    4 +-
 drivers/net/nfp/nfd3/nfp_nfd3.h               |    4 +-
 drivers/net/nfp/nfp_rxtx.h                    |    8 +-
 drivers/net/nfp/nfpcore/nfp_nsp.c             |    4 +-
 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c |   12 +-
 drivers/net/octeon_ep/otx_ep_mbox.h           |    4 +-
 drivers/net/octeontx/base/octeontx_pki_var.h  |    4 +-
 drivers/net/pfe/pfe_hif.h                     |    4 +-
 drivers/net/virtio/virtio.h                   |    4 +-
 drivers/net/virtio/virtio_cvq.h               |    8 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |    4 +-
 drivers/net/zxdh/zxdh_common.c                |    8 +-
 drivers/net/zxdh/zxdh_msg.h                   |   16 +-
 drivers/net/zxdh/zxdh_pci.h                   |    4 +-
 drivers/net/zxdh/zxdh_queue.h                 |   64 +-
 drivers/net/zxdh/zxdh_rxtx.h                  |    8 +-
 59 files changed, 2193 insertions(+), 2198 deletions(-)
drivers/net/ark/ark_ddm.h +2 -2
index 84beeb063a..bde3a41345 100644
@@ -17,7 +17,7 @@
  */
 
 /* struct defining Tx meta data --  fixed in FPGA -- 8 bytes */
-union ark_tx_meta {
+union __rte_packed_begin ark_tx_meta {
 	uint64_t physaddr;
 	struct {
 		uint32_t usermeta0;
@@ -31,7 +31,7 @@ union ark_tx_meta {
 		uint8_t  meta_cnt;
 		uint32_t user1;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * DDM core hardware structures
drivers/net/ark/ark_pktchkr.h +4 -4
index b362281776..fa5d2baabe 100644
@@ -23,7 +23,7 @@ typedef void *ark_pkt_chkr_t;
  * This are overlay structures to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_chkr_stat_regs {
+struct __rte_packed_begin ark_pkt_chkr_stat_regs {
 	uint32_t r0;
 	uint32_t pkt_start_stop;
 	uint32_t pkt_ctrl;
@@ -37,9 +37,9 @@ struct ark_pkt_chkr_stat_regs {
 	uint32_t pkts_missing;
 	uint32_t min_latency;
 	uint32_t max_latency;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ark_pkt_chkr_ctl_regs {
+struct __rte_packed_begin ark_pkt_chkr_ctl_regs {
 	uint32_t pkt_ctrl;
 	uint32_t pkt_payload;
 	uint32_t pkt_size_min;
@@ -53,7 +53,7 @@ struct ark_pkt_chkr_ctl_regs {
 	uint32_t dst_mac_addr_h;
 	uint32_t eth_type;
 	uint32_t hdr_dw[7];
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_chkr_inst {
 	struct rte_eth_dev_info *dev_info;
drivers/net/ark/ark_pktdir.h +3 -2
index b5577cebb3..738909941d 100644
@@ -6,6 +6,7 @@
 #define _ARK_PKTDIR_H_
 
 #include <stdint.h>
+#include <rte_common.h>
 
 #define ARK_PKT_DIR_INIT_VAL 0x0110
 
@@ -22,11 +23,11 @@ typedef void *ark_pkt_dir_t;
  * This is an overlay structures to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_dir_regs {
+struct __rte_packed_begin ark_pkt_dir_regs {
 	uint32_t ctrl;
 	uint32_t status;
 	uint32_t stall_cnt;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_dir_inst {
 	volatile struct ark_pkt_dir_regs *regs;
drivers/net/ark/ark_pktgen.h +2 -2
index 925058367c..34879711a3 100644
@@ -22,7 +22,7 @@ typedef void *ark_pkt_gen_t;
  * This is an overlay structure to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_gen_regs {
+struct __rte_packed_begin ark_pkt_gen_regs {
 	uint32_t r0;
 	volatile uint32_t pkt_start_stop;
 	volatile uint32_t pkt_ctrl;
@@ -41,7 +41,7 @@ struct ark_pkt_gen_regs {
 	uint32_t hdr_dw[7];
 	uint32_t start_offset;
 	uint32_t bytes_per_cycle;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_gen_inst {
 	struct rte_eth_dev_info *dev_info;
drivers/net/ark/ark_udm.h +2 -2
index ec53ec7e79..55ffccff9d 100644
@@ -18,12 +18,12 @@
 /* Meta data structure passed from FPGA, must match layout in FPGA
  * -- 32 bytes
  */
-struct ark_rx_meta {
+struct __rte_packed_begin ark_rx_meta {
 	uint32_t user_meta[5];	/* user defined based on fpga code */
 	uint32_t pkt_len32;
 	uint8_t  reserved[6];
 	uint16_t pkt_len;
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * UDM hardware structures
drivers/net/atlantic/hw_atl/hw_atl_utils.h +60 -60

313 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +4 -4
index 3a7faf405c..51ff718620 100644
@@ -37,12 +37,12 @@
 
 #define HW_ATL_FW_FEATURE_LED 0x03010026
 
-struct fw2x_msg_wol_pattern {
+struct __rte_packed_begin fw2x_msg_wol_pattern {
 	u8 mask[16];
 	u32 crc;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fw2x_msg_wol {
+struct __rte_packed_begin fw2x_msg_wol {
 	u32 msg_id;
 	u8 hw_addr[6];
 	u8 magic_packet_enabled;
@@ -53,7 +53,7 @@ struct fw2x_msg_wol {
 	u16 reserved;
 	u32 link_up_timeout;
 	u32 link_down_timeout;
-} __rte_packed;
+} __rte_packed_end;
 
 static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed);
 static int aq_fw2x_set_state(struct aq_hw_s *self,
drivers/net/avp/rte_avp_common.h +6 -6
index 5ad71ac088..906cf0b60a 100644
@@ -60,7 +60,7 @@ enum rte_avp_req_id {
 /*
  * Structure for AVP queue configuration query request/result
  */
-struct rte_avp_device_config {
+struct __rte_packed_begin rte_avp_device_config {
 	uint64_t device_id;	/**< Unique system identifier */
 	uint32_t driver_type; /**< Device Driver type */
 	uint32_t driver_version; /**< Device Driver version */
@@ -68,12 +68,12 @@ struct rte_avp_device_config {
 	uint16_t num_tx_queues;	/**< Number of active transmit queues */
 	uint16_t num_rx_queues;	/**< Number of active receive queues */
 	uint8_t if_up; /**< 1: interface up, 0: interface down */
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * Structure for AVP request.
  */
-struct rte_avp_request {
+struct __rte_packed_begin rte_avp_request {
 	uint32_t req_id; /**< Request id */
 	union {
 		uint32_t new_mtu; /**< New MTU */
@@ -81,7 +81,7 @@ struct rte_avp_request {
 	struct rte_avp_device_config config; /**< Queue configuration */
 	};
 	int32_t result;	/**< Result for processing request */
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * FIFO struct mapped in a shared memory. It describes a circular buffer FIFO
@@ -100,7 +100,7 @@ struct rte_avp_fifo {
 /*
  * AVP packet buffer header used to define the exchange of packet data.
  */
-struct __rte_cache_aligned rte_avp_desc {
+struct __rte_cache_aligned __rte_packed_begin rte_avp_desc {
 	uint64_t pad0;
 	void *pkt_mbuf; /**< Reference to packet mbuf */
 	uint8_t pad1[14];
@@ -114,7 +114,7 @@ struct __rte_cache_aligned rte_avp_desc {
 	uint32_t pad3;
 	uint16_t vlan_tci; /**< VLAN Tag Control Identifier (CPU order). */
 	uint32_t pad4;
-} __rte_packed;
+} __rte_packed_end;
 
 
 /**{ AVP device features */
drivers/net/bnxt/bnxt.h +4 -4
index 0402de3eb9..4a5c224c09 100644
@@ -219,16 +219,16 @@ struct bnxt_led_cfg {
 #define BNXT_LED_DFLT_ENABLES(x)                        \
 	rte_cpu_to_le_32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
 
-struct bnxt_vlan_table_entry {
+struct __rte_packed_begin bnxt_vlan_table_entry {
 	uint16_t		tpid;
 	uint16_t		vid;
-} __rte_packed;
+} __rte_packed_end;
 
-struct bnxt_vlan_antispoof_table_entry {
+struct __rte_packed_begin bnxt_vlan_antispoof_table_entry {
 	uint16_t		tpid;
 	uint16_t		vid;
 	uint16_t		mask;
-} __rte_packed;
+} __rte_packed_end;
 
 struct bnxt_child_vf_info {
 	void			*req_buf;
drivers/net/bnxt/hsi_struct_def_dpdk.h +1672 -1672

2,505 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_resources.h +16 -16
index e77e882b70..f9d18577e5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c +10 -10
index 9b85ede417..be16d00deb 100644

Lines of this file are not shown. View the raw message.

drivers/net/bonding/rte_eth_bond_8023ad.h +16 -16
index 5432eafcfe..395e41ff95 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn10k_rxtx.h +2 -2
index ed54e5f920..9861aa6571 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn20k_rxtx.h +2 -2
index 03eaf34d64..4a8f194eb8 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn9k_ethdev.h +2 -2
index 4933954c33..c267c11c46 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cnxk_rep_msg.h +32 -32

64 lines not on this page · raw message

drivers/net/dpaa/dpaa_rxtx.h +14 -14
index 392926e286..edb29788fb 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa/fmlib/fm_ext.h +2 -2
index 7b8d85cc71..b341862c73 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h +2 -2
index 7e5e499b6a..6bca4c8de2 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa2/dpaa2_recycle.c +8 -8
index 4fde9b95a0..94a7e2a020 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/base/vnic_devcmd.h +20 -20
index 2b3be855f9..b470f44a69 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/base/vnic_flowman.h +60 -60

120 lines not on this page · raw message

drivers/net/gve/base/gve_desc.h +8 -8
index 006b36442f..51d3ec73f6 100644

Lines of this file are not shown. View the raw message.

drivers/net/gve/base/gve_desc_dqo.h +16 -16
index bb4a18d4d1..aa860e1e76 100644

Lines of this file are not shown. View the raw message.

drivers/net/gve/base/gve_osdep.h +0 -3
index 64181cebd6..cb3936c150 100644

Lines of this file are not shown. View the raw message.

drivers/net/hns3/hns3_mbx.h +4 -4
index 2b6cb8f513..c73f34fb32 100644

Lines of this file are not shown. View the raw message.

drivers/net/hns3/hns3_rxtx.h +2 -2
index e975cd151a..0bce89ebaa 100644

Lines of this file are not shown. View the raw message.

drivers/net/i40e/base/i40e_osdep.h +4 -4
index 302841dba8..c04f94732a 100644

Lines of this file are not shown. View the raw message.

drivers/net/iavf/iavf_ipsec_crypto.h +5 -5
index 49f9202aca..795b75a624 100644

Lines of this file are not shown. View the raw message.

drivers/net/iavf/iavf_rxtx.c +1 -1
index 6a093c6746..f7df5f21f2 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_osdep.h +4 -7
index 64e4779878..7b96fcde03 100644

Lines of this file are not shown. View the raw message.

drivers/net/ionic/ionic_if.h +36 -36

72 lines not on this page · raw message

drivers/net/memif/memif.h +18 -18
index 3f5b407a48..cff96f271a 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx4/mlx4_mr.h +6 -6
index af5251a960..56dd73ff19 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/hws/mlx5dr.h +2 -2
index 3668ab9fcf..7097d22099 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5.h +2 -2
index 89d277b523..cc8a03ccd6 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_flow.h +8 -8
index bcc2782460..50b0e2ce47 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_hws_cnt.h +2 -2
index d8da9dfcdd..38a9c19449 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_utils.h +8 -8
index f933daf03c..db2e33dfa9 100644

Lines of this file are not shown. View the raw message.

drivers/net/netvsc/hn_nvs.h +36 -36

72 lines not on this page · raw message

drivers/net/netvsc/ndis.h +4 -4
index d97a397a86..df39b26df7 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/flower/nfp_flower_cmsg.h +2 -2
index a7866e8382..aff5d54347 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/flower/nfp_flower_flow.h +2 -2
index f54ad6cf55..a5cb440bd5 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfd3/nfp_nfd3.h +2 -2
index 3ba562cc3f..96ea23b3df 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfp_rxtx.h +4 -4
index c717d97003..81e420a79d 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfpcore/nfp_nsp.c +2 -2
index 9837b3354b..b664e3adfa 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +6 -6
index e46a3bef28..c178144d42 100644

Lines of this file are not shown. View the raw message.

drivers/net/octeon_ep/otx_ep_mbox.h +2 -2
index ec96e4edc5..4f7afe7635 100644

Lines of this file are not shown. View the raw message.

drivers/net/octeontx/base/octeontx_pki_var.h +2 -2
index 4445369ce7..8816680dfe 100644

Lines of this file are not shown. View the raw message.

drivers/net/pfe/pfe_hif.h +2 -2
index e8d5ba10e1..16bf696689 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio.h +2 -2
index 04a897bf51..ef5827c5f5 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio_cvq.h +4 -4
index 70739ae04b..5e176b6379 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio_user/vhost_user.c +2 -2
index c10252506b..6c042f6186 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_common.c +4 -4
index 4f18c97ed7..72c0ed65cc 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_msg.h +8 -8
index 530ee406b1..5f57acd055 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_pci.h +2 -2
index ed6fd89742..fe41312cc0 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_queue.h +32 -32

64 lines not on this page · raw message

drivers/net/zxdh/zxdh_rxtx.h +4 -4
index de9353b223..bc9c9b629a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.47.0.vfs.0.3

Part of the diff is not shown here. View the raw message.

#237 lore raw

PATCH v9 15/30 drivers/raw: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/raw/ifpga/afu_pmd_n3000.h    | 8 ++++----
 drivers/raw/ifpga/base/opae_hw_api.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/raw/ifpga/afu_pmd_n3000.h +4 -4
index f6b6e07c6b..2c137bd14e 100644
@@ -211,7 +211,7 @@ typedef union {
 	};
 } msgdma_desc_ctrl;
 
-typedef struct __rte_packed {
+typedef struct __rte_packed_begin {
 	uint32_t rd_address;
 	uint32_t wr_address;
 	uint32_t len;
@@ -223,7 +223,7 @@ typedef struct __rte_packed {
 	uint32_t rd_address_ext;
 	uint32_t wr_address_ext;
 	msgdma_desc_ctrl control;
-} msgdma_ext_desc;
+} __rte_packed_end msgdma_ext_desc;
 
 typedef union {
 	uint32_t csr;
@@ -279,13 +279,13 @@ typedef union {
 	};
 } msgdma_seq_num;
 
-typedef struct __rte_packed {
+typedef struct __rte_packed_begin {
 	msgdma_status status;
 	msgdma_ctrl ctrl;
 	msgdma_fill_level fill_level;
 	msgdma_rsp_level rsp;
 	msgdma_seq_num seq_num;
-} msgdma_csr;
+} __rte_packed_end msgdma_csr;
 
 #define CSR_STATUS(csr)   (&(((msgdma_csr *)(csr))->status))
 #define CSR_CONTROL(csr)  (&(((msgdma_csr *)(csr))->ctrl))
drivers/raw/ifpga/base/opae_hw_api.h +2 -2
index 613563a0b4..57750022dd 100644
@@ -343,9 +343,9 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 /* OPAE vBNG network datastruct */
 #define OPAE_ETHER_ADDR_LEN 6
 
-struct opae_ether_addr {
+struct __rte_packed_begin opae_ether_addr {
 	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
-} __rte_packed;
+} __rte_packed_end;
 
 /* OPAE vBNG network API*/
 int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
Signature · 1 line
2.47.0.vfs.0.3
#238 lore raw

PATCH v9 16/30 drivers/regex: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/regex/cn9k/cn9k_regexdev.c |  4 ++--
 drivers/regex/mlx5/mlx5_rxp.h      | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/regex/cn9k/cn9k_regexdev.c +2 -2
index aa809ab5bf..5abc7e22bc 100644
@@ -40,12 +40,12 @@ struct ree_rule_db_entry {
 	uint64_t	value;
 };
 
-struct ree_rule_db {
+struct __rte_packed_begin ree_rule_db {
 	uint32_t version;
 	uint32_t revision;
 	uint32_t number_of_entries;
 	struct ree_rule_db_entry entries[];
-} __rte_packed;
+} __rte_packed_end;
 
 static void
 qp_memzone_name_get(char *name, int size, int dev_id, int qp_id)
drivers/regex/mlx5/mlx5_rxp.h +8 -8
index b38b53cc14..08b9a2680b 100644
@@ -42,14 +42,14 @@
 #define MLX5_RXP_RESP_STATUS_PMI_EOJ (1 << 14)
 
 /* This describes the header the RXP expects for any search data. */
-struct mlx5_rxp_job_desc {
+struct __rte_packed_begin mlx5_rxp_job_desc {
 	uint32_t job_id;
 	uint16_t ctrl;
 	uint16_t len;
 	uint16_t subset[4];
-} __rte_packed;
+} __rte_packed_end;
 
-struct mlx5_rxp_response_desc {
+struct __rte_packed_begin mlx5_rxp_response_desc {
 	uint32_t job_id;
 	uint16_t status;
 	uint8_t	detected_match_count;
@@ -58,13 +58,13 @@ struct mlx5_rxp_response_desc {
 	uint16_t instruction_count;
 	uint16_t latency_count;
 	uint16_t pmi_min_byte_ptr;
-} __rte_packed;
+} __rte_packed_end;
 
-struct mlx5_rxp_match_tuple {
+struct __rte_packed_begin mlx5_rxp_match_tuple {
 	uint32_t rule_id;
 	uint16_t start_ptr;
 	uint16_t length;
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_rxp_response {
 	struct mlx5_rxp_response_desc header;
@@ -115,11 +115,11 @@ struct mlx5_rxp_rof {
 	struct mlx5_rxp_rof_entry *rof_entries;
 };
 
-struct mlx5_rxp_ctl_rules_pgm {
+struct __rte_packed_begin mlx5_rxp_ctl_rules_pgm {
 	struct mlx5_rxp_ctl_hdr hdr;
 	uint32_t count;
 	struct mlx5_rxp_rof_entry rules[];
-} __rte_packed;
+} __rte_packed_end;
 
 /* RXP programming mode setting. */
 enum mlx5_rxp_program_mode {
Signature · 1 line
2.47.0.vfs.0.3
#239 lore raw

PATCH v9 17/30 drivers/vdpa: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/vdpa/ifc/base/ifcvf.h | 4 ++--
 drivers/vdpa/mlx5/mlx5_vdpa.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/vdpa/ifc/base/ifcvf.h +2 -2
index 04c81c8196..0c3b8956c5 100644
@@ -115,11 +115,11 @@ struct ifcvf_pci_common_cfg {
 	u32 queue_used_hi;
 };
 
-struct ifcvf_net_config {
+struct __rte_packed_begin ifcvf_net_config {
 	u8    mac[6];
 	u16   status;
 	u16   max_virtqueue_pairs;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ifcvf_pci_mem_resource {
 	u64      phys_addr; /**< Physical address, 0 if not resource. */
drivers/vdpa/mlx5/mlx5_vdpa.h +2 -2
index e156520172..a398aa22ce 100644
@@ -90,13 +90,13 @@ enum mlx5_vdpa_task_type {
 };
 
 /* Generic task information and size must be multiple of 4B. */
-struct __rte_aligned(4) mlx5_vdpa_task {
+struct __rte_aligned(4) __rte_packed_begin mlx5_vdpa_task {
 	struct mlx5_vdpa_priv *priv;
 	enum mlx5_vdpa_task_type type;
 	RTE_ATOMIC(uint32_t) *remaining_cnt;
 	RTE_ATOMIC(uint32_t) *err_cnt;
 	uint32_t idx;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Generic mlx5_vdpa_c_thread information. */
 struct mlx5_vdpa_c_thread {
Signature · 1 line
2.47.0.vfs.0.3
#240 lore raw

PATCH v9 18/30 examples/common: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Added parenthesis around *pnum in line
__ rte_packed_end (*pnum) = (void *)pn;
to avoid patch check error below:

ERROR:SPACING: need consistent spacing around '*' (ctx:WxV) 34: FILE: examples/common/neon/port_group.h:27:
+ } __ rte_packed_end *pnum = (void *)pn;

With the parenthesis it becomes a warning, still not ideal, but better Running checkpatch.pl:
WARNING:SPACING: space prohibited between function name and open parenthesis '('
34: FILE: examples/common/neon/port_group.h:27:
+ } __ rte_packed_end (*pnum) = (void *)pn;

---
 examples/common/neon/port_group.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/common/neon/port_group.h +2 -2
index 421e2e8613..b8f8be66e8 100644
@@ -21,10 +21,10 @@ static inline uint16_t *
 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 		  uint16x8_t dp2)
 {
-	union {
+	union __rte_packed_begin {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
-	} __rte_packed *pnum = (void *)pn;
+	} __rte_packed_end (*pnum) = (void *)pn;
 
 	uint16x8_t mask = {1, 2, 4, 8, 0, 0, 0, 0};
 	int32_t v;
Signature · 1 line
2.47.0.vfs.0.3
#241 lore raw

PATCH v9 19/30 examples/ip-pipeline: remove packed attributes

In reply to Andre Muezerie

Removed packed attributes from structs that are naturally packed already, or don't require packing.

---
 examples/ip_pipeline/cli.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
examples/ip_pipeline/cli.c +5 -5
index 92dfacdeb0..766fc8e46e 100644
@@ -2571,7 +2571,7 @@ struct pkt_key_qinq {
 	uint16_t svlan;
 	uint16_t ethertype_cvlan;
 	uint16_t cvlan;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_5tuple {
 	uint8_t time_to_live;
@@ -2581,7 +2581,7 @@ struct pkt_key_ipv4_5tuple {
 	uint32_t da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
@@ -2591,15 +2591,15 @@ struct pkt_key_ipv6_5tuple {
 	struct rte_ipv6_addr da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_addr {
 	uint32_t addr;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_addr {
 	struct rte_ipv6_addr addr;
-} __rte_packed;
+};
 
 static uint32_t
 parse_match(char **tokens,
Signature · 1 line
2.47.0.vfs.0.3
#242 lore raw

PATCH v9 20/30 examples/ipsec_secgw: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/ipsec-secgw/ipsec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ipsec-secgw/ipsec.h +2 -2
index f12f57e2d5..e3cc43ef3b 100644
@@ -274,11 +274,11 @@ struct socket_ctx {
 	struct rte_mempool *session_pool;
 };
 
-struct cnt_blk {
+struct __rte_packed_begin cnt_blk {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
 struct __rte_cache_aligned lcore_rx_queue {
 	uint16_t port_id;
Signature · 1 line
2.47.0.vfs.0.3
#243 lore raw

PATCH v9 21/30 examples/l3fwd-power: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/l3fwd-power/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/l3fwd-power/main.c +4 -4
index ae8b55924e..d279e664b3 100644
@@ -282,21 +282,21 @@ static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
 #define DEFAULT_HASH_FUNC       rte_jhash
 #endif
 
-struct ipv4_5tuple {
+struct __rte_packed_begin ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ipv6_5tuple {
+struct __rte_packed_begin ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ipv4_l3fwd_route {
 	struct ipv4_5tuple key;
Signature · 1 line
2.47.0.vfs.0.3
#244 lore raw

PATCH v9 22/30 examples/l3fwd: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/l3fwd/l3fwd_route.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/l3fwd/l3fwd_route.h +4 -4
index 62263c3540..b02b9cc11c 100644
@@ -36,21 +36,21 @@ struct ipv6_l3fwd_route {
 	uint8_t if_out;
 };
 
-struct ipv4_5tuple {
+struct __rte_packed_begin ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ipv6_5tuple {
+struct __rte_packed_begin ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
 struct lpm_route_rule {
 	union {
Signature · 1 line
2.47.0.vfs.0.3
#245 lore raw

PATCH v9 23/30 examples/ptpclient: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/ptpclient/ptpclient.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
examples/ptpclient/ptpclient.c +16 -16
index 7b6862d951..9c64313fa9 100644
@@ -56,22 +56,22 @@ static const struct rte_ether_addr ether_multicast = {
 };
 
 /* Structs used for PTP handling. */
-struct tstamp {
+struct __rte_packed_begin tstamp {
 	uint16_t   sec_msb;
 	uint32_t   sec_lsb;
 	uint32_t   ns;
-}  __rte_packed;
+}  __rte_packed_end;
 
 struct clock_id {
 	uint8_t id[8];
 };
 
-struct port_id {
+struct __rte_packed_begin port_id {
 	struct clock_id        clock_id;
 	uint16_t               port_number;
-}  __rte_packed;
+}  __rte_packed_end;
 
-struct ptp_header {
+struct __rte_packed_begin ptp_header {
 	uint8_t              msg_type;
 	uint8_t              ver;
 	uint16_t             message_length;
@@ -84,39 +84,39 @@ struct ptp_header {
 	uint16_t             seq_id;
 	uint8_t              control;
 	int8_t               log_message_interval;
-} __rte_packed;
+} __rte_packed_end;
 
-struct sync_msg {
+struct __rte_packed_begin sync_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
-} __rte_packed;
+} __rte_packed_end;
 
-struct follow_up_msg {
+struct __rte_packed_begin follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
 	uint8_t             suffix[];
-} __rte_packed;
+} __rte_packed_end;
 
-struct delay_req_msg {
+struct __rte_packed_begin delay_req_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
-} __rte_packed;
+} __rte_packed_end;
 
-struct delay_resp_msg {
+struct __rte_packed_begin delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
 	struct port_id       req_port_id;
 	uint8_t              suffix[];
-} __rte_packed;
+} __rte_packed_end;
 
 struct ptp_message {
-	union {
+	union __rte_packed_begin {
 		struct ptp_header          header;
 		struct sync_msg            sync;
 		struct delay_req_msg       delay_req;
 		struct follow_up_msg       follow_up;
 		struct delay_resp_msg      delay_resp;
-	} __rte_packed;
+	} __rte_packed_end;
 };
 
 struct ptpv2_time_receiver_ordinary {
Signature · 1 line
2.47.0.vfs.0.3
#246 lore raw

PATCH v9 24/30 examples/vhost_blk: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/vhost_blk/blk_spec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/vhost_blk/blk_spec.h +2 -2
index 3c54f70eaf..7f785fa563 100644
@@ -73,7 +73,7 @@ struct vhost_memory_padded {
 	struct vhost_memory_region regions[VHOST_USER_MEMORY_MAX_NREGIONS];
 };
 
-struct vhost_user_msg {
+struct __rte_packed_begin vhost_user_msg {
 	enum vhost_user_request request;
 
 #define VHOST_USER_VERSION_MASK     0x3
@@ -89,6 +89,6 @@ struct vhost_user_msg {
 		struct vhost_memory_padded memory;
 		struct vhost_user_config cfg;
 	} payload;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif
Signature · 1 line
2.47.0.vfs.0.3
#247 lore raw

PATCH v9 25/30 lib/eal: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Removed the packed attributes from some structures that don't need them.

---
 lib/eal/common/eal_private.h      |  2 +-
 lib/eal/include/rte_memory.h      |  4 ++--
 lib/eal/include/rte_memzone.h     |  4 ++--
 lib/eal/include/rte_trace_point.h |  2 +-
 lib/eal/x86/include/rte_memcpy.h  | 12 ++++++------
 5 files changed, 12 insertions(+), 12 deletions(-)
lib/eal/common/eal_private.h +1 -1
index bb315dab04..3b94e01b5b 100644
@@ -62,7 +62,7 @@ struct rte_config {
 	 * DPDK instances
 	 */
 	struct rte_mem_config *mem_config;
-} __rte_packed;
+};
 
 /**
  * Get the global configuration structure.
lib/eal/include/rte_memory.h +2 -2
index dbd0a6bedc..249e0f5690 100644
@@ -46,7 +46,7 @@ extern "C" {
 /**
  * Physical memory segment descriptor.
  */
-struct rte_memseg {
+struct __rte_packed_begin rte_memseg {
 	rte_iova_t iova;            /**< Start IO address. */
 	union {
 		void *addr;         /**< Start virtual address. */
@@ -58,7 +58,7 @@ struct rte_memseg {
 	uint32_t nchannel;          /**< Number of channels. */
 	uint32_t nrank;             /**< Number of ranks. */
 	uint32_t flags;             /**< Memseg-specific flags */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * memseg list is a special case as we need to store a bunch of other data
lib/eal/include/rte_memzone.h +2 -2
index e1563994d5..5a0e1b8a15 100644
@@ -45,7 +45,7 @@ extern "C" {
  * A structure describing a memzone, which is a contiguous portion of
  * physical memory identified by a name.
  */
-struct rte_memzone {
+struct __rte_packed_begin rte_memzone {
 
 #define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
 	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
@@ -62,7 +62,7 @@ struct rte_memzone {
 	int32_t socket_id;                /**< NUMA socket ID. */
 
 	uint32_t flags;                   /**< Characteristics of this memzone. */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Set the maximum number of memzones.
lib/eal/include/rte_trace_point.h +1 -1
index 87b5f43c3c..b24db3b6da 100644
@@ -298,7 +298,7 @@ struct __rte_trace_stream_header {
 	rte_uuid_t uuid;
 	uint32_t lcore_id;
 	char thread_name[__RTE_TRACE_EMIT_STRING_LEN_MAX];
-} __rte_packed;
+};
 
 struct __rte_trace_header {
 	uint32_t offset;
lib/eal/x86/include/rte_memcpy.h +6 -6
index 42058e4a3f..46d34b8081 100644
@@ -67,15 +67,15 @@ rte_mov15_or_less(void *dst, const void *src, size_t n)
 	 * Use the following structs to avoid violating C standard
 	 * alignment requirements and to avoid strict aliasing bugs
 	 */
-	struct rte_uint64_alias {
+	struct __rte_packed_begin rte_uint64_alias {
 		uint64_t val;
-	} __rte_packed __rte_may_alias;
-	struct rte_uint32_alias {
+	} __rte_packed_end __rte_may_alias;
+	struct __rte_packed_begin rte_uint32_alias {
 		uint32_t val;
-	} __rte_packed __rte_may_alias;
-	struct rte_uint16_alias {
+	} __rte_packed_end __rte_may_alias;
+	struct __rte_packed_begin rte_uint16_alias {
 		uint16_t val;
-	} __rte_packed __rte_may_alias;
+	} __rte_packed_end __rte_may_alias;
 
 	void *ret = dst;
 	if (n & 8) {
Signature · 1 line
2.47.0.vfs.0.3
#248 lore raw

PATCH v9 26/30 lib/ipsec: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/ipsec/crypto.h | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)
lib/ipsec/crypto.h +22 -22
index 93d20aaaa0..dc6210a49a 100644
@@ -15,11 +15,11 @@
  * AES-CTR counter block format.
  */
 
-struct aesctr_cnt_blk {
+struct __rte_packed_begin aesctr_cnt_blk {
 	uint32_t nonce;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * CHACHA20-POLY1305 devices have some specific requirements
@@ -27,13 +27,13 @@ struct aesctr_cnt_blk {
   * Ideally that to be done by the driver itself.
   */
 
-struct aead_chacha20_poly1305_iv {
+struct __rte_packed_begin aead_chacha20_poly1305_iv {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_chacha20_poly1305_aad {
+struct __rte_packed_begin aead_chacha20_poly1305_aad {
 	uint32_t spi;
 	/*
 	 * RFC 4106, section 5:
@@ -45,25 +45,25 @@ struct aead_chacha20_poly1305_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct chacha20_poly1305_esph_iv {
+struct __rte_packed_begin chacha20_poly1305_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * AES-GCM devices have some specific requirements for IV and AAD formats.
   * Ideally that to be done by the driver itself.
   */
 
-struct aead_gcm_iv {
+struct __rte_packed_begin aead_gcm_iv {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_gcm_aad {
+struct __rte_packed_begin aead_gcm_aad {
 	uint32_t spi;
 	/*
 	 * RFC 4106, section 5:
@@ -75,34 +75,34 @@ struct aead_gcm_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct gcm_esph_iv {
+struct __rte_packed_begin gcm_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * AES-CCM devices have some specific requirements for IV and AAD formats.
   * Ideally that to be done by the driver itself.
   */
-union aead_ccm_salt {
+union __rte_packed_begin aead_ccm_salt {
 	uint32_t salt;
 	struct inner {
 		uint8_t salt8[3];
 		uint8_t ccm_flags;
 	} inner;
-} __rte_packed;
+} __rte_packed_end;
 
 
-struct aead_ccm_iv {
+struct __rte_packed_begin aead_ccm_iv {
 	uint8_t ccm_flags;
 	uint8_t salt[3];
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_ccm_aad {
+struct __rte_packed_begin aead_ccm_aad {
 	uint8_t padding[18];
 	uint32_t spi;
 	/*
@@ -115,12 +115,12 @@ struct aead_ccm_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct ccm_esph_iv {
+struct __rte_packed_begin ccm_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
 
 static inline void
Signature · 1 line
2.47.0.vfs.0.3
#249 lore raw

PATCH v9 27/30 lib/net: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/net/rte_arp.h      |  8 ++++----
 lib/net/rte_dtls.h     |  4 ++--
 lib/net/rte_esp.h      |  8 ++++----
 lib/net/rte_geneve.h   |  4 ++--
 lib/net/rte_gre.h      | 16 ++++++++--------
 lib/net/rte_gtp.h      | 20 ++++++++++----------
 lib/net/rte_ib.h       |  4 ++--
 lib/net/rte_icmp.h     | 12 ++++++------
 lib/net/rte_ip4.h      |  4 ++--
 lib/net/rte_ip6.h      | 14 +++++++-------
 lib/net/rte_l2tpv2.h   | 16 ++++++++--------
 lib/net/rte_macsec.h   |  8 ++++----
 lib/net/rte_mpls.h     |  4 ++--
 lib/net/rte_pdcp_hdr.h | 16 ++++++++--------
 lib/net/rte_ppp.h      |  4 ++--
 lib/net/rte_sctp.h     |  4 ++--
 lib/net/rte_tcp.h      |  4 ++--
 lib/net/rte_tls.h      |  4 ++--
 lib/net/rte_udp.h      |  4 ++--
 lib/net/rte_vxlan.h    | 28 ++++++++++++++--------------
 20 files changed, 93 insertions(+), 93 deletions(-)
lib/net/rte_arp.h +4 -4
index 668cea1704..e885a71292 100644
@@ -21,17 +21,17 @@ extern "C" {
 /**
  * ARP header IPv4 payload.
  */
-struct __rte_aligned(2) rte_arp_ipv4 {
+struct __rte_aligned(2) __rte_packed_begin rte_arp_ipv4 {
 	struct rte_ether_addr arp_sha;  /**< sender hardware address */
 	rte_be32_t            arp_sip;  /**< sender IP address */
 	struct rte_ether_addr arp_tha;  /**< target hardware address */
 	rte_be32_t            arp_tip;  /**< target IP address */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ARP header.
  */
-struct __rte_aligned(2) rte_arp_hdr {
+struct __rte_aligned(2) __rte_packed_begin rte_arp_hdr {
 	rte_be16_t arp_hardware; /**< format of hardware address */
 #define RTE_ARP_HRD_ETHER     1  /**< ARP Ethernet address format */
 
@@ -47,7 +47,7 @@ struct __rte_aligned(2) rte_arp_hdr {
 #define	RTE_ARP_OP_INVREPLY   9  /**< response identifying peer */
 
 	struct rte_arp_ipv4 arp_data;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Make a RARP packet based on MAC addr.
lib/net/rte_dtls.h +2 -2
index 246cd8a72d..1dd95ce899 100644
@@ -30,7 +30,7 @@
  * DTLS Header
  */
 __extension__
-struct rte_dtls_hdr {
+struct __rte_packed_begin rte_dtls_hdr {
 	/** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */
 	uint8_t type;
 	/** DTLS Version defined as RTE_DTLS_VERSION*. */
@@ -48,6 +48,6 @@ struct rte_dtls_hdr {
 #endif
 	/** The length (in bytes) of the following DTLS packet. */
 	rte_be16_t length;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_DTLS_H */
lib/net/rte_esp.h +4 -4
index 745a9847fe..2a0002f4d9 100644
@@ -16,17 +16,17 @@
 /**
  * ESP Header
  */
-struct rte_esp_hdr {
+struct __rte_packed_begin rte_esp_hdr {
 	rte_be32_t spi;  /**< Security Parameters Index */
 	rte_be32_t seq;  /**< packet sequence number */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ESP Trailer
  */
-struct rte_esp_tail {
+struct __rte_packed_begin rte_esp_tail {
 	uint8_t pad_len;     /**< number of pad bytes (0-255) */
 	uint8_t next_proto;  /**< IPv4 or IPv6 or next layer header */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_ESP_H_ */
lib/net/rte_geneve.h +2 -2
index eb2c85f1e9..f962c587ee 100644
@@ -34,7 +34,7 @@
  * More-bits (optional) variable length options.
  */
 __extension__
-struct rte_geneve_hdr {
+struct __rte_packed_begin rte_geneve_hdr {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t ver:2;		/**< Version. */
 	uint8_t opt_len:6;	/**< Options length. */
@@ -52,7 +52,7 @@ struct rte_geneve_hdr {
 	uint8_t vni[3];		/**< Virtual network identifier. */
 	uint8_t reserved2;	/**< Reserved. */
 	uint32_t opts[];	/**< Variable length options. */
-} __rte_packed;
+} __rte_packed_end;
 
 /* GENEVE ETH next protocol types */
 #define RTE_GENEVE_TYPE_ETH	0x6558 /**< Ethernet Protocol. */
lib/net/rte_gre.h +8 -8
index 1483e1b42d..768c4ce7b5 100644
@@ -23,7 +23,7 @@
  * GRE Header
  */
 __extension__
-struct rte_gre_hdr {
+struct __rte_packed_begin rte_gre_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint16_t res2:4; /**< Reserved */
 	uint16_t s:1;    /**< Sequence Number Present bit */
@@ -42,28 +42,28 @@ struct rte_gre_hdr {
 	uint16_t ver:3;  /**< Version Number */
 #endif
 	rte_be16_t proto;  /**< Protocol Type */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional field checksum in GRE header
  */
-struct rte_gre_hdr_opt_checksum_rsvd {
+struct __rte_packed_begin rte_gre_hdr_opt_checksum_rsvd {
 	rte_be16_t checksum;
 	rte_be16_t reserved1;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional field key in GRE header
  */
-struct rte_gre_hdr_opt_key {
+struct __rte_packed_begin rte_gre_hdr_opt_key {
 	rte_be32_t key;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional field sequence in GRE header
  */
-struct rte_gre_hdr_opt_sequence {
+struct __rte_packed_begin rte_gre_hdr_opt_sequence {
 	rte_be32_t sequence;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_GRE_H_ */
lib/net/rte_gtp.h +10 -10
index ab06e23a6e..0332d35c16 100644
@@ -24,7 +24,7 @@
  * No optional fields and next extension header.
  */
 __extension__
-struct rte_gtp_hdr {
+struct __rte_packed_begin rte_gtp_hdr {
 	union {
 		uint8_t gtp_hdr_info; /**< GTP header info */
 		struct {
@@ -48,21 +48,21 @@ struct rte_gtp_hdr {
 	uint8_t msg_type;     /**< GTP message type */
 	rte_be16_t plen;      /**< Total payload length */
 	rte_be32_t teid;      /**< Tunnel endpoint ID */
-} __rte_packed;
+} __rte_packed_end;
 
 /* Optional word of GTP header, present if any of E, S, PN is set. */
-struct rte_gtp_hdr_ext_word {
+struct __rte_packed_begin rte_gtp_hdr_ext_word {
 	rte_be16_t sqn;	      /**< Sequence Number. */
 	uint8_t npdu;	      /**< N-PDU number. */
 	uint8_t next_ext;     /**< Next Extension Header Type. */
-}  __rte_packed;
+}  __rte_packed_end;
 
 /**
  * Optional extension for GTP with next_ext set to 0x85
  * defined based on RFC 38415-g30.
  */
 __extension__
-struct rte_gtp_psc_generic_hdr {
+struct __rte_packed_begin rte_gtp_psc_generic_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t type:4;		/**< PDU type */
@@ -78,14 +78,14 @@ struct rte_gtp_psc_generic_hdr {
 	uint8_t spare:2;	/**< type specific spare bits */
 #endif
 	uint8_t data[0];	/**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional extension for GTP with next_ext set to 0x85
  * type0 defined based on RFC 38415-g30
  */
 __extension__
-struct rte_gtp_psc_type0_hdr {
+struct __rte_packed_begin rte_gtp_psc_type0_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t type:4;		/**< PDU type */
@@ -105,14 +105,14 @@ struct rte_gtp_psc_type0_hdr {
 	uint8_t ppp:1;		/**< Paging policy presence */
 #endif
 	uint8_t data[0];	/**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional extension for GTP with next_ext set to 0x85
  * type1 defined based on RFC 38415-g30
  */
 __extension__
-struct rte_gtp_psc_type1_hdr {
+struct __rte_packed_begin rte_gtp_psc_type1_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t type:4;		/**< PDU type */
@@ -134,7 +134,7 @@ struct rte_gtp_psc_type1_hdr {
 	uint8_t n_delay_ind:1;	/**< N3/N9 delay result presence */
 #endif
 	uint8_t data[0];	/**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
 
 /** GTP header length */
 #define RTE_ETHER_GTP_HLEN \
lib/net/rte_ib.h +2 -2
index a551f3753f..f1b455cea0 100644
@@ -22,7 +22,7 @@
  * IB Specification Vol 1-Release-1.4.
  */
 __extension__
-struct rte_ib_bth {
+struct __rte_packed_begin rte_ib_bth {
 	uint8_t	opcode;		/**< Opcode. */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t	tver:4;		/**< Transport Header Version. */
@@ -54,7 +54,7 @@ struct rte_ib_bth {
 	uint8_t	rsvd1:7;	/**< Reserved. */
 #endif
 	uint8_t	psn[3];		/**< Packet Sequence Number */
-} __rte_packed;
+} __rte_packed_end;
 
 /** RoCEv2 default port. */
 #define RTE_ROCEV2_DEFAULT_PORT 4791
lib/net/rte_icmp.h +6 -6
index e69d68ab6e..cca73b3733 100644
@@ -21,33 +21,33 @@
 /**
  * ICMP base header
  */
-struct rte_icmp_base_hdr {
+struct __rte_packed_begin rte_icmp_base_hdr {
 	uint8_t type;
 	uint8_t code;
 	rte_be16_t checksum;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ICMP echo header
  */
-struct rte_icmp_echo_hdr {
+struct __rte_packed_begin rte_icmp_echo_hdr {
 	struct rte_icmp_base_hdr base;
 	rte_be16_t identifier;
 	rte_be16_t sequence;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ICMP Header
  *
  * @see rte_icmp_echo_hdr which is similar.
  */
-struct rte_icmp_hdr {
+struct __rte_packed_begin rte_icmp_hdr {
 	uint8_t  icmp_type;     /* ICMP packet type. */
 	uint8_t  icmp_code;     /* ICMP packet code. */
 	rte_be16_t icmp_cksum;  /* ICMP packet checksum. */
 	rte_be16_t icmp_ident;  /* ICMP packet identifier. */
 	rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */
-} __rte_packed;
+} __rte_packed_end;
 
 /* ICMP packet types */
 #define RTE_ICMP_TYPE_ECHO_REPLY 0
lib/net/rte_ip4.h +2 -2
index f9b8333332..d4b38c513c 100644
@@ -39,7 +39,7 @@ extern "C" {
 /**
  * IPv4 Header
  */
-struct __rte_aligned(2) rte_ipv4_hdr {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv4_hdr {
 	__extension__
 	union {
 		uint8_t version_ihl;    /**< version and header length */
@@ -62,7 +62,7 @@ struct __rte_aligned(2) rte_ipv4_hdr {
 	rte_be16_t hdr_checksum;	/**< header checksum */
 	rte_be32_t src_addr;		/**< source address */
 	rte_be32_t dst_addr;		/**< destination address */
-} __rte_packed;
+} __rte_packed_end;
 
 /** Create IPv4 address */
 #define RTE_IPV4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \
lib/net/rte_ip6.h +7 -7
index 992ab5ee1f..92558a124a 100644
@@ -358,7 +358,7 @@ enum rte_ipv6_mc_scope {
 	RTE_IPV6_MC_SCOPE_ORGLOCAL = 0x08,
 	/** Global multicast scope. */
 	RTE_IPV6_MC_SCOPE_GLOBAL = 0x0e,
-} __rte_packed;
+};
 
 /**
  * Extract the IPv6 multicast scope value as defined in RFC 4291, section 2.7.
@@ -461,7 +461,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr *mac, const struct rte_ipv6_addr
 /**
  * IPv6 Header
  */
-struct __rte_aligned(2) rte_ipv6_hdr {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv6_hdr {
 	union {
 		rte_be32_t vtc_flow;        /**< IP version, traffic class & flow label. */
 		__extension__
@@ -484,7 +484,7 @@ struct __rte_aligned(2) rte_ipv6_hdr {
 	uint8_t  hop_limits;	/**< Hop limits. */
 	struct rte_ipv6_addr src_addr;	/**< IP address of source host. */
 	struct rte_ipv6_addr dst_addr;	/**< IP address of destination host(s). */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Check that the IPv6 header version field is valid according to RFC 8200 section 3.
@@ -508,7 +508,7 @@ static inline int rte_ipv6_check_version(const struct rte_ipv6_hdr *ip)
 /**
  * IPv6 Routing Extension Header
  */
-struct __rte_aligned(2) rte_ipv6_routing_ext {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
 	uint8_t type;				/**< Extension header type. */
@@ -523,7 +523,7 @@ struct __rte_aligned(2) rte_ipv6_routing_ext {
 		};
 	};
 	/* Next are 128-bit IPv6 address fields to describe segments. */
-} __rte_packed;
+} __rte_packed_end;
 
 /* IPv6 vtc_flow: IPv / TC / flow_label */
 #define RTE_IPV6_HDR_FL_SHIFT 0
@@ -752,12 +752,12 @@ rte_ipv6_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m,
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
-struct __rte_aligned(2) rte_ipv6_fragment_ext {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
 	rte_be16_t frag_data;	/**< All fragmentation data */
 	rte_be32_t id;		/**< Packet ID */
-} __rte_packed;
+} __rte_packed_end;
 
 /* IPv6 fragment extension header size */
 #define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
lib/net/rte_l2tpv2.h +8 -8
index ac16657856..728dc01506 100644
@@ -125,7 +125,7 @@ struct rte_l2tpv2_common_hdr {
  * L2TPv2 message Header contains all options(length, ns, nr,
  * offset size, offset padding).
  */
-struct rte_l2tpv2_msg_with_all_options {
+struct __rte_packed_begin rte_l2tpv2_msg_with_all_options {
 	rte_be16_t length;		/**< length(16) */
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -133,20 +133,20 @@ struct rte_l2tpv2_msg_with_all_options {
 	rte_be16_t nr;			/**< Nr(16) */
 	rte_be16_t offset_size;		/**< offset size(16) */
 	uint8_t   *offset_padding;	/**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * L2TPv2 message Header contains all options except length(ns, nr,
  * offset size, offset padding).
  */
-struct rte_l2tpv2_msg_without_length {
+struct __rte_packed_begin rte_l2tpv2_msg_without_length {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
 	rte_be16_t ns;			/**< Ns(16) */
 	rte_be16_t nr;			/**< Nr(16) */
 	rte_be16_t offset_size;		/**< offset size(16) */
 	uint8_t   *offset_padding;	/**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * L2TPv2 message Header contains all options except ns_nr(length,
@@ -176,12 +176,12 @@ struct rte_l2tpv2_msg_without_offset {
 /**
  * L2TPv2 message Header contains options offset size and offset padding.
  */
-struct rte_l2tpv2_msg_with_offset {
+struct __rte_packed_begin rte_l2tpv2_msg_with_offset {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
 	rte_be16_t offset_size;		/**< offset size(16) */
 	uint8_t   *offset_padding;	/**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * L2TPv2 message Header contains options ns and nr.
@@ -213,7 +213,7 @@ struct rte_l2tpv2_msg_without_all_options {
 /**
  * L2TPv2 Combined Message Header Format: Common Header + Options
  */
-struct rte_l2tpv2_combined_msg_hdr {
+struct __rte_packed_begin rte_l2tpv2_combined_msg_hdr {
 	struct rte_l2tpv2_common_hdr common; /**< common header */
 	union {
 		/** header with all options */
@@ -233,6 +233,6 @@ struct rte_l2tpv2_combined_msg_hdr {
 		/** header without all options */
 		struct rte_l2tpv2_msg_without_all_options type7;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* _RTE_L2TPV2_H_ */
lib/net/rte_macsec.h +4 -4
index beeeb8effe..c694c37b4b 100644
@@ -25,7 +25,7 @@
  * MACsec Header (SecTAG)
  */
 __extension__
-struct rte_macsec_hdr {
+struct __rte_packed_begin rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
 	 * Various bits of TCI and AN are masked using RTE_MACSEC_TCI_* and RTE_MACSEC_AN_MASK.
@@ -39,7 +39,7 @@ struct rte_macsec_hdr {
 	uint8_t short_length:6; /**< Short Length. */
 #endif
 	rte_be32_t packet_number; /**< Packet number to support replay protection. */
-} __rte_packed;
+} __rte_packed_end;
 
 /** SCI length in MACsec header if present. */
 #define RTE_MACSEC_SCI_LEN 8
@@ -48,8 +48,8 @@ struct rte_macsec_hdr {
  * MACsec SCI header (8 bytes) after the MACsec header
  * which is present if SC bit is set in tci_an.
  */
-struct rte_macsec_sci_hdr {
+struct __rte_packed_begin rte_macsec_sci_hdr {
 	uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_MACSEC_H */
lib/net/rte_mpls.h +2 -2
index 35a356efd3..53614a0b88 100644
@@ -18,7 +18,7 @@
  * MPLS header.
  */
 __extension__
-struct rte_mpls_hdr {
+struct __rte_packed_begin rte_mpls_hdr {
 	rte_be16_t tag_msb; /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t tag_lsb:4;  /**< Label(lsb). */
@@ -30,6 +30,6 @@ struct rte_mpls_hdr {
 	uint8_t tag_lsb:4;  /**< label(lsb) */
 #endif
 	uint8_t  ttl;       /**< Time to live. */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_MPLS_H_ */
lib/net/rte_pdcp_hdr.h +8 -8
index c22b66bf93..2e8da1e1d3 100644
@@ -56,7 +56,7 @@ enum rte_pdcp_pdu_type {
  * 6.2.2.1 Data PDU for SRBs
  */
 __extension__
-struct rte_pdcp_cp_data_pdu_sn_12_hdr {
+struct __rte_packed_begin rte_pdcp_cp_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 	uint8_t r : 4;		/**< Reserved */
@@ -65,13 +65,13 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr {
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 #endif
 	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
  */
 __extension__
-struct rte_pdcp_up_data_pdu_sn_12_hdr {
+struct __rte_packed_begin rte_pdcp_up_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 	uint8_t r : 3;		/**< Reserved */
@@ -82,13 +82,13 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr {
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 #endif
 	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
  */
 __extension__
-struct rte_pdcp_up_data_pdu_sn_18_hdr {
+struct __rte_packed_begin rte_pdcp_up_data_pdu_sn_18_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
 	uint8_t r : 5;		/**< Reserved */
@@ -100,13 +100,13 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr {
 #endif
 	uint8_t sn_15_8;	/**< Sequence number bits 8-15 */
 	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * 6.2.3.1 Control PDU for PDCP status report
  */
 __extension__
-struct rte_pdcp_up_ctrl_pdu_hdr {
+struct __rte_packed_begin rte_pdcp_up_ctrl_pdu_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t r : 4;		/**< Reserved */
 	uint8_t pdu_type : 3;	/**< Control PDU type */
@@ -134,6 +134,6 @@ struct rte_pdcp_up_ctrl_pdu_hdr {
 	 * in the Bitmap is 1.
 	 */
 	uint8_t bitmap[];
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_PDCP_HDR_H */
lib/net/rte_ppp.h +2 -2
index 63c72a9392..02bfb03c03 100644
@@ -17,10 +17,10 @@
 /**
  * PPP Header
  */
-struct rte_ppp_hdr {
+struct __rte_packed_begin rte_ppp_hdr {
 	uint8_t addr; /**< PPP address(8) */
 	uint8_t ctrl; /**< PPP control(8) */
 	rte_be16_t proto_id; /**< PPP protocol identifier(16) */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* _RTE_PPP_H_ */
lib/net/rte_sctp.h +2 -2
index e757c57db3..73051b94fd 100644
@@ -21,11 +21,11 @@
 /**
  * SCTP Header
  */
-struct rte_sctp_hdr {
+struct __rte_packed_begin rte_sctp_hdr {
 	rte_be16_t src_port; /**< Source port. */
 	rte_be16_t dst_port; /**< Destin port. */
 	rte_be32_t tag;      /**< Validation tag. */
 	rte_be32_t cksum;    /**< Checksum. */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_SCTP_H_ */
lib/net/rte_tcp.h +2 -2
index 1bcacbf038..fb0eb308f5 100644
@@ -21,7 +21,7 @@
 /**
  * TCP Header
  */
-struct rte_tcp_hdr {
+struct __rte_packed_begin rte_tcp_hdr {
 	rte_be16_t src_port; /**< TCP source port. */
 	rte_be16_t dst_port; /**< TCP destination port. */
 	rte_be32_t sent_seq; /**< TX data sequence number. */
@@ -31,7 +31,7 @@ struct rte_tcp_hdr {
 	rte_be16_t rx_win;   /**< RX flow control window. */
 	rte_be16_t cksum;    /**< TCP checksum. */
 	rte_be16_t tcp_urp;  /**< TCP urgent pointer, if any. */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * TCP Flags
lib/net/rte_tls.h +2 -2
index 595567e3e9..f27db3acb1 100644
@@ -28,13 +28,13 @@
  * TLS Header
  */
 __extension__
-struct rte_tls_hdr {
+struct __rte_packed_begin rte_tls_hdr {
 	/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
 	uint8_t type;
 	/** TLS Version defined as RTE_TLS_VERSION*. */
 	rte_be16_t version;
 	/** The length (in bytes) of the following TLS packet. */
 	rte_be16_t length;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_TLS_H */
lib/net/rte_udp.h +2 -2
index c01dad9c9b..94f5304e6d 100644
@@ -21,11 +21,11 @@
 /**
  * UDP Header
  */
-struct rte_udp_hdr {
+struct __rte_packed_begin rte_udp_hdr {
 	rte_be16_t src_port;    /**< UDP source port. */
 	rte_be16_t dst_port;    /**< UDP destination port. */
 	rte_be16_t dgram_len;   /**< UDP datagram length */
 	rte_be16_t dgram_cksum; /**< UDP datagram checksum */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_UDP_H_ */
lib/net/rte_vxlan.h +14 -14
index bd1c89835e..f59829b182 100644
@@ -27,13 +27,13 @@
  * Reserved fields (24 bits and 8 bits)
  */
 __extension__ /* no named member in struct */
-struct rte_vxlan_hdr {
+struct __rte_packed_begin rte_vxlan_hdr {
 	union {
 		rte_be32_t vx_flags; /**< flags (8 bits) + extensions (24 bits). */
-		struct {
+		struct __rte_packed_begin {
 			union {
 				uint8_t flags; /**< Default is I bit, others are extensions. */
-				struct {
+				struct __rte_packed_begin {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 					uint8_t flag_g:1,     /**< GBP bit. */
 						flag_rsvd:1,  /*   Reserved. */
@@ -51,11 +51,11 @@ struct rte_vxlan_hdr {
 						flag_rsvd:1,
 						flag_g:1;
 #endif
-				} __rte_packed;
+				} __rte_packed_end;
 			}; /* end of 1st byte */
 			union {
 				uint8_t rsvd0[3]; /* Reserved for extensions. */
-				struct {
+				struct __rte_packed_begin {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 					uint8_t rsvd0_gbp1:1, /*   Reserved. */
 						flag_d:1,     /**< GBP Don't Learn bit. */
@@ -71,7 +71,7 @@ struct rte_vxlan_hdr {
 #endif
 					union {
 						uint16_t policy_id; /**< GBP Identifier. */
-						struct {
+						struct __rte_packed_begin {
 							uint8_t rsvd0_gpe; /* Reserved. */
 							uint8_t proto; /**< GPE Next protocol. */
 								/* 0x01 : IPv4
@@ -79,23 +79,23 @@ struct rte_vxlan_hdr {
 								 * 0x03 : Ethernet
 								 * 0x04 : Network Service Header
 								 */
-						} __rte_packed;
+						} __rte_packed_end;
 					};
-				} __rte_packed;
+				} __rte_packed_end;
 			};
-		} __rte_packed;
+		} __rte_packed_end;
 	}; /* end of 1st 32-bit word */
 	union {
 		rte_be32_t vx_vni; /**< VNI (24 bits) + reserved (8 bits). */
-		struct {
+		struct __rte_packed_begin {
 			uint8_t    vni[3];   /**< VXLAN Identifier. */
 			union {
 				uint8_t    rsvd1;        /**< Reserved. */
 				uint8_t    last_rsvd;    /**< Reserved. */
 			};
-		} __rte_packed;
+		} __rte_packed_end;
 	}; /* end of 2nd 32-bit word */
-} __rte_packed;
+} __rte_packed_end;
 
 /** VXLAN tunnel header length. */
 #define RTE_ETHER_VXLAN_HLEN \
@@ -111,7 +111,7 @@ struct rte_vxlan_hdr {
  * Identifier and Reserved fields (16 bits and 8 bits).
  */
 __extension__ /* no named member in struct */
-struct rte_vxlan_gpe_hdr {
+struct __rte_packed_begin rte_vxlan_gpe_hdr {
 	union {
 		struct {
 			uint8_t vx_flags;    /**< flag (8). */
@@ -127,7 +127,7 @@ struct rte_vxlan_gpe_hdr {
 			uint8_t rsvd1;    /**< Reserved. */
 		};
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * @deprecated
Signature · 1 line
2.47.0.vfs.0.3
#250 lore raw

PATCH v9 28/30 lib/pipeline: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/pipeline/rte_table_action.c | 64 ++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 32 deletions(-)
lib/pipeline/rte_table_action.c +32 -32
index a431f8f128..3a408e81b8 100644
@@ -60,9 +60,9 @@ lb_cfg_check(struct rte_table_action_lb_config *cfg)
 	return 0;
 }
 
-struct lb_data {
+struct __rte_packed_begin lb_data {
 	uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE];
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 lb_apply(struct lb_data *data,
@@ -356,10 +356,10 @@ tm_cfg_check(struct rte_table_action_tm_config *tm)
 	return 0;
 }
 
-struct tm_data {
+struct __rte_packed_begin tm_data {
 	uint32_t queue_id;
 	uint32_t reserved;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 tm_apply_check(struct rte_table_action_tm_params *p,
@@ -465,11 +465,11 @@ struct encap_qinq_data {
 	((((uint64_t)(s)) & 0x1LLU) << 8) |                \
 	(((uint64_t)(ttl)) & 0xFFLLU)))
 
-struct __rte_aligned(2) encap_mpls_data {
+struct __rte_aligned(2) __rte_packed_begin encap_mpls_data {
 	struct rte_ether_hdr ether;
 	uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX];
 	uint32_t mpls_count;
-} __rte_packed;
+} __rte_packed_end;
 
 #define PPP_PROTOCOL_IP                                    0x0021
 
@@ -487,42 +487,42 @@ struct encap_pppoe_data {
 
 #define IP_PROTO_UDP                                       17
 
-struct __rte_aligned(2) encap_vxlan_ipv4_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv4_data {
 	struct rte_ether_hdr ether;
 	struct rte_ipv4_hdr ipv4;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_vxlan_ipv4_vlan_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv4_vlan_data {
 	struct rte_ether_hdr ether;
 	struct rte_vlan_hdr vlan;
 	struct rte_ipv4_hdr ipv4;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_vxlan_ipv6_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv6_data {
 	struct rte_ether_hdr ether;
 	struct rte_ipv6_hdr ipv6;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_vxlan_ipv6_vlan_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv6_vlan_data {
 	struct rte_ether_hdr ether;
 	struct rte_vlan_hdr vlan;
 	struct rte_ipv6_hdr ipv6;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_qinq_pppoe_data {
+struct __rte_aligned(2) __rte_packed_begin encap_qinq_pppoe_data {
 	struct rte_ether_hdr ether;
 	struct rte_vlan_hdr svlan;
 	struct rte_vlan_hdr cvlan;
 	struct pppoe_ppp_hdr pppoe_ppp;
-} __rte_packed;
+} __rte_packed_end;
 
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
@@ -1196,15 +1196,15 @@ nat_cfg_check(struct rte_table_action_nat_config *nat)
 	return 0;
 }
 
-struct nat_ipv4_data {
+struct __rte_packed_begin nat_ipv4_data {
 	uint32_t addr;
 	uint16_t port;
-} __rte_packed;
+} __rte_packed_end;
 
-struct nat_ipv6_data {
+struct __rte_packed_begin nat_ipv6_data {
 	struct rte_ipv6_addr addr;
 	uint16_t port;
-} __rte_packed;
+} __rte_packed_end;
 
 static size_t
 nat_data_size(struct rte_table_action_nat_config *nat __rte_unused,
@@ -1493,9 +1493,9 @@ ttl_cfg_check(struct rte_table_action_ttl_config *ttl)
 	return 0;
 }
 
-struct ttl_data {
+struct __rte_packed_begin ttl_data {
 	uint32_t n_packets;
-} __rte_packed;
+} __rte_packed_end;
 
 #define TTL_INIT(data, decrement)                         \
 	((data)->n_packets = (decrement) ? 1 : 0)
@@ -1576,10 +1576,10 @@ stats_cfg_check(struct rte_table_action_stats_config *stats)
 	return 0;
 }
 
-struct stats_data {
+struct __rte_packed_begin stats_data {
 	uint64_t n_packets;
 	uint64_t n_bytes;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 stats_apply(struct stats_data *data,
@@ -1602,9 +1602,9 @@ pkt_work_stats(struct stats_data *data,
 /**
  * RTE_TABLE_ACTION_TIME
  */
-struct time_data {
+struct __rte_packed_begin time_data {
 	uint64_t time;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 time_apply(struct time_data *data,
@@ -1649,7 +1649,7 @@ struct crypto_op_sym_iv_aad {
 	} iv_aad;
 };
 
-struct sym_crypto_data {
+struct __rte_packed_begin sym_crypto_data {
 
 	union {
 		struct {
@@ -1717,7 +1717,7 @@ struct sym_crypto_data {
 	/** Private data size to store cipher iv / aad. */
 	uint8_t iv_aad_data[32];
 
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 sym_crypto_cfg_check(struct rte_table_action_sym_crypto_config *cfg)
@@ -2052,9 +2052,9 @@ pkt_work_sym_crypto(struct rte_mbuf *mbuf, struct sym_crypto_data *data,
 /**
  * RTE_TABLE_ACTION_TAG
  */
-struct tag_data {
+struct __rte_packed_begin tag_data {
 	uint32_t tag;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 tag_apply(struct tag_data *data,
@@ -2096,9 +2096,9 @@ pkt4_work_tag(struct rte_mbuf *mbuf0,
 /**
  * RTE_TABLE_ACTION_DECAP
  */
-struct decap_data {
+struct __rte_packed_begin decap_data {
 	uint16_t n;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 decap_apply(struct decap_data *data,
Signature · 1 line
2.47.0.vfs.0.3
#251 lore raw

PATCH v9 29/30 lib/vhost: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/vhost/vhost_user.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/vhost/vhost_user.h +4 -4
index edf7adb3c0..9a905ee5f4 100644
@@ -143,7 +143,7 @@ struct vhost_user_config {
 	uint8_t region[VHOST_USER_MAX_CONFIG_SIZE];
 };
 
-typedef struct VhostUserMsg {
+typedef struct __rte_packed_begin VhostUserMsg {
 	union {
 		uint32_t frontend; /* a VhostUserRequest value */
 		uint32_t backend;  /* a VhostUserBackendRequest value*/
@@ -169,16 +169,16 @@ typedef struct VhostUserMsg {
 		struct vhost_user_config cfg;
 	} payload;
 	/* Nothing should be added after the payload */
-} __rte_packed VhostUserMsg;
+} __rte_packed_end VhostUserMsg;
 
 /* Note: this structure and VhostUserMsg can't be changed carelessly as
  * external message handlers rely on them.
  */
-struct __rte_packed vhu_msg_context {
+struct __rte_packed_begin vhu_msg_context {
 	VhostUserMsg msg;
 	int fds[VHOST_MEMORY_MAX_NREGIONS];
 	int fd_num;
-};
+} __rte_packed_end;
 
 #define VHOST_USER_HDR_SIZE offsetof(VhostUserMsg, payload.u64)
 
Signature · 1 line
2.47.0.vfs.0.3
#252 lore raw

PATCH v9 30/30 eal/include: deprecate macro __rte_packed

In reply to Andre Muezerie

Macro __rte_packed was marked as deprecated.

---
 lib/eal/include/rte_common.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
lib/eal/include/rte_common.h +13 -0
index d72f8590bd..40592f71b1 100644
@@ -99,6 +99,19 @@ typedef uint32_t unaligned_uint32_t;
 typedef uint16_t unaligned_uint16_t;
 #endif
 
+/**
+ * @deprecated
+ * @see __rte_packed_begin
+ * @see __rte_packed_end
+ *
+ * Force a structure to be packed
+ */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_packed RTE_DEPRECATED(__rte_packed)
+#else
+#define __rte_packed (RTE_DEPRECATED(__rte_packed) __attribute__((__packed__)))
+#endif
+
 /**
  * Force a structure to be packed
  * Usage:
Signature · 1 line
2.47.0.vfs.0.3
#253 lore raw

v10 cover fix packing of structs when building with MSVC

In reply to Tyler Retzlaff

MSVC struct packing is not compatible with GCC. Different alternatives were considered:

1) Have a macro __RTE_PACKED(decl) to which the struct/union is passed and the macro would define the struct/union with the appropriate packing attribute for the compiler in use.

Advantages:
* Can be placed in front of a struct, or even in the middle. Good for readability.
* Does not require a different macro to be placed at the end of the structure.

However, problems can arise when compiler directives are present in the struct, as they become arguments for __RTE_PACKED macro. This is not portable. Two problematic situations observed in the DPDK code:

a) #defines mentioned in the struct. In this situation we could just move the #define out of the struct.

b) #if/#ifdef/#elif mentioned in the struct.
This is a somewhat common pattern in structs where fields change based on endianness and would require code duplication to be handled, which makes the code hard to read and maintain.

2) Have macros __rte_msvc_pack_begin and __rte_msvc_pack_end which would be placed at the beginning and end of the struct/union respectively. Concerns were raised about having macros for specific compilers, or even having compiler names mentioned in the macros' names.

3) Instead of providing macros exclusively for MSVC and for GCC, have a macro __rte_packed_begin and __rte_packed_end which would be placed at the beginning and end of the struct/union respectively. With MSVC both macros end up having a purpose. With GCC and Clang only __rte_packed_end has a purpose, as can be seen below. This makes the solution generic and is the approach taken in this patchset.

   #ifdef RTE_TOOLCHAIN_MSVC
   #define __rte_packed_begin __pragma(pack(push, 1))
   #define __rte_packed_end __pragma(pack(pop))
   #else
   #define __rte_packed_begin
   #define __rte_packed_end __attribute__((__packed__))
   #endif

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Macro __rte_packed is marked deprecated and the two new macros represent the new way to enable packing in the DPDK code.

Script checkpatches.sh was enhanced to ensure that:
* __rte_packed_begin and __rte_packed_end show up in pairs.
* __rte_packed_begin is not used with enums.
* __rte_packed_begin is only used after struct, union, __rte_cache_aligned, __rte_cache_min_aligned or __rte_aligned

v10:
* added a note to commit message on patch 27/30 about storage size change for variables of type enum rte_ipv6_mc_scope.

v9:
* moved the deprecation of __rte_packed to the end of the patchset

v8:
* moved __rte_packed_begin after the struct and union keywords
* added more packing related tests to checkpatches.sh

v7:
* added __rte_packed back but marked it deprecated

v6:
* replace __rte_msvc_pack with __rte_packed_begin
* replace __rte_packed with __rte_packed_end
* update checkpatches.sh to ensure __rte_packed_begin and __rte_packed_end are used in pairs
* remove __rte_packed

v5:
* rebase on top of latest main

v4:
* add another missing __rte_msvc_pack to crypto/mlx5 patch
* correct commit message for duplicated packing in crypto/mlx5 patch

v3:
* add missing __rte_msvc_pack to crypto/mlx5
* fix commit messages to reference __rte_msvc_pack macro instead

    of __rte_msvc_pushpack(1)

v2:
* app/testpmd, remove packing from simple_gre_hdr
* net/iavf, remove packing from iavf_ipsec_crypto_pkt_metadata, simple_gre_hdr
* examples, remove packing from pkt_key_qinq, pkt_key_ipv4_5tuple,

    pkt_key_ipv6_5tuple, pkt_key_ipv4_addr, pkt_key_ipv6_addr

* eal, remove packing from rte_config, __rte_trace_stream_header

Andre Muezerie (30):
devtools: check packed attributes eal/include: add new packing macros app/test-pmd: remove unnecessary packed attributes app/test: replace packed attributes doc/guides: replace packed attributes drivers/baseband: replace packed attributes drivers/bus: replace packed attributes drivers/common: replace packed attributes drivers/compress: replace packed attributes drivers/crypto: replace packed attributes drivers/dma: replace packed attributes drivers/event: replace packed attributes drivers/mempool: replace packed attributes drivers/net: replace packed attributes drivers/raw: replace packed attributes drivers/regex: replace packed attributes drivers/vdpa: replace packed attributes examples/common: replace packed attributes examples/ip-pipeline: remove packed attributes examples/ipsec_secgw: replace packed attributes examples/l3fwd-power: replace packed attributes examples/l3fwd: replace packed attributes examples/ptpclient: replace packed attributes examples/vhost_blk: replace packed attributes lib/eal: replace packed attributes lib/ipsec: replace packed attributes lib/net: replace packed attributes lib/pipeline: replace packed attributes lib/vhost: replace packed attributes eal/include: deprecate macro __rte_packed

 app/test-pmd/csumonly.c                       |    2 +-
 app/test/test_efd.c                           |    4 +-
 app/test/test_hash.c                          |    4 +-
 app/test/test_member.c                        |    4 +-
 devtools/checkpatches.sh                      |   43 +
 doc/guides/nics/ark.rst                       |    4 +-
 .../prog_guide/packet_classif_access_ctrl.rst |    4 +-
 drivers/baseband/acc/acc_common.h             |   52 +-
 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   |   16 +-
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |    4 +-
 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  |    8 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   12 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |   32 +-
 drivers/bus/dpaa/include/fsl_bman.h           |   20 +-
 drivers/bus/dpaa/include/fsl_fman.h           |    4 +-
 drivers/bus/dpaa/include/fsl_qman.h           |  160 +-
 drivers/bus/ifpga/bus_ifpga_driver.h          |    8 +-
 drivers/bus/vmbus/rte_vmbus_reg.h             |  108 +-
 drivers/common/cnxk/hw/sdp.h                  |    4 +-
 drivers/common/cnxk/roc_npc.h                 |   16 +-
 drivers/common/cnxk/roc_npc_mcam_dump.c       |    4 +-
 drivers/common/cnxk/roc_platform.h            |    3 +-
 drivers/common/dpaax/compat.h                 |    3 -
 drivers/common/iavf/iavf_osdep.h              |    8 +-
 drivers/common/iavf/virtchnl_inline_ipsec.h   |   44 +-
 drivers/common/idpf/base/idpf_osdep.h         |    8 +-
 drivers/common/mlx5/mlx5_common_mr.h          |   16 +-
 drivers/common/mlx5/mlx5_common_utils.h       |    4 +-
 drivers/common/mlx5/mlx5_prm.h                |  120 +-
 drivers/common/qat/qat_adf/icp_qat_fw_la.h    |    8 +-
 drivers/common/qat/qat_common.h               |    8 +-
 drivers/compress/qat/qat_comp.h               |    4 +-
 drivers/crypto/caam_jr/caam_jr.c              |    4 +-
 drivers/crypto/caam_jr/caam_jr_desc.h         |   64 +-
 drivers/crypto/caam_jr/caam_jr_hw_specific.h  |   48 +-
 drivers/crypto/dpaa_sec/dpaa_sec.h            |   12 +-
 drivers/crypto/ionic/ionic_crypto_if.h        |   36 +-
 drivers/crypto/mlx5/mlx5_crypto.h             |    8 +-
 drivers/crypto/mlx5/mlx5_crypto_gcm.c         |    4 +-
 drivers/crypto/qat/qat_sym.h                  |    8 +-
 drivers/crypto/qat/qat_sym_session.h          |    4 +-
 drivers/dma/dpaa/dpaa_qdma.h                  |   20 +-
 drivers/dma/dpaa2/dpaa2_qdma.h                |   16 +-
 drivers/dma/ioat/ioat_hw_defs.h               |    4 +-
 drivers/event/octeontx/timvf_evdev.c          |    4 +-
 drivers/event/octeontx/timvf_evdev.h          |   12 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   16 +-
 drivers/net/ark/ark_ddm.h                     |    4 +-
 drivers/net/ark/ark_pktchkr.h                 |    8 +-
 drivers/net/ark/ark_pktdir.h                  |    5 +-
 drivers/net/ark/ark_pktgen.h                  |    4 +-
 drivers/net/ark/ark_udm.h                     |    4 +-
 drivers/net/atlantic/hw_atl/hw_atl_utils.h    |  120 +-
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |    8 +-
 drivers/net/avp/rte_avp_common.h              |   12 +-
 drivers/net/bnxt/bnxt.h                       |    8 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h        | 3344 ++++++++---------
 drivers/net/bnxt/tf_core/tf_resources.h       |   32 +-
 drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c   |   20 +-
 drivers/net/bonding/rte_eth_bond_8023ad.h     |   32 +-
 drivers/net/cnxk/cn10k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn20k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn9k_ethdev.h                |    4 +-
 drivers/net/cnxk/cnxk_rep_msg.h               |   64 +-
 drivers/net/dpaa/dpaa_rxtx.h                  |   28 +-
 drivers/net/dpaa/fmlib/fm_ext.h               |    4 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h  |    4 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   16 +-
 drivers/net/enic/base/vnic_devcmd.h           |   40 +-
 drivers/net/enic/base/vnic_flowman.h          |  120 +-
 drivers/net/gve/base/gve_desc.h               |   16 +-
 drivers/net/gve/base/gve_desc_dqo.h           |   32 +-
 drivers/net/gve/base/gve_osdep.h              |    3 -
 drivers/net/hns3/hns3_mbx.h                   |    8 +-
 drivers/net/hns3/hns3_rxtx.h                  |    4 +-
 drivers/net/i40e/base/i40e_osdep.h            |    8 +-
 drivers/net/iavf/iavf_ipsec_crypto.h          |   10 +-
 drivers/net/iavf/iavf_rxtx.c                  |    2 +-
 drivers/net/ice/base/ice_osdep.h              |   11 +-
 drivers/net/ionic/ionic_if.h                  |   72 +-
 drivers/net/memif/memif.h                     |   36 +-
 drivers/net/mlx4/mlx4_mr.h                    |   12 +-
 drivers/net/mlx5/hws/mlx5dr.h                 |    4 +-
 drivers/net/mlx5/mlx5.h                       |    4 +-
 drivers/net/mlx5/mlx5_flow.h                  |   16 +-
 drivers/net/mlx5/mlx5_hws_cnt.h               |    4 +-
 drivers/net/mlx5/mlx5_utils.h                 |   16 +-
 drivers/net/netvsc/hn_nvs.h                   |   72 +-
 drivers/net/netvsc/ndis.h                     |    8 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.h      |    4 +-
 drivers/net/nfp/flower/nfp_flower_flow.h      |    4 +-
 drivers/net/nfp/nfd3/nfp_nfd3.h               |    4 +-
 drivers/net/nfp/nfp_rxtx.h                    |    8 +-
 drivers/net/nfp/nfpcore/nfp_nsp.c             |    4 +-
 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c |   12 +-
 drivers/net/octeon_ep/otx_ep_mbox.h           |    4 +-
 drivers/net/octeontx/base/octeontx_pki_var.h  |    4 +-
 drivers/net/pfe/pfe_hif.h                     |    4 +-
 drivers/net/virtio/virtio.h                   |    4 +-
 drivers/net/virtio/virtio_cvq.h               |    8 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |    4 +-
 drivers/net/zxdh/zxdh_common.c                |    8 +-
 drivers/net/zxdh/zxdh_msg.h                   |   16 +-
 drivers/net/zxdh/zxdh_pci.h                   |    4 +-
 drivers/net/zxdh/zxdh_queue.h                 |   64 +-
 drivers/net/zxdh/zxdh_rxtx.h                  |    8 +-
 drivers/raw/ifpga/afu_pmd_n3000.h             |    8 +-
 drivers/raw/ifpga/base/opae_hw_api.h          |    4 +-
 drivers/regex/cn9k/cn9k_regexdev.c            |    4 +-
 drivers/regex/mlx5/mlx5_rxp.h                 |   16 +-
 drivers/vdpa/ifc/base/ifcvf.h                 |    4 +-
 drivers/vdpa/mlx5/mlx5_vdpa.h                 |    4 +-
 examples/common/neon/port_group.h             |    4 +-
 examples/ip_pipeline/cli.c                    |   10 +-
 examples/ipsec-secgw/ipsec.h                  |    4 +-
 examples/l3fwd-power/main.c                   |    8 +-
 examples/l3fwd/l3fwd_route.h                  |    8 +-
 examples/ptpclient/ptpclient.c                |   32 +-
 examples/vhost_blk/blk_spec.h                 |    4 +-
 lib/eal/common/eal_private.h                  |    2 +-
 lib/eal/include/rte_common.h                  |   23 +-
 lib/eal/include/rte_memory.h                  |    4 +-
 lib/eal/include/rte_memzone.h                 |    4 +-
 lib/eal/include/rte_trace_point.h             |    2 +-
 lib/eal/x86/include/rte_memcpy.h              |   12 +-
 lib/ipsec/crypto.h                            |   44 +-
 lib/net/rte_arp.h                             |    8 +-
 lib/net/rte_dtls.h                            |    4 +-
 lib/net/rte_esp.h                             |    8 +-
 lib/net/rte_geneve.h                          |    4 +-
 lib/net/rte_gre.h                             |   16 +-
 lib/net/rte_gtp.h                             |   20 +-
 lib/net/rte_ib.h                              |    4 +-
 lib/net/rte_icmp.h                            |   12 +-
 lib/net/rte_ip4.h                             |    4 +-
 lib/net/rte_ip6.h                             |   14 +-
 lib/net/rte_l2tpv2.h                          |   16 +-
 lib/net/rte_macsec.h                          |    8 +-
 lib/net/rte_mpls.h                            |    4 +-
 lib/net/rte_pdcp_hdr.h                        |   16 +-
 lib/net/rte_ppp.h                             |    4 +-
 lib/net/rte_sctp.h                            |    4 +-
 lib/net/rte_tcp.h                             |    4 +-
 lib/net/rte_tls.h                             |    4 +-
 lib/net/rte_udp.h                             |    4 +-
 lib/net/rte_vxlan.h                           |   28 +-
 lib/pipeline/rte_table_action.c               |   64 +-
 lib/vhost/vhost_user.h                        |    8 +-
 148 files changed, 2952 insertions(+), 2897 deletions(-)

--
2.47.0.vfs.0.3

#254 lore raw

PATCH v10 1/30 devtools: check packed attributes

Ensure __rte_packed_begin and __rte_packed_end show up in pairs when checking patches.

---
 devtools/checkpatches.sh | 43 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
devtools/checkpatches.sh +43 -0
index 4a8591be22..7868f5e522 100755
@@ -202,6 +202,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid use of __rte_packed_begin with enums
+	awk -v FOLDERS='lib drivers app examples' \
+		-v EXPRESSIONS='enum.*__rte_packed_begin' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using __rte_packed_begin with enum is not allowed' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# forbid use of experimental build flag except in examples
 	awk -v FOLDERS='lib drivers app' \
 		-v EXPRESSIONS='-DALLOW_EXPERIMENTAL_API allow_experimental_apis' \
@@ -362,6 +370,33 @@ check_aligned_attributes() { # <patch>
 	return $res
 }
 
+check_packed_attributes() { # <patch>
+	res=0
+
+	if [ $(grep -E '^\+.*__rte_packed_begin' "$1" | \
+			grep -vE '\<struct[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<union[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<__rte_cache_aligned[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<__rte_cache_min_aligned[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<__rte_aligned\(.*\)[[:space:]]*__rte_packed_begin\>' | \
+			wc -l) != 0 ]; then
+		echo "Please use __rte_packed_begin only after struct, union," \
+			 " __rte_cache_aligned, __rte_cache_min_aligned or __rte_aligned."
+		res=1
+	fi
+
+	begin_count=$(grep '__rte_packed_begin' "$1" | \
+			wc -l)
+	end_count=$(grep '__rte_packed_end' "$1" | \
+			wc -l)
+	if [ $begin_count != $end_count ]; then
+		echo "__rte_packed_begin and __rte_packed_end mismatch. They should always be used in pairs."
+		res=1
+	fi
+
+	return $res
+}
+
 check_release_notes() { # <patch>
 	rel_notes_prefix=doc/guides/rel_notes/release_
 	IFS=. read year month release < VERSION
@@ -479,6 +514,14 @@ check () { # <patch-file> <commit>
 		ret=1
 	fi
 
+	! $verbose || printf '\nChecking packed attributes:\n'
+	report=$(check_packed_attributes "$tmpinput")
+	if [ $? -ne 0 ] ; then
+		$headline_printed || print_headline "$subject"
+		printf '%s\n' "$report"
+		ret=1
+	fi
+
 	! $verbose || printf '\nChecking release notes updates:\n'
 	report=$(check_release_notes "$tmpinput")
 	if [ $? -ne 0 ] ; then
Signature · 1 line
2.47.0.vfs.0.3
#255 lore raw

PATCH v10 2/30 eal/include: add new packing macros

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Add macro __rte_packed_begin which can be used to push existing pack value and set packing to 1-byte. Add macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/eal/include/rte_common.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/eal/include/rte_common.h +8 -2
index 4d299f2b36..d72f8590bd 100644
@@ -101,11 +101,17 @@ typedef uint16_t unaligned_uint16_t;
 
 /**
  * Force a structure to be packed
+ * Usage:
+ *     struct __rte_packed_begin mystruct { ... } __rte_packed_end;
+ *     union __rte_packed_begin myunion { ... } __rte_packed_end;
+ * Note: alignment attributes when present should precede __rte_packed_begin.
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_packed
+#define __rte_packed_begin __pragma(pack(push, 1))
+#define __rte_packed_end __pragma(pack(pop))
 #else
-#define __rte_packed __attribute__((__packed__))
+#define __rte_packed_begin
+#define __rte_packed_end __attribute__((__packed__))
 #endif
 
 /**
Signature · 1 line
2.47.0.vfs.0.3
#256 lore raw

PATCH v10 3/30 app/test-pmd: remove unnecessary packed attributes

In reply to Andre Muezerie

Removed __rte_packed attribute from structure that is naturally packed already.

---
 app/test-pmd/csumonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/csumonly.c +1 -1
index 2246c22e8e..d77a140641 100644
@@ -92,7 +92,7 @@ struct testpmd_offload_info {
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-} __rte_packed;
+};
 
 static uint16_t
 get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off,
Signature · 1 line
2.47.0.vfs.0.3
#257 lore raw

PATCH v10 4/30 app/test: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 app/test/test_efd.c    | 4 ++--
 app/test/test_hash.c   | 4 ++--
 app/test/test_member.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
app/test/test_efd.c +2 -2
index 1c0986b9bc..4a4379c563 100644
@@ -33,13 +33,13 @@ test_efd(void)
 static unsigned int test_socket_id;
 
 /* 5-tuple key type */
-struct flow_key {
+struct __rte_packed_begin flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
 	uint16_t port_src;
 	uint16_t port_dst;
 	uint8_t proto;
-} __rte_packed;
+} __rte_packed_end;
 
 RTE_LOG_REGISTER(efd_logtype_test, test.efd, INFO);
 
app/test/test_hash.c +2 -2
index 65b9cad93c..6b5ef2d1e5 100644
@@ -79,13 +79,13 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,
  * Should be packed to avoid holes with potentially
  * undefined content in the middle.
  */
-struct flow_key {
+struct __rte_packed_begin flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
 	uint16_t port_src;
 	uint16_t port_dst;
 	uint32_t proto;
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * Hash function that always returns the same value, to easily test what
app/test/test_member.c +2 -2
index 5a4d2750db..a93787a10c 100644
@@ -32,13 +32,13 @@ struct rte_member_setsum *setsum_vbf;
 struct rte_member_setsum *setsum_sketch;
 
 /* 5-tuple key type */
-struct flow_key {
+struct __rte_packed_begin flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
 	uint16_t port_src;
 	uint16_t port_dst;
 	uint8_t proto;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Set ID Macros for multimatch test usage */
 #define M_MATCH_S 1	/* Not start with 0 since by default 0 means no match */
Signature · 1 line
2.47.0.vfs.0.3
#258 lore raw

PATCH v10 5/30 doc/guides: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 doc/guides/nics/ark.rst                              | 4 ++--
 doc/guides/prog_guide/packet_classif_access_ctrl.rst | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
doc/guides/nics/ark.rst +2 -2
index a9f6d4cdb8..6aabde2ed5 100644
@@ -172,10 +172,10 @@ during RX from user meta data coming from FPGA hardware.
    };
 
    /* RX tuser field based on user's hardware */
-   struct user_rx_meta {
+   struct __rte_packed_begin user_rx_meta {
       uint64_t timestamp;
       uint32_t rss;
-   } __rte_packed;
+   } __rte_packed_end;
 
    /* Create ark_user_extension object for use in other hook functions */
    void *rte_pmd_ark_dev_init(struct rte_eth_dev * dev,
doc/guides/prog_guide/packet_classif_access_ctrl.rst +2 -2
index c8844d0616..e2cd60fb47 100644
@@ -154,14 +154,14 @@ To define classification for the IPv6 2-tuple: <protocol, IPv6 source address> o
 
 .. code-block:: c
 
-    struct rte_ipv6_hdr {
+    struct __rte_packed_begin rte_ipv6_hdr {
         uint32_t vtc_flow;     /* IP version, traffic class & flow label. */
         uint16_t payload_len;  /* IP packet length - includes sizeof(ip_header). */
         uint8_t proto;         /* Protocol, next header. */
         uint8_t hop_limits;    /* Hop limits. */
         uint8_t src_addr[16];  /* IP address of source host. */
         uint8_t dst_addr[16];  /* IP address of destination host(s). */
-    } __rte_packed;
+    } __rte_packed_end;
 
 The following array of field definitions can be used:
 
Signature · 1 line
2.47.0.vfs.0.3
#259 lore raw

PATCH v10 6/30 drivers/baseband: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/baseband/acc/acc_common.h             | 52 +++++++++----------
 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   | 16 +++---
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |  4 +-
 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  |  8 +--
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  | 12 ++---
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    | 32 ++++++------
 6 files changed, 62 insertions(+), 62 deletions(-)
drivers/baseband/acc/acc_common.h +26 -26
index bf218332be..a49b154a0c 100644
@@ -160,7 +160,7 @@ extern int acc_common_logtype;
 	RTE_LOG_LINE(level, ACC_COMMON, __VA_ARGS__)
 
 /* ACC100 DMA Descriptor triplet */
-struct acc_dma_triplet {
+struct __rte_packed_begin acc_dma_triplet {
 	uint64_t address;
 	uint32_t blen:20,
 		res0:4,
@@ -168,7 +168,7 @@ struct acc_dma_triplet {
 		dma_ext:1,
 		res1:2,
 		blkid:4;
-} __rte_packed;
+} __rte_packed_end;
 
 
 /* ACC100 Queue Manager Enqueue PCI Register */
@@ -183,7 +183,7 @@ union acc_enqueue_reg_fmt {
 };
 
 /* FEC 4G Uplink Frame Control Word */
-struct __rte_packed acc_fcw_td {
+struct __rte_packed_begin acc_fcw_td {
 	uint8_t fcw_ver:4,
 		num_maps:4; /* Unused in ACC100 */
 	uint8_t filler:6, /* Unused in ACC100 */
@@ -220,10 +220,10 @@ struct __rte_packed acc_fcw_td {
 				rsrvd4:10;
 		};
 	};
-};
+} __rte_packed_end;
 
 /* FEC 4G Downlink Frame Control Word */
-struct __rte_packed acc_fcw_te {
+struct __rte_packed_begin acc_fcw_te {
 	uint16_t k_neg;
 	uint16_t k_pos;
 	uint8_t c_neg;
@@ -251,10 +251,10 @@ struct __rte_packed acc_fcw_te {
 	uint8_t code_block_mode:1,
 		rsrvd8:7;
 	uint64_t rsrvd9;
-};
+} __rte_packed_end;
 
 /* FEC 5GNR Downlink Frame Control Word */
-struct __rte_packed acc_fcw_le {
+struct __rte_packed_begin acc_fcw_le {
 	uint32_t FCWversion:4,
 		qm:4,
 		nfiller:11,
@@ -279,10 +279,10 @@ struct __rte_packed acc_fcw_le {
 	uint32_t res6;
 	uint32_t res7;
 	uint32_t res8;
-};
+} __rte_packed_end;
 
 /* FEC 5GNR Uplink Frame Control Word */
-struct __rte_packed acc_fcw_ld {
+struct __rte_packed_begin acc_fcw_ld {
 	uint32_t FCWversion:4,
 		qm:4,
 		nfiller:11,
@@ -326,10 +326,10 @@ struct __rte_packed acc_fcw_ld {
 		tb_crc_select:2, /* Not supported in ACC100 */
 		dec_llrclip:2,  /* Not supported in VRB1 */
 		tb_trailer_size:20; /* Not supported in ACC100 */
-};
+} __rte_packed_end;
 
 /* FFT Frame Control Word */
-struct __rte_packed acc_fcw_fft {
+struct __rte_packed_begin acc_fcw_fft {
 	uint32_t in_frame_size:16,
 		leading_pad_size:16;
 	uint32_t out_frame_size:16,
@@ -351,10 +351,10 @@ struct __rte_packed acc_fcw_fft {
 		power_shift:4,
 		power_en:1,
 		res:19;
-};
+} __rte_packed_end;
 
 /* FFT Frame Control Word. */
-struct __rte_packed acc_fcw_fft_3 {
+struct __rte_packed_begin acc_fcw_fft_3 {
 	uint32_t in_frame_size:16,
 		leading_pad_size:16;
 	uint32_t out_frame_size:16,
@@ -381,11 +381,11 @@ struct __rte_packed acc_fcw_fft_3 {
 	uint16_t cs_theta_0[ACC_MAX_CS];
 	uint32_t cs_theta_d[ACC_MAX_CS];
 	int8_t cs_time_offset[ACC_MAX_CS];
-};
+} __rte_packed_end;
 
 
 /* MLD-TS Frame Control Word */
-struct __rte_packed acc_fcw_mldts {
+struct __rte_packed_begin acc_fcw_mldts {
 	uint32_t fcw_version:4,
 		res0:12,
 		nrb:13, /* 1 to 1925 */
@@ -409,7 +409,7 @@ struct __rte_packed acc_fcw_mldts {
 	uint32_t pad2;
 	uint32_t pad3;
 	uint32_t pad4;
-};
+} __rte_packed_end;
 
 /* DMA Response Descriptor */
 union acc_dma_rsp_desc {
@@ -435,7 +435,7 @@ union acc_dma_rsp_desc {
 };
 
 /* DMA Request Descriptor */
-struct __rte_packed acc_dma_req_desc {
+struct __rte_packed_begin acc_dma_req_desc {
 	union {
 		struct{
 			uint32_t type:4,
@@ -496,7 +496,7 @@ struct __rte_packed acc_dma_req_desc {
 		};
 		uint64_t pad3[ACC_DMA_DESC_PADDINGS]; /* pad to 64 bits */
 	};
-};
+} __rte_packed_end;
 
 /* ACC100 DMA Descriptor */
 union acc_dma_desc {
@@ -506,7 +506,7 @@ union acc_dma_desc {
 };
 
 /* Union describing Info Ring entry */
-union acc_info_ring_data {
+union __rte_packed_begin acc_info_ring_data {
 	uint32_t val;
 	struct {
 		union {
@@ -534,25 +534,25 @@ union acc_info_ring_data {
 		uint32_t loop_vrb2: 1;
 		uint32_t valid_vrb2: 1;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_packed acc_pad_ptr {
+struct __rte_packed_begin acc_pad_ptr {
 	void *op_addr;
 	uint64_t pad1;  /* pad to 64 bits */
-};
+} __rte_packed_end;
 
-struct __rte_packed acc_ptrs {
+struct __rte_packed_begin acc_ptrs {
 	struct acc_pad_ptr ptr[ACC_COMPANION_PTRS];
-};
+} __rte_packed_end;
 
 /* Union describing Info Ring entry */
-union acc_harq_layout_data {
+union __rte_packed_begin acc_harq_layout_data {
 	uint32_t val;
 	struct {
 		uint16_t offset;
 		uint16_t size0;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Structure with details about RTE_BBDEV_EVENT_DEQUEUE event. It's passed to
drivers/baseband/fpga_5gnr_fec/agx100_pmd.h +8 -8
index 5e562376c9..06332c780b 100644
@@ -49,7 +49,7 @@ enum {
 };
 
 /* AGX100 TX Slice Descriptor. */
-struct __rte_packed agx100_input_slice_desc {
+struct __rte_packed_begin agx100_input_slice_desc {
 	uint32_t input_start_addr_lo;
 	uint32_t input_start_addr_hi;
 	uint32_t input_slice_length:21,
@@ -58,10 +58,10 @@ struct __rte_packed agx100_input_slice_desc {
 		start_of_pkt:1;
 	uint32_t input_slice_time_stamp:31,
 		input_c:1;
-};
+} __rte_packed_end;
 
 /* AGX100 RX Slice Descriptor. */
-struct __rte_packed agx100_output_slice_desc {
+struct __rte_packed_begin agx100_output_slice_desc {
 	uint32_t output_start_addr_lo;
 	uint32_t output_start_addr_hi;
 	uint32_t output_slice_length:21,
@@ -70,10 +70,10 @@ struct __rte_packed agx100_output_slice_desc {
 		start_of_pkt:1;
 	uint32_t output_slice_time_stamp:31,
 		output_c:1;
-};
+} __rte_packed_end;
 
 /* AGX100 DL DMA Encoding Request Descriptor. */
-struct __rte_packed agx100_dma_enc_desc {
+struct __rte_packed_begin agx100_dma_enc_desc {
 	uint32_t done:1, /**< 0: not completed 1: completed. */
 		rsrvd0:17,
 		error_msg:2,
@@ -161,10 +161,10 @@ struct __rte_packed agx100_dma_enc_desc {
 		uint8_t sw_ctxt[AGX100_RING_DESC_LEN_UNIT_BYTES *
 					(AGX100_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* AGX100 UL DMA Decoding Request Descriptor. */
-struct __rte_packed agx100_dma_dec_desc {
+struct __rte_packed_begin agx100_dma_dec_desc {
 	uint32_t done:1, /**< 0: not completed 1: completed. */
 		tb_crc_pass:1, /**< 0: doesn't pass 1: pass. */
 		cb_crc_all_pass:1, /**< 0: doesn't pass 1: pass. */
@@ -262,7 +262,7 @@ struct __rte_packed agx100_dma_dec_desc {
 		uint8_t sw_ctxt[AGX100_RING_DESC_LEN_UNIT_BYTES *
 					(AGX100_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* AGX100 DMA Descriptor. */
 union agx100_dma_desc {
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +2 -2
index 10a19e4dec..80db1b8832 100644
@@ -89,7 +89,7 @@ enum {
 };
 
 /* FPGA 5GNR Ring Control Register. */
-struct __rte_packed fpga_5gnr_ring_ctrl_reg {
+struct __rte_packed_begin fpga_5gnr_ring_ctrl_reg {
 	uint64_t ring_base_addr;
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
@@ -107,7 +107,7 @@ struct __rte_packed fpga_5gnr_ring_ctrl_reg {
 	uint16_t rsrvd3;
 	uint16_t head_point;
 	uint16_t rsrvd4;
-};
+} __rte_packed_end;
 
 /* Private data structure for each FPGA 5GNR device. */
 struct fpga_5gnr_fec_device {
drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h +4 -4
index 9a488ae8d6..e845a6e2b8 100644
@@ -46,7 +46,7 @@ enum {
 };
 
 /* VC 5GNR FPGA FEC DMA Encoding Request Descriptor. */
-struct __rte_packed vc_5gnr_dma_enc_desc {
+struct __rte_packed_begin vc_5gnr_dma_enc_desc {
 	uint32_t done:1,
 		rsrvd0:7,
 		error:4,
@@ -84,10 +84,10 @@ struct __rte_packed vc_5gnr_dma_enc_desc {
 		uint8_t sw_ctxt[VC_5GNR_RING_DESC_LEN_UNIT_BYTES *
 					(VC_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* VC 5GNR FPGA DPC FEC DMA Decoding Request Descriptor. */
-struct __rte_packed vc_5gnr_dma_dec_desc {
+struct __rte_packed_begin vc_5gnr_dma_dec_desc {
 	uint32_t done:1,
 		iter:5,
 		et_pass:1,
@@ -128,7 +128,7 @@ struct __rte_packed vc_5gnr_dma_dec_desc {
 
 		uint32_t sw_ctxt[8 * (VC_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* Vista Creek 5GNR DMA Descriptor. */
 union vc_5gnr_dma_desc {
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +6 -6
index ed21a18b62..04c1f95180 100644
@@ -114,7 +114,7 @@ enum {
 };
 
 /* FPGA LTE FEC DMA Encoding Request Descriptor */
-struct __rte_packed fpga_dma_enc_desc {
+struct __rte_packed_begin fpga_dma_enc_desc {
 	uint32_t done:1,
 		rsrvd0:11,
 		error:4,
@@ -148,10 +148,10 @@ struct __rte_packed fpga_dma_enc_desc {
 		uint8_t sw_ctxt[FPGA_RING_DESC_LEN_UNIT_BYTES *
 					(FPGA_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* FPGA LTE FEC DMA Decoding Request Descriptor */
-struct __rte_packed fpga_dma_dec_desc {
+struct __rte_packed_begin fpga_dma_dec_desc {
 	uint32_t done:1,
 		iter:5,
 		rsrvd0:2,
@@ -188,7 +188,7 @@ struct __rte_packed fpga_dma_dec_desc {
 
 		uint32_t sw_ctxt[8 * (FPGA_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* FPGA LTE DMA Descriptor */
 union fpga_dma_desc {
@@ -197,7 +197,7 @@ union fpga_dma_desc {
 };
 
 /* FPGA LTE FEC Ring Control Register */
-struct __rte_packed fpga_ring_ctrl_reg {
+struct __rte_packed_begin fpga_ring_ctrl_reg {
 	uint64_t ring_base_addr;
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
@@ -216,7 +216,7 @@ struct __rte_packed fpga_ring_ctrl_reg {
 	uint16_t head_point;
 	uint16_t rsrvd4;
 
-};
+} __rte_packed_end;
 
 /* Private data structure for each FPGA FEC device */
 struct fpga_lte_fec_device {
drivers/baseband/la12xx/bbdev_la12xx_ipc.h +16 -16
index b6a7f677d0..a855c43efa 100644
@@ -93,7 +93,7 @@ typedef struct {
 #define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
 
 /** buffer ring common metadata */
-typedef struct ipc_bd_ring_md {
+typedef struct __rte_packed_begin ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
 					  *  which flip for each Ring wrapping
 					  */
@@ -102,10 +102,10 @@ typedef struct ipc_bd_ring_md {
 					  */
 	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
 	uint32_t msg_size;	/**< Size of the each buffer */
-} __rte_packed ipc_br_md_t;
+} __rte_packed_end ipc_br_md_t;
 
 /** IPC buffer descriptor */
-typedef struct ipc_buffer_desc {
+typedef struct __rte_packed_begin ipc_buffer_desc {
 	union {
 		uint64_t host_virt;	/**< msg's host virtual address */
 		struct {
@@ -115,9 +115,9 @@ typedef struct ipc_buffer_desc {
 	};
 	uint32_t modem_ptr;	/**< msg's modem physical address */
 	uint32_t len;		/**< msg len */
-} __rte_packed ipc_bd_t;
+} __rte_packed_end ipc_bd_t;
 
-typedef struct ipc_channel {
+typedef struct __rte_packed_begin ipc_channel {
 	uint32_t ch_id;		/**< Channel id */
 	ipc_br_md_t md;			/**< Metadata for BD ring */
 	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
@@ -134,22 +134,22 @@ typedef struct ipc_channel {
 					  * circular buffer size
 					  */
 	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
-} __rte_packed ipc_ch_t;
+} __rte_packed_end ipc_ch_t;
 
-typedef struct ipc_instance {
+typedef struct __rte_packed_begin ipc_instance {
 	uint32_t instance_id;		/**< instance id, use to init this
 					  * instance by ipc_init API
 					  */
 	uint32_t initialized;		/**< Set in ipc_init */
 	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
 		/**< Channel descriptors in this instance */
-} __rte_packed ipc_instance_t;
+} __rte_packed_end ipc_instance_t;
 
-typedef struct ipc_metadata {
+typedef struct __rte_packed_begin ipc_metadata {
 	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
 	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
 	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
-} __rte_packed ipc_metadata_t;
+} __rte_packed_end ipc_metadata_t;
 
 typedef struct ipc_channel_us_priv {
 	int32_t		eventfd;
@@ -221,24 +221,24 @@ struct bbdev_ipc_dequeue_op {
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
  */
-typedef struct host_ipc_params {
+typedef struct __rte_packed_begin host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
 	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
-} __rte_packed host_ipc_params_t;
+} __rte_packed_end host_ipc_params_t;
 
-struct hif_ipc_regs {
+struct __rte_packed_begin hif_ipc_regs {
 	uint32_t ipc_mdata_offset;
 	uint32_t ipc_mdata_size;
-} __rte_packed;
+} __rte_packed_end;
 
-struct gul_hif {
+struct __rte_packed_begin gul_hif {
 	uint32_t ver;
 	uint32_t hif_ver;
 	uint32_t status;
 	volatile uint32_t host_ready;
 	volatile uint32_t mod_ready;
 	struct hif_ipc_regs ipc_regs;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif
Signature · 1 line
2.47.0.vfs.0.3
#260 lore raw

PATCH v10 7/30 drivers/bus: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/bus/dpaa/include/fsl_bman.h  |  20 ++--
 drivers/bus/dpaa/include/fsl_fman.h  |   4 +-
 drivers/bus/dpaa/include/fsl_qman.h  | 160 +++++++++++++--------------
 drivers/bus/ifpga/bus_ifpga_driver.h |   8 +-
 drivers/bus/vmbus/rte_vmbus_reg.h    | 108 +++++++++---------
 5 files changed, 150 insertions(+), 150 deletions(-)
drivers/bus/dpaa/include/fsl_bman.h +10 -10
index 34d7eb32ce..c0760149e1 100644
@@ -86,7 +86,7 @@ static inline dma_addr_t bm_buf_addr(const struct bm_buffer *buf)
 	} while (0)
 
 /* See 1.5.3.5.4: "Release Command" */
-struct bm_rcr_entry {
+struct __rte_packed_begin bm_rcr_entry {
 	union {
 		struct {
 			u8 __dont_write_directly__verb;
@@ -95,7 +95,7 @@ struct bm_rcr_entry {
 		};
 		struct bm_buffer bufs[8];
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_RCR_VERB_VBIT		0x80
 #define BM_RCR_VERB_CMD_MASK		0x70	/* one of two values; */
 #define BM_RCR_VERB_CMD_BPID_SINGLE	0x20
@@ -104,20 +104,20 @@ struct bm_rcr_entry {
 
 /* See 1.5.3.1: "Acquire Command" */
 /* See 1.5.3.2: "Query Command" */
-struct bm_mcc_acquire {
+struct __rte_packed_begin bm_mcc_acquire {
 	u8 bpid;
 	u8 __reserved1[62];
-} __packed;
-struct bm_mcc_query {
+} __rte_packed_end;
+struct __rte_packed_begin bm_mcc_query {
 	u8 __reserved2[63];
-} __packed;
-struct bm_mc_command {
+} __rte_packed_end;
+struct __rte_packed_begin bm_mc_command {
 	u8 __dont_write_directly__verb;
 	union {
 		struct bm_mcc_acquire acquire;
 		struct bm_mcc_query query;
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_MCC_VERB_VBIT		0x80
 #define BM_MCC_VERB_CMD_MASK		0x70	/* where the verb contains; */
 #define BM_MCC_VERB_CMD_ACQUIRE		0x10
@@ -136,7 +136,7 @@ struct bm_pool_state {
 	} as, ds;
 };
 
-struct bm_mc_result {
+struct __rte_packed_begin bm_mc_result {
 	union {
 		struct {
 			u8 verb;
@@ -152,7 +152,7 @@ struct bm_mc_result {
 		} acquire;
 		struct bm_pool_state query;
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_MCR_VERB_VBIT		0x80
 #define BM_MCR_VERB_CMD_MASK		BM_MCC_VERB_CMD_MASK
 #define BM_MCR_VERB_CMD_ACQUIRE		BM_MCC_VERB_CMD_ACQUIRE
drivers/bus/dpaa/include/fsl_fman.h +2 -2
index 5a9750ad0c..7acdcfc7f0 100644
@@ -12,7 +12,7 @@
 /* Status field in FD is updated on Rx side by FMAN with following information.
  * Refer to field description in FM BG.
  */
-struct fm_status_t {
+struct __rte_packed_begin fm_status_t {
 	unsigned int reserved0:3;
 	unsigned int dcl4c:1; /* Don't Check L4 Checksum */
 	unsigned int reserved1:1;
@@ -38,7 +38,7 @@ struct fm_status_t {
 	unsigned int phe:1; /* Header Error during parsing */
 	unsigned int frdr:1; /* Frame Dropped by disabled port */
 	unsigned int reserved5:4;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Set MAC address for a particular interface */
 __rte_internal
drivers/bus/dpaa/include/fsl_qman.h +80 -80

426 lines not on this page · raw message

drivers/bus/ifpga/bus_ifpga_driver.h +4 -4
index af151ffd4b..56ce34c91d 100644
@@ -29,10 +29,10 @@ struct rte_afu_driver;
 
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
-struct rte_afu_uuid {
+struct __rte_packed_begin rte_afu_uuid {
 	uint64_t uuid_low;
 	uint64_t uuid_high;
-} __rte_packed;
+} __rte_packed_end;
 
 #define IFPGA_BUS_DEV_PORT_MAX 4
 
@@ -40,10 +40,10 @@ struct rte_afu_uuid {
  * A structure describing an ID for a AFU driver. Each driver provides a
  * table of these IDs for each device that it supports.
  */
-struct rte_afu_id {
+struct __rte_packed_begin rte_afu_id {
 	struct rte_afu_uuid uuid;
 	int      port; /**< port number */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * A structure PR (Partial Reconfiguration) configuration AFU driver.
drivers/bus/vmbus/rte_vmbus_reg.h +54 -54

285 lines not on this page · raw message

Signature · 1 line
2.47.0.vfs.0.3
#261 lore raw

PATCH v10 8/30 drivers/common: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/common/cnxk/hw/sdp.h                |   4 +-
 drivers/common/cnxk/roc_npc.h               |  16 +--
 drivers/common/cnxk/roc_npc_mcam_dump.c     |   4 +-
 drivers/common/cnxk/roc_platform.h          |   3 +-
 drivers/common/dpaax/compat.h               |   3 -
 drivers/common/iavf/iavf_osdep.h            |   8 +-
 drivers/common/iavf/virtchnl_inline_ipsec.h |  44 +++----
 drivers/common/idpf/base/idpf_osdep.h       |   8 +-
 drivers/common/mlx5/mlx5_common_mr.h        |  16 +--
 drivers/common/mlx5/mlx5_common_utils.h     |   4 +-
 drivers/common/mlx5/mlx5_prm.h              | 120 ++++++++++----------
 drivers/common/qat/qat_adf/icp_qat_fw_la.h  |   8 +-
 drivers/common/qat/qat_common.h             |   8 +-
 13 files changed, 122 insertions(+), 124 deletions(-)
drivers/common/cnxk/hw/sdp.h +2 -2
index 686f516097..5792f309d7 100644
@@ -156,7 +156,7 @@
 #define SDP_VF_R_OUT_INT_LEVELS_TIMET (32)
 
 /* SDP Instruction Header */
-struct sdp_instr_ih {
+struct __plt_packed_begin sdp_instr_ih {
 	/* Data Len */
 	uint64_t tlen : 16;
 
@@ -177,6 +177,6 @@ struct sdp_instr_ih {
 
 	/* Reserved2 */
 	uint64_t rsvd2 : 1;
-} __plt_packed;
+} __plt_packed_end;
 
 #endif /* __SDP_HW_H_  */
drivers/common/cnxk/roc_npc.h +8 -8
index bf8c65aa9c..f7a1e5d810 100644
@@ -97,10 +97,10 @@ struct roc_npc_flow_item_eth {
 	uint32_t reserved : 31; /**< Reserved, must be zero. */
 };
 
-struct roc_vlan_hdr {
+struct __plt_packed_begin roc_vlan_hdr {
 	uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */
 	uint16_t eth_proto; /**< Ethernet type of encapsulated frame. */
-} __plt_packed;
+} __plt_packed_end;
 
 struct roc_npc_flow_item_vlan {
 	union {
@@ -115,23 +115,23 @@ struct roc_npc_flow_item_vlan {
 	uint32_t reserved : 31; /**< Reserved, must be zero. */
 };
 
-struct roc_ipv6_hdr {
+struct __plt_packed_begin roc_ipv6_hdr {
 	uint32_t vtc_flow;    /**< IP version, traffic class & flow label. */
 	uint16_t payload_len; /**< IP payload size, including ext. headers */
 	uint8_t proto;	      /**< Protocol, next header. */
 	uint8_t hop_limits;   /**< Hop limits. */
 	uint8_t src_addr[16]; /**< IP address of source host. */
 	uint8_t dst_addr[16]; /**< IP address of destination host(s). */
-} __plt_packed;
+} __plt_packed_end;
 
-struct roc_ipv6_fragment_ext {
+struct __plt_packed_begin roc_ipv6_fragment_ext {
 	uint8_t next_header; /**< Next header type */
 	uint8_t reserved;    /**< Reserved */
 	uint16_t frag_data;  /**< All fragmentation data */
 	uint32_t id;	     /**< Packet ID */
-} __plt_packed;
+} __plt_packed_end;
 
-struct roc_ipv6_routing_ext {
+struct __plt_packed_begin roc_ipv6_routing_ext {
 	uint8_t next_hdr;	/**< Protocol, next header. */
 	uint8_t hdr_len;	/**< Header length. */
 	uint8_t type;		/**< Extension header type. */
@@ -145,7 +145,7 @@ struct roc_ipv6_routing_ext {
 		};
 	};
 	/* Next are 128-bit IPv6 address fields to describe segments. */
-} __plt_packed;
+} __plt_packed_end;
 
 struct roc_flow_item_ipv6_ext {
 	uint8_t next_hdr; /**< Next header. */
drivers/common/cnxk/roc_npc_mcam_dump.c +2 -2
index ebd2dd69c2..27a63cc92d 100644
@@ -35,7 +35,7 @@
 #define NIX_TX_VTAGACT_VTAG1_OP_MASK	 GENMASK(45, 44)
 #define NIX_TX_VTAGACT_VTAG1_DEF_MASK	 GENMASK(57, 48)
 
-struct npc_rx_parse_nibble_s {
+struct __plt_packed_begin npc_rx_parse_nibble_s {
 	uint16_t chan : 3;
 	uint16_t errlev : 1;
 	uint16_t errcode : 2;
@@ -56,7 +56,7 @@ struct npc_rx_parse_nibble_s {
 	uint16_t lgtype : 1;
 	uint16_t lhflags : 2;
 	uint16_t lhtype : 1;
-} __plt_packed;
+} __plt_packed_end;
 
 static const char *const intf_str[] = {
 	"NIX-RX",
drivers/common/cnxk/roc_platform.h +2 -1
index df4f88f288..d6f3ea9acc 100644
@@ -97,7 +97,8 @@
 
 #define __plt_cache_aligned __rte_cache_aligned
 #define __plt_always_inline __rte_always_inline
-#define __plt_packed	    __rte_packed
+#define __plt_packed_begin	__rte_packed_begin
+#define __plt_packed_end	__rte_packed_end
 #define __plt_unused	    __rte_unused
 #define __roc_api	    __rte_internal
 #define plt_iova_t	    rte_iova_t
drivers/common/dpaax/compat.h +0 -3
index a7df70d5e6..d59207245c 100644
@@ -53,9 +53,6 @@
 #ifndef __always_unused
 #define __always_unused	__rte_unused
 #endif
-#ifndef __packed
-#define __packed	__rte_packed
-#endif
 #ifndef noinline
 #define noinline	__rte_noinline
 #endif
drivers/common/iavf/iavf_osdep.h +4 -4
index 1f2b7889cb..1b0ca933cc 100644
@@ -158,17 +158,17 @@ do {                                                            \
 } while (0)
 
 /* memory allocation tracking */
-struct iavf_dma_mem {
+struct __rte_packed_begin iavf_dma_mem {
 	void *va;
 	u64 pa;
 	u32 size;
 	const void *zone;
-} __rte_packed;
+} __rte_packed_end;
 
-struct iavf_virt_mem {
+struct __rte_packed_begin iavf_virt_mem {
 	void *va;
 	u32 size;
-} __rte_packed;
+} __rte_packed_end;
 
 #define iavf_allocate_dma_mem(h, m, unused, s, a) \
 			iavf_allocate_dma_mem_d(h, m, s, a)
drivers/common/iavf/virtchnl_inline_ipsec.h +22 -22

153 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h +4 -4
index 250f0ec500..7b43df3079 100644
@@ -182,17 +182,17 @@ static inline uint64_t idpf_read_addr64(volatile void *addr)
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
-struct idpf_dma_mem {
+struct __rte_packed_begin idpf_dma_mem {
 	void *va;
 	u64 pa;
 	u32 size;
 	const void *zone;
-} __rte_packed;
+} __rte_packed_end;
 
-struct idpf_virt_mem {
+struct __rte_packed_begin idpf_virt_mem {
 	void *va;
 	u32 size;
-} __rte_packed;
+} __rte_packed_end;
 
 #define idpf_malloc(h, s)	rte_zmalloc(NULL, s, 0)
 #define idpf_calloc(h, c, s)	rte_zmalloc(NULL, (c) * (s), 0)
drivers/common/mlx5/mlx5_common_mr.h +8 -8
index a7f1042037..cf7c685e9b 100644
@@ -49,36 +49,36 @@ struct mlx5_mr {
 };
 
 /* Cache entry for Memory Region. */
-struct mr_cache_entry {
+struct __rte_packed_begin mr_cache_entry {
 	uintptr_t start; /* Start address of MR. */
 	uintptr_t end; /* End address of MR. */
 	uint32_t lkey; /* rte_cpu_to_be_32(lkey). */
-} __rte_packed;
+} __rte_packed_end;
 
 /* MR Cache table for Binary search. */
-struct mlx5_mr_btree {
+struct __rte_packed_begin mlx5_mr_btree {
 	uint32_t len; /* Number of entries. */
 	uint32_t size; /* Total number of entries. */
 	struct mr_cache_entry (*table)[];
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_common_device;
 
 /* Per-queue MR control descriptor. */
-struct mlx5_mr_ctrl {
+struct __rte_packed_begin mlx5_mr_ctrl {
 	uint32_t *dev_gen_ptr; /* Generation number of device to poll. */
 	uint32_t cur_gen; /* Generation number saved to flush caches. */
 	uint16_t mru; /* Index of last hit entry in top-half cache. */
 	uint16_t head; /* Index of the oldest entry in top-half cache. */
 	struct mr_cache_entry cache[MLX5_MR_CACHE_N]; /* Cache for top-half. */
 	struct mlx5_mr_btree cache_bh; /* Cache for bottom-half. */
-} __rte_packed;
+} __rte_packed_end;
 
 LIST_HEAD(mlx5_mr_list, mlx5_mr);
 LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg);
 
 /* Global per-device MR cache. */
-struct mlx5_mr_share_cache {
+struct __rte_packed_begin mlx5_mr_share_cache {
 	uint32_t dev_gen; /* Generation number to flush local caches. */
 	rte_rwlock_t rwlock; /* MR cache Lock. */
 	rte_rwlock_t mprwlock; /* Mempool Registration Lock. */
@@ -88,7 +88,7 @@ struct mlx5_mr_share_cache {
 	struct mlx5_mempool_reg_list mempool_reg_list; /* Mempool database. */
 	mlx5_reg_mr_t reg_mr_cb; /* Callback to reg_mr func */
 	mlx5_dereg_mr_t dereg_mr_cb; /* Callback to dereg_mr func */
-} __rte_packed;
+} __rte_packed_end;
 
 /* Multi-Packet RQ buffer header. */
 struct __rte_cache_aligned mlx5_mprq_buf {
drivers/common/mlx5/mlx5_common_utils.h +2 -2
index 9139bc6829..e56f367bf2 100644
@@ -27,7 +27,7 @@ struct mlx5_list;
  * Structure of the entry in the mlx5 list, user should define its own struct
  * that contains this in order to store the data.
  */
-struct mlx5_list_entry {
+struct __rte_packed_begin mlx5_list_entry {
 	LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */
 	alignas(8) RTE_ATOMIC(uint32_t) ref_cnt; /* 0 means, entry is invalid. */
 	uint32_t lcore_idx;
@@ -35,7 +35,7 @@ struct mlx5_list_entry {
 		struct mlx5_list_entry *gentry;
 		uint32_t bucket_idx;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct __rte_cache_aligned mlx5_list_cache {
 	LIST_HEAD(mlx5_list_head, mlx5_list_entry) h;
drivers/common/mlx5/mlx5_prm.h +60 -60

334 lines not on this page · raw message

drivers/common/qat/qat_adf/icp_qat_fw_la.h +4 -4
index fe32b66c50..835674d91b 100644
@@ -357,7 +357,7 @@ struct icp_qat_fw_cipher_auth_cd_ctrl_hdr {
 #define ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET 24
 #define ICP_QAT_FW_CIPHER_REQUEST_PARAMETERS_OFFSET (0)
 
-struct icp_qat_fw_la_cipher_req_params {
+struct __rte_packed_begin icp_qat_fw_la_cipher_req_params {
 	uint32_t cipher_offset;
 	uint32_t cipher_length;
 	union {
@@ -372,9 +372,9 @@ struct icp_qat_fw_la_cipher_req_params {
 	uint16_t spc_aad_sz;
 	uint8_t reserved;
 	uint8_t spc_auth_res_sz;
-} __rte_packed;
+} __rte_packed_end;
 
-struct icp_qat_fw_la_auth_req_params {
+struct __rte_packed_begin icp_qat_fw_la_auth_req_params {
 	uint32_t auth_off;
 	uint32_t auth_len;
 	union {
@@ -389,7 +389,7 @@ struct icp_qat_fw_la_auth_req_params {
 	uint8_t resrvd1;
 	uint8_t hash_state_sz;
 	uint8_t auth_res_sz;
-} __rte_packed;
+} __rte_packed_end;
 
 struct icp_qat_fw_la_auth_req_params_resrvd_flds {
 	uint32_t resrvd[ICP_QAT_FW_NUM_LONGWORDS_6];
drivers/common/qat/qat_common.h +4 -4
index 703534dc15..51d20267bd 100644
@@ -57,11 +57,11 @@ enum qat_svc_list {
 };
 
 /**< Common struct for scatter-gather list operations */
-struct qat_flat_buf {
+struct __rte_packed_begin qat_flat_buf {
 	uint32_t len;
 	uint32_t resrvd;
 	uint64_t addr;
-} __rte_packed;
+} __rte_packed_end;
 
 #define qat_sgl_hdr  struct { \
 	uint64_t resrvd; \
@@ -70,11 +70,11 @@ struct qat_flat_buf {
 }
 
 __extension__
-struct __rte_cache_aligned qat_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_sgl {
 	qat_sgl_hdr;
 	/* flexible array of flat buffers*/
 	struct qat_flat_buf buffers[0];
-} __rte_packed;
+} __rte_packed_end;
 
 /** Common, i.e. not service-specific, statistics */
 struct qat_common_stats {
Signature · 1 line
2.47.0.vfs.0.3
#262 lore raw

PATCH v10 9/30 drivers/compress: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/compress/qat/qat_comp.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/compress/qat/qat_comp.h +2 -2
index 1da4770b1c..18d5fd4b02 100644
@@ -50,10 +50,10 @@ struct array_of_ptrs {
 	phys_addr_t pointer[0];
 };
 
-struct __rte_cache_aligned qat_inter_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_inter_sgl {
 	qat_sgl_hdr;
 	struct qat_flat_buf buffers[QAT_NUM_BUFS_IN_IM_SGL];
-} __rte_packed;
+} __rte_packed_end;
 
 
 struct qat_comp_op_cookie {
Signature · 1 line
2.47.0.vfs.0.3
#263 lore raw

PATCH v10 10/30 drivers/crypto: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/crypto/caam_jr/caam_jr.c             |  4 +-
 drivers/crypto/caam_jr/caam_jr_desc.h        | 64 ++++++++++----------
 drivers/crypto/caam_jr/caam_jr_hw_specific.h | 48 +++++++--------
 drivers/crypto/dpaa_sec/dpaa_sec.h           | 12 ++--
 drivers/crypto/ionic/ionic_crypto_if.h       | 36 +++++------
 drivers/crypto/mlx5/mlx5_crypto.h            |  8 +--
 drivers/crypto/mlx5/mlx5_crypto_gcm.c        |  4 +-
 drivers/crypto/qat/qat_sym.h                 |  8 +--
 drivers/crypto/qat/qat_sym_session.h         |  4 +-
 9 files changed, 94 insertions(+), 94 deletions(-)
drivers/crypto/caam_jr/caam_jr.c +2 -2
index 4082b3f422..a57dc56b80 100644
@@ -53,10 +53,10 @@ static enum sec_driver_state_e g_driver_state = SEC_DRIVER_STATE_IDLE;
 static int g_job_rings_no;
 static int g_job_rings_max;
 
-struct sec_outring_entry {
+struct __rte_packed_begin sec_outring_entry {
 	phys_addr_t desc;	/* Pointer to completed descriptor */
 	uint32_t status;	/* Status for completed descriptor */
-} __rte_packed;
+} __rte_packed_end;
 
 /* virtual address conversin when mempool support is available for ctx */
 static inline phys_addr_t
drivers/crypto/caam_jr/caam_jr_desc.h +32 -32

139 lines not on this page · raw message

drivers/crypto/caam_jr/caam_jr_hw_specific.h +24 -24

103 lines not on this page · raw message

drivers/crypto/dpaa_sec/dpaa_sec.h +6 -6
index 64d9e22159..d78cad818a 100644
@@ -62,8 +62,8 @@ enum dpaa_sec_op_type {
 #define DPAA_SEC_MAX_DESC_SIZE  64
 /* code or cmd block to caam */
 struct sec_cdb {
-	struct {
-		union {
+	struct __rte_packed_begin {
+		union __rte_packed_begin {
 			uint32_t word;
 			struct {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -76,9 +76,9 @@ struct sec_cdb {
 				uint16_t rsvd63_48;
 #endif
 			} field;
-		} __packed hi;
+		} __rte_packed_end hi;
 
-		union {
+		union __rte_packed_begin {
 			uint32_t word;
 			struct {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -101,8 +101,8 @@ struct sec_cdb {
 				unsigned int rsvd31_30:2;
 #endif
 			} field;
-		} __packed lo;
-	} __packed sh_hdr;
+		} __rte_packed_end lo;
+	} __rte_packed_end sh_hdr;
 
 	uint32_t sh_desc[DPAA_SEC_MAX_DESC_SIZE];
 };
drivers/crypto/ionic/ionic_crypto_if.h +18 -18
index ea418f3d4b..b152079fdf 100644
@@ -263,13 +263,13 @@ struct iocpt_lif_setattr_cmd {
 	u8     opcode;
 	u8     attr;
 	__le16 lif_index;
-	union {
+	union __rte_packed_begin {
 		u8	state;
 		char	name[IOCPT_IFNAMSIZ];
 		__le64	features;
 		u8	stats_ctl;
 		u8	rsvd[60];
-	} __rte_packed;
+	} __rte_packed_end;
 };
 
 /**
@@ -283,10 +283,10 @@ struct iocpt_lif_setattr_comp {
 	u8     status;
 	u8     rsvd;
 	__le16 comp_index;
-	union {
+	union __rte_packed_begin {
 		__le64	features;
 		u8	rsvd2[11];
-	} __rte_packed;
+	} __rte_packed_end;
 	u8     color;
 };
 
@@ -316,11 +316,11 @@ struct iocpt_lif_getattr_comp {
 	u8     status;
 	u8     rsvd;
 	__le16 comp_index;
-	union {
+	union __rte_packed_begin {
 		u8	state;
 		__le64	features;
 		u8	rsvd2[11];
-	} __rte_packed;
+	} __rte_packed_end;
 	u8     color;
 };
 
@@ -396,7 +396,7 @@ struct iocpt_q_identify_comp {
  * @cq_ring_base: Completion queue ring base address
  * @sg_ring_base: Scatter/Gather ring base address
  */
-struct iocpt_q_init_cmd {
+struct __rte_packed_begin iocpt_q_init_cmd {
 	u8     opcode;
 	u8     type;
 	__le16 lif_index;
@@ -417,7 +417,7 @@ struct iocpt_q_init_cmd {
 	__le64 cq_ring_base;
 	__le64 sg_ring_base;
 	u8     rsvd2[20];
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * struct iocpt_q_init_comp - Queue init command completion
@@ -469,7 +469,7 @@ enum iocpt_desc_opcode {
  * @intr_ctx_addr:   Completion interrupt context address
  * @intr_ctx_data:   Completion interrupt context data
  */
-struct iocpt_crypto_desc {
+struct __rte_packed_begin iocpt_crypto_desc {
 	uint8_t  opcode;
 	uint8_t  flags;
 	uint8_t  num_src_dst_sgs;
@@ -481,7 +481,7 @@ struct iocpt_crypto_desc {
 	__le32   session_tag;
 	__le64   intr_ctx_addr;
 	__le64   intr_ctx_data;
-} __rte_packed;
+} __rte_packed_end;
 
 static inline uint8_t iocpt_encode_nsge_src_dst(uint8_t src, uint8_t dst)
 {
@@ -765,14 +765,14 @@ struct iocpt_log_event {
  * @queue_count:    Queue counts per queue-type
  */
 union iocpt_lif_config {
-	struct {
+	struct __rte_packed_begin {
 		u8     state;
 		u8     rsvd[3];
 		char   name[IOCPT_IFNAMSIZ];
 		u8     rsvd2[12];
 		__le64 features;
 		__le32 queue_count[IOCPT_QTYPE_MAX];
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[56];
 };
 
@@ -876,14 +876,14 @@ union iocpt_dev_info_regs {
  * @data:            Opcode-specific side-data
  */
 union iocpt_dev_cmd_regs {
-	struct {
+	struct __rte_packed_begin {
 		u32    doorbell;
 		u32    done;
 		union iocpt_dev_cmd         cmd;
 		union iocpt_dev_cmd_comp    comp;
 		u8     rsvd[48];
 		u32    data[478];
-	} __rte_packed;
+	} __rte_packed_end;
 	u32    words[512];
 };
 
@@ -893,10 +893,10 @@ union iocpt_dev_cmd_regs {
  * @devcmd:          Device command registers
  */
 union iocpt_dev_regs {
-	struct {
+	struct __rte_packed_begin {
 		union iocpt_dev_info_regs info;
 		union iocpt_dev_cmd_regs  devcmd;
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[1024];
 };
 
@@ -971,7 +971,7 @@ union iocpt_dev_identity {
  * @config:             LIF config struct with features, q counts
  */
 union iocpt_lif_identity {
-	struct {
+	struct __rte_packed_begin {
 		__le64 features;
 
 		u8 version;
@@ -980,7 +980,7 @@ union iocpt_lif_identity {
 		__le32 max_nb_sessions;
 		u8 rsvd2[120];
 		union iocpt_lif_config config;
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[90];
 };
 
drivers/crypto/mlx5/mlx5_crypto.h +4 -4
index 547bb490e2..f9f127e9e6 100644
@@ -32,9 +32,9 @@ enum mlx5_crypto_mode {
 	MLX5_CRYPTO_IPSEC_OPT,
 };
 
-struct mlx5_crypto_ipsec_mem {
+struct __rte_packed_begin mlx5_crypto_ipsec_mem {
 	uint8_t mem[MLX5_CRYPTO_GCM_IPSEC_IV_SIZE];
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_crypto_priv {
 	TAILQ_ENTRY(mlx5_crypto_priv) next;
@@ -108,7 +108,7 @@ struct mlx5_crypto_devarg_params {
 	enum mlx5_crypto_mode crypto_mode;
 };
 
-struct mlx5_crypto_session {
+struct __rte_packed_begin mlx5_crypto_session {
 	union {
 		/**< AES-XTS configuration. */
 		struct {
@@ -145,7 +145,7 @@ struct mlx5_crypto_session {
 	/**< Initialisation Vector length. */
 	struct mlx5_crypto_dek *dek; /**< Pointer to dek struct. */
 	uint32_t dek_id; /**< DEK ID */
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_crypto_dek_ctx {
 	struct rte_crypto_sym_xform *xform;
drivers/crypto/mlx5/mlx5_crypto_gcm.c +2 -2
index cd21605bd2..89f32c7722 100644
@@ -62,10 +62,10 @@ struct mlx5_crypto_gcm_data {
 	uint32_t dst_mkey;
 };
 
-struct mlx5_crypto_gcm_tag_cpy_info {
+struct __rte_packed_begin mlx5_crypto_gcm_tag_cpy_info {
 	void *digest;
 	uint8_t tag_len;
-} __rte_packed;
+} __rte_packed_end;
 
 static struct rte_cryptodev_capabilities mlx5_crypto_gcm_caps[] = {
 	{
drivers/crypto/qat/qat_sym.h +4 -4
index eedf5de755..2a04bd9425 100644
@@ -103,10 +103,10 @@
 
 struct qat_sym_session;
 
-struct __rte_cache_aligned qat_sym_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_sym_sgl {
 	qat_sgl_hdr;
 	struct qat_flat_buf buffers[QAT_SYM_SGL_MAX_NUMBER];
-} __rte_packed;
+} __rte_packed_end;
 
 struct qat_sym_op_cookie {
 	struct qat_sym_sgl qat_sgl_src;
@@ -116,8 +116,8 @@ struct qat_sym_op_cookie {
 	union {
 		/* Used for Single-Pass AES-GMAC only */
 		struct {
-			alignas(RTE_CACHE_LINE_SIZE) struct icp_qat_hw_cipher_algo_blk cd_cipher
-					__rte_packed;
+			alignas(RTE_CACHE_LINE_SIZE) struct __rte_packed_begin
+					 icp_qat_hw_cipher_algo_blk cd_cipher __rte_packed_end;
 			phys_addr_t cd_phys_addr;
 		} spc_gmac;
 	} opt;
drivers/crypto/qat/qat_sym_session.h +2 -2
index f2634774ec..2ca6c8ddf5 100644
@@ -92,7 +92,7 @@ typedef int (*qat_sym_build_request_t)(void *in_op, struct qat_sym_session *ctx,
 		uint8_t *out_msg, void *op_cookie);
 
 /* Common content descriptor */
-struct __rte_cache_aligned qat_sym_cd {
+struct __rte_cache_aligned __rte_packed_begin qat_sym_cd {
 	struct icp_qat_hw_cipher_algo_blk cipher;
 	union {
 		struct icp_qat_hw_auth_algo_blk hash;
@@ -100,7 +100,7 @@ struct __rte_cache_aligned qat_sym_cd {
 		struct icp_qat_hw_gen3_crc_cd crc_gen3;
 		struct icp_qat_hw_gen4_crc_cd crc_gen4;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct qat_sym_session {
 	enum icp_qat_fw_la_cmd_id qat_cmd;
Signature · 1 line
2.47.0.vfs.0.3
#264 lore raw

PATCH v10 11/30 drivers/dma: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/dma/dpaa/dpaa_qdma.h    | 20 ++++++++++----------
 drivers/dma/dpaa2/dpaa2_qdma.h  | 16 ++++++++--------
 drivers/dma/ioat/ioat_hw_defs.h |  4 ++--
 3 files changed, 20 insertions(+), 20 deletions(-)
drivers/dma/dpaa/dpaa_qdma.h +10 -10
index 91eaf1455a..0b08909221 100644
@@ -119,7 +119,7 @@
 	(((fsl_qdma_engine)->block_offset) * (x))
 
 /* qDMA Command Descriptor Formats */
-struct fsl_qdma_comp_cmd_desc {
+struct __rte_packed_begin fsl_qdma_comp_cmd_desc {
 	uint8_t status;
 	uint32_t rsv0:22;
 	uint32_t ser:1;
@@ -132,9 +132,9 @@ struct fsl_qdma_comp_cmd_desc {
 	uint8_t queue:3;
 	uint8_t rsv4:3;
 	uint8_t dd:2;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_comp_sg_desc {
+struct __rte_packed_begin fsl_qdma_comp_sg_desc {
 	uint32_t offset:13;
 	uint32_t rsv0:19;
 	uint32_t length:30;
@@ -143,9 +143,9 @@ struct fsl_qdma_comp_sg_desc {
 	uint32_t addr_lo;
 	uint8_t addr_hi;
 	uint32_t rsv1:24;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_sdf {
+struct __rte_packed_begin fsl_qdma_sdf {
 	uint32_t rsv0;
 	uint32_t ssd:12;
 	uint32_t sss:12;
@@ -160,9 +160,9 @@ struct fsl_qdma_sdf {
 	uint32_t sqos:3;
 	uint32_t ns:1;
 	uint32_t srttype:4;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_ddf {
+struct __rte_packed_begin fsl_qdma_ddf {
 	uint32_t rsv0;
 	uint32_t dsd:12;
 	uint32_t dss:12;
@@ -177,7 +177,7 @@ struct fsl_qdma_ddf {
 	uint32_t dqos:3;
 	uint32_t ns:1;
 	uint32_t dwttype:4;
-} __rte_packed;
+} __rte_packed_end;
 
 struct fsl_qdma_df {
 	struct fsl_qdma_sdf sdf;
@@ -186,7 +186,7 @@ struct fsl_qdma_df {
 
 #define FSL_QDMA_SG_MAX_ENTRY 64
 #define FSL_QDMA_MAX_DESC_NUM (FSL_QDMA_SG_MAX_ENTRY * QDMA_QUEUE_SIZE)
-struct fsl_qdma_cmpd_ft {
+struct __rte_packed_begin fsl_qdma_cmpd_ft {
 	struct fsl_qdma_comp_sg_desc desc_buf;
 	struct fsl_qdma_comp_sg_desc desc_sbuf;
 	struct fsl_qdma_comp_sg_desc desc_dbuf;
@@ -197,7 +197,7 @@ struct fsl_qdma_cmpd_ft {
 	uint64_t phy_ssge;
 	uint64_t phy_dsge;
 	uint64_t phy_df;
-} __rte_packed;
+} __rte_packed_end;
 
 #define FSL_QDMA_ERR_REG_STATUS_OFFSET 0xe00
 
drivers/dma/dpaa2/dpaa2_qdma.h +8 -8
index 0fd1debaf8..e2d2eb4fa8 100644
@@ -39,7 +39,7 @@
 #define DPAA2_QDMA_BMT_DISABLE 0x0
 
 /** Source/Destination Descriptor */
-struct qdma_sdd {
+struct __rte_packed_begin qdma_sdd {
 	uint32_t rsv;
 	/** Stride configuration */
 	uint32_t stride;
@@ -85,7 +85,7 @@ struct qdma_sdd {
 			uint32_t wrttype:4;
 		} write_cmd;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 #define QDMA_SG_FMT_SDB	0x0 /* single data buffer */
 #define QDMA_SG_FMT_FDS	0x1 /* frame data section */
@@ -96,7 +96,7 @@ struct qdma_sdd {
 #define QDMA_SG_BMT_ENABLE DPAA2_QDMA_BMT_ENABLE
 #define QDMA_SG_BMT_DISABLE DPAA2_QDMA_BMT_DISABLE
 
-struct qdma_sg_entry {
+struct __rte_packed_begin qdma_sg_entry {
 	uint32_t addr_lo;		/* address 0:31 */
 	uint32_t addr_hi:17;	/* address 32:48 */
 	uint32_t rsv:15;
@@ -122,7 +122,7 @@ struct qdma_sg_entry {
 			uint32_t f:1;
 		} ctrl;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct dpaa2_qdma_rbp {
 	uint32_t use_ultrashort:1;
@@ -213,19 +213,19 @@ enum {
 	DPAA2_QDMA_MAX_SDD
 };
 
-struct qdma_cntx_fle_sdd {
+struct __rte_packed_begin qdma_cntx_fle_sdd {
 	struct qbman_fle fle[DPAA2_QDMA_MAX_FLE];
 	struct qdma_sdd sdd[DPAA2_QDMA_MAX_SDD];
-} __rte_packed;
+} __rte_packed_end;
 
-struct qdma_cntx_sg {
+struct __rte_packed_begin qdma_cntx_sg {
 	struct qdma_cntx_fle_sdd fle_sdd;
 	struct qdma_sg_entry sg_src_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	struct qdma_sg_entry sg_dst_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	uint16_t cntx_idx[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	uint16_t job_nb;
 	uint16_t rsv[3];
-} __rte_packed;
+} __rte_packed_end;
 
 #define DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flag) \
 	((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAAX_QDMA_SG_IDX_ADDR_MASK)))
drivers/dma/ioat/ioat_hw_defs.h +2 -2
index 11893951f2..dbfbc50f70 100644
@@ -52,7 +52,7 @@ extern "C" {
 #define	IOAT_DMACAP_PQ		(1 << 9)
 #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
 
-struct ioat_registers {
+struct __rte_packed_begin ioat_registers {
 	uint8_t		chancnt;
 	uint8_t		xfercap;
 	uint8_t		genctrl;
@@ -75,7 +75,7 @@ struct ioat_registers {
 	uint8_t		reserved2[0x8];	/* 0xA0 */
 	uint32_t	chanerr;	/* 0xA8 */
 	uint32_t	chanerrmask;	/* 0xAC */
-} __rte_packed;
+} __rte_packed_end;
 
 #define IOAT_CHANCMD_RESET	0x20
 #define IOAT_CHANCMD_SUSPEND	0x04
Signature · 1 line
2.47.0.vfs.0.3
#265 lore raw

PATCH v10 12/30 drivers/event: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/event/octeontx/timvf_evdev.c |  4 ++--
 drivers/event/octeontx/timvf_evdev.h | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/event/octeontx/timvf_evdev.c +2 -2
index 82f17144a6..b404b1db61 100644
@@ -9,10 +9,10 @@ RTE_LOG_REGISTER_SUFFIX(otx_logtype_timvf, timer, NOTICE);
 
 static struct rte_eventdev *event_dev;
 
-struct __rte_packed timvf_mbox_dev_info {
+struct __rte_packed_begin timvf_mbox_dev_info {
 	uint64_t ring_active[4];
 	uint64_t clk_freq;
-};
+} __rte_packed_end;
 
 /* Response messages */
 enum {
drivers/event/octeontx/timvf_evdev.h +6 -6
index 44a4ee41c4..e9152424ab 100644
@@ -123,7 +123,7 @@ enum timvf_clk_src {
 };
 
 /* TIM_MEM_BUCKET */
-struct __rte_aligned(8) tim_mem_bucket {
+struct __rte_aligned(8) __rte_packed_begin tim_mem_bucket {
 	uint64_t first_chunk;
 	union {
 		RTE_ATOMIC(uint64_t) w1;
@@ -139,19 +139,19 @@ struct __rte_aligned(8) tim_mem_bucket {
 	};
 	uint64_t current_chunk;
 	uint64_t pad;
-} __rte_packed;
+} __rte_packed_end;
 
-struct tim_mem_entry {
+struct __rte_packed_begin tim_mem_entry {
 	uint64_t w0;
 	uint64_t wqe;
-} __rte_packed;
+} __rte_packed_end;
 
-struct timvf_ctrl_reg {
+struct __rte_packed_begin timvf_ctrl_reg {
 	uint64_t rctrl0;
 	uint64_t rctrl1;
 	uint64_t rctrl2;
 	uint8_t use_pmu;
-} __rte_packed;
+} __rte_packed_end;
 
 struct timvf_ring;
 
Signature · 1 line
2.47.0.vfs.0.3
#266 lore raw

PATCH v10 13/30 drivers/mempool: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/mempool/octeontx/octeontx_fpavf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/mempool/octeontx/octeontx_fpavf.c +8 -8
index 966fee8bfe..6cd0fc057f 100644
@@ -46,20 +46,20 @@ struct octeontx_mbox_fpa_cfg {
 	uint64_t	aura_cfg;
 };
 
-struct __rte_packed gen_req {
+struct __rte_packed_begin gen_req {
 	uint32_t	value;
-};
+} __rte_packed_end;
 
-struct __rte_packed idn_req {
+struct __rte_packed_begin idn_req {
 	uint8_t	domain_id;
-};
+} __rte_packed_end;
 
-struct __rte_packed gen_resp {
+struct __rte_packed_begin gen_resp {
 	uint16_t	domain_id;
 	uint16_t	vfid;
-};
+} __rte_packed_end;
 
-struct __rte_packed dcfg_resp {
+struct __rte_packed_begin dcfg_resp {
 	uint8_t	sso_count;
 	uint8_t	ssow_count;
 	uint8_t	fpa_count;
@@ -67,7 +67,7 @@ struct __rte_packed dcfg_resp {
 	uint8_t	tim_count;
 	uint8_t	net_port_count;
 	uint8_t	virt_port_count;
-};
+} __rte_packed_end;
 
 #define FPA_MAX_POOL	32
 #define FPA_PF_PAGE_SZ	4096
Signature · 1 line
2.47.0.vfs.0.3
#267 lore raw

PATCH v10 14/30 drivers/net: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/net/ark/ark_ddm.h                     |    4 +-
 drivers/net/ark/ark_pktchkr.h                 |    8 +-
 drivers/net/ark/ark_pktdir.h                  |    5 +-
 drivers/net/ark/ark_pktgen.h                  |    4 +-
 drivers/net/ark/ark_udm.h                     |    4 +-
 drivers/net/atlantic/hw_atl/hw_atl_utils.h    |  120 +-
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |    8 +-
 drivers/net/avp/rte_avp_common.h              |   12 +-
 drivers/net/bnxt/bnxt.h                       |    8 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h        | 3344 ++++++++---------
 drivers/net/bnxt/tf_core/tf_resources.h       |   32 +-
 drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c   |   20 +-
 drivers/net/bonding/rte_eth_bond_8023ad.h     |   32 +-
 drivers/net/cnxk/cn10k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn20k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn9k_ethdev.h                |    4 +-
 drivers/net/cnxk/cnxk_rep_msg.h               |   64 +-
 drivers/net/dpaa/dpaa_rxtx.h                  |   28 +-
 drivers/net/dpaa/fmlib/fm_ext.h               |    4 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h  |    4 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   16 +-
 drivers/net/enic/base/vnic_devcmd.h           |   40 +-
 drivers/net/enic/base/vnic_flowman.h          |  120 +-
 drivers/net/gve/base/gve_desc.h               |   16 +-
 drivers/net/gve/base/gve_desc_dqo.h           |   32 +-
 drivers/net/gve/base/gve_osdep.h              |    3 -
 drivers/net/hns3/hns3_mbx.h                   |    8 +-
 drivers/net/hns3/hns3_rxtx.h                  |    4 +-
 drivers/net/i40e/base/i40e_osdep.h            |    8 +-
 drivers/net/iavf/iavf_ipsec_crypto.h          |   10 +-
 drivers/net/iavf/iavf_rxtx.c                  |    2 +-
 drivers/net/ice/base/ice_osdep.h              |   11 +-
 drivers/net/ionic/ionic_if.h                  |   72 +-
 drivers/net/memif/memif.h                     |   36 +-
 drivers/net/mlx4/mlx4_mr.h                    |   12 +-
 drivers/net/mlx5/hws/mlx5dr.h                 |    4 +-
 drivers/net/mlx5/mlx5.h                       |    4 +-
 drivers/net/mlx5/mlx5_flow.h                  |   16 +-
 drivers/net/mlx5/mlx5_hws_cnt.h               |    4 +-
 drivers/net/mlx5/mlx5_utils.h                 |   16 +-
 drivers/net/netvsc/hn_nvs.h                   |   72 +-
 drivers/net/netvsc/ndis.h                     |    8 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.h      |    4 +-
 drivers/net/nfp/flower/nfp_flower_flow.h      |    4 +-
 drivers/net/nfp/nfd3/nfp_nfd3.h               |    4 +-
 drivers/net/nfp/nfp_rxtx.h                    |    8 +-
 drivers/net/nfp/nfpcore/nfp_nsp.c             |    4 +-
 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c |   12 +-
 drivers/net/octeon_ep/otx_ep_mbox.h           |    4 +-
 drivers/net/octeontx/base/octeontx_pki_var.h  |    4 +-
 drivers/net/pfe/pfe_hif.h                     |    4 +-
 drivers/net/virtio/virtio.h                   |    4 +-
 drivers/net/virtio/virtio_cvq.h               |    8 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |    4 +-
 drivers/net/zxdh/zxdh_common.c                |    8 +-
 drivers/net/zxdh/zxdh_msg.h                   |   16 +-
 drivers/net/zxdh/zxdh_pci.h                   |    4 +-
 drivers/net/zxdh/zxdh_queue.h                 |   64 +-
 drivers/net/zxdh/zxdh_rxtx.h                  |    8 +-
 59 files changed, 2193 insertions(+), 2198 deletions(-)
drivers/net/ark/ark_ddm.h +2 -2
index 84beeb063a..bde3a41345 100644
@@ -17,7 +17,7 @@
  */
 
 /* struct defining Tx meta data --  fixed in FPGA -- 8 bytes */
-union ark_tx_meta {
+union __rte_packed_begin ark_tx_meta {
 	uint64_t physaddr;
 	struct {
 		uint32_t usermeta0;
@@ -31,7 +31,7 @@ union ark_tx_meta {
 		uint8_t  meta_cnt;
 		uint32_t user1;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * DDM core hardware structures
drivers/net/ark/ark_pktchkr.h +4 -4
index b362281776..fa5d2baabe 100644
@@ -23,7 +23,7 @@ typedef void *ark_pkt_chkr_t;
  * This are overlay structures to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_chkr_stat_regs {
+struct __rte_packed_begin ark_pkt_chkr_stat_regs {
 	uint32_t r0;
 	uint32_t pkt_start_stop;
 	uint32_t pkt_ctrl;
@@ -37,9 +37,9 @@ struct ark_pkt_chkr_stat_regs {
 	uint32_t pkts_missing;
 	uint32_t min_latency;
 	uint32_t max_latency;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ark_pkt_chkr_ctl_regs {
+struct __rte_packed_begin ark_pkt_chkr_ctl_regs {
 	uint32_t pkt_ctrl;
 	uint32_t pkt_payload;
 	uint32_t pkt_size_min;
@@ -53,7 +53,7 @@ struct ark_pkt_chkr_ctl_regs {
 	uint32_t dst_mac_addr_h;
 	uint32_t eth_type;
 	uint32_t hdr_dw[7];
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_chkr_inst {
 	struct rte_eth_dev_info *dev_info;
drivers/net/ark/ark_pktdir.h +3 -2
index b5577cebb3..738909941d 100644
@@ -6,6 +6,7 @@
 #define _ARK_PKTDIR_H_
 
 #include <stdint.h>
+#include <rte_common.h>
 
 #define ARK_PKT_DIR_INIT_VAL 0x0110
 
@@ -22,11 +23,11 @@ typedef void *ark_pkt_dir_t;
  * This is an overlay structures to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_dir_regs {
+struct __rte_packed_begin ark_pkt_dir_regs {
 	uint32_t ctrl;
 	uint32_t status;
 	uint32_t stall_cnt;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_dir_inst {
 	volatile struct ark_pkt_dir_regs *regs;
drivers/net/ark/ark_pktgen.h +2 -2
index 925058367c..34879711a3 100644
@@ -22,7 +22,7 @@ typedef void *ark_pkt_gen_t;
  * This is an overlay structure to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_gen_regs {
+struct __rte_packed_begin ark_pkt_gen_regs {
 	uint32_t r0;
 	volatile uint32_t pkt_start_stop;
 	volatile uint32_t pkt_ctrl;
@@ -41,7 +41,7 @@ struct ark_pkt_gen_regs {
 	uint32_t hdr_dw[7];
 	uint32_t start_offset;
 	uint32_t bytes_per_cycle;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_gen_inst {
 	struct rte_eth_dev_info *dev_info;
drivers/net/ark/ark_udm.h +2 -2
index ec53ec7e79..55ffccff9d 100644
@@ -18,12 +18,12 @@
 /* Meta data structure passed from FPGA, must match layout in FPGA
  * -- 32 bytes
  */
-struct ark_rx_meta {
+struct __rte_packed_begin ark_rx_meta {
 	uint32_t user_meta[5];	/* user defined based on fpga code */
 	uint32_t pkt_len32;
 	uint8_t  reserved[6];
 	uint16_t pkt_len;
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * UDM hardware structures
drivers/net/atlantic/hw_atl/hw_atl_utils.h +60 -60

313 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +4 -4
index 3a7faf405c..51ff718620 100644
@@ -37,12 +37,12 @@
 
 #define HW_ATL_FW_FEATURE_LED 0x03010026
 
-struct fw2x_msg_wol_pattern {
+struct __rte_packed_begin fw2x_msg_wol_pattern {
 	u8 mask[16];
 	u32 crc;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fw2x_msg_wol {
+struct __rte_packed_begin fw2x_msg_wol {
 	u32 msg_id;
 	u8 hw_addr[6];
 	u8 magic_packet_enabled;
@@ -53,7 +53,7 @@ struct fw2x_msg_wol {
 	u16 reserved;
 	u32 link_up_timeout;
 	u32 link_down_timeout;
-} __rte_packed;
+} __rte_packed_end;
 
 static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed);
 static int aq_fw2x_set_state(struct aq_hw_s *self,
drivers/net/avp/rte_avp_common.h +6 -6
index 5ad71ac088..906cf0b60a 100644
@@ -60,7 +60,7 @@ enum rte_avp_req_id {
 /*
  * Structure for AVP queue configuration query request/result
  */
-struct rte_avp_device_config {
+struct __rte_packed_begin rte_avp_device_config {
 	uint64_t device_id;	/**< Unique system identifier */
 	uint32_t driver_type; /**< Device Driver type */
 	uint32_t driver_version; /**< Device Driver version */
@@ -68,12 +68,12 @@ struct rte_avp_device_config {
 	uint16_t num_tx_queues;	/**< Number of active transmit queues */
 	uint16_t num_rx_queues;	/**< Number of active receive queues */
 	uint8_t if_up; /**< 1: interface up, 0: interface down */
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * Structure for AVP request.
  */
-struct rte_avp_request {
+struct __rte_packed_begin rte_avp_request {
 	uint32_t req_id; /**< Request id */
 	union {
 		uint32_t new_mtu; /**< New MTU */
@@ -81,7 +81,7 @@ struct rte_avp_request {
 	struct rte_avp_device_config config; /**< Queue configuration */
 	};
 	int32_t result;	/**< Result for processing request */
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * FIFO struct mapped in a shared memory. It describes a circular buffer FIFO
@@ -100,7 +100,7 @@ struct rte_avp_fifo {
 /*
  * AVP packet buffer header used to define the exchange of packet data.
  */
-struct __rte_cache_aligned rte_avp_desc {
+struct __rte_cache_aligned __rte_packed_begin rte_avp_desc {
 	uint64_t pad0;
 	void *pkt_mbuf; /**< Reference to packet mbuf */
 	uint8_t pad1[14];
@@ -114,7 +114,7 @@ struct __rte_cache_aligned rte_avp_desc {
 	uint32_t pad3;
 	uint16_t vlan_tci; /**< VLAN Tag Control Identifier (CPU order). */
 	uint32_t pad4;
-} __rte_packed;
+} __rte_packed_end;
 
 
 /**{ AVP device features */
drivers/net/bnxt/bnxt.h +4 -4
index 0402de3eb9..4a5c224c09 100644
@@ -219,16 +219,16 @@ struct bnxt_led_cfg {
 #define BNXT_LED_DFLT_ENABLES(x)                        \
 	rte_cpu_to_le_32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
 
-struct bnxt_vlan_table_entry {
+struct __rte_packed_begin bnxt_vlan_table_entry {
 	uint16_t		tpid;
 	uint16_t		vid;
-} __rte_packed;
+} __rte_packed_end;
 
-struct bnxt_vlan_antispoof_table_entry {
+struct __rte_packed_begin bnxt_vlan_antispoof_table_entry {
 	uint16_t		tpid;
 	uint16_t		vid;
 	uint16_t		mask;
-} __rte_packed;
+} __rte_packed_end;
 
 struct bnxt_child_vf_info {
 	void			*req_buf;
drivers/net/bnxt/hsi_struct_def_dpdk.h +1672 -1672

2,505 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_resources.h +16 -16
index e77e882b70..f9d18577e5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c +10 -10
index 9b85ede417..be16d00deb 100644

Lines of this file are not shown. View the raw message.

drivers/net/bonding/rte_eth_bond_8023ad.h +16 -16
index 5432eafcfe..395e41ff95 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn10k_rxtx.h +2 -2
index ed54e5f920..9861aa6571 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn20k_rxtx.h +2 -2
index 03eaf34d64..4a8f194eb8 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn9k_ethdev.h +2 -2
index 4933954c33..c267c11c46 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cnxk_rep_msg.h +32 -32

64 lines not on this page · raw message

drivers/net/dpaa/dpaa_rxtx.h +14 -14
index 392926e286..edb29788fb 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa/fmlib/fm_ext.h +2 -2
index 7b8d85cc71..b341862c73 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h +2 -2
index 7e5e499b6a..6bca4c8de2 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa2/dpaa2_recycle.c +8 -8
index 4fde9b95a0..94a7e2a020 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/base/vnic_devcmd.h +20 -20
index 2b3be855f9..b470f44a69 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/base/vnic_flowman.h +60 -60

120 lines not on this page · raw message

drivers/net/gve/base/gve_desc.h +8 -8
index 006b36442f..51d3ec73f6 100644

Lines of this file are not shown. View the raw message.

drivers/net/gve/base/gve_desc_dqo.h +16 -16
index bb4a18d4d1..aa860e1e76 100644

Lines of this file are not shown. View the raw message.

drivers/net/gve/base/gve_osdep.h +0 -3
index 64181cebd6..cb3936c150 100644

Lines of this file are not shown. View the raw message.

drivers/net/hns3/hns3_mbx.h +4 -4
index 2b6cb8f513..c73f34fb32 100644

Lines of this file are not shown. View the raw message.

drivers/net/hns3/hns3_rxtx.h +2 -2
index e975cd151a..0bce89ebaa 100644

Lines of this file are not shown. View the raw message.

drivers/net/i40e/base/i40e_osdep.h +4 -4
index 302841dba8..c04f94732a 100644

Lines of this file are not shown. View the raw message.

drivers/net/iavf/iavf_ipsec_crypto.h +5 -5
index 49f9202aca..795b75a624 100644

Lines of this file are not shown. View the raw message.

drivers/net/iavf/iavf_rxtx.c +1 -1
index 6a093c6746..f7df5f21f2 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_osdep.h +4 -7
index 64e4779878..7b96fcde03 100644

Lines of this file are not shown. View the raw message.

drivers/net/ionic/ionic_if.h +36 -36

72 lines not on this page · raw message

drivers/net/memif/memif.h +18 -18
index 3f5b407a48..cff96f271a 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx4/mlx4_mr.h +6 -6
index af5251a960..56dd73ff19 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/hws/mlx5dr.h +2 -2
index 3668ab9fcf..7097d22099 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5.h +2 -2
index 89d277b523..cc8a03ccd6 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_flow.h +8 -8
index bcc2782460..50b0e2ce47 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_hws_cnt.h +2 -2
index d8da9dfcdd..38a9c19449 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_utils.h +8 -8
index f933daf03c..db2e33dfa9 100644

Lines of this file are not shown. View the raw message.

drivers/net/netvsc/hn_nvs.h +36 -36

72 lines not on this page · raw message

drivers/net/netvsc/ndis.h +4 -4
index d97a397a86..df39b26df7 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/flower/nfp_flower_cmsg.h +2 -2
index a7866e8382..aff5d54347 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/flower/nfp_flower_flow.h +2 -2
index f54ad6cf55..a5cb440bd5 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfd3/nfp_nfd3.h +2 -2
index 3ba562cc3f..96ea23b3df 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfp_rxtx.h +4 -4
index c717d97003..81e420a79d 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfpcore/nfp_nsp.c +2 -2
index 9837b3354b..b664e3adfa 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +6 -6
index e46a3bef28..c178144d42 100644

Lines of this file are not shown. View the raw message.

drivers/net/octeon_ep/otx_ep_mbox.h +2 -2
index ec96e4edc5..4f7afe7635 100644

Lines of this file are not shown. View the raw message.

drivers/net/octeontx/base/octeontx_pki_var.h +2 -2
index 4445369ce7..8816680dfe 100644

Lines of this file are not shown. View the raw message.

drivers/net/pfe/pfe_hif.h +2 -2
index e8d5ba10e1..16bf696689 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio.h +2 -2
index 04a897bf51..ef5827c5f5 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio_cvq.h +4 -4
index 70739ae04b..5e176b6379 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio_user/vhost_user.c +2 -2
index c10252506b..6c042f6186 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_common.c +4 -4
index 4f18c97ed7..72c0ed65cc 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_msg.h +8 -8
index 530ee406b1..5f57acd055 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_pci.h +2 -2
index ed6fd89742..fe41312cc0 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_queue.h +32 -32

64 lines not on this page · raw message

drivers/net/zxdh/zxdh_rxtx.h +4 -4
index de9353b223..bc9c9b629a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.47.0.vfs.0.3

Part of the diff is not shown here. View the raw message.

#268 lore raw

PATCH v10 15/30 drivers/raw: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/raw/ifpga/afu_pmd_n3000.h    | 8 ++++----
 drivers/raw/ifpga/base/opae_hw_api.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/raw/ifpga/afu_pmd_n3000.h +4 -4
index f6b6e07c6b..2c137bd14e 100644
@@ -211,7 +211,7 @@ typedef union {
 	};
 } msgdma_desc_ctrl;
 
-typedef struct __rte_packed {
+typedef struct __rte_packed_begin {
 	uint32_t rd_address;
 	uint32_t wr_address;
 	uint32_t len;
@@ -223,7 +223,7 @@ typedef struct __rte_packed {
 	uint32_t rd_address_ext;
 	uint32_t wr_address_ext;
 	msgdma_desc_ctrl control;
-} msgdma_ext_desc;
+} __rte_packed_end msgdma_ext_desc;
 
 typedef union {
 	uint32_t csr;
@@ -279,13 +279,13 @@ typedef union {
 	};
 } msgdma_seq_num;
 
-typedef struct __rte_packed {
+typedef struct __rte_packed_begin {
 	msgdma_status status;
 	msgdma_ctrl ctrl;
 	msgdma_fill_level fill_level;
 	msgdma_rsp_level rsp;
 	msgdma_seq_num seq_num;
-} msgdma_csr;
+} __rte_packed_end msgdma_csr;
 
 #define CSR_STATUS(csr)   (&(((msgdma_csr *)(csr))->status))
 #define CSR_CONTROL(csr)  (&(((msgdma_csr *)(csr))->ctrl))
drivers/raw/ifpga/base/opae_hw_api.h +2 -2
index 613563a0b4..57750022dd 100644
@@ -343,9 +343,9 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 /* OPAE vBNG network datastruct */
 #define OPAE_ETHER_ADDR_LEN 6
 
-struct opae_ether_addr {
+struct __rte_packed_begin opae_ether_addr {
 	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
-} __rte_packed;
+} __rte_packed_end;
 
 /* OPAE vBNG network API*/
 int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
Signature · 1 line
2.47.0.vfs.0.3
#269 lore raw

PATCH v10 16/30 drivers/regex: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/regex/cn9k/cn9k_regexdev.c |  4 ++--
 drivers/regex/mlx5/mlx5_rxp.h      | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/regex/cn9k/cn9k_regexdev.c +2 -2
index aa809ab5bf..5abc7e22bc 100644
@@ -40,12 +40,12 @@ struct ree_rule_db_entry {
 	uint64_t	value;
 };
 
-struct ree_rule_db {
+struct __rte_packed_begin ree_rule_db {
 	uint32_t version;
 	uint32_t revision;
 	uint32_t number_of_entries;
 	struct ree_rule_db_entry entries[];
-} __rte_packed;
+} __rte_packed_end;
 
 static void
 qp_memzone_name_get(char *name, int size, int dev_id, int qp_id)
drivers/regex/mlx5/mlx5_rxp.h +8 -8
index b38b53cc14..08b9a2680b 100644
@@ -42,14 +42,14 @@
 #define MLX5_RXP_RESP_STATUS_PMI_EOJ (1 << 14)
 
 /* This describes the header the RXP expects for any search data. */
-struct mlx5_rxp_job_desc {
+struct __rte_packed_begin mlx5_rxp_job_desc {
 	uint32_t job_id;
 	uint16_t ctrl;
 	uint16_t len;
 	uint16_t subset[4];
-} __rte_packed;
+} __rte_packed_end;
 
-struct mlx5_rxp_response_desc {
+struct __rte_packed_begin mlx5_rxp_response_desc {
 	uint32_t job_id;
 	uint16_t status;
 	uint8_t	detected_match_count;
@@ -58,13 +58,13 @@ struct mlx5_rxp_response_desc {
 	uint16_t instruction_count;
 	uint16_t latency_count;
 	uint16_t pmi_min_byte_ptr;
-} __rte_packed;
+} __rte_packed_end;
 
-struct mlx5_rxp_match_tuple {
+struct __rte_packed_begin mlx5_rxp_match_tuple {
 	uint32_t rule_id;
 	uint16_t start_ptr;
 	uint16_t length;
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_rxp_response {
 	struct mlx5_rxp_response_desc header;
@@ -115,11 +115,11 @@ struct mlx5_rxp_rof {
 	struct mlx5_rxp_rof_entry *rof_entries;
 };
 
-struct mlx5_rxp_ctl_rules_pgm {
+struct __rte_packed_begin mlx5_rxp_ctl_rules_pgm {
 	struct mlx5_rxp_ctl_hdr hdr;
 	uint32_t count;
 	struct mlx5_rxp_rof_entry rules[];
-} __rte_packed;
+} __rte_packed_end;
 
 /* RXP programming mode setting. */
 enum mlx5_rxp_program_mode {
Signature · 1 line
2.47.0.vfs.0.3
#270 lore raw

PATCH v10 17/30 drivers/vdpa: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/vdpa/ifc/base/ifcvf.h | 4 ++--
 drivers/vdpa/mlx5/mlx5_vdpa.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/vdpa/ifc/base/ifcvf.h +2 -2
index 04c81c8196..0c3b8956c5 100644
@@ -115,11 +115,11 @@ struct ifcvf_pci_common_cfg {
 	u32 queue_used_hi;
 };
 
-struct ifcvf_net_config {
+struct __rte_packed_begin ifcvf_net_config {
 	u8    mac[6];
 	u16   status;
 	u16   max_virtqueue_pairs;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ifcvf_pci_mem_resource {
 	u64      phys_addr; /**< Physical address, 0 if not resource. */
drivers/vdpa/mlx5/mlx5_vdpa.h +2 -2
index e156520172..a398aa22ce 100644
@@ -90,13 +90,13 @@ enum mlx5_vdpa_task_type {
 };
 
 /* Generic task information and size must be multiple of 4B. */
-struct __rte_aligned(4) mlx5_vdpa_task {
+struct __rte_aligned(4) __rte_packed_begin mlx5_vdpa_task {
 	struct mlx5_vdpa_priv *priv;
 	enum mlx5_vdpa_task_type type;
 	RTE_ATOMIC(uint32_t) *remaining_cnt;
 	RTE_ATOMIC(uint32_t) *err_cnt;
 	uint32_t idx;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Generic mlx5_vdpa_c_thread information. */
 struct mlx5_vdpa_c_thread {
Signature · 1 line
2.47.0.vfs.0.3
#271 lore raw

PATCH v10 18/30 examples/common: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Added parenthesis around *pnum in line
__ rte_packed_end (*pnum) = (void *)pn;
to avoid patch check error below:

ERROR:SPACING: need consistent spacing around '*' (ctx:WxV) 34: FILE: examples/common/neon/port_group.h:27:
+ } __ rte_packed_end *pnum = (void *)pn;

With the parenthesis it becomes a warning, still not ideal, but better Running checkpatch.pl:
WARNING:SPACING: space prohibited between function name and open parenthesis '('
34: FILE: examples/common/neon/port_group.h:27:
+ } __ rte_packed_end (*pnum) = (void *)pn;

---
 examples/common/neon/port_group.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/common/neon/port_group.h +2 -2
index 421e2e8613..b8f8be66e8 100644
@@ -21,10 +21,10 @@ static inline uint16_t *
 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 		  uint16x8_t dp2)
 {
-	union {
+	union __rte_packed_begin {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
-	} __rte_packed *pnum = (void *)pn;
+	} __rte_packed_end (*pnum) = (void *)pn;
 
 	uint16x8_t mask = {1, 2, 4, 8, 0, 0, 0, 0};
 	int32_t v;
Signature · 1 line
2.47.0.vfs.0.3
#272 lore raw

PATCH v10 19/30 examples/ip-pipeline: remove packed attributes

In reply to Andre Muezerie

Removed packed attributes from structs that are naturally packed already, or don't require packing.

---
 examples/ip_pipeline/cli.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
examples/ip_pipeline/cli.c +5 -5
index 92dfacdeb0..766fc8e46e 100644
@@ -2571,7 +2571,7 @@ struct pkt_key_qinq {
 	uint16_t svlan;
 	uint16_t ethertype_cvlan;
 	uint16_t cvlan;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_5tuple {
 	uint8_t time_to_live;
@@ -2581,7 +2581,7 @@ struct pkt_key_ipv4_5tuple {
 	uint32_t da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
@@ -2591,15 +2591,15 @@ struct pkt_key_ipv6_5tuple {
 	struct rte_ipv6_addr da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_addr {
 	uint32_t addr;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_addr {
 	struct rte_ipv6_addr addr;
-} __rte_packed;
+};
 
 static uint32_t
 parse_match(char **tokens,
Signature · 1 line
2.47.0.vfs.0.3
#273 lore raw

PATCH v10 20/30 examples/ipsec_secgw: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/ipsec-secgw/ipsec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ipsec-secgw/ipsec.h +2 -2
index f12f57e2d5..e3cc43ef3b 100644
@@ -274,11 +274,11 @@ struct socket_ctx {
 	struct rte_mempool *session_pool;
 };
 
-struct cnt_blk {
+struct __rte_packed_begin cnt_blk {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
 struct __rte_cache_aligned lcore_rx_queue {
 	uint16_t port_id;
Signature · 1 line
2.47.0.vfs.0.3
#274 lore raw

PATCH v10 21/30 examples/l3fwd-power: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/l3fwd-power/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/l3fwd-power/main.c +4 -4
index ae8b55924e..d279e664b3 100644
@@ -282,21 +282,21 @@ static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
 #define DEFAULT_HASH_FUNC       rte_jhash
 #endif
 
-struct ipv4_5tuple {
+struct __rte_packed_begin ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ipv6_5tuple {
+struct __rte_packed_begin ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ipv4_l3fwd_route {
 	struct ipv4_5tuple key;
Signature · 1 line
2.47.0.vfs.0.3
#275 lore raw

PATCH v10 22/30 examples/l3fwd: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/l3fwd/l3fwd_route.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/l3fwd/l3fwd_route.h +4 -4
index 62263c3540..b02b9cc11c 100644
@@ -36,21 +36,21 @@ struct ipv6_l3fwd_route {
 	uint8_t if_out;
 };
 
-struct ipv4_5tuple {
+struct __rte_packed_begin ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ipv6_5tuple {
+struct __rte_packed_begin ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
 struct lpm_route_rule {
 	union {
Signature · 1 line
2.47.0.vfs.0.3
#276 lore raw

PATCH v10 23/30 examples/ptpclient: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/ptpclient/ptpclient.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
examples/ptpclient/ptpclient.c +16 -16
index 7b6862d951..9c64313fa9 100644
@@ -56,22 +56,22 @@ static const struct rte_ether_addr ether_multicast = {
 };
 
 /* Structs used for PTP handling. */
-struct tstamp {
+struct __rte_packed_begin tstamp {
 	uint16_t   sec_msb;
 	uint32_t   sec_lsb;
 	uint32_t   ns;
-}  __rte_packed;
+}  __rte_packed_end;
 
 struct clock_id {
 	uint8_t id[8];
 };
 
-struct port_id {
+struct __rte_packed_begin port_id {
 	struct clock_id        clock_id;
 	uint16_t               port_number;
-}  __rte_packed;
+}  __rte_packed_end;
 
-struct ptp_header {
+struct __rte_packed_begin ptp_header {
 	uint8_t              msg_type;
 	uint8_t              ver;
 	uint16_t             message_length;
@@ -84,39 +84,39 @@ struct ptp_header {
 	uint16_t             seq_id;
 	uint8_t              control;
 	int8_t               log_message_interval;
-} __rte_packed;
+} __rte_packed_end;
 
-struct sync_msg {
+struct __rte_packed_begin sync_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
-} __rte_packed;
+} __rte_packed_end;
 
-struct follow_up_msg {
+struct __rte_packed_begin follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
 	uint8_t             suffix[];
-} __rte_packed;
+} __rte_packed_end;
 
-struct delay_req_msg {
+struct __rte_packed_begin delay_req_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
-} __rte_packed;
+} __rte_packed_end;
 
-struct delay_resp_msg {
+struct __rte_packed_begin delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
 	struct port_id       req_port_id;
 	uint8_t              suffix[];
-} __rte_packed;
+} __rte_packed_end;
 
 struct ptp_message {
-	union {
+	union __rte_packed_begin {
 		struct ptp_header          header;
 		struct sync_msg            sync;
 		struct delay_req_msg       delay_req;
 		struct follow_up_msg       follow_up;
 		struct delay_resp_msg      delay_resp;
-	} __rte_packed;
+	} __rte_packed_end;
 };
 
 struct ptpv2_time_receiver_ordinary {
Signature · 1 line
2.47.0.vfs.0.3
#277 lore raw

PATCH v10 24/30 examples/vhost_blk: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/vhost_blk/blk_spec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/vhost_blk/blk_spec.h +2 -2
index 3c54f70eaf..7f785fa563 100644
@@ -73,7 +73,7 @@ struct vhost_memory_padded {
 	struct vhost_memory_region regions[VHOST_USER_MEMORY_MAX_NREGIONS];
 };
 
-struct vhost_user_msg {
+struct __rte_packed_begin vhost_user_msg {
 	enum vhost_user_request request;
 
 #define VHOST_USER_VERSION_MASK     0x3
@@ -89,6 +89,6 @@ struct vhost_user_msg {
 		struct vhost_memory_padded memory;
 		struct vhost_user_config cfg;
 	} payload;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif
Signature · 1 line
2.47.0.vfs.0.3
#278 lore raw

PATCH v10 25/30 lib/eal: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Removed the packed attributes from some structures that don't need them.

---
 lib/eal/common/eal_private.h      |  2 +-
 lib/eal/include/rte_memory.h      |  4 ++--
 lib/eal/include/rte_memzone.h     |  4 ++--
 lib/eal/include/rte_trace_point.h |  2 +-
 lib/eal/x86/include/rte_memcpy.h  | 12 ++++++------
 5 files changed, 12 insertions(+), 12 deletions(-)
lib/eal/common/eal_private.h +1 -1
index bb315dab04..3b94e01b5b 100644
@@ -62,7 +62,7 @@ struct rte_config {
 	 * DPDK instances
 	 */
 	struct rte_mem_config *mem_config;
-} __rte_packed;
+};
 
 /**
  * Get the global configuration structure.
lib/eal/include/rte_memory.h +2 -2
index dbd0a6bedc..249e0f5690 100644
@@ -46,7 +46,7 @@ extern "C" {
 /**
  * Physical memory segment descriptor.
  */
-struct rte_memseg {
+struct __rte_packed_begin rte_memseg {
 	rte_iova_t iova;            /**< Start IO address. */
 	union {
 		void *addr;         /**< Start virtual address. */
@@ -58,7 +58,7 @@ struct rte_memseg {
 	uint32_t nchannel;          /**< Number of channels. */
 	uint32_t nrank;             /**< Number of ranks. */
 	uint32_t flags;             /**< Memseg-specific flags */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * memseg list is a special case as we need to store a bunch of other data
lib/eal/include/rte_memzone.h +2 -2
index e1563994d5..5a0e1b8a15 100644
@@ -45,7 +45,7 @@ extern "C" {
  * A structure describing a memzone, which is a contiguous portion of
  * physical memory identified by a name.
  */
-struct rte_memzone {
+struct __rte_packed_begin rte_memzone {
 
 #define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
 	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
@@ -62,7 +62,7 @@ struct rte_memzone {
 	int32_t socket_id;                /**< NUMA socket ID. */
 
 	uint32_t flags;                   /**< Characteristics of this memzone. */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Set the maximum number of memzones.
lib/eal/include/rte_trace_point.h +1 -1
index 87b5f43c3c..b24db3b6da 100644
@@ -298,7 +298,7 @@ struct __rte_trace_stream_header {
 	rte_uuid_t uuid;
 	uint32_t lcore_id;
 	char thread_name[__RTE_TRACE_EMIT_STRING_LEN_MAX];
-} __rte_packed;
+};
 
 struct __rte_trace_header {
 	uint32_t offset;
lib/eal/x86/include/rte_memcpy.h +6 -6
index 42058e4a3f..46d34b8081 100644
@@ -67,15 +67,15 @@ rte_mov15_or_less(void *dst, const void *src, size_t n)
 	 * Use the following structs to avoid violating C standard
 	 * alignment requirements and to avoid strict aliasing bugs
 	 */
-	struct rte_uint64_alias {
+	struct __rte_packed_begin rte_uint64_alias {
 		uint64_t val;
-	} __rte_packed __rte_may_alias;
-	struct rte_uint32_alias {
+	} __rte_packed_end __rte_may_alias;
+	struct __rte_packed_begin rte_uint32_alias {
 		uint32_t val;
-	} __rte_packed __rte_may_alias;
-	struct rte_uint16_alias {
+	} __rte_packed_end __rte_may_alias;
+	struct __rte_packed_begin rte_uint16_alias {
 		uint16_t val;
-	} __rte_packed __rte_may_alias;
+	} __rte_packed_end __rte_may_alias;
 
 	void *ret = dst;
 	if (n & 8) {
Signature · 1 line
2.47.0.vfs.0.3
#279 lore raw

PATCH v10 26/30 lib/ipsec: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/ipsec/crypto.h | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)
lib/ipsec/crypto.h +22 -22
index 93d20aaaa0..dc6210a49a 100644
@@ -15,11 +15,11 @@
  * AES-CTR counter block format.
  */
 
-struct aesctr_cnt_blk {
+struct __rte_packed_begin aesctr_cnt_blk {
 	uint32_t nonce;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * CHACHA20-POLY1305 devices have some specific requirements
@@ -27,13 +27,13 @@ struct aesctr_cnt_blk {
   * Ideally that to be done by the driver itself.
   */
 
-struct aead_chacha20_poly1305_iv {
+struct __rte_packed_begin aead_chacha20_poly1305_iv {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_chacha20_poly1305_aad {
+struct __rte_packed_begin aead_chacha20_poly1305_aad {
 	uint32_t spi;
 	/*
 	 * RFC 4106, section 5:
@@ -45,25 +45,25 @@ struct aead_chacha20_poly1305_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct chacha20_poly1305_esph_iv {
+struct __rte_packed_begin chacha20_poly1305_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * AES-GCM devices have some specific requirements for IV and AAD formats.
   * Ideally that to be done by the driver itself.
   */
 
-struct aead_gcm_iv {
+struct __rte_packed_begin aead_gcm_iv {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_gcm_aad {
+struct __rte_packed_begin aead_gcm_aad {
 	uint32_t spi;
 	/*
 	 * RFC 4106, section 5:
@@ -75,34 +75,34 @@ struct aead_gcm_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct gcm_esph_iv {
+struct __rte_packed_begin gcm_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * AES-CCM devices have some specific requirements for IV and AAD formats.
   * Ideally that to be done by the driver itself.
   */
-union aead_ccm_salt {
+union __rte_packed_begin aead_ccm_salt {
 	uint32_t salt;
 	struct inner {
 		uint8_t salt8[3];
 		uint8_t ccm_flags;
 	} inner;
-} __rte_packed;
+} __rte_packed_end;
 
 
-struct aead_ccm_iv {
+struct __rte_packed_begin aead_ccm_iv {
 	uint8_t ccm_flags;
 	uint8_t salt[3];
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_ccm_aad {
+struct __rte_packed_begin aead_ccm_aad {
 	uint8_t padding[18];
 	uint32_t spi;
 	/*
@@ -115,12 +115,12 @@ struct aead_ccm_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct ccm_esph_iv {
+struct __rte_packed_begin ccm_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
 
 static inline void
Signature · 1 line
2.47.0.vfs.0.3
#280 lore raw

PATCH v10 27/30 lib/net: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

This change affects the storage size of a variable of enum rte_ipv6_mc_scope (at least with gcc). It should be OK from an ABI POV
though: there is one (inline) helper using this type, and nothing else in DPDK takes a IPv6 multicast scope as input.

---
 lib/net/rte_arp.h      |  8 ++++----
 lib/net/rte_dtls.h     |  4 ++--
 lib/net/rte_esp.h      |  8 ++++----
 lib/net/rte_geneve.h   |  4 ++--
 lib/net/rte_gre.h      | 16 ++++++++--------
 lib/net/rte_gtp.h      | 20 ++++++++++----------
 lib/net/rte_ib.h       |  4 ++--
 lib/net/rte_icmp.h     | 12 ++++++------
 lib/net/rte_ip4.h      |  4 ++--
 lib/net/rte_ip6.h      | 14 +++++++-------
 lib/net/rte_l2tpv2.h   | 16 ++++++++--------
 lib/net/rte_macsec.h   |  8 ++++----
 lib/net/rte_mpls.h     |  4 ++--
 lib/net/rte_pdcp_hdr.h | 16 ++++++++--------
 lib/net/rte_ppp.h      |  4 ++--
 lib/net/rte_sctp.h     |  4 ++--
 lib/net/rte_tcp.h      |  4 ++--
 lib/net/rte_tls.h      |  4 ++--
 lib/net/rte_udp.h      |  4 ++--
 lib/net/rte_vxlan.h    | 28 ++++++++++++++--------------
 20 files changed, 93 insertions(+), 93 deletions(-)
lib/net/rte_arp.h +4 -4
index 668cea1704..e885a71292 100644
@@ -21,17 +21,17 @@ extern "C" {
 /**
  * ARP header IPv4 payload.
  */
-struct __rte_aligned(2) rte_arp_ipv4 {
+struct __rte_aligned(2) __rte_packed_begin rte_arp_ipv4 {
 	struct rte_ether_addr arp_sha;  /**< sender hardware address */
 	rte_be32_t            arp_sip;  /**< sender IP address */
 	struct rte_ether_addr arp_tha;  /**< target hardware address */
 	rte_be32_t            arp_tip;  /**< target IP address */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ARP header.
  */
-struct __rte_aligned(2) rte_arp_hdr {
+struct __rte_aligned(2) __rte_packed_begin rte_arp_hdr {
 	rte_be16_t arp_hardware; /**< format of hardware address */
 #define RTE_ARP_HRD_ETHER     1  /**< ARP Ethernet address format */
 
@@ -47,7 +47,7 @@ struct __rte_aligned(2) rte_arp_hdr {
 #define	RTE_ARP_OP_INVREPLY   9  /**< response identifying peer */
 
 	struct rte_arp_ipv4 arp_data;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Make a RARP packet based on MAC addr.
lib/net/rte_dtls.h +2 -2
index 246cd8a72d..1dd95ce899 100644
@@ -30,7 +30,7 @@
  * DTLS Header
  */
 __extension__
-struct rte_dtls_hdr {
+struct __rte_packed_begin rte_dtls_hdr {
 	/** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */
 	uint8_t type;
 	/** DTLS Version defined as RTE_DTLS_VERSION*. */
@@ -48,6 +48,6 @@ struct rte_dtls_hdr {
 #endif
 	/** The length (in bytes) of the following DTLS packet. */
 	rte_be16_t length;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_DTLS_H */
lib/net/rte_esp.h +4 -4
index 745a9847fe..2a0002f4d9 100644
@@ -16,17 +16,17 @@
 /**
  * ESP Header
  */
-struct rte_esp_hdr {
+struct __rte_packed_begin rte_esp_hdr {
 	rte_be32_t spi;  /**< Security Parameters Index */
 	rte_be32_t seq;  /**< packet sequence number */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ESP Trailer
  */
-struct rte_esp_tail {
+struct __rte_packed_begin rte_esp_tail {
 	uint8_t pad_len;     /**< number of pad bytes (0-255) */
 	uint8_t next_proto;  /**< IPv4 or IPv6 or next layer header */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_ESP_H_ */
lib/net/rte_geneve.h +2 -2
index eb2c85f1e9..f962c587ee 100644
@@ -34,7 +34,7 @@
  * More-bits (optional) variable length options.
  */
 __extension__
-struct rte_geneve_hdr {
+struct __rte_packed_begin rte_geneve_hdr {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t ver:2;		/**< Version. */
 	uint8_t opt_len:6;	/**< Options length. */
@@ -52,7 +52,7 @@ struct rte_geneve_hdr {
 	uint8_t vni[3];		/**< Virtual network identifier. */
 	uint8_t reserved2;	/**< Reserved. */
 	uint32_t opts[];	/**< Variable length options. */
-} __rte_packed;
+} __rte_packed_end;
 
 /* GENEVE ETH next protocol types */
 #define RTE_GENEVE_TYPE_ETH	0x6558 /**< Ethernet Protocol. */
lib/net/rte_gre.h +8 -8
index 1483e1b42d..768c4ce7b5 100644
@@ -23,7 +23,7 @@
  * GRE Header
  */
 __extension__
-struct rte_gre_hdr {
+struct __rte_packed_begin rte_gre_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint16_t res2:4; /**< Reserved */
 	uint16_t s:1;    /**< Sequence Number Present bit */
@@ -42,28 +42,28 @@ struct rte_gre_hdr {
 	uint16_t ver:3;  /**< Version Number */
 #endif
 	rte_be16_t proto;  /**< Protocol Type */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional field checksum in GRE header
  */
-struct rte_gre_hdr_opt_checksum_rsvd {
+struct __rte_packed_begin rte_gre_hdr_opt_checksum_rsvd {
 	rte_be16_t checksum;
 	rte_be16_t reserved1;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional field key in GRE header
  */
-struct rte_gre_hdr_opt_key {
+struct __rte_packed_begin rte_gre_hdr_opt_key {
 	rte_be32_t key;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional field sequence in GRE header
  */
-struct rte_gre_hdr_opt_sequence {
+struct __rte_packed_begin rte_gre_hdr_opt_sequence {
 	rte_be32_t sequence;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_GRE_H_ */
lib/net/rte_gtp.h +10 -10
index ab06e23a6e..0332d35c16 100644
@@ -24,7 +24,7 @@
  * No optional fields and next extension header.
  */
 __extension__
-struct rte_gtp_hdr {
+struct __rte_packed_begin rte_gtp_hdr {
 	union {
 		uint8_t gtp_hdr_info; /**< GTP header info */
 		struct {
@@ -48,21 +48,21 @@ struct rte_gtp_hdr {
 	uint8_t msg_type;     /**< GTP message type */
 	rte_be16_t plen;      /**< Total payload length */
 	rte_be32_t teid;      /**< Tunnel endpoint ID */
-} __rte_packed;
+} __rte_packed_end;
 
 /* Optional word of GTP header, present if any of E, S, PN is set. */
-struct rte_gtp_hdr_ext_word {
+struct __rte_packed_begin rte_gtp_hdr_ext_word {
 	rte_be16_t sqn;	      /**< Sequence Number. */
 	uint8_t npdu;	      /**< N-PDU number. */
 	uint8_t next_ext;     /**< Next Extension Header Type. */
-}  __rte_packed;
+}  __rte_packed_end;
 
 /**
  * Optional extension for GTP with next_ext set to 0x85
  * defined based on RFC 38415-g30.
  */
 __extension__
-struct rte_gtp_psc_generic_hdr {
+struct __rte_packed_begin rte_gtp_psc_generic_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t type:4;		/**< PDU type */
@@ -78,14 +78,14 @@ struct rte_gtp_psc_generic_hdr {
 	uint8_t spare:2;	/**< type specific spare bits */
 #endif
 	uint8_t data[0];	/**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional extension for GTP with next_ext set to 0x85
  * type0 defined based on RFC 38415-g30
  */
 __extension__
-struct rte_gtp_psc_type0_hdr {
+struct __rte_packed_begin rte_gtp_psc_type0_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t type:4;		/**< PDU type */
@@ -105,14 +105,14 @@ struct rte_gtp_psc_type0_hdr {
 	uint8_t ppp:1;		/**< Paging policy presence */
 #endif
 	uint8_t data[0];	/**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Optional extension for GTP with next_ext set to 0x85
  * type1 defined based on RFC 38415-g30
  */
 __extension__
-struct rte_gtp_psc_type1_hdr {
+struct __rte_packed_begin rte_gtp_psc_type1_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t type:4;		/**< PDU type */
@@ -134,7 +134,7 @@ struct rte_gtp_psc_type1_hdr {
 	uint8_t n_delay_ind:1;	/**< N3/N9 delay result presence */
 #endif
 	uint8_t data[0];	/**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
 
 /** GTP header length */
 #define RTE_ETHER_GTP_HLEN \
lib/net/rte_ib.h +2 -2
index a551f3753f..f1b455cea0 100644
@@ -22,7 +22,7 @@
  * IB Specification Vol 1-Release-1.4.
  */
 __extension__
-struct rte_ib_bth {
+struct __rte_packed_begin rte_ib_bth {
 	uint8_t	opcode;		/**< Opcode. */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t	tver:4;		/**< Transport Header Version. */
@@ -54,7 +54,7 @@ struct rte_ib_bth {
 	uint8_t	rsvd1:7;	/**< Reserved. */
 #endif
 	uint8_t	psn[3];		/**< Packet Sequence Number */
-} __rte_packed;
+} __rte_packed_end;
 
 /** RoCEv2 default port. */
 #define RTE_ROCEV2_DEFAULT_PORT 4791
lib/net/rte_icmp.h +6 -6
index e69d68ab6e..cca73b3733 100644
@@ -21,33 +21,33 @@
 /**
  * ICMP base header
  */
-struct rte_icmp_base_hdr {
+struct __rte_packed_begin rte_icmp_base_hdr {
 	uint8_t type;
 	uint8_t code;
 	rte_be16_t checksum;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ICMP echo header
  */
-struct rte_icmp_echo_hdr {
+struct __rte_packed_begin rte_icmp_echo_hdr {
 	struct rte_icmp_base_hdr base;
 	rte_be16_t identifier;
 	rte_be16_t sequence;
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * ICMP Header
  *
  * @see rte_icmp_echo_hdr which is similar.
  */
-struct rte_icmp_hdr {
+struct __rte_packed_begin rte_icmp_hdr {
 	uint8_t  icmp_type;     /* ICMP packet type. */
 	uint8_t  icmp_code;     /* ICMP packet code. */
 	rte_be16_t icmp_cksum;  /* ICMP packet checksum. */
 	rte_be16_t icmp_ident;  /* ICMP packet identifier. */
 	rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */
-} __rte_packed;
+} __rte_packed_end;
 
 /* ICMP packet types */
 #define RTE_ICMP_TYPE_ECHO_REPLY 0
lib/net/rte_ip4.h +2 -2
index f9b8333332..d4b38c513c 100644
@@ -39,7 +39,7 @@ extern "C" {
 /**
  * IPv4 Header
  */
-struct __rte_aligned(2) rte_ipv4_hdr {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv4_hdr {
 	__extension__
 	union {
 		uint8_t version_ihl;    /**< version and header length */
@@ -62,7 +62,7 @@ struct __rte_aligned(2) rte_ipv4_hdr {
 	rte_be16_t hdr_checksum;	/**< header checksum */
 	rte_be32_t src_addr;		/**< source address */
 	rte_be32_t dst_addr;		/**< destination address */
-} __rte_packed;
+} __rte_packed_end;
 
 /** Create IPv4 address */
 #define RTE_IPV4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \
lib/net/rte_ip6.h +7 -7
index 992ab5ee1f..92558a124a 100644
@@ -358,7 +358,7 @@ enum rte_ipv6_mc_scope {
 	RTE_IPV6_MC_SCOPE_ORGLOCAL = 0x08,
 	/** Global multicast scope. */
 	RTE_IPV6_MC_SCOPE_GLOBAL = 0x0e,
-} __rte_packed;
+};
 
 /**
  * Extract the IPv6 multicast scope value as defined in RFC 4291, section 2.7.
@@ -461,7 +461,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr *mac, const struct rte_ipv6_addr
 /**
  * IPv6 Header
  */
-struct __rte_aligned(2) rte_ipv6_hdr {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv6_hdr {
 	union {
 		rte_be32_t vtc_flow;        /**< IP version, traffic class & flow label. */
 		__extension__
@@ -484,7 +484,7 @@ struct __rte_aligned(2) rte_ipv6_hdr {
 	uint8_t  hop_limits;	/**< Hop limits. */
 	struct rte_ipv6_addr src_addr;	/**< IP address of source host. */
 	struct rte_ipv6_addr dst_addr;	/**< IP address of destination host(s). */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Check that the IPv6 header version field is valid according to RFC 8200 section 3.
@@ -508,7 +508,7 @@ static inline int rte_ipv6_check_version(const struct rte_ipv6_hdr *ip)
 /**
  * IPv6 Routing Extension Header
  */
-struct __rte_aligned(2) rte_ipv6_routing_ext {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
 	uint8_t type;				/**< Extension header type. */
@@ -523,7 +523,7 @@ struct __rte_aligned(2) rte_ipv6_routing_ext {
 		};
 	};
 	/* Next are 128-bit IPv6 address fields to describe segments. */
-} __rte_packed;
+} __rte_packed_end;
 
 /* IPv6 vtc_flow: IPv / TC / flow_label */
 #define RTE_IPV6_HDR_FL_SHIFT 0
@@ -752,12 +752,12 @@ rte_ipv6_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m,
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
-struct __rte_aligned(2) rte_ipv6_fragment_ext {
+struct __rte_aligned(2) __rte_packed_begin rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
 	rte_be16_t frag_data;	/**< All fragmentation data */
 	rte_be32_t id;		/**< Packet ID */
-} __rte_packed;
+} __rte_packed_end;
 
 /* IPv6 fragment extension header size */
 #define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
lib/net/rte_l2tpv2.h +8 -8
index ac16657856..728dc01506 100644
@@ -125,7 +125,7 @@ struct rte_l2tpv2_common_hdr {
  * L2TPv2 message Header contains all options(length, ns, nr,
  * offset size, offset padding).
  */
-struct rte_l2tpv2_msg_with_all_options {
+struct __rte_packed_begin rte_l2tpv2_msg_with_all_options {
 	rte_be16_t length;		/**< length(16) */
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -133,20 +133,20 @@ struct rte_l2tpv2_msg_with_all_options {
 	rte_be16_t nr;			/**< Nr(16) */
 	rte_be16_t offset_size;		/**< offset size(16) */
 	uint8_t   *offset_padding;	/**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * L2TPv2 message Header contains all options except length(ns, nr,
  * offset size, offset padding).
  */
-struct rte_l2tpv2_msg_without_length {
+struct __rte_packed_begin rte_l2tpv2_msg_without_length {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
 	rte_be16_t ns;			/**< Ns(16) */
 	rte_be16_t nr;			/**< Nr(16) */
 	rte_be16_t offset_size;		/**< offset size(16) */
 	uint8_t   *offset_padding;	/**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * L2TPv2 message Header contains all options except ns_nr(length,
@@ -176,12 +176,12 @@ struct rte_l2tpv2_msg_without_offset {
 /**
  * L2TPv2 message Header contains options offset size and offset padding.
  */
-struct rte_l2tpv2_msg_with_offset {
+struct __rte_packed_begin rte_l2tpv2_msg_with_offset {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
 	rte_be16_t offset_size;		/**< offset size(16) */
 	uint8_t   *offset_padding;	/**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * L2TPv2 message Header contains options ns and nr.
@@ -213,7 +213,7 @@ struct rte_l2tpv2_msg_without_all_options {
 /**
  * L2TPv2 Combined Message Header Format: Common Header + Options
  */
-struct rte_l2tpv2_combined_msg_hdr {
+struct __rte_packed_begin rte_l2tpv2_combined_msg_hdr {
 	struct rte_l2tpv2_common_hdr common; /**< common header */
 	union {
 		/** header with all options */
@@ -233,6 +233,6 @@ struct rte_l2tpv2_combined_msg_hdr {
 		/** header without all options */
 		struct rte_l2tpv2_msg_without_all_options type7;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* _RTE_L2TPV2_H_ */
lib/net/rte_macsec.h +4 -4
index beeeb8effe..c694c37b4b 100644
@@ -25,7 +25,7 @@
  * MACsec Header (SecTAG)
  */
 __extension__
-struct rte_macsec_hdr {
+struct __rte_packed_begin rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
 	 * Various bits of TCI and AN are masked using RTE_MACSEC_TCI_* and RTE_MACSEC_AN_MASK.
@@ -39,7 +39,7 @@ struct rte_macsec_hdr {
 	uint8_t short_length:6; /**< Short Length. */
 #endif
 	rte_be32_t packet_number; /**< Packet number to support replay protection. */
-} __rte_packed;
+} __rte_packed_end;
 
 /** SCI length in MACsec header if present. */
 #define RTE_MACSEC_SCI_LEN 8
@@ -48,8 +48,8 @@ struct rte_macsec_hdr {
  * MACsec SCI header (8 bytes) after the MACsec header
  * which is present if SC bit is set in tci_an.
  */
-struct rte_macsec_sci_hdr {
+struct __rte_packed_begin rte_macsec_sci_hdr {
 	uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_MACSEC_H */
lib/net/rte_mpls.h +2 -2
index 35a356efd3..53614a0b88 100644
@@ -18,7 +18,7 @@
  * MPLS header.
  */
 __extension__
-struct rte_mpls_hdr {
+struct __rte_packed_begin rte_mpls_hdr {
 	rte_be16_t tag_msb; /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t tag_lsb:4;  /**< Label(lsb). */
@@ -30,6 +30,6 @@ struct rte_mpls_hdr {
 	uint8_t tag_lsb:4;  /**< label(lsb) */
 #endif
 	uint8_t  ttl;       /**< Time to live. */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_MPLS_H_ */
lib/net/rte_pdcp_hdr.h +8 -8
index c22b66bf93..2e8da1e1d3 100644
@@ -56,7 +56,7 @@ enum rte_pdcp_pdu_type {
  * 6.2.2.1 Data PDU for SRBs
  */
 __extension__
-struct rte_pdcp_cp_data_pdu_sn_12_hdr {
+struct __rte_packed_begin rte_pdcp_cp_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 	uint8_t r : 4;		/**< Reserved */
@@ -65,13 +65,13 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr {
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 #endif
 	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
  */
 __extension__
-struct rte_pdcp_up_data_pdu_sn_12_hdr {
+struct __rte_packed_begin rte_pdcp_up_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 	uint8_t r : 3;		/**< Reserved */
@@ -82,13 +82,13 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr {
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
 #endif
 	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
  */
 __extension__
-struct rte_pdcp_up_data_pdu_sn_18_hdr {
+struct __rte_packed_begin rte_pdcp_up_data_pdu_sn_18_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
 	uint8_t r : 5;		/**< Reserved */
@@ -100,13 +100,13 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr {
 #endif
 	uint8_t sn_15_8;	/**< Sequence number bits 8-15 */
 	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * 6.2.3.1 Control PDU for PDCP status report
  */
 __extension__
-struct rte_pdcp_up_ctrl_pdu_hdr {
+struct __rte_packed_begin rte_pdcp_up_ctrl_pdu_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t r : 4;		/**< Reserved */
 	uint8_t pdu_type : 3;	/**< Control PDU type */
@@ -134,6 +134,6 @@ struct rte_pdcp_up_ctrl_pdu_hdr {
 	 * in the Bitmap is 1.
 	 */
 	uint8_t bitmap[];
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_PDCP_HDR_H */
lib/net/rte_ppp.h +2 -2
index 63c72a9392..02bfb03c03 100644
@@ -17,10 +17,10 @@
 /**
  * PPP Header
  */
-struct rte_ppp_hdr {
+struct __rte_packed_begin rte_ppp_hdr {
 	uint8_t addr; /**< PPP address(8) */
 	uint8_t ctrl; /**< PPP control(8) */
 	rte_be16_t proto_id; /**< PPP protocol identifier(16) */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* _RTE_PPP_H_ */
lib/net/rte_sctp.h +2 -2
index e757c57db3..73051b94fd 100644
@@ -21,11 +21,11 @@
 /**
  * SCTP Header
  */
-struct rte_sctp_hdr {
+struct __rte_packed_begin rte_sctp_hdr {
 	rte_be16_t src_port; /**< Source port. */
 	rte_be16_t dst_port; /**< Destin port. */
 	rte_be32_t tag;      /**< Validation tag. */
 	rte_be32_t cksum;    /**< Checksum. */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_SCTP_H_ */
lib/net/rte_tcp.h +2 -2
index 1bcacbf038..fb0eb308f5 100644
@@ -21,7 +21,7 @@
 /**
  * TCP Header
  */
-struct rte_tcp_hdr {
+struct __rte_packed_begin rte_tcp_hdr {
 	rte_be16_t src_port; /**< TCP source port. */
 	rte_be16_t dst_port; /**< TCP destination port. */
 	rte_be32_t sent_seq; /**< TX data sequence number. */
@@ -31,7 +31,7 @@ struct rte_tcp_hdr {
 	rte_be16_t rx_win;   /**< RX flow control window. */
 	rte_be16_t cksum;    /**< TCP checksum. */
 	rte_be16_t tcp_urp;  /**< TCP urgent pointer, if any. */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * TCP Flags
lib/net/rte_tls.h +2 -2
index 595567e3e9..f27db3acb1 100644
@@ -28,13 +28,13 @@
  * TLS Header
  */
 __extension__
-struct rte_tls_hdr {
+struct __rte_packed_begin rte_tls_hdr {
 	/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
 	uint8_t type;
 	/** TLS Version defined as RTE_TLS_VERSION*. */
 	rte_be16_t version;
 	/** The length (in bytes) of the following TLS packet. */
 	rte_be16_t length;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_TLS_H */
lib/net/rte_udp.h +2 -2
index c01dad9c9b..94f5304e6d 100644
@@ -21,11 +21,11 @@
 /**
  * UDP Header
  */
-struct rte_udp_hdr {
+struct __rte_packed_begin rte_udp_hdr {
 	rte_be16_t src_port;    /**< UDP source port. */
 	rte_be16_t dst_port;    /**< UDP destination port. */
 	rte_be16_t dgram_len;   /**< UDP datagram length */
 	rte_be16_t dgram_cksum; /**< UDP datagram checksum */
-} __rte_packed;
+} __rte_packed_end;
 
 #endif /* RTE_UDP_H_ */
lib/net/rte_vxlan.h +14 -14
index bd1c89835e..f59829b182 100644
@@ -27,13 +27,13 @@
  * Reserved fields (24 bits and 8 bits)
  */
 __extension__ /* no named member in struct */
-struct rte_vxlan_hdr {
+struct __rte_packed_begin rte_vxlan_hdr {
 	union {
 		rte_be32_t vx_flags; /**< flags (8 bits) + extensions (24 bits). */
-		struct {
+		struct __rte_packed_begin {
 			union {
 				uint8_t flags; /**< Default is I bit, others are extensions. */
-				struct {
+				struct __rte_packed_begin {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 					uint8_t flag_g:1,     /**< GBP bit. */
 						flag_rsvd:1,  /*   Reserved. */
@@ -51,11 +51,11 @@ struct rte_vxlan_hdr {
 						flag_rsvd:1,
 						flag_g:1;
 #endif
-				} __rte_packed;
+				} __rte_packed_end;
 			}; /* end of 1st byte */
 			union {
 				uint8_t rsvd0[3]; /* Reserved for extensions. */
-				struct {
+				struct __rte_packed_begin {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 					uint8_t rsvd0_gbp1:1, /*   Reserved. */
 						flag_d:1,     /**< GBP Don't Learn bit. */
@@ -71,7 +71,7 @@ struct rte_vxlan_hdr {
 #endif
 					union {
 						uint16_t policy_id; /**< GBP Identifier. */
-						struct {
+						struct __rte_packed_begin {
 							uint8_t rsvd0_gpe; /* Reserved. */
 							uint8_t proto; /**< GPE Next protocol. */
 								/* 0x01 : IPv4
@@ -79,23 +79,23 @@ struct rte_vxlan_hdr {
 								 * 0x03 : Ethernet
 								 * 0x04 : Network Service Header
 								 */
-						} __rte_packed;
+						} __rte_packed_end;
 					};
-				} __rte_packed;
+				} __rte_packed_end;
 			};
-		} __rte_packed;
+		} __rte_packed_end;
 	}; /* end of 1st 32-bit word */
 	union {
 		rte_be32_t vx_vni; /**< VNI (24 bits) + reserved (8 bits). */
-		struct {
+		struct __rte_packed_begin {
 			uint8_t    vni[3];   /**< VXLAN Identifier. */
 			union {
 				uint8_t    rsvd1;        /**< Reserved. */
 				uint8_t    last_rsvd;    /**< Reserved. */
 			};
-		} __rte_packed;
+		} __rte_packed_end;
 	}; /* end of 2nd 32-bit word */
-} __rte_packed;
+} __rte_packed_end;
 
 /** VXLAN tunnel header length. */
 #define RTE_ETHER_VXLAN_HLEN \
@@ -111,7 +111,7 @@ struct rte_vxlan_hdr {
  * Identifier and Reserved fields (16 bits and 8 bits).
  */
 __extension__ /* no named member in struct */
-struct rte_vxlan_gpe_hdr {
+struct __rte_packed_begin rte_vxlan_gpe_hdr {
 	union {
 		struct {
 			uint8_t vx_flags;    /**< flag (8). */
@@ -127,7 +127,7 @@ struct rte_vxlan_gpe_hdr {
 			uint8_t rsvd1;    /**< Reserved. */
 		};
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * @deprecated
Signature · 1 line
2.47.0.vfs.0.3
#281 lore raw

PATCH v10 28/30 lib/pipeline: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/pipeline/rte_table_action.c | 64 ++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 32 deletions(-)
lib/pipeline/rte_table_action.c +32 -32
index a431f8f128..3a408e81b8 100644
@@ -60,9 +60,9 @@ lb_cfg_check(struct rte_table_action_lb_config *cfg)
 	return 0;
 }
 
-struct lb_data {
+struct __rte_packed_begin lb_data {
 	uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE];
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 lb_apply(struct lb_data *data,
@@ -356,10 +356,10 @@ tm_cfg_check(struct rte_table_action_tm_config *tm)
 	return 0;
 }
 
-struct tm_data {
+struct __rte_packed_begin tm_data {
 	uint32_t queue_id;
 	uint32_t reserved;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 tm_apply_check(struct rte_table_action_tm_params *p,
@@ -465,11 +465,11 @@ struct encap_qinq_data {
 	((((uint64_t)(s)) & 0x1LLU) << 8) |                \
 	(((uint64_t)(ttl)) & 0xFFLLU)))
 
-struct __rte_aligned(2) encap_mpls_data {
+struct __rte_aligned(2) __rte_packed_begin encap_mpls_data {
 	struct rte_ether_hdr ether;
 	uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX];
 	uint32_t mpls_count;
-} __rte_packed;
+} __rte_packed_end;
 
 #define PPP_PROTOCOL_IP                                    0x0021
 
@@ -487,42 +487,42 @@ struct encap_pppoe_data {
 
 #define IP_PROTO_UDP                                       17
 
-struct __rte_aligned(2) encap_vxlan_ipv4_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv4_data {
 	struct rte_ether_hdr ether;
 	struct rte_ipv4_hdr ipv4;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_vxlan_ipv4_vlan_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv4_vlan_data {
 	struct rte_ether_hdr ether;
 	struct rte_vlan_hdr vlan;
 	struct rte_ipv4_hdr ipv4;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_vxlan_ipv6_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv6_data {
 	struct rte_ether_hdr ether;
 	struct rte_ipv6_hdr ipv6;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_vxlan_ipv6_vlan_data {
+struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv6_vlan_data {
 	struct rte_ether_hdr ether;
 	struct rte_vlan_hdr vlan;
 	struct rte_ipv6_hdr ipv6;
 	struct rte_udp_hdr udp;
 	struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_aligned(2) encap_qinq_pppoe_data {
+struct __rte_aligned(2) __rte_packed_begin encap_qinq_pppoe_data {
 	struct rte_ether_hdr ether;
 	struct rte_vlan_hdr svlan;
 	struct rte_vlan_hdr cvlan;
 	struct pppoe_ppp_hdr pppoe_ppp;
-} __rte_packed;
+} __rte_packed_end;
 
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
@@ -1196,15 +1196,15 @@ nat_cfg_check(struct rte_table_action_nat_config *nat)
 	return 0;
 }
 
-struct nat_ipv4_data {
+struct __rte_packed_begin nat_ipv4_data {
 	uint32_t addr;
 	uint16_t port;
-} __rte_packed;
+} __rte_packed_end;
 
-struct nat_ipv6_data {
+struct __rte_packed_begin nat_ipv6_data {
 	struct rte_ipv6_addr addr;
 	uint16_t port;
-} __rte_packed;
+} __rte_packed_end;
 
 static size_t
 nat_data_size(struct rte_table_action_nat_config *nat __rte_unused,
@@ -1493,9 +1493,9 @@ ttl_cfg_check(struct rte_table_action_ttl_config *ttl)
 	return 0;
 }
 
-struct ttl_data {
+struct __rte_packed_begin ttl_data {
 	uint32_t n_packets;
-} __rte_packed;
+} __rte_packed_end;
 
 #define TTL_INIT(data, decrement)                         \
 	((data)->n_packets = (decrement) ? 1 : 0)
@@ -1576,10 +1576,10 @@ stats_cfg_check(struct rte_table_action_stats_config *stats)
 	return 0;
 }
 
-struct stats_data {
+struct __rte_packed_begin stats_data {
 	uint64_t n_packets;
 	uint64_t n_bytes;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 stats_apply(struct stats_data *data,
@@ -1602,9 +1602,9 @@ pkt_work_stats(struct stats_data *data,
 /**
  * RTE_TABLE_ACTION_TIME
  */
-struct time_data {
+struct __rte_packed_begin time_data {
 	uint64_t time;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 time_apply(struct time_data *data,
@@ -1649,7 +1649,7 @@ struct crypto_op_sym_iv_aad {
 	} iv_aad;
 };
 
-struct sym_crypto_data {
+struct __rte_packed_begin sym_crypto_data {
 
 	union {
 		struct {
@@ -1717,7 +1717,7 @@ struct sym_crypto_data {
 	/** Private data size to store cipher iv / aad. */
 	uint8_t iv_aad_data[32];
 
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 sym_crypto_cfg_check(struct rte_table_action_sym_crypto_config *cfg)
@@ -2052,9 +2052,9 @@ pkt_work_sym_crypto(struct rte_mbuf *mbuf, struct sym_crypto_data *data,
 /**
  * RTE_TABLE_ACTION_TAG
  */
-struct tag_data {
+struct __rte_packed_begin tag_data {
 	uint32_t tag;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 tag_apply(struct tag_data *data,
@@ -2096,9 +2096,9 @@ pkt4_work_tag(struct rte_mbuf *mbuf0,
 /**
  * RTE_TABLE_ACTION_DECAP
  */
-struct decap_data {
+struct __rte_packed_begin decap_data {
 	uint16_t n;
-} __rte_packed;
+} __rte_packed_end;
 
 static int
 decap_apply(struct decap_data *data,
Signature · 1 line
2.47.0.vfs.0.3
#282 lore raw

PATCH v10 29/30 lib/vhost: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/vhost/vhost_user.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/vhost/vhost_user.h +4 -4
index edf7adb3c0..9a905ee5f4 100644
@@ -143,7 +143,7 @@ struct vhost_user_config {
 	uint8_t region[VHOST_USER_MAX_CONFIG_SIZE];
 };
 
-typedef struct VhostUserMsg {
+typedef struct __rte_packed_begin VhostUserMsg {
 	union {
 		uint32_t frontend; /* a VhostUserRequest value */
 		uint32_t backend;  /* a VhostUserBackendRequest value*/
@@ -169,16 +169,16 @@ typedef struct VhostUserMsg {
 		struct vhost_user_config cfg;
 	} payload;
 	/* Nothing should be added after the payload */
-} __rte_packed VhostUserMsg;
+} __rte_packed_end VhostUserMsg;
 
 /* Note: this structure and VhostUserMsg can't be changed carelessly as
  * external message handlers rely on them.
  */
-struct __rte_packed vhu_msg_context {
+struct __rte_packed_begin vhu_msg_context {
 	VhostUserMsg msg;
 	int fds[VHOST_MEMORY_MAX_NREGIONS];
 	int fd_num;
-};
+} __rte_packed_end;
 
 #define VHOST_USER_HDR_SIZE offsetof(VhostUserMsg, payload.u64)
 
Signature · 1 line
2.47.0.vfs.0.3
#283 lore raw

PATCH v10 30/30 eal/include: deprecate macro __rte_packed

In reply to Andre Muezerie

Macro __rte_packed was marked as deprecated.

---
 lib/eal/include/rte_common.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
lib/eal/include/rte_common.h +13 -0
index d72f8590bd..40592f71b1 100644
@@ -99,6 +99,19 @@ typedef uint32_t unaligned_uint32_t;
 typedef uint16_t unaligned_uint16_t;
 #endif
 
+/**
+ * @deprecated
+ * @see __rte_packed_begin
+ * @see __rte_packed_end
+ *
+ * Force a structure to be packed
+ */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_packed RTE_DEPRECATED(__rte_packed)
+#else
+#define __rte_packed (RTE_DEPRECATED(__rte_packed) __attribute__((__packed__)))
+#endif
+
 /**
  * Force a structure to be packed
  * Usage:
Signature · 1 line
2.47.0.vfs.0.3
#284 lore raw

v11 cover fix packing of structs when building with MSVC

In reply to Tyler Retzlaff

MSVC struct packing is not compatible with GCC. Different alternatives were considered:

1) Have a macro __RTE_PACKED(decl) to which the struct/union is passed and the macro would define the struct/union with the appropriate packing attribute for the compiler in use.

Advantages:
* Can be placed in front of a struct, or even in the middle. Good for readability.
* Does not require a different macro to be placed at the end of the structure.

However, problems can arise when compiler directives are present in the struct, as they become arguments for __RTE_PACKED macro. This is not portable. Two problematic situations observed in the DPDK code:

a) #defines mentioned in the struct. In this situation we could just move the #define out of the struct.

b) #if/#ifdef/#elif mentioned in the struct.
This is a somewhat common pattern in structs where fields change based on endianness and would require code duplication to be handled, which makes the code hard to read and maintain.

2) Have macros __rte_msvc_pack_begin and __rte_msvc_pack_end which would be placed at the beginning and end of the struct/union respectively. Concerns were raised about having macros for specific compilers, or even having compiler names mentioned in the macros' names.

3) Instead of providing macros exclusively for MSVC and for GCC, have a macro __rte_packed_begin and __rte_packed_end which would be placed at the beginning and end of the struct/union respectively. With MSVC both macros end up having a purpose. With GCC and Clang only __rte_packed_end has a purpose, as can be seen below. This makes the solution generic and is the approach taken in this patchset.

   #ifdef RTE_TOOLCHAIN_MSVC
   #define __rte_packed_begin __pragma(pack(push, 1))
   #define __rte_packed_end __pragma(pack(pop))
   #else
   #define __rte_packed_begin
   #define __rte_packed_end __attribute__((__packed__))
   #endif

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Macro __rte_packed is marked deprecated and the two new macros represent the new way to enable packing in the DPDK code.

Script checkpatches.sh was enhanced to ensure that:
* __rte_packed_begin and __rte_packed_end show up in pairs.
* __rte_packed_begin is not used with enums.
* __rte_packed_begin is only used after struct, union, __rte_cache_aligned, __rte_cache_min_aligned or __rte_aligned

v11:
* removed lib/ prefix from commit titles

v10:
* added a note to commit message on patch 27/30 about storage size change for variables of type enum rte_ipv6_mc_scope.

v9:
* moved the deprecation of __rte_packed to the end of the patchset

v8:
* moved __rte_packed_begin after the struct and union keywords
* added more packing related tests to checkpatches.sh

v7:
* added __rte_packed back but marked it deprecated

v6:
* replace __rte_msvc_pack with __rte_packed_begin
* replace __rte_packed with __rte_packed_end
* update checkpatches.sh to ensure __rte_packed_begin and __rte_packed_end are used in pairs
* remove __rte_packed

v5:
* rebase on top of latest main

v4:
* add another missing __rte_msvc_pack to crypto/mlx5 patch
* correct commit message for duplicated packing in crypto/mlx5 patch

v3:
* add missing __rte_msvc_pack to crypto/mlx5
* fix commit messages to reference __rte_msvc_pack macro instead

    of __rte_msvc_pushpack(1)

v2:
* app/testpmd, remove packing from simple_gre_hdr
* net/iavf, remove packing from iavf_ipsec_crypto_pkt_metadata, simple_gre_hdr
* examples, remove packing from pkt_key_qinq, pkt_key_ipv4_5tuple,

    pkt_key_ipv6_5tuple, pkt_key_ipv4_addr, pkt_key_ipv6_addr

* eal, remove packing from rte_config, __rte_trace_stream_header

Andre Muezerie (30):
devtools: check packed attributes eal/include: add new packing macros app/test-pmd: remove unnecessary packed attributes app/test: replace packed attributes doc/guides: replace packed attributes drivers/baseband: replace packed attributes drivers/bus: replace packed attributes drivers/common: replace packed attributes drivers/compress: replace packed attributes drivers/crypto: replace packed attributes drivers/dma: replace packed attributes drivers/event: replace packed attributes drivers/mempool: replace packed attributes drivers/net: replace packed attributes drivers/raw: replace packed attributes drivers/regex: replace packed attributes drivers/vdpa: replace packed attributes examples/common: replace packed attributes examples/ip-pipeline: remove packed attributes examples/ipsec_secgw: replace packed attributes examples/l3fwd-power: replace packed attributes examples/l3fwd: replace packed attributes examples/ptpclient: replace packed attributes examples/vhost_blk: replace packed attributes
eal: replace packed attributes
ipsec: replace packed attributes
net: replace packed attributes
pipeline: replace packed attributes
vhost: replace packed attributes eal/include: deprecate macro __rte_packed

 app/test-pmd/csumonly.c                       |    2 +-
 app/test/test_efd.c                           |    4 +-
 app/test/test_hash.c                          |    4 +-
 app/test/test_member.c                        |    4 +-
 devtools/checkpatches.sh                      |   43 +
 doc/guides/nics/ark.rst                       |    4 +-
 .../prog_guide/packet_classif_access_ctrl.rst |    4 +-
 drivers/baseband/acc/acc_common.h             |   52 +-
 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   |   16 +-
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |    4 +-
 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  |    8 +-
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  |   12 +-
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    |   32 +-
 drivers/bus/dpaa/include/fsl_bman.h           |   20 +-
 drivers/bus/dpaa/include/fsl_fman.h           |    4 +-
 drivers/bus/dpaa/include/fsl_qman.h           |  160 +-
 drivers/bus/ifpga/bus_ifpga_driver.h          |    8 +-
 drivers/bus/vmbus/rte_vmbus_reg.h             |  108 +-
 drivers/common/cnxk/hw/sdp.h                  |    4 +-
 drivers/common/cnxk/roc_npc.h                 |   16 +-
 drivers/common/cnxk/roc_npc_mcam_dump.c       |    4 +-
 drivers/common/cnxk/roc_platform.h            |    3 +-
 drivers/common/dpaax/compat.h                 |    3 -
 drivers/common/iavf/iavf_osdep.h              |    8 +-
 drivers/common/iavf/virtchnl_inline_ipsec.h   |   44 +-
 drivers/common/idpf/base/idpf_osdep.h         |    8 +-
 drivers/common/mlx5/mlx5_common_mr.h          |   16 +-
 drivers/common/mlx5/mlx5_common_utils.h       |    4 +-
 drivers/common/mlx5/mlx5_prm.h                |  120 +-
 drivers/common/qat/qat_adf/icp_qat_fw_la.h    |    8 +-
 drivers/common/qat/qat_common.h               |    8 +-
 drivers/compress/qat/qat_comp.h               |    4 +-
 drivers/crypto/caam_jr/caam_jr.c              |    4 +-
 drivers/crypto/caam_jr/caam_jr_desc.h         |   64 +-
 drivers/crypto/caam_jr/caam_jr_hw_specific.h  |   48 +-
 drivers/crypto/dpaa_sec/dpaa_sec.h            |   12 +-
 drivers/crypto/ionic/ionic_crypto_if.h        |   36 +-
 drivers/crypto/mlx5/mlx5_crypto.h             |    8 +-
 drivers/crypto/mlx5/mlx5_crypto_gcm.c         |    4 +-
 drivers/crypto/qat/qat_sym.h                  |    8 +-
 drivers/crypto/qat/qat_sym_session.h          |    4 +-
 drivers/dma/dpaa/dpaa_qdma.h                  |   20 +-
 drivers/dma/dpaa2/dpaa2_qdma.h                |   16 +-
 drivers/dma/ioat/ioat_hw_defs.h               |    4 +-
 drivers/event/octeontx/timvf_evdev.c          |    4 +-
 drivers/event/octeontx/timvf_evdev.h          |   12 +-
 drivers/mempool/octeontx/octeontx_fpavf.c     |   16 +-
 drivers/net/ark/ark_ddm.h                     |    4 +-
 drivers/net/ark/ark_pktchkr.h                 |    8 +-
 drivers/net/ark/ark_pktdir.h                  |    5 +-
 drivers/net/ark/ark_pktgen.h                  |    4 +-
 drivers/net/ark/ark_udm.h                     |    4 +-
 drivers/net/atlantic/hw_atl/hw_atl_utils.h    |  120 +-
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |    8 +-
 drivers/net/avp/rte_avp_common.h              |   12 +-
 drivers/net/bnxt/bnxt.h                       |    8 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h        | 3344 ++++++++---------
 drivers/net/bnxt/tf_core/tf_resources.h       |   32 +-
 drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c   |   20 +-
 drivers/net/bonding/rte_eth_bond_8023ad.h     |   32 +-
 drivers/net/cnxk/cn10k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn20k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn9k_ethdev.h                |    4 +-
 drivers/net/cnxk/cnxk_rep_msg.h               |   64 +-
 drivers/net/dpaa/dpaa_rxtx.h                  |   28 +-
 drivers/net/dpaa/fmlib/fm_ext.h               |    4 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h  |    4 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   16 +-
 drivers/net/enic/base/vnic_devcmd.h           |   40 +-
 drivers/net/enic/base/vnic_flowman.h          |  120 +-
 drivers/net/gve/base/gve_desc.h               |   16 +-
 drivers/net/gve/base/gve_desc_dqo.h           |   32 +-
 drivers/net/gve/base/gve_osdep.h              |    3 -
 drivers/net/hns3/hns3_mbx.h                   |    8 +-
 drivers/net/hns3/hns3_rxtx.h                  |    4 +-
 drivers/net/i40e/base/i40e_osdep.h            |    8 +-
 drivers/net/iavf/iavf_ipsec_crypto.h          |   10 +-
 drivers/net/iavf/iavf_rxtx.c                  |    2 +-
 drivers/net/ice/base/ice_osdep.h              |   11 +-
 drivers/net/ionic/ionic_if.h                  |   72 +-
 drivers/net/memif/memif.h                     |   36 +-
 drivers/net/mlx4/mlx4_mr.h                    |   12 +-
 drivers/net/mlx5/hws/mlx5dr.h                 |    4 +-
 drivers/net/mlx5/mlx5.h                       |    4 +-
 drivers/net/mlx5/mlx5_flow.h                  |   16 +-
 drivers/net/mlx5/mlx5_hws_cnt.h               |    4 +-
 drivers/net/mlx5/mlx5_utils.h                 |   16 +-
 drivers/net/netvsc/hn_nvs.h                   |   72 +-
 drivers/net/netvsc/ndis.h                     |    8 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.h      |    4 +-
 drivers/net/nfp/flower/nfp_flower_flow.h      |    4 +-
 drivers/net/nfp/nfd3/nfp_nfd3.h               |    4 +-
 drivers/net/nfp/nfp_rxtx.h                    |    8 +-
 drivers/net/nfp/nfpcore/nfp_nsp.c             |    4 +-
 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c |   12 +-
 drivers/net/octeon_ep/otx_ep_mbox.h           |    4 +-
 drivers/net/octeontx/base/octeontx_pki_var.h  |    4 +-
 drivers/net/pfe/pfe_hif.h                     |    4 +-
 drivers/net/virtio/virtio.h                   |    4 +-
 drivers/net/virtio/virtio_cvq.h               |    8 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |    4 +-
 drivers/net/zxdh/zxdh_common.c                |    8 +-
 drivers/net/zxdh/zxdh_msg.h                   |   16 +-
 drivers/net/zxdh/zxdh_pci.h                   |    4 +-
 drivers/net/zxdh/zxdh_queue.h                 |   64 +-
 drivers/net/zxdh/zxdh_rxtx.h                  |    8 +-
 drivers/raw/ifpga/afu_pmd_n3000.h             |    8 +-
 drivers/raw/ifpga/base/opae_hw_api.h          |    4 +-
 drivers/regex/cn9k/cn9k_regexdev.c            |    4 +-
 drivers/regex/mlx5/mlx5_rxp.h                 |   16 +-
 drivers/vdpa/ifc/base/ifcvf.h                 |    4 +-
 drivers/vdpa/mlx5/mlx5_vdpa.h                 |    4 +-
 examples/common/neon/port_group.h             |    4 +-
 examples/ip_pipeline/cli.c                    |   10 +-
 examples/ipsec-secgw/ipsec.h                  |    4 +-
 examples/l3fwd-power/main.c                   |    8 +-
 examples/l3fwd/l3fwd_route.h                  |    8 +-
 examples/ptpclient/ptpclient.c                |   32 +-
 examples/vhost_blk/blk_spec.h                 |    4 +-
 lib/eal/common/eal_private.h                  |    2 +-
 lib/eal/include/rte_common.h                  |   23 +-
 lib/eal/include/rte_memory.h                  |    4 +-
 lib/eal/include/rte_memzone.h                 |    4 +-
 lib/eal/include/rte_trace_point.h             |    2 +-
 lib/eal/x86/include/rte_memcpy.h              |   12 +-
 lib/ipsec/crypto.h                            |   44 +-
 lib/net/rte_arp.h                             |    8 +-
 lib/net/rte_dtls.h                            |    4 +-
 lib/net/rte_esp.h                             |    8 +-
 lib/net/rte_geneve.h                          |    4 +-
 lib/net/rte_gre.h                             |   16 +-
 lib/net/rte_gtp.h                             |   20 +-
 lib/net/rte_ib.h                              |    4 +-
 lib/net/rte_icmp.h                            |   12 +-
 lib/net/rte_ip4.h                             |    4 +-
 lib/net/rte_ip6.h                             |   14 +-
 lib/net/rte_l2tpv2.h                          |   16 +-
 lib/net/rte_macsec.h                          |    8 +-
 lib/net/rte_mpls.h                            |    4 +-
 lib/net/rte_pdcp_hdr.h                        |   16 +-
 lib/net/rte_ppp.h                             |    4 +-
 lib/net/rte_sctp.h                            |    4 +-
 lib/net/rte_tcp.h                             |    4 +-
 lib/net/rte_tls.h                             |    4 +-
 lib/net/rte_udp.h                             |    4 +-
 lib/net/rte_vxlan.h                           |   28 +-
 lib/pipeline/rte_table_action.c               |   64 +-
 lib/vhost/vhost_user.h                        |    8 +-
 148 files changed, 2952 insertions(+), 2897 deletions(-)

--
2.47.0.vfs.0.3

#285 lore raw

PATCH v11 1/30 devtools: check packed attributes

Ensure __rte_packed_begin and __rte_packed_end show up in pairs when checking patches.

---
 devtools/checkpatches.sh | 43 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
devtools/checkpatches.sh +43 -0
index 4a8591be22..7868f5e522 100755
@@ -202,6 +202,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid use of __rte_packed_begin with enums
+	awk -v FOLDERS='lib drivers app examples' \
+		-v EXPRESSIONS='enum.*__rte_packed_begin' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using __rte_packed_begin with enum is not allowed' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# forbid use of experimental build flag except in examples
 	awk -v FOLDERS='lib drivers app' \
 		-v EXPRESSIONS='-DALLOW_EXPERIMENTAL_API allow_experimental_apis' \
@@ -362,6 +370,33 @@ check_aligned_attributes() { # <patch>
 	return $res
 }
 
+check_packed_attributes() { # <patch>
+	res=0
+
+	if [ $(grep -E '^\+.*__rte_packed_begin' "$1" | \
+			grep -vE '\<struct[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<union[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<__rte_cache_aligned[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<__rte_cache_min_aligned[[:space:]]*__rte_packed_begin\>' | \
+			grep -vE '\<__rte_aligned\(.*\)[[:space:]]*__rte_packed_begin\>' | \
+			wc -l) != 0 ]; then
+		echo "Please use __rte_packed_begin only after struct, union," \
+			 " __rte_cache_aligned, __rte_cache_min_aligned or __rte_aligned."
+		res=1
+	fi
+
+	begin_count=$(grep '__rte_packed_begin' "$1" | \
+			wc -l)
+	end_count=$(grep '__rte_packed_end' "$1" | \
+			wc -l)
+	if [ $begin_count != $end_count ]; then
+		echo "__rte_packed_begin and __rte_packed_end mismatch. They should always be used in pairs."
+		res=1
+	fi
+
+	return $res
+}
+
 check_release_notes() { # <patch>
 	rel_notes_prefix=doc/guides/rel_notes/release_
 	IFS=. read year month release < VERSION
@@ -479,6 +514,14 @@ check () { # <patch-file> <commit>
 		ret=1
 	fi
 
+	! $verbose || printf '\nChecking packed attributes:\n'
+	report=$(check_packed_attributes "$tmpinput")
+	if [ $? -ne 0 ] ; then
+		$headline_printed || print_headline "$subject"
+		printf '%s\n' "$report"
+		ret=1
+	fi
+
 	! $verbose || printf '\nChecking release notes updates:\n'
 	report=$(check_release_notes "$tmpinput")
 	if [ $? -ne 0 ] ; then
Signature · 1 line
2.47.0.vfs.0.3
#286 lore raw

PATCH v11 2/30 eal/include: add new packing macros

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Add macro __rte_packed_begin which can be used to push existing pack value and set packing to 1-byte. Add macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/eal/include/rte_common.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/eal/include/rte_common.h +8 -2
index 4d299f2b36..d72f8590bd 100644
@@ -101,11 +101,17 @@ typedef uint16_t unaligned_uint16_t;
 
 /**
  * Force a structure to be packed
+ * Usage:
+ *     struct __rte_packed_begin mystruct { ... } __rte_packed_end;
+ *     union __rte_packed_begin myunion { ... } __rte_packed_end;
+ * Note: alignment attributes when present should precede __rte_packed_begin.
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_packed
+#define __rte_packed_begin __pragma(pack(push, 1))
+#define __rte_packed_end __pragma(pack(pop))
 #else
-#define __rte_packed __attribute__((__packed__))
+#define __rte_packed_begin
+#define __rte_packed_end __attribute__((__packed__))
 #endif
 
 /**
Signature · 1 line
2.47.0.vfs.0.3
#287 lore raw

PATCH v11 3/30 app/test-pmd: remove unnecessary packed attributes

In reply to Andre Muezerie

Removed __rte_packed attribute from structure that is naturally packed already.

---
 app/test-pmd/csumonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/csumonly.c +1 -1
index 2246c22e8e..d77a140641 100644
@@ -92,7 +92,7 @@ struct testpmd_offload_info {
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-} __rte_packed;
+};
 
 static uint16_t
 get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off,
Signature · 1 line
2.47.0.vfs.0.3
#288 lore raw

PATCH v11 4/30 app/test: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 app/test/test_efd.c    | 4 ++--
 app/test/test_hash.c   | 4 ++--
 app/test/test_member.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
app/test/test_efd.c +2 -2
index 1c0986b9bc..4a4379c563 100644
@@ -33,13 +33,13 @@ test_efd(void)
 static unsigned int test_socket_id;
 
 /* 5-tuple key type */
-struct flow_key {
+struct __rte_packed_begin flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
 	uint16_t port_src;
 	uint16_t port_dst;
 	uint8_t proto;
-} __rte_packed;
+} __rte_packed_end;
 
 RTE_LOG_REGISTER(efd_logtype_test, test.efd, INFO);
 
app/test/test_hash.c +2 -2
index 65b9cad93c..6b5ef2d1e5 100644
@@ -79,13 +79,13 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,
  * Should be packed to avoid holes with potentially
  * undefined content in the middle.
  */
-struct flow_key {
+struct __rte_packed_begin flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
 	uint16_t port_src;
 	uint16_t port_dst;
 	uint32_t proto;
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * Hash function that always returns the same value, to easily test what
app/test/test_member.c +2 -2
index 5a4d2750db..a93787a10c 100644
@@ -32,13 +32,13 @@ struct rte_member_setsum *setsum_vbf;
 struct rte_member_setsum *setsum_sketch;
 
 /* 5-tuple key type */
-struct flow_key {
+struct __rte_packed_begin flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
 	uint16_t port_src;
 	uint16_t port_dst;
 	uint8_t proto;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Set ID Macros for multimatch test usage */
 #define M_MATCH_S 1	/* Not start with 0 since by default 0 means no match */
Signature · 1 line
2.47.0.vfs.0.3
#289 lore raw

PATCH v11 5/30 doc/guides: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 doc/guides/nics/ark.rst                              | 4 ++--
 doc/guides/prog_guide/packet_classif_access_ctrl.rst | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
doc/guides/nics/ark.rst +2 -2
index a9f6d4cdb8..6aabde2ed5 100644
@@ -172,10 +172,10 @@ during RX from user meta data coming from FPGA hardware.
    };
 
    /* RX tuser field based on user's hardware */
-   struct user_rx_meta {
+   struct __rte_packed_begin user_rx_meta {
       uint64_t timestamp;
       uint32_t rss;
-   } __rte_packed;
+   } __rte_packed_end;
 
    /* Create ark_user_extension object for use in other hook functions */
    void *rte_pmd_ark_dev_init(struct rte_eth_dev * dev,
doc/guides/prog_guide/packet_classif_access_ctrl.rst +2 -2
index c8844d0616..e2cd60fb47 100644
@@ -154,14 +154,14 @@ To define classification for the IPv6 2-tuple: <protocol, IPv6 source address> o
 
 .. code-block:: c
 
-    struct rte_ipv6_hdr {
+    struct __rte_packed_begin rte_ipv6_hdr {
         uint32_t vtc_flow;     /* IP version, traffic class & flow label. */
         uint16_t payload_len;  /* IP packet length - includes sizeof(ip_header). */
         uint8_t proto;         /* Protocol, next header. */
         uint8_t hop_limits;    /* Hop limits. */
         uint8_t src_addr[16];  /* IP address of source host. */
         uint8_t dst_addr[16];  /* IP address of destination host(s). */
-    } __rte_packed;
+    } __rte_packed_end;
 
 The following array of field definitions can be used:
 
Signature · 1 line
2.47.0.vfs.0.3
#290 lore raw

PATCH v11 6/30 drivers/baseband: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/baseband/acc/acc_common.h             | 52 +++++++++----------
 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   | 16 +++---
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |  4 +-
 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  |  8 +--
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  | 12 ++---
 drivers/baseband/la12xx/bbdev_la12xx_ipc.h    | 32 ++++++------
 6 files changed, 62 insertions(+), 62 deletions(-)
drivers/baseband/acc/acc_common.h +26 -26
index bf218332be..a49b154a0c 100644
@@ -160,7 +160,7 @@ extern int acc_common_logtype;
 	RTE_LOG_LINE(level, ACC_COMMON, __VA_ARGS__)
 
 /* ACC100 DMA Descriptor triplet */
-struct acc_dma_triplet {
+struct __rte_packed_begin acc_dma_triplet {
 	uint64_t address;
 	uint32_t blen:20,
 		res0:4,
@@ -168,7 +168,7 @@ struct acc_dma_triplet {
 		dma_ext:1,
 		res1:2,
 		blkid:4;
-} __rte_packed;
+} __rte_packed_end;
 
 
 /* ACC100 Queue Manager Enqueue PCI Register */
@@ -183,7 +183,7 @@ union acc_enqueue_reg_fmt {
 };
 
 /* FEC 4G Uplink Frame Control Word */
-struct __rte_packed acc_fcw_td {
+struct __rte_packed_begin acc_fcw_td {
 	uint8_t fcw_ver:4,
 		num_maps:4; /* Unused in ACC100 */
 	uint8_t filler:6, /* Unused in ACC100 */
@@ -220,10 +220,10 @@ struct __rte_packed acc_fcw_td {
 				rsrvd4:10;
 		};
 	};
-};
+} __rte_packed_end;
 
 /* FEC 4G Downlink Frame Control Word */
-struct __rte_packed acc_fcw_te {
+struct __rte_packed_begin acc_fcw_te {
 	uint16_t k_neg;
 	uint16_t k_pos;
 	uint8_t c_neg;
@@ -251,10 +251,10 @@ struct __rte_packed acc_fcw_te {
 	uint8_t code_block_mode:1,
 		rsrvd8:7;
 	uint64_t rsrvd9;
-};
+} __rte_packed_end;
 
 /* FEC 5GNR Downlink Frame Control Word */
-struct __rte_packed acc_fcw_le {
+struct __rte_packed_begin acc_fcw_le {
 	uint32_t FCWversion:4,
 		qm:4,
 		nfiller:11,
@@ -279,10 +279,10 @@ struct __rte_packed acc_fcw_le {
 	uint32_t res6;
 	uint32_t res7;
 	uint32_t res8;
-};
+} __rte_packed_end;
 
 /* FEC 5GNR Uplink Frame Control Word */
-struct __rte_packed acc_fcw_ld {
+struct __rte_packed_begin acc_fcw_ld {
 	uint32_t FCWversion:4,
 		qm:4,
 		nfiller:11,
@@ -326,10 +326,10 @@ struct __rte_packed acc_fcw_ld {
 		tb_crc_select:2, /* Not supported in ACC100 */
 		dec_llrclip:2,  /* Not supported in VRB1 */
 		tb_trailer_size:20; /* Not supported in ACC100 */
-};
+} __rte_packed_end;
 
 /* FFT Frame Control Word */
-struct __rte_packed acc_fcw_fft {
+struct __rte_packed_begin acc_fcw_fft {
 	uint32_t in_frame_size:16,
 		leading_pad_size:16;
 	uint32_t out_frame_size:16,
@@ -351,10 +351,10 @@ struct __rte_packed acc_fcw_fft {
 		power_shift:4,
 		power_en:1,
 		res:19;
-};
+} __rte_packed_end;
 
 /* FFT Frame Control Word. */
-struct __rte_packed acc_fcw_fft_3 {
+struct __rte_packed_begin acc_fcw_fft_3 {
 	uint32_t in_frame_size:16,
 		leading_pad_size:16;
 	uint32_t out_frame_size:16,
@@ -381,11 +381,11 @@ struct __rte_packed acc_fcw_fft_3 {
 	uint16_t cs_theta_0[ACC_MAX_CS];
 	uint32_t cs_theta_d[ACC_MAX_CS];
 	int8_t cs_time_offset[ACC_MAX_CS];
-};
+} __rte_packed_end;
 
 
 /* MLD-TS Frame Control Word */
-struct __rte_packed acc_fcw_mldts {
+struct __rte_packed_begin acc_fcw_mldts {
 	uint32_t fcw_version:4,
 		res0:12,
 		nrb:13, /* 1 to 1925 */
@@ -409,7 +409,7 @@ struct __rte_packed acc_fcw_mldts {
 	uint32_t pad2;
 	uint32_t pad3;
 	uint32_t pad4;
-};
+} __rte_packed_end;
 
 /* DMA Response Descriptor */
 union acc_dma_rsp_desc {
@@ -435,7 +435,7 @@ union acc_dma_rsp_desc {
 };
 
 /* DMA Request Descriptor */
-struct __rte_packed acc_dma_req_desc {
+struct __rte_packed_begin acc_dma_req_desc {
 	union {
 		struct{
 			uint32_t type:4,
@@ -496,7 +496,7 @@ struct __rte_packed acc_dma_req_desc {
 		};
 		uint64_t pad3[ACC_DMA_DESC_PADDINGS]; /* pad to 64 bits */
 	};
-};
+} __rte_packed_end;
 
 /* ACC100 DMA Descriptor */
 union acc_dma_desc {
@@ -506,7 +506,7 @@ union acc_dma_desc {
 };
 
 /* Union describing Info Ring entry */
-union acc_info_ring_data {
+union __rte_packed_begin acc_info_ring_data {
 	uint32_t val;
 	struct {
 		union {
@@ -534,25 +534,25 @@ union acc_info_ring_data {
 		uint32_t loop_vrb2: 1;
 		uint32_t valid_vrb2: 1;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
-struct __rte_packed acc_pad_ptr {
+struct __rte_packed_begin acc_pad_ptr {
 	void *op_addr;
 	uint64_t pad1;  /* pad to 64 bits */
-};
+} __rte_packed_end;
 
-struct __rte_packed acc_ptrs {
+struct __rte_packed_begin acc_ptrs {
 	struct acc_pad_ptr ptr[ACC_COMPANION_PTRS];
-};
+} __rte_packed_end;
 
 /* Union describing Info Ring entry */
-union acc_harq_layout_data {
+union __rte_packed_begin acc_harq_layout_data {
 	uint32_t val;
 	struct {
 		uint16_t offset;
 		uint16_t size0;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Structure with details about RTE_BBDEV_EVENT_DEQUEUE event. It's passed to
drivers/baseband/fpga_5gnr_fec/agx100_pmd.h +8 -8
index 5e562376c9..06332c780b 100644
@@ -49,7 +49,7 @@ enum {
 };
 
 /* AGX100 TX Slice Descriptor. */
-struct __rte_packed agx100_input_slice_desc {
+struct __rte_packed_begin agx100_input_slice_desc {
 	uint32_t input_start_addr_lo;
 	uint32_t input_start_addr_hi;
 	uint32_t input_slice_length:21,
@@ -58,10 +58,10 @@ struct __rte_packed agx100_input_slice_desc {
 		start_of_pkt:1;
 	uint32_t input_slice_time_stamp:31,
 		input_c:1;
-};
+} __rte_packed_end;
 
 /* AGX100 RX Slice Descriptor. */
-struct __rte_packed agx100_output_slice_desc {
+struct __rte_packed_begin agx100_output_slice_desc {
 	uint32_t output_start_addr_lo;
 	uint32_t output_start_addr_hi;
 	uint32_t output_slice_length:21,
@@ -70,10 +70,10 @@ struct __rte_packed agx100_output_slice_desc {
 		start_of_pkt:1;
 	uint32_t output_slice_time_stamp:31,
 		output_c:1;
-};
+} __rte_packed_end;
 
 /* AGX100 DL DMA Encoding Request Descriptor. */
-struct __rte_packed agx100_dma_enc_desc {
+struct __rte_packed_begin agx100_dma_enc_desc {
 	uint32_t done:1, /**< 0: not completed 1: completed. */
 		rsrvd0:17,
 		error_msg:2,
@@ -161,10 +161,10 @@ struct __rte_packed agx100_dma_enc_desc {
 		uint8_t sw_ctxt[AGX100_RING_DESC_LEN_UNIT_BYTES *
 					(AGX100_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* AGX100 UL DMA Decoding Request Descriptor. */
-struct __rte_packed agx100_dma_dec_desc {
+struct __rte_packed_begin agx100_dma_dec_desc {
 	uint32_t done:1, /**< 0: not completed 1: completed. */
 		tb_crc_pass:1, /**< 0: doesn't pass 1: pass. */
 		cb_crc_all_pass:1, /**< 0: doesn't pass 1: pass. */
@@ -262,7 +262,7 @@ struct __rte_packed agx100_dma_dec_desc {
 		uint8_t sw_ctxt[AGX100_RING_DESC_LEN_UNIT_BYTES *
 					(AGX100_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* AGX100 DMA Descriptor. */
 union agx100_dma_desc {
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +2 -2
index 10a19e4dec..80db1b8832 100644
@@ -89,7 +89,7 @@ enum {
 };
 
 /* FPGA 5GNR Ring Control Register. */
-struct __rte_packed fpga_5gnr_ring_ctrl_reg {
+struct __rte_packed_begin fpga_5gnr_ring_ctrl_reg {
 	uint64_t ring_base_addr;
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
@@ -107,7 +107,7 @@ struct __rte_packed fpga_5gnr_ring_ctrl_reg {
 	uint16_t rsrvd3;
 	uint16_t head_point;
 	uint16_t rsrvd4;
-};
+} __rte_packed_end;
 
 /* Private data structure for each FPGA 5GNR device. */
 struct fpga_5gnr_fec_device {
drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h +4 -4
index 9a488ae8d6..e845a6e2b8 100644
@@ -46,7 +46,7 @@ enum {
 };
 
 /* VC 5GNR FPGA FEC DMA Encoding Request Descriptor. */
-struct __rte_packed vc_5gnr_dma_enc_desc {
+struct __rte_packed_begin vc_5gnr_dma_enc_desc {
 	uint32_t done:1,
 		rsrvd0:7,
 		error:4,
@@ -84,10 +84,10 @@ struct __rte_packed vc_5gnr_dma_enc_desc {
 		uint8_t sw_ctxt[VC_5GNR_RING_DESC_LEN_UNIT_BYTES *
 					(VC_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* VC 5GNR FPGA DPC FEC DMA Decoding Request Descriptor. */
-struct __rte_packed vc_5gnr_dma_dec_desc {
+struct __rte_packed_begin vc_5gnr_dma_dec_desc {
 	uint32_t done:1,
 		iter:5,
 		et_pass:1,
@@ -128,7 +128,7 @@ struct __rte_packed vc_5gnr_dma_dec_desc {
 
 		uint32_t sw_ctxt[8 * (VC_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* Vista Creek 5GNR DMA Descriptor. */
 union vc_5gnr_dma_desc {
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +6 -6
index ed21a18b62..04c1f95180 100644
@@ -114,7 +114,7 @@ enum {
 };
 
 /* FPGA LTE FEC DMA Encoding Request Descriptor */
-struct __rte_packed fpga_dma_enc_desc {
+struct __rte_packed_begin fpga_dma_enc_desc {
 	uint32_t done:1,
 		rsrvd0:11,
 		error:4,
@@ -148,10 +148,10 @@ struct __rte_packed fpga_dma_enc_desc {
 		uint8_t sw_ctxt[FPGA_RING_DESC_LEN_UNIT_BYTES *
 					(FPGA_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* FPGA LTE FEC DMA Decoding Request Descriptor */
-struct __rte_packed fpga_dma_dec_desc {
+struct __rte_packed_begin fpga_dma_dec_desc {
 	uint32_t done:1,
 		iter:5,
 		rsrvd0:2,
@@ -188,7 +188,7 @@ struct __rte_packed fpga_dma_dec_desc {
 
 		uint32_t sw_ctxt[8 * (FPGA_RING_DESC_ENTRY_LENGTH - 1)];
 	};
-};
+} __rte_packed_end;
 
 /* FPGA LTE DMA Descriptor */
 union fpga_dma_desc {
@@ -197,7 +197,7 @@ union fpga_dma_desc {
 };
 
 /* FPGA LTE FEC Ring Control Register */
-struct __rte_packed fpga_ring_ctrl_reg {
+struct __rte_packed_begin fpga_ring_ctrl_reg {
 	uint64_t ring_base_addr;
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
@@ -216,7 +216,7 @@ struct __rte_packed fpga_ring_ctrl_reg {
 	uint16_t head_point;
 	uint16_t rsrvd4;
 
-};
+} __rte_packed_end;
 
 /* Private data structure for each FPGA FEC device */
 struct fpga_lte_fec_device {
drivers/baseband/la12xx/bbdev_la12xx_ipc.h +16 -16
index b6a7f677d0..a855c43efa 100644
@@ -93,7 +93,7 @@ typedef struct {
 #define IPC_GET_CI_INDEX(x)	(x & IPC_PI_CI_INDEX_MASK)
 
 /** buffer ring common metadata */
-typedef struct ipc_bd_ring_md {
+typedef struct __rte_packed_begin ipc_bd_ring_md {
 	volatile uint32_t pi;		/**< Producer index and flag (MSB)
 					  *  which flip for each Ring wrapping
 					  */
@@ -102,10 +102,10 @@ typedef struct ipc_bd_ring_md {
 					  */
 	uint32_t ring_size;	/**< depth (Used to roll-over pi/ci) */
 	uint32_t msg_size;	/**< Size of the each buffer */
-} __rte_packed ipc_br_md_t;
+} __rte_packed_end ipc_br_md_t;
 
 /** IPC buffer descriptor */
-typedef struct ipc_buffer_desc {
+typedef struct __rte_packed_begin ipc_buffer_desc {
 	union {
 		uint64_t host_virt;	/**< msg's host virtual address */
 		struct {
@@ -115,9 +115,9 @@ typedef struct ipc_buffer_desc {
 	};
 	uint32_t modem_ptr;	/**< msg's modem physical address */
 	uint32_t len;		/**< msg len */
-} __rte_packed ipc_bd_t;
+} __rte_packed_end ipc_bd_t;
 
-typedef struct ipc_channel {
+typedef struct __rte_packed_begin ipc_channel {
 	uint32_t ch_id;		/**< Channel id */
 	ipc_br_md_t md;			/**< Metadata for BD ring */
 	ipc_bd_t bd_h[IPC_MAX_DEPTH];	/**< Buffer Descriptor on Host */
@@ -134,22 +134,22 @@ typedef struct ipc_channel {
 					  * circular buffer size
 					  */
 	uint32_t host_ipc_params;	/**< Address for host IPC parameters */
-} __rte_packed ipc_ch_t;
+} __rte_packed_end ipc_ch_t;
 
-typedef struct ipc_instance {
+typedef struct __rte_packed_begin ipc_instance {
 	uint32_t instance_id;		/**< instance id, use to init this
 					  * instance by ipc_init API
 					  */
 	uint32_t initialized;		/**< Set in ipc_init */
 	ipc_ch_t ch_list[IPC_MAX_CHANNEL_COUNT];
 		/**< Channel descriptors in this instance */
-} __rte_packed ipc_instance_t;
+} __rte_packed_end ipc_instance_t;
 
-typedef struct ipc_metadata {
+typedef struct __rte_packed_begin ipc_metadata {
 	uint32_t ipc_host_signature; /**< IPC host signature, Set by host/L2 */
 	uint32_t ipc_geul_signature; /**< IPC geul signature, Set by modem */
 	ipc_instance_t instance_list[IPC_MAX_INSTANCE_COUNT];
-} __rte_packed ipc_metadata_t;
+} __rte_packed_end ipc_metadata_t;
 
 typedef struct ipc_channel_us_priv {
 	int32_t		eventfd;
@@ -221,24 +221,24 @@ struct bbdev_ipc_dequeue_op {
  * of the parameters which are also part of Shared BD ring. Read access
  * of these parameters from the host side would not be over PCI.
  */
-typedef struct host_ipc_params {
+typedef struct __rte_packed_begin host_ipc_params {
 	volatile uint32_t pi;
 	volatile uint32_t ci;
 	volatile uint32_t bd_m_modem_ptr[IPC_MAX_DEPTH];
-} __rte_packed host_ipc_params_t;
+} __rte_packed_end host_ipc_params_t;
 
-struct hif_ipc_regs {
+struct __rte_packed_begin hif_ipc_regs {
 	uint32_t ipc_mdata_offset;
 	uint32_t ipc_mdata_size;
-} __rte_packed;
+} __rte_packed_end;
 
-struct gul_hif {
+struct __rte_packed_begin gul_hif {
 	uint32_t ver;
 	uint32_t hif_ver;
 	uint32_t status;
 	volatile uint32_t host_ready;
 	volatile uint32_t mod_ready;
 	struct hif_ipc_regs ipc_regs;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif
Signature · 1 line
2.47.0.vfs.0.3
#291 lore raw

PATCH v11 7/30 drivers/bus: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/bus/dpaa/include/fsl_bman.h  |  20 ++--
 drivers/bus/dpaa/include/fsl_fman.h  |   4 +-
 drivers/bus/dpaa/include/fsl_qman.h  | 160 +++++++++++++--------------
 drivers/bus/ifpga/bus_ifpga_driver.h |   8 +-
 drivers/bus/vmbus/rte_vmbus_reg.h    | 108 +++++++++---------
 5 files changed, 150 insertions(+), 150 deletions(-)
drivers/bus/dpaa/include/fsl_bman.h +10 -10
index 34d7eb32ce..c0760149e1 100644
@@ -86,7 +86,7 @@ static inline dma_addr_t bm_buf_addr(const struct bm_buffer *buf)
 	} while (0)
 
 /* See 1.5.3.5.4: "Release Command" */
-struct bm_rcr_entry {
+struct __rte_packed_begin bm_rcr_entry {
 	union {
 		struct {
 			u8 __dont_write_directly__verb;
@@ -95,7 +95,7 @@ struct bm_rcr_entry {
 		};
 		struct bm_buffer bufs[8];
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_RCR_VERB_VBIT		0x80
 #define BM_RCR_VERB_CMD_MASK		0x70	/* one of two values; */
 #define BM_RCR_VERB_CMD_BPID_SINGLE	0x20
@@ -104,20 +104,20 @@ struct bm_rcr_entry {
 
 /* See 1.5.3.1: "Acquire Command" */
 /* See 1.5.3.2: "Query Command" */
-struct bm_mcc_acquire {
+struct __rte_packed_begin bm_mcc_acquire {
 	u8 bpid;
 	u8 __reserved1[62];
-} __packed;
-struct bm_mcc_query {
+} __rte_packed_end;
+struct __rte_packed_begin bm_mcc_query {
 	u8 __reserved2[63];
-} __packed;
-struct bm_mc_command {
+} __rte_packed_end;
+struct __rte_packed_begin bm_mc_command {
 	u8 __dont_write_directly__verb;
 	union {
 		struct bm_mcc_acquire acquire;
 		struct bm_mcc_query query;
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_MCC_VERB_VBIT		0x80
 #define BM_MCC_VERB_CMD_MASK		0x70	/* where the verb contains; */
 #define BM_MCC_VERB_CMD_ACQUIRE		0x10
@@ -136,7 +136,7 @@ struct bm_pool_state {
 	} as, ds;
 };
 
-struct bm_mc_result {
+struct __rte_packed_begin bm_mc_result {
 	union {
 		struct {
 			u8 verb;
@@ -152,7 +152,7 @@ struct bm_mc_result {
 		} acquire;
 		struct bm_pool_state query;
 	};
-} __packed;
+} __rte_packed_end;
 #define BM_MCR_VERB_VBIT		0x80
 #define BM_MCR_VERB_CMD_MASK		BM_MCC_VERB_CMD_MASK
 #define BM_MCR_VERB_CMD_ACQUIRE		BM_MCC_VERB_CMD_ACQUIRE
drivers/bus/dpaa/include/fsl_fman.h +2 -2
index 5a9750ad0c..7acdcfc7f0 100644
@@ -12,7 +12,7 @@
 /* Status field in FD is updated on Rx side by FMAN with following information.
  * Refer to field description in FM BG.
  */
-struct fm_status_t {
+struct __rte_packed_begin fm_status_t {
 	unsigned int reserved0:3;
 	unsigned int dcl4c:1; /* Don't Check L4 Checksum */
 	unsigned int reserved1:1;
@@ -38,7 +38,7 @@ struct fm_status_t {
 	unsigned int phe:1; /* Header Error during parsing */
 	unsigned int frdr:1; /* Frame Dropped by disabled port */
 	unsigned int reserved5:4;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Set MAC address for a particular interface */
 __rte_internal
drivers/bus/dpaa/include/fsl_qman.h +80 -80

426 lines not on this page · raw message

drivers/bus/ifpga/bus_ifpga_driver.h +4 -4
index af151ffd4b..56ce34c91d 100644
@@ -29,10 +29,10 @@ struct rte_afu_driver;
 
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
-struct rte_afu_uuid {
+struct __rte_packed_begin rte_afu_uuid {
 	uint64_t uuid_low;
 	uint64_t uuid_high;
-} __rte_packed;
+} __rte_packed_end;
 
 #define IFPGA_BUS_DEV_PORT_MAX 4
 
@@ -40,10 +40,10 @@ struct rte_afu_uuid {
  * A structure describing an ID for a AFU driver. Each driver provides a
  * table of these IDs for each device that it supports.
  */
-struct rte_afu_id {
+struct __rte_packed_begin rte_afu_id {
 	struct rte_afu_uuid uuid;
 	int      port; /**< port number */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * A structure PR (Partial Reconfiguration) configuration AFU driver.
drivers/bus/vmbus/rte_vmbus_reg.h +54 -54

285 lines not on this page · raw message

Signature · 1 line
2.47.0.vfs.0.3
#292 lore raw

PATCH v11 8/30 drivers/common: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/common/cnxk/hw/sdp.h                |   4 +-
 drivers/common/cnxk/roc_npc.h               |  16 +--
 drivers/common/cnxk/roc_npc_mcam_dump.c     |   4 +-
 drivers/common/cnxk/roc_platform.h          |   3 +-
 drivers/common/dpaax/compat.h               |   3 -
 drivers/common/iavf/iavf_osdep.h            |   8 +-
 drivers/common/iavf/virtchnl_inline_ipsec.h |  44 +++----
 drivers/common/idpf/base/idpf_osdep.h       |   8 +-
 drivers/common/mlx5/mlx5_common_mr.h        |  16 +--
 drivers/common/mlx5/mlx5_common_utils.h     |   4 +-
 drivers/common/mlx5/mlx5_prm.h              | 120 ++++++++++----------
 drivers/common/qat/qat_adf/icp_qat_fw_la.h  |   8 +-
 drivers/common/qat/qat_common.h             |   8 +-
 13 files changed, 122 insertions(+), 124 deletions(-)
drivers/common/cnxk/hw/sdp.h +2 -2
index 686f516097..5792f309d7 100644
@@ -156,7 +156,7 @@
 #define SDP_VF_R_OUT_INT_LEVELS_TIMET (32)
 
 /* SDP Instruction Header */
-struct sdp_instr_ih {
+struct __plt_packed_begin sdp_instr_ih {
 	/* Data Len */
 	uint64_t tlen : 16;
 
@@ -177,6 +177,6 @@ struct sdp_instr_ih {
 
 	/* Reserved2 */
 	uint64_t rsvd2 : 1;
-} __plt_packed;
+} __plt_packed_end;
 
 #endif /* __SDP_HW_H_  */
drivers/common/cnxk/roc_npc.h +8 -8
index bf8c65aa9c..f7a1e5d810 100644
@@ -97,10 +97,10 @@ struct roc_npc_flow_item_eth {
 	uint32_t reserved : 31; /**< Reserved, must be zero. */
 };
 
-struct roc_vlan_hdr {
+struct __plt_packed_begin roc_vlan_hdr {
 	uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */
 	uint16_t eth_proto; /**< Ethernet type of encapsulated frame. */
-} __plt_packed;
+} __plt_packed_end;
 
 struct roc_npc_flow_item_vlan {
 	union {
@@ -115,23 +115,23 @@ struct roc_npc_flow_item_vlan {
 	uint32_t reserved : 31; /**< Reserved, must be zero. */
 };
 
-struct roc_ipv6_hdr {
+struct __plt_packed_begin roc_ipv6_hdr {
 	uint32_t vtc_flow;    /**< IP version, traffic class & flow label. */
 	uint16_t payload_len; /**< IP payload size, including ext. headers */
 	uint8_t proto;	      /**< Protocol, next header. */
 	uint8_t hop_limits;   /**< Hop limits. */
 	uint8_t src_addr[16]; /**< IP address of source host. */
 	uint8_t dst_addr[16]; /**< IP address of destination host(s). */
-} __plt_packed;
+} __plt_packed_end;
 
-struct roc_ipv6_fragment_ext {
+struct __plt_packed_begin roc_ipv6_fragment_ext {
 	uint8_t next_header; /**< Next header type */
 	uint8_t reserved;    /**< Reserved */
 	uint16_t frag_data;  /**< All fragmentation data */
 	uint32_t id;	     /**< Packet ID */
-} __plt_packed;
+} __plt_packed_end;
 
-struct roc_ipv6_routing_ext {
+struct __plt_packed_begin roc_ipv6_routing_ext {
 	uint8_t next_hdr;	/**< Protocol, next header. */
 	uint8_t hdr_len;	/**< Header length. */
 	uint8_t type;		/**< Extension header type. */
@@ -145,7 +145,7 @@ struct roc_ipv6_routing_ext {
 		};
 	};
 	/* Next are 128-bit IPv6 address fields to describe segments. */
-} __plt_packed;
+} __plt_packed_end;
 
 struct roc_flow_item_ipv6_ext {
 	uint8_t next_hdr; /**< Next header. */
drivers/common/cnxk/roc_npc_mcam_dump.c +2 -2
index ebd2dd69c2..27a63cc92d 100644
@@ -35,7 +35,7 @@
 #define NIX_TX_VTAGACT_VTAG1_OP_MASK	 GENMASK(45, 44)
 #define NIX_TX_VTAGACT_VTAG1_DEF_MASK	 GENMASK(57, 48)
 
-struct npc_rx_parse_nibble_s {
+struct __plt_packed_begin npc_rx_parse_nibble_s {
 	uint16_t chan : 3;
 	uint16_t errlev : 1;
 	uint16_t errcode : 2;
@@ -56,7 +56,7 @@ struct npc_rx_parse_nibble_s {
 	uint16_t lgtype : 1;
 	uint16_t lhflags : 2;
 	uint16_t lhtype : 1;
-} __plt_packed;
+} __plt_packed_end;
 
 static const char *const intf_str[] = {
 	"NIX-RX",
drivers/common/cnxk/roc_platform.h +2 -1
index df4f88f288..d6f3ea9acc 100644
@@ -97,7 +97,8 @@
 
 #define __plt_cache_aligned __rte_cache_aligned
 #define __plt_always_inline __rte_always_inline
-#define __plt_packed	    __rte_packed
+#define __plt_packed_begin	__rte_packed_begin
+#define __plt_packed_end	__rte_packed_end
 #define __plt_unused	    __rte_unused
 #define __roc_api	    __rte_internal
 #define plt_iova_t	    rte_iova_t
drivers/common/dpaax/compat.h +0 -3
index a7df70d5e6..d59207245c 100644
@@ -53,9 +53,6 @@
 #ifndef __always_unused
 #define __always_unused	__rte_unused
 #endif
-#ifndef __packed
-#define __packed	__rte_packed
-#endif
 #ifndef noinline
 #define noinline	__rte_noinline
 #endif
drivers/common/iavf/iavf_osdep.h +4 -4
index 1f2b7889cb..1b0ca933cc 100644
@@ -158,17 +158,17 @@ do {                                                            \
 } while (0)
 
 /* memory allocation tracking */
-struct iavf_dma_mem {
+struct __rte_packed_begin iavf_dma_mem {
 	void *va;
 	u64 pa;
 	u32 size;
 	const void *zone;
-} __rte_packed;
+} __rte_packed_end;
 
-struct iavf_virt_mem {
+struct __rte_packed_begin iavf_virt_mem {
 	void *va;
 	u32 size;
-} __rte_packed;
+} __rte_packed_end;
 
 #define iavf_allocate_dma_mem(h, m, unused, s, a) \
 			iavf_allocate_dma_mem_d(h, m, s, a)
drivers/common/iavf/virtchnl_inline_ipsec.h +22 -22

153 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h +4 -4
index 250f0ec500..7b43df3079 100644
@@ -182,17 +182,17 @@ static inline uint64_t idpf_read_addr64(volatile void *addr)
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
-struct idpf_dma_mem {
+struct __rte_packed_begin idpf_dma_mem {
 	void *va;
 	u64 pa;
 	u32 size;
 	const void *zone;
-} __rte_packed;
+} __rte_packed_end;
 
-struct idpf_virt_mem {
+struct __rte_packed_begin idpf_virt_mem {
 	void *va;
 	u32 size;
-} __rte_packed;
+} __rte_packed_end;
 
 #define idpf_malloc(h, s)	rte_zmalloc(NULL, s, 0)
 #define idpf_calloc(h, c, s)	rte_zmalloc(NULL, (c) * (s), 0)
drivers/common/mlx5/mlx5_common_mr.h +8 -8
index a7f1042037..cf7c685e9b 100644
@@ -49,36 +49,36 @@ struct mlx5_mr {
 };
 
 /* Cache entry for Memory Region. */
-struct mr_cache_entry {
+struct __rte_packed_begin mr_cache_entry {
 	uintptr_t start; /* Start address of MR. */
 	uintptr_t end; /* End address of MR. */
 	uint32_t lkey; /* rte_cpu_to_be_32(lkey). */
-} __rte_packed;
+} __rte_packed_end;
 
 /* MR Cache table for Binary search. */
-struct mlx5_mr_btree {
+struct __rte_packed_begin mlx5_mr_btree {
 	uint32_t len; /* Number of entries. */
 	uint32_t size; /* Total number of entries. */
 	struct mr_cache_entry (*table)[];
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_common_device;
 
 /* Per-queue MR control descriptor. */
-struct mlx5_mr_ctrl {
+struct __rte_packed_begin mlx5_mr_ctrl {
 	uint32_t *dev_gen_ptr; /* Generation number of device to poll. */
 	uint32_t cur_gen; /* Generation number saved to flush caches. */
 	uint16_t mru; /* Index of last hit entry in top-half cache. */
 	uint16_t head; /* Index of the oldest entry in top-half cache. */
 	struct mr_cache_entry cache[MLX5_MR_CACHE_N]; /* Cache for top-half. */
 	struct mlx5_mr_btree cache_bh; /* Cache for bottom-half. */
-} __rte_packed;
+} __rte_packed_end;
 
 LIST_HEAD(mlx5_mr_list, mlx5_mr);
 LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg);
 
 /* Global per-device MR cache. */
-struct mlx5_mr_share_cache {
+struct __rte_packed_begin mlx5_mr_share_cache {
 	uint32_t dev_gen; /* Generation number to flush local caches. */
 	rte_rwlock_t rwlock; /* MR cache Lock. */
 	rte_rwlock_t mprwlock; /* Mempool Registration Lock. */
@@ -88,7 +88,7 @@ struct mlx5_mr_share_cache {
 	struct mlx5_mempool_reg_list mempool_reg_list; /* Mempool database. */
 	mlx5_reg_mr_t reg_mr_cb; /* Callback to reg_mr func */
 	mlx5_dereg_mr_t dereg_mr_cb; /* Callback to dereg_mr func */
-} __rte_packed;
+} __rte_packed_end;
 
 /* Multi-Packet RQ buffer header. */
 struct __rte_cache_aligned mlx5_mprq_buf {
drivers/common/mlx5/mlx5_common_utils.h +2 -2
index 9139bc6829..e56f367bf2 100644
@@ -27,7 +27,7 @@ struct mlx5_list;
  * Structure of the entry in the mlx5 list, user should define its own struct
  * that contains this in order to store the data.
  */
-struct mlx5_list_entry {
+struct __rte_packed_begin mlx5_list_entry {
 	LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */
 	alignas(8) RTE_ATOMIC(uint32_t) ref_cnt; /* 0 means, entry is invalid. */
 	uint32_t lcore_idx;
@@ -35,7 +35,7 @@ struct mlx5_list_entry {
 		struct mlx5_list_entry *gentry;
 		uint32_t bucket_idx;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct __rte_cache_aligned mlx5_list_cache {
 	LIST_HEAD(mlx5_list_head, mlx5_list_entry) h;
drivers/common/mlx5/mlx5_prm.h +60 -60

334 lines not on this page · raw message

drivers/common/qat/qat_adf/icp_qat_fw_la.h +4 -4
index fe32b66c50..835674d91b 100644
@@ -357,7 +357,7 @@ struct icp_qat_fw_cipher_auth_cd_ctrl_hdr {
 #define ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET 24
 #define ICP_QAT_FW_CIPHER_REQUEST_PARAMETERS_OFFSET (0)
 
-struct icp_qat_fw_la_cipher_req_params {
+struct __rte_packed_begin icp_qat_fw_la_cipher_req_params {
 	uint32_t cipher_offset;
 	uint32_t cipher_length;
 	union {
@@ -372,9 +372,9 @@ struct icp_qat_fw_la_cipher_req_params {
 	uint16_t spc_aad_sz;
 	uint8_t reserved;
 	uint8_t spc_auth_res_sz;
-} __rte_packed;
+} __rte_packed_end;
 
-struct icp_qat_fw_la_auth_req_params {
+struct __rte_packed_begin icp_qat_fw_la_auth_req_params {
 	uint32_t auth_off;
 	uint32_t auth_len;
 	union {
@@ -389,7 +389,7 @@ struct icp_qat_fw_la_auth_req_params {
 	uint8_t resrvd1;
 	uint8_t hash_state_sz;
 	uint8_t auth_res_sz;
-} __rte_packed;
+} __rte_packed_end;
 
 struct icp_qat_fw_la_auth_req_params_resrvd_flds {
 	uint32_t resrvd[ICP_QAT_FW_NUM_LONGWORDS_6];
drivers/common/qat/qat_common.h +4 -4
index 703534dc15..51d20267bd 100644
@@ -57,11 +57,11 @@ enum qat_svc_list {
 };
 
 /**< Common struct for scatter-gather list operations */
-struct qat_flat_buf {
+struct __rte_packed_begin qat_flat_buf {
 	uint32_t len;
 	uint32_t resrvd;
 	uint64_t addr;
-} __rte_packed;
+} __rte_packed_end;
 
 #define qat_sgl_hdr  struct { \
 	uint64_t resrvd; \
@@ -70,11 +70,11 @@ struct qat_flat_buf {
 }
 
 __extension__
-struct __rte_cache_aligned qat_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_sgl {
 	qat_sgl_hdr;
 	/* flexible array of flat buffers*/
 	struct qat_flat_buf buffers[0];
-} __rte_packed;
+} __rte_packed_end;
 
 /** Common, i.e. not service-specific, statistics */
 struct qat_common_stats {
Signature · 1 line
2.47.0.vfs.0.3
#293 lore raw

PATCH v11 9/30 drivers/compress: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/compress/qat/qat_comp.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/compress/qat/qat_comp.h +2 -2
index 1da4770b1c..18d5fd4b02 100644
@@ -50,10 +50,10 @@ struct array_of_ptrs {
 	phys_addr_t pointer[0];
 };
 
-struct __rte_cache_aligned qat_inter_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_inter_sgl {
 	qat_sgl_hdr;
 	struct qat_flat_buf buffers[QAT_NUM_BUFS_IN_IM_SGL];
-} __rte_packed;
+} __rte_packed_end;
 
 
 struct qat_comp_op_cookie {
Signature · 1 line
2.47.0.vfs.0.3
#294 lore raw

PATCH v11 10/30 drivers/crypto: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/crypto/caam_jr/caam_jr.c             |  4 +-
 drivers/crypto/caam_jr/caam_jr_desc.h        | 64 ++++++++++----------
 drivers/crypto/caam_jr/caam_jr_hw_specific.h | 48 +++++++--------
 drivers/crypto/dpaa_sec/dpaa_sec.h           | 12 ++--
 drivers/crypto/ionic/ionic_crypto_if.h       | 36 +++++------
 drivers/crypto/mlx5/mlx5_crypto.h            |  8 +--
 drivers/crypto/mlx5/mlx5_crypto_gcm.c        |  4 +-
 drivers/crypto/qat/qat_sym.h                 |  8 +--
 drivers/crypto/qat/qat_sym_session.h         |  4 +-
 9 files changed, 94 insertions(+), 94 deletions(-)
drivers/crypto/caam_jr/caam_jr.c +2 -2
index 4082b3f422..a57dc56b80 100644
@@ -53,10 +53,10 @@ static enum sec_driver_state_e g_driver_state = SEC_DRIVER_STATE_IDLE;
 static int g_job_rings_no;
 static int g_job_rings_max;
 
-struct sec_outring_entry {
+struct __rte_packed_begin sec_outring_entry {
 	phys_addr_t desc;	/* Pointer to completed descriptor */
 	uint32_t status;	/* Status for completed descriptor */
-} __rte_packed;
+} __rte_packed_end;
 
 /* virtual address conversin when mempool support is available for ctx */
 static inline phys_addr_t
drivers/crypto/caam_jr/caam_jr_desc.h +32 -32

139 lines not on this page · raw message

drivers/crypto/caam_jr/caam_jr_hw_specific.h +24 -24

103 lines not on this page · raw message

drivers/crypto/dpaa_sec/dpaa_sec.h +6 -6
index 64d9e22159..d78cad818a 100644
@@ -62,8 +62,8 @@ enum dpaa_sec_op_type {
 #define DPAA_SEC_MAX_DESC_SIZE  64
 /* code or cmd block to caam */
 struct sec_cdb {
-	struct {
-		union {
+	struct __rte_packed_begin {
+		union __rte_packed_begin {
 			uint32_t word;
 			struct {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -76,9 +76,9 @@ struct sec_cdb {
 				uint16_t rsvd63_48;
 #endif
 			} field;
-		} __packed hi;
+		} __rte_packed_end hi;
 
-		union {
+		union __rte_packed_begin {
 			uint32_t word;
 			struct {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -101,8 +101,8 @@ struct sec_cdb {
 				unsigned int rsvd31_30:2;
 #endif
 			} field;
-		} __packed lo;
-	} __packed sh_hdr;
+		} __rte_packed_end lo;
+	} __rte_packed_end sh_hdr;
 
 	uint32_t sh_desc[DPAA_SEC_MAX_DESC_SIZE];
 };
drivers/crypto/ionic/ionic_crypto_if.h +18 -18
index ea418f3d4b..b152079fdf 100644
@@ -263,13 +263,13 @@ struct iocpt_lif_setattr_cmd {
 	u8     opcode;
 	u8     attr;
 	__le16 lif_index;
-	union {
+	union __rte_packed_begin {
 		u8	state;
 		char	name[IOCPT_IFNAMSIZ];
 		__le64	features;
 		u8	stats_ctl;
 		u8	rsvd[60];
-	} __rte_packed;
+	} __rte_packed_end;
 };
 
 /**
@@ -283,10 +283,10 @@ struct iocpt_lif_setattr_comp {
 	u8     status;
 	u8     rsvd;
 	__le16 comp_index;
-	union {
+	union __rte_packed_begin {
 		__le64	features;
 		u8	rsvd2[11];
-	} __rte_packed;
+	} __rte_packed_end;
 	u8     color;
 };
 
@@ -316,11 +316,11 @@ struct iocpt_lif_getattr_comp {
 	u8     status;
 	u8     rsvd;
 	__le16 comp_index;
-	union {
+	union __rte_packed_begin {
 		u8	state;
 		__le64	features;
 		u8	rsvd2[11];
-	} __rte_packed;
+	} __rte_packed_end;
 	u8     color;
 };
 
@@ -396,7 +396,7 @@ struct iocpt_q_identify_comp {
  * @cq_ring_base: Completion queue ring base address
  * @sg_ring_base: Scatter/Gather ring base address
  */
-struct iocpt_q_init_cmd {
+struct __rte_packed_begin iocpt_q_init_cmd {
 	u8     opcode;
 	u8     type;
 	__le16 lif_index;
@@ -417,7 +417,7 @@ struct iocpt_q_init_cmd {
 	__le64 cq_ring_base;
 	__le64 sg_ring_base;
 	u8     rsvd2[20];
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * struct iocpt_q_init_comp - Queue init command completion
@@ -469,7 +469,7 @@ enum iocpt_desc_opcode {
  * @intr_ctx_addr:   Completion interrupt context address
  * @intr_ctx_data:   Completion interrupt context data
  */
-struct iocpt_crypto_desc {
+struct __rte_packed_begin iocpt_crypto_desc {
 	uint8_t  opcode;
 	uint8_t  flags;
 	uint8_t  num_src_dst_sgs;
@@ -481,7 +481,7 @@ struct iocpt_crypto_desc {
 	__le32   session_tag;
 	__le64   intr_ctx_addr;
 	__le64   intr_ctx_data;
-} __rte_packed;
+} __rte_packed_end;
 
 static inline uint8_t iocpt_encode_nsge_src_dst(uint8_t src, uint8_t dst)
 {
@@ -765,14 +765,14 @@ struct iocpt_log_event {
  * @queue_count:    Queue counts per queue-type
  */
 union iocpt_lif_config {
-	struct {
+	struct __rte_packed_begin {
 		u8     state;
 		u8     rsvd[3];
 		char   name[IOCPT_IFNAMSIZ];
 		u8     rsvd2[12];
 		__le64 features;
 		__le32 queue_count[IOCPT_QTYPE_MAX];
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[56];
 };
 
@@ -876,14 +876,14 @@ union iocpt_dev_info_regs {
  * @data:            Opcode-specific side-data
  */
 union iocpt_dev_cmd_regs {
-	struct {
+	struct __rte_packed_begin {
 		u32    doorbell;
 		u32    done;
 		union iocpt_dev_cmd         cmd;
 		union iocpt_dev_cmd_comp    comp;
 		u8     rsvd[48];
 		u32    data[478];
-	} __rte_packed;
+	} __rte_packed_end;
 	u32    words[512];
 };
 
@@ -893,10 +893,10 @@ union iocpt_dev_cmd_regs {
  * @devcmd:          Device command registers
  */
 union iocpt_dev_regs {
-	struct {
+	struct __rte_packed_begin {
 		union iocpt_dev_info_regs info;
 		union iocpt_dev_cmd_regs  devcmd;
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[1024];
 };
 
@@ -971,7 +971,7 @@ union iocpt_dev_identity {
  * @config:             LIF config struct with features, q counts
  */
 union iocpt_lif_identity {
-	struct {
+	struct __rte_packed_begin {
 		__le64 features;
 
 		u8 version;
@@ -980,7 +980,7 @@ union iocpt_lif_identity {
 		__le32 max_nb_sessions;
 		u8 rsvd2[120];
 		union iocpt_lif_config config;
-	} __rte_packed;
+	} __rte_packed_end;
 	__le32 words[90];
 };
 
drivers/crypto/mlx5/mlx5_crypto.h +4 -4
index 547bb490e2..f9f127e9e6 100644
@@ -32,9 +32,9 @@ enum mlx5_crypto_mode {
 	MLX5_CRYPTO_IPSEC_OPT,
 };
 
-struct mlx5_crypto_ipsec_mem {
+struct __rte_packed_begin mlx5_crypto_ipsec_mem {
 	uint8_t mem[MLX5_CRYPTO_GCM_IPSEC_IV_SIZE];
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_crypto_priv {
 	TAILQ_ENTRY(mlx5_crypto_priv) next;
@@ -108,7 +108,7 @@ struct mlx5_crypto_devarg_params {
 	enum mlx5_crypto_mode crypto_mode;
 };
 
-struct mlx5_crypto_session {
+struct __rte_packed_begin mlx5_crypto_session {
 	union {
 		/**< AES-XTS configuration. */
 		struct {
@@ -145,7 +145,7 @@ struct mlx5_crypto_session {
 	/**< Initialisation Vector length. */
 	struct mlx5_crypto_dek *dek; /**< Pointer to dek struct. */
 	uint32_t dek_id; /**< DEK ID */
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_crypto_dek_ctx {
 	struct rte_crypto_sym_xform *xform;
drivers/crypto/mlx5/mlx5_crypto_gcm.c +2 -2
index cd21605bd2..89f32c7722 100644
@@ -62,10 +62,10 @@ struct mlx5_crypto_gcm_data {
 	uint32_t dst_mkey;
 };
 
-struct mlx5_crypto_gcm_tag_cpy_info {
+struct __rte_packed_begin mlx5_crypto_gcm_tag_cpy_info {
 	void *digest;
 	uint8_t tag_len;
-} __rte_packed;
+} __rte_packed_end;
 
 static struct rte_cryptodev_capabilities mlx5_crypto_gcm_caps[] = {
 	{
drivers/crypto/qat/qat_sym.h +4 -4
index eedf5de755..2a04bd9425 100644
@@ -103,10 +103,10 @@
 
 struct qat_sym_session;
 
-struct __rte_cache_aligned qat_sym_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_sym_sgl {
 	qat_sgl_hdr;
 	struct qat_flat_buf buffers[QAT_SYM_SGL_MAX_NUMBER];
-} __rte_packed;
+} __rte_packed_end;
 
 struct qat_sym_op_cookie {
 	struct qat_sym_sgl qat_sgl_src;
@@ -116,8 +116,8 @@ struct qat_sym_op_cookie {
 	union {
 		/* Used for Single-Pass AES-GMAC only */
 		struct {
-			alignas(RTE_CACHE_LINE_SIZE) struct icp_qat_hw_cipher_algo_blk cd_cipher
-					__rte_packed;
+			alignas(RTE_CACHE_LINE_SIZE) struct __rte_packed_begin
+					 icp_qat_hw_cipher_algo_blk cd_cipher __rte_packed_end;
 			phys_addr_t cd_phys_addr;
 		} spc_gmac;
 	} opt;
drivers/crypto/qat/qat_sym_session.h +2 -2
index f2634774ec..2ca6c8ddf5 100644
@@ -92,7 +92,7 @@ typedef int (*qat_sym_build_request_t)(void *in_op, struct qat_sym_session *ctx,
 		uint8_t *out_msg, void *op_cookie);
 
 /* Common content descriptor */
-struct __rte_cache_aligned qat_sym_cd {
+struct __rte_cache_aligned __rte_packed_begin qat_sym_cd {
 	struct icp_qat_hw_cipher_algo_blk cipher;
 	union {
 		struct icp_qat_hw_auth_algo_blk hash;
@@ -100,7 +100,7 @@ struct __rte_cache_aligned qat_sym_cd {
 		struct icp_qat_hw_gen3_crc_cd crc_gen3;
 		struct icp_qat_hw_gen4_crc_cd crc_gen4;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct qat_sym_session {
 	enum icp_qat_fw_la_cmd_id qat_cmd;
Signature · 1 line
2.47.0.vfs.0.3
#295 lore raw

PATCH v11 11/30 drivers/dma: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/dma/dpaa/dpaa_qdma.h    | 20 ++++++++++----------
 drivers/dma/dpaa2/dpaa2_qdma.h  | 16 ++++++++--------
 drivers/dma/ioat/ioat_hw_defs.h |  4 ++--
 3 files changed, 20 insertions(+), 20 deletions(-)
drivers/dma/dpaa/dpaa_qdma.h +10 -10
index 91eaf1455a..0b08909221 100644
@@ -119,7 +119,7 @@
 	(((fsl_qdma_engine)->block_offset) * (x))
 
 /* qDMA Command Descriptor Formats */
-struct fsl_qdma_comp_cmd_desc {
+struct __rte_packed_begin fsl_qdma_comp_cmd_desc {
 	uint8_t status;
 	uint32_t rsv0:22;
 	uint32_t ser:1;
@@ -132,9 +132,9 @@ struct fsl_qdma_comp_cmd_desc {
 	uint8_t queue:3;
 	uint8_t rsv4:3;
 	uint8_t dd:2;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_comp_sg_desc {
+struct __rte_packed_begin fsl_qdma_comp_sg_desc {
 	uint32_t offset:13;
 	uint32_t rsv0:19;
 	uint32_t length:30;
@@ -143,9 +143,9 @@ struct fsl_qdma_comp_sg_desc {
 	uint32_t addr_lo;
 	uint8_t addr_hi;
 	uint32_t rsv1:24;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_sdf {
+struct __rte_packed_begin fsl_qdma_sdf {
 	uint32_t rsv0;
 	uint32_t ssd:12;
 	uint32_t sss:12;
@@ -160,9 +160,9 @@ struct fsl_qdma_sdf {
 	uint32_t sqos:3;
 	uint32_t ns:1;
 	uint32_t srttype:4;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fsl_qdma_ddf {
+struct __rte_packed_begin fsl_qdma_ddf {
 	uint32_t rsv0;
 	uint32_t dsd:12;
 	uint32_t dss:12;
@@ -177,7 +177,7 @@ struct fsl_qdma_ddf {
 	uint32_t dqos:3;
 	uint32_t ns:1;
 	uint32_t dwttype:4;
-} __rte_packed;
+} __rte_packed_end;
 
 struct fsl_qdma_df {
 	struct fsl_qdma_sdf sdf;
@@ -186,7 +186,7 @@ struct fsl_qdma_df {
 
 #define FSL_QDMA_SG_MAX_ENTRY 64
 #define FSL_QDMA_MAX_DESC_NUM (FSL_QDMA_SG_MAX_ENTRY * QDMA_QUEUE_SIZE)
-struct fsl_qdma_cmpd_ft {
+struct __rte_packed_begin fsl_qdma_cmpd_ft {
 	struct fsl_qdma_comp_sg_desc desc_buf;
 	struct fsl_qdma_comp_sg_desc desc_sbuf;
 	struct fsl_qdma_comp_sg_desc desc_dbuf;
@@ -197,7 +197,7 @@ struct fsl_qdma_cmpd_ft {
 	uint64_t phy_ssge;
 	uint64_t phy_dsge;
 	uint64_t phy_df;
-} __rte_packed;
+} __rte_packed_end;
 
 #define FSL_QDMA_ERR_REG_STATUS_OFFSET 0xe00
 
drivers/dma/dpaa2/dpaa2_qdma.h +8 -8
index 0fd1debaf8..e2d2eb4fa8 100644
@@ -39,7 +39,7 @@
 #define DPAA2_QDMA_BMT_DISABLE 0x0
 
 /** Source/Destination Descriptor */
-struct qdma_sdd {
+struct __rte_packed_begin qdma_sdd {
 	uint32_t rsv;
 	/** Stride configuration */
 	uint32_t stride;
@@ -85,7 +85,7 @@ struct qdma_sdd {
 			uint32_t wrttype:4;
 		} write_cmd;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 #define QDMA_SG_FMT_SDB	0x0 /* single data buffer */
 #define QDMA_SG_FMT_FDS	0x1 /* frame data section */
@@ -96,7 +96,7 @@ struct qdma_sdd {
 #define QDMA_SG_BMT_ENABLE DPAA2_QDMA_BMT_ENABLE
 #define QDMA_SG_BMT_DISABLE DPAA2_QDMA_BMT_DISABLE
 
-struct qdma_sg_entry {
+struct __rte_packed_begin qdma_sg_entry {
 	uint32_t addr_lo;		/* address 0:31 */
 	uint32_t addr_hi:17;	/* address 32:48 */
 	uint32_t rsv:15;
@@ -122,7 +122,7 @@ struct qdma_sg_entry {
 			uint32_t f:1;
 		} ctrl;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 struct dpaa2_qdma_rbp {
 	uint32_t use_ultrashort:1;
@@ -213,19 +213,19 @@ enum {
 	DPAA2_QDMA_MAX_SDD
 };
 
-struct qdma_cntx_fle_sdd {
+struct __rte_packed_begin qdma_cntx_fle_sdd {
 	struct qbman_fle fle[DPAA2_QDMA_MAX_FLE];
 	struct qdma_sdd sdd[DPAA2_QDMA_MAX_SDD];
-} __rte_packed;
+} __rte_packed_end;
 
-struct qdma_cntx_sg {
+struct __rte_packed_begin qdma_cntx_sg {
 	struct qdma_cntx_fle_sdd fle_sdd;
 	struct qdma_sg_entry sg_src_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	struct qdma_sg_entry sg_dst_entry[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	uint16_t cntx_idx[RTE_DPAAX_QDMA_JOB_SUBMIT_MAX];
 	uint16_t job_nb;
 	uint16_t rsv[3];
-} __rte_packed;
+} __rte_packed_end;
 
 #define DPAA2_QDMA_IDXADDR_FROM_SG_FLAG(flag) \
 	((void *)(uintptr_t)((flag) - ((flag) & RTE_DPAAX_QDMA_SG_IDX_ADDR_MASK)))
drivers/dma/ioat/ioat_hw_defs.h +2 -2
index 11893951f2..dbfbc50f70 100644
@@ -52,7 +52,7 @@ extern "C" {
 #define	IOAT_DMACAP_PQ		(1 << 9)
 #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
 
-struct ioat_registers {
+struct __rte_packed_begin ioat_registers {
 	uint8_t		chancnt;
 	uint8_t		xfercap;
 	uint8_t		genctrl;
@@ -75,7 +75,7 @@ struct ioat_registers {
 	uint8_t		reserved2[0x8];	/* 0xA0 */
 	uint32_t	chanerr;	/* 0xA8 */
 	uint32_t	chanerrmask;	/* 0xAC */
-} __rte_packed;
+} __rte_packed_end;
 
 #define IOAT_CHANCMD_RESET	0x20
 #define IOAT_CHANCMD_SUSPEND	0x04
Signature · 1 line
2.47.0.vfs.0.3
#296 lore raw

PATCH v11 12/30 drivers/event: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/event/octeontx/timvf_evdev.c |  4 ++--
 drivers/event/octeontx/timvf_evdev.h | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/event/octeontx/timvf_evdev.c +2 -2
index 82f17144a6..b404b1db61 100644
@@ -9,10 +9,10 @@ RTE_LOG_REGISTER_SUFFIX(otx_logtype_timvf, timer, NOTICE);
 
 static struct rte_eventdev *event_dev;
 
-struct __rte_packed timvf_mbox_dev_info {
+struct __rte_packed_begin timvf_mbox_dev_info {
 	uint64_t ring_active[4];
 	uint64_t clk_freq;
-};
+} __rte_packed_end;
 
 /* Response messages */
 enum {
drivers/event/octeontx/timvf_evdev.h +6 -6
index 44a4ee41c4..e9152424ab 100644
@@ -123,7 +123,7 @@ enum timvf_clk_src {
 };
 
 /* TIM_MEM_BUCKET */
-struct __rte_aligned(8) tim_mem_bucket {
+struct __rte_aligned(8) __rte_packed_begin tim_mem_bucket {
 	uint64_t first_chunk;
 	union {
 		RTE_ATOMIC(uint64_t) w1;
@@ -139,19 +139,19 @@ struct __rte_aligned(8) tim_mem_bucket {
 	};
 	uint64_t current_chunk;
 	uint64_t pad;
-} __rte_packed;
+} __rte_packed_end;
 
-struct tim_mem_entry {
+struct __rte_packed_begin tim_mem_entry {
 	uint64_t w0;
 	uint64_t wqe;
-} __rte_packed;
+} __rte_packed_end;
 
-struct timvf_ctrl_reg {
+struct __rte_packed_begin timvf_ctrl_reg {
 	uint64_t rctrl0;
 	uint64_t rctrl1;
 	uint64_t rctrl2;
 	uint8_t use_pmu;
-} __rte_packed;
+} __rte_packed_end;
 
 struct timvf_ring;
 
Signature · 1 line
2.47.0.vfs.0.3
#297 lore raw

PATCH v11 13/30 drivers/mempool: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/mempool/octeontx/octeontx_fpavf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/mempool/octeontx/octeontx_fpavf.c +8 -8
index 966fee8bfe..6cd0fc057f 100644
@@ -46,20 +46,20 @@ struct octeontx_mbox_fpa_cfg {
 	uint64_t	aura_cfg;
 };
 
-struct __rte_packed gen_req {
+struct __rte_packed_begin gen_req {
 	uint32_t	value;
-};
+} __rte_packed_end;
 
-struct __rte_packed idn_req {
+struct __rte_packed_begin idn_req {
 	uint8_t	domain_id;
-};
+} __rte_packed_end;
 
-struct __rte_packed gen_resp {
+struct __rte_packed_begin gen_resp {
 	uint16_t	domain_id;
 	uint16_t	vfid;
-};
+} __rte_packed_end;
 
-struct __rte_packed dcfg_resp {
+struct __rte_packed_begin dcfg_resp {
 	uint8_t	sso_count;
 	uint8_t	ssow_count;
 	uint8_t	fpa_count;
@@ -67,7 +67,7 @@ struct __rte_packed dcfg_resp {
 	uint8_t	tim_count;
 	uint8_t	net_port_count;
 	uint8_t	virt_port_count;
-};
+} __rte_packed_end;
 
 #define FPA_MAX_POOL	32
 #define FPA_PF_PAGE_SZ	4096
Signature · 1 line
2.47.0.vfs.0.3
#298 lore raw

PATCH v11 14/30 drivers/net: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/net/ark/ark_ddm.h                     |    4 +-
 drivers/net/ark/ark_pktchkr.h                 |    8 +-
 drivers/net/ark/ark_pktdir.h                  |    5 +-
 drivers/net/ark/ark_pktgen.h                  |    4 +-
 drivers/net/ark/ark_udm.h                     |    4 +-
 drivers/net/atlantic/hw_atl/hw_atl_utils.h    |  120 +-
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |    8 +-
 drivers/net/avp/rte_avp_common.h              |   12 +-
 drivers/net/bnxt/bnxt.h                       |    8 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h        | 3344 ++++++++---------
 drivers/net/bnxt/tf_core/tf_resources.h       |   32 +-
 drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c   |   20 +-
 drivers/net/bonding/rte_eth_bond_8023ad.h     |   32 +-
 drivers/net/cnxk/cn10k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn20k_rxtx.h                 |    4 +-
 drivers/net/cnxk/cn9k_ethdev.h                |    4 +-
 drivers/net/cnxk/cnxk_rep_msg.h               |   64 +-
 drivers/net/dpaa/dpaa_rxtx.h                  |   28 +-
 drivers/net/dpaa/fmlib/fm_ext.h               |    4 +-
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h  |    4 +-
 drivers/net/dpaa2/dpaa2_recycle.c             |   16 +-
 drivers/net/enic/base/vnic_devcmd.h           |   40 +-
 drivers/net/enic/base/vnic_flowman.h          |  120 +-
 drivers/net/gve/base/gve_desc.h               |   16 +-
 drivers/net/gve/base/gve_desc_dqo.h           |   32 +-
 drivers/net/gve/base/gve_osdep.h              |    3 -
 drivers/net/hns3/hns3_mbx.h                   |    8 +-
 drivers/net/hns3/hns3_rxtx.h                  |    4 +-
 drivers/net/i40e/base/i40e_osdep.h            |    8 +-
 drivers/net/iavf/iavf_ipsec_crypto.h          |   10 +-
 drivers/net/iavf/iavf_rxtx.c                  |    2 +-
 drivers/net/ice/base/ice_osdep.h              |   11 +-
 drivers/net/ionic/ionic_if.h                  |   72 +-
 drivers/net/memif/memif.h                     |   36 +-
 drivers/net/mlx4/mlx4_mr.h                    |   12 +-
 drivers/net/mlx5/hws/mlx5dr.h                 |    4 +-
 drivers/net/mlx5/mlx5.h                       |    4 +-
 drivers/net/mlx5/mlx5_flow.h                  |   16 +-
 drivers/net/mlx5/mlx5_hws_cnt.h               |    4 +-
 drivers/net/mlx5/mlx5_utils.h                 |   16 +-
 drivers/net/netvsc/hn_nvs.h                   |   72 +-
 drivers/net/netvsc/ndis.h                     |    8 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.h      |    4 +-
 drivers/net/nfp/flower/nfp_flower_flow.h      |    4 +-
 drivers/net/nfp/nfd3/nfp_nfd3.h               |    4 +-
 drivers/net/nfp/nfp_rxtx.h                    |    8 +-
 drivers/net/nfp/nfpcore/nfp_nsp.c             |    4 +-
 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c |   12 +-
 drivers/net/octeon_ep/otx_ep_mbox.h           |    4 +-
 drivers/net/octeontx/base/octeontx_pki_var.h  |    4 +-
 drivers/net/pfe/pfe_hif.h                     |    4 +-
 drivers/net/virtio/virtio.h                   |    4 +-
 drivers/net/virtio/virtio_cvq.h               |    8 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |    4 +-
 drivers/net/zxdh/zxdh_common.c                |    8 +-
 drivers/net/zxdh/zxdh_msg.h                   |   16 +-
 drivers/net/zxdh/zxdh_pci.h                   |    4 +-
 drivers/net/zxdh/zxdh_queue.h                 |   64 +-
 drivers/net/zxdh/zxdh_rxtx.h                  |    8 +-
 59 files changed, 2193 insertions(+), 2198 deletions(-)
drivers/net/ark/ark_ddm.h +2 -2
index 84beeb063a..bde3a41345 100644
@@ -17,7 +17,7 @@
  */
 
 /* struct defining Tx meta data --  fixed in FPGA -- 8 bytes */
-union ark_tx_meta {
+union __rte_packed_begin ark_tx_meta {
 	uint64_t physaddr;
 	struct {
 		uint32_t usermeta0;
@@ -31,7 +31,7 @@ union ark_tx_meta {
 		uint8_t  meta_cnt;
 		uint32_t user1;
 	};
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * DDM core hardware structures
drivers/net/ark/ark_pktchkr.h +4 -4
index b362281776..fa5d2baabe 100644
@@ -23,7 +23,7 @@ typedef void *ark_pkt_chkr_t;
  * This are overlay structures to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_chkr_stat_regs {
+struct __rte_packed_begin ark_pkt_chkr_stat_regs {
 	uint32_t r0;
 	uint32_t pkt_start_stop;
 	uint32_t pkt_ctrl;
@@ -37,9 +37,9 @@ struct ark_pkt_chkr_stat_regs {
 	uint32_t pkts_missing;
 	uint32_t min_latency;
 	uint32_t max_latency;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ark_pkt_chkr_ctl_regs {
+struct __rte_packed_begin ark_pkt_chkr_ctl_regs {
 	uint32_t pkt_ctrl;
 	uint32_t pkt_payload;
 	uint32_t pkt_size_min;
@@ -53,7 +53,7 @@ struct ark_pkt_chkr_ctl_regs {
 	uint32_t dst_mac_addr_h;
 	uint32_t eth_type;
 	uint32_t hdr_dw[7];
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_chkr_inst {
 	struct rte_eth_dev_info *dev_info;
drivers/net/ark/ark_pktdir.h +3 -2
index b5577cebb3..738909941d 100644
@@ -6,6 +6,7 @@
 #define _ARK_PKTDIR_H_
 
 #include <stdint.h>
+#include <rte_common.h>
 
 #define ARK_PKT_DIR_INIT_VAL 0x0110
 
@@ -22,11 +23,11 @@ typedef void *ark_pkt_dir_t;
  * This is an overlay structures to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_dir_regs {
+struct __rte_packed_begin ark_pkt_dir_regs {
 	uint32_t ctrl;
 	uint32_t status;
 	uint32_t stall_cnt;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_dir_inst {
 	volatile struct ark_pkt_dir_regs *regs;
drivers/net/ark/ark_pktgen.h +2 -2
index 925058367c..34879711a3 100644
@@ -22,7 +22,7 @@ typedef void *ark_pkt_gen_t;
  * This is an overlay structure to a memory mapped FPGA device.  These
  * structs will never be instantiated in ram memory
  */
-struct ark_pkt_gen_regs {
+struct __rte_packed_begin ark_pkt_gen_regs {
 	uint32_t r0;
 	volatile uint32_t pkt_start_stop;
 	volatile uint32_t pkt_ctrl;
@@ -41,7 +41,7 @@ struct ark_pkt_gen_regs {
 	uint32_t hdr_dw[7];
 	uint32_t start_offset;
 	uint32_t bytes_per_cycle;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ark_pkt_gen_inst {
 	struct rte_eth_dev_info *dev_info;
drivers/net/ark/ark_udm.h +2 -2
index ec53ec7e79..55ffccff9d 100644
@@ -18,12 +18,12 @@
 /* Meta data structure passed from FPGA, must match layout in FPGA
  * -- 32 bytes
  */
-struct ark_rx_meta {
+struct __rte_packed_begin ark_rx_meta {
 	uint32_t user_meta[5];	/* user defined based on fpga code */
 	uint32_t pkt_len32;
 	uint8_t  reserved[6];
 	uint16_t pkt_len;
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * UDM hardware structures
drivers/net/atlantic/hw_atl/hw_atl_utils.h +60 -60

313 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +4 -4
index 3a7faf405c..51ff718620 100644
@@ -37,12 +37,12 @@
 
 #define HW_ATL_FW_FEATURE_LED 0x03010026
 
-struct fw2x_msg_wol_pattern {
+struct __rte_packed_begin fw2x_msg_wol_pattern {
 	u8 mask[16];
 	u32 crc;
-} __rte_packed;
+} __rte_packed_end;
 
-struct fw2x_msg_wol {
+struct __rte_packed_begin fw2x_msg_wol {
 	u32 msg_id;
 	u8 hw_addr[6];
 	u8 magic_packet_enabled;
@@ -53,7 +53,7 @@ struct fw2x_msg_wol {
 	u16 reserved;
 	u32 link_up_timeout;
 	u32 link_down_timeout;
-} __rte_packed;
+} __rte_packed_end;
 
 static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed);
 static int aq_fw2x_set_state(struct aq_hw_s *self,
drivers/net/avp/rte_avp_common.h +6 -6
index 5ad71ac088..906cf0b60a 100644
@@ -60,7 +60,7 @@ enum rte_avp_req_id {
 /*
  * Structure for AVP queue configuration query request/result
  */
-struct rte_avp_device_config {
+struct __rte_packed_begin rte_avp_device_config {
 	uint64_t device_id;	/**< Unique system identifier */
 	uint32_t driver_type; /**< Device Driver type */
 	uint32_t driver_version; /**< Device Driver version */
@@ -68,12 +68,12 @@ struct rte_avp_device_config {
 	uint16_t num_tx_queues;	/**< Number of active transmit queues */
 	uint16_t num_rx_queues;	/**< Number of active receive queues */
 	uint8_t if_up; /**< 1: interface up, 0: interface down */
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * Structure for AVP request.
  */
-struct rte_avp_request {
+struct __rte_packed_begin rte_avp_request {
 	uint32_t req_id; /**< Request id */
 	union {
 		uint32_t new_mtu; /**< New MTU */
@@ -81,7 +81,7 @@ struct rte_avp_request {
 	struct rte_avp_device_config config; /**< Queue configuration */
 	};
 	int32_t result;	/**< Result for processing request */
-} __rte_packed;
+} __rte_packed_end;
 
 /*
  * FIFO struct mapped in a shared memory. It describes a circular buffer FIFO
@@ -100,7 +100,7 @@ struct rte_avp_fifo {
 /*
  * AVP packet buffer header used to define the exchange of packet data.
  */
-struct __rte_cache_aligned rte_avp_desc {
+struct __rte_cache_aligned __rte_packed_begin rte_avp_desc {
 	uint64_t pad0;
 	void *pkt_mbuf; /**< Reference to packet mbuf */
 	uint8_t pad1[14];
@@ -114,7 +114,7 @@ struct __rte_cache_aligned rte_avp_desc {
 	uint32_t pad3;
 	uint16_t vlan_tci; /**< VLAN Tag Control Identifier (CPU order). */
 	uint32_t pad4;
-} __rte_packed;
+} __rte_packed_end;
 
 
 /**{ AVP device features */
drivers/net/bnxt/bnxt.h +4 -4
index 0402de3eb9..4a5c224c09 100644
@@ -219,16 +219,16 @@ struct bnxt_led_cfg {
 #define BNXT_LED_DFLT_ENABLES(x)                        \
 	rte_cpu_to_le_32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
 
-struct bnxt_vlan_table_entry {
+struct __rte_packed_begin bnxt_vlan_table_entry {
 	uint16_t		tpid;
 	uint16_t		vid;
-} __rte_packed;
+} __rte_packed_end;
 
-struct bnxt_vlan_antispoof_table_entry {
+struct __rte_packed_begin bnxt_vlan_antispoof_table_entry {
 	uint16_t		tpid;
 	uint16_t		vid;
 	uint16_t		mask;
-} __rte_packed;
+} __rte_packed_end;
 
 struct bnxt_child_vf_info {
 	void			*req_buf;
drivers/net/bnxt/hsi_struct_def_dpdk.h +1672 -1672

2,505 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_resources.h +16 -16
index e77e882b70..f9d18577e5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/v3/tfc_mpc_table.c +10 -10
index 9b85ede417..be16d00deb 100644

Lines of this file are not shown. View the raw message.

drivers/net/bonding/rte_eth_bond_8023ad.h +16 -16
index 5432eafcfe..395e41ff95 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn10k_rxtx.h +2 -2
index ed54e5f920..9861aa6571 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn20k_rxtx.h +2 -2
index 03eaf34d64..4a8f194eb8 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cn9k_ethdev.h +2 -2
index 4933954c33..c267c11c46 100644

Lines of this file are not shown. View the raw message.

drivers/net/cnxk/cnxk_rep_msg.h +32 -32

64 lines not on this page · raw message

drivers/net/dpaa/dpaa_rxtx.h +14 -14
index 392926e286..edb29788fb 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa/fmlib/fm_ext.h +2 -2
index 7b8d85cc71..b341862c73 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h +2 -2
index 7e5e499b6a..6bca4c8de2 100644

Lines of this file are not shown. View the raw message.

drivers/net/dpaa2/dpaa2_recycle.c +8 -8
index 4fde9b95a0..94a7e2a020 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/base/vnic_devcmd.h +20 -20
index 2b3be855f9..b470f44a69 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/base/vnic_flowman.h +60 -60

120 lines not on this page · raw message

drivers/net/gve/base/gve_desc.h +8 -8
index 006b36442f..51d3ec73f6 100644

Lines of this file are not shown. View the raw message.

drivers/net/gve/base/gve_desc_dqo.h +16 -16
index bb4a18d4d1..aa860e1e76 100644

Lines of this file are not shown. View the raw message.

drivers/net/gve/base/gve_osdep.h +0 -3
index 64181cebd6..cb3936c150 100644

Lines of this file are not shown. View the raw message.

drivers/net/hns3/hns3_mbx.h +4 -4
index 2b6cb8f513..c73f34fb32 100644

Lines of this file are not shown. View the raw message.

drivers/net/hns3/hns3_rxtx.h +2 -2
index e975cd151a..0bce89ebaa 100644

Lines of this file are not shown. View the raw message.

drivers/net/i40e/base/i40e_osdep.h +4 -4
index 302841dba8..c04f94732a 100644

Lines of this file are not shown. View the raw message.

drivers/net/iavf/iavf_ipsec_crypto.h +5 -5
index 49f9202aca..795b75a624 100644

Lines of this file are not shown. View the raw message.

drivers/net/iavf/iavf_rxtx.c +1 -1
index 6a093c6746..f7df5f21f2 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_osdep.h +4 -7
index 64e4779878..7b96fcde03 100644

Lines of this file are not shown. View the raw message.

drivers/net/ionic/ionic_if.h +36 -36

72 lines not on this page · raw message

drivers/net/memif/memif.h +18 -18
index 3f5b407a48..cff96f271a 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx4/mlx4_mr.h +6 -6
index af5251a960..56dd73ff19 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/hws/mlx5dr.h +2 -2
index 3668ab9fcf..7097d22099 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5.h +2 -2
index 89d277b523..cc8a03ccd6 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_flow.h +8 -8
index bcc2782460..50b0e2ce47 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_hws_cnt.h +2 -2
index d8da9dfcdd..38a9c19449 100644

Lines of this file are not shown. View the raw message.

drivers/net/mlx5/mlx5_utils.h +8 -8
index f933daf03c..db2e33dfa9 100644

Lines of this file are not shown. View the raw message.

drivers/net/netvsc/hn_nvs.h +36 -36

72 lines not on this page · raw message

drivers/net/netvsc/ndis.h +4 -4
index d97a397a86..df39b26df7 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/flower/nfp_flower_cmsg.h +2 -2
index a7866e8382..aff5d54347 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/flower/nfp_flower_flow.h +2 -2
index f54ad6cf55..a5cb440bd5 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfd3/nfp_nfd3.h +2 -2
index 3ba562cc3f..96ea23b3df 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfp_rxtx.h +4 -4
index c717d97003..81e420a79d 100644

Lines of this file are not shown. View the raw message.

drivers/net/nfp/nfpcore/nfp_nsp.c +2 -2
index 9837b3354b..b664e3adfa 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +6 -6
index e46a3bef28..c178144d42 100644

Lines of this file are not shown. View the raw message.

drivers/net/octeon_ep/otx_ep_mbox.h +2 -2
index ec96e4edc5..4f7afe7635 100644

Lines of this file are not shown. View the raw message.

drivers/net/octeontx/base/octeontx_pki_var.h +2 -2
index 4445369ce7..8816680dfe 100644

Lines of this file are not shown. View the raw message.

drivers/net/pfe/pfe_hif.h +2 -2
index e8d5ba10e1..16bf696689 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio.h +2 -2
index 04a897bf51..ef5827c5f5 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio_cvq.h +4 -4
index 70739ae04b..5e176b6379 100644

Lines of this file are not shown. View the raw message.

drivers/net/virtio/virtio_user/vhost_user.c +2 -2
index c10252506b..6c042f6186 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_common.c +4 -4
index 4f18c97ed7..72c0ed65cc 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_msg.h +8 -8
index 530ee406b1..5f57acd055 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_pci.h +2 -2
index ed6fd89742..fe41312cc0 100644

Lines of this file are not shown. View the raw message.

drivers/net/zxdh/zxdh_queue.h +32 -32

64 lines not on this page · raw message

drivers/net/zxdh/zxdh_rxtx.h +4 -4
index de9353b223..bc9c9b629a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.47.0.vfs.0.3

Part of the diff is not shown here. View the raw message.

#299 lore raw

PATCH v11 15/30 drivers/raw: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/raw/ifpga/afu_pmd_n3000.h    | 8 ++++----
 drivers/raw/ifpga/base/opae_hw_api.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/raw/ifpga/afu_pmd_n3000.h +4 -4
index f6b6e07c6b..2c137bd14e 100644
@@ -211,7 +211,7 @@ typedef union {
 	};
 } msgdma_desc_ctrl;
 
-typedef struct __rte_packed {
+typedef struct __rte_packed_begin {
 	uint32_t rd_address;
 	uint32_t wr_address;
 	uint32_t len;
@@ -223,7 +223,7 @@ typedef struct __rte_packed {
 	uint32_t rd_address_ext;
 	uint32_t wr_address_ext;
 	msgdma_desc_ctrl control;
-} msgdma_ext_desc;
+} __rte_packed_end msgdma_ext_desc;
 
 typedef union {
 	uint32_t csr;
@@ -279,13 +279,13 @@ typedef union {
 	};
 } msgdma_seq_num;
 
-typedef struct __rte_packed {
+typedef struct __rte_packed_begin {
 	msgdma_status status;
 	msgdma_ctrl ctrl;
 	msgdma_fill_level fill_level;
 	msgdma_rsp_level rsp;
 	msgdma_seq_num seq_num;
-} msgdma_csr;
+} __rte_packed_end msgdma_csr;
 
 #define CSR_STATUS(csr)   (&(((msgdma_csr *)(csr))->status))
 #define CSR_CONTROL(csr)  (&(((msgdma_csr *)(csr))->ctrl))
drivers/raw/ifpga/base/opae_hw_api.h +2 -2
index 613563a0b4..57750022dd 100644
@@ -343,9 +343,9 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 /* OPAE vBNG network datastruct */
 #define OPAE_ETHER_ADDR_LEN 6
 
-struct opae_ether_addr {
+struct __rte_packed_begin opae_ether_addr {
 	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
-} __rte_packed;
+} __rte_packed_end;
 
 /* OPAE vBNG network API*/
 int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
Signature · 1 line
2.47.0.vfs.0.3
#300 lore raw

PATCH v11 16/30 drivers/regex: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/regex/cn9k/cn9k_regexdev.c |  4 ++--
 drivers/regex/mlx5/mlx5_rxp.h      | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/regex/cn9k/cn9k_regexdev.c +2 -2
index aa809ab5bf..5abc7e22bc 100644
@@ -40,12 +40,12 @@ struct ree_rule_db_entry {
 	uint64_t	value;
 };
 
-struct ree_rule_db {
+struct __rte_packed_begin ree_rule_db {
 	uint32_t version;
 	uint32_t revision;
 	uint32_t number_of_entries;
 	struct ree_rule_db_entry entries[];
-} __rte_packed;
+} __rte_packed_end;
 
 static void
 qp_memzone_name_get(char *name, int size, int dev_id, int qp_id)
drivers/regex/mlx5/mlx5_rxp.h +8 -8
index b38b53cc14..08b9a2680b 100644
@@ -42,14 +42,14 @@
 #define MLX5_RXP_RESP_STATUS_PMI_EOJ (1 << 14)
 
 /* This describes the header the RXP expects for any search data. */
-struct mlx5_rxp_job_desc {
+struct __rte_packed_begin mlx5_rxp_job_desc {
 	uint32_t job_id;
 	uint16_t ctrl;
 	uint16_t len;
 	uint16_t subset[4];
-} __rte_packed;
+} __rte_packed_end;
 
-struct mlx5_rxp_response_desc {
+struct __rte_packed_begin mlx5_rxp_response_desc {
 	uint32_t job_id;
 	uint16_t status;
 	uint8_t	detected_match_count;
@@ -58,13 +58,13 @@ struct mlx5_rxp_response_desc {
 	uint16_t instruction_count;
 	uint16_t latency_count;
 	uint16_t pmi_min_byte_ptr;
-} __rte_packed;
+} __rte_packed_end;
 
-struct mlx5_rxp_match_tuple {
+struct __rte_packed_begin mlx5_rxp_match_tuple {
 	uint32_t rule_id;
 	uint16_t start_ptr;
 	uint16_t length;
-} __rte_packed;
+} __rte_packed_end;
 
 struct mlx5_rxp_response {
 	struct mlx5_rxp_response_desc header;
@@ -115,11 +115,11 @@ struct mlx5_rxp_rof {
 	struct mlx5_rxp_rof_entry *rof_entries;
 };
 
-struct mlx5_rxp_ctl_rules_pgm {
+struct __rte_packed_begin mlx5_rxp_ctl_rules_pgm {
 	struct mlx5_rxp_ctl_hdr hdr;
 	uint32_t count;
 	struct mlx5_rxp_rof_entry rules[];
-} __rte_packed;
+} __rte_packed_end;
 
 /* RXP programming mode setting. */
 enum mlx5_rxp_program_mode {
Signature · 1 line
2.47.0.vfs.0.3
#301 lore raw

PATCH v11 17/30 drivers/vdpa: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 drivers/vdpa/ifc/base/ifcvf.h | 4 ++--
 drivers/vdpa/mlx5/mlx5_vdpa.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/vdpa/ifc/base/ifcvf.h +2 -2
index 04c81c8196..0c3b8956c5 100644
@@ -115,11 +115,11 @@ struct ifcvf_pci_common_cfg {
 	u32 queue_used_hi;
 };
 
-struct ifcvf_net_config {
+struct __rte_packed_begin ifcvf_net_config {
 	u8    mac[6];
 	u16   status;
 	u16   max_virtqueue_pairs;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ifcvf_pci_mem_resource {
 	u64      phys_addr; /**< Physical address, 0 if not resource. */
drivers/vdpa/mlx5/mlx5_vdpa.h +2 -2
index e156520172..a398aa22ce 100644
@@ -90,13 +90,13 @@ enum mlx5_vdpa_task_type {
 };
 
 /* Generic task information and size must be multiple of 4B. */
-struct __rte_aligned(4) mlx5_vdpa_task {
+struct __rte_aligned(4) __rte_packed_begin mlx5_vdpa_task {
 	struct mlx5_vdpa_priv *priv;
 	enum mlx5_vdpa_task_type type;
 	RTE_ATOMIC(uint32_t) *remaining_cnt;
 	RTE_ATOMIC(uint32_t) *err_cnt;
 	uint32_t idx;
-} __rte_packed;
+} __rte_packed_end;
 
 /* Generic mlx5_vdpa_c_thread information. */
 struct mlx5_vdpa_c_thread {
Signature · 1 line
2.47.0.vfs.0.3
#302 lore raw

PATCH v11 18/30 examples/common: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Added parenthesis around *pnum in line
__ rte_packed_end (*pnum) = (void *)pn;
to avoid patch check error below:

ERROR:SPACING: need consistent spacing around '*' (ctx:WxV) 34: FILE: examples/common/neon/port_group.h:27:
+ } __ rte_packed_end *pnum = (void *)pn;

With the parenthesis it becomes a warning, still not ideal, but better Running checkpatch.pl:
WARNING:SPACING: space prohibited between function name and open parenthesis '('
34: FILE: examples/common/neon/port_group.h:27:
+ } __ rte_packed_end (*pnum) = (void *)pn;

---
 examples/common/neon/port_group.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/common/neon/port_group.h +2 -2
index 421e2e8613..b8f8be66e8 100644
@@ -21,10 +21,10 @@ static inline uint16_t *
 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 		  uint16x8_t dp2)
 {
-	union {
+	union __rte_packed_begin {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
-	} __rte_packed *pnum = (void *)pn;
+	} __rte_packed_end (*pnum) = (void *)pn;
 
 	uint16x8_t mask = {1, 2, 4, 8, 0, 0, 0, 0};
 	int32_t v;
Signature · 1 line
2.47.0.vfs.0.3
#303 lore raw

PATCH v11 19/30 examples/ip-pipeline: remove packed attributes

In reply to Andre Muezerie

Removed packed attributes from structs that are naturally packed already, or don't require packing.

---
 examples/ip_pipeline/cli.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
examples/ip_pipeline/cli.c +5 -5
index 92dfacdeb0..766fc8e46e 100644
@@ -2571,7 +2571,7 @@ struct pkt_key_qinq {
 	uint16_t svlan;
 	uint16_t ethertype_cvlan;
 	uint16_t cvlan;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_5tuple {
 	uint8_t time_to_live;
@@ -2581,7 +2581,7 @@ struct pkt_key_ipv4_5tuple {
 	uint32_t da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
@@ -2591,15 +2591,15 @@ struct pkt_key_ipv6_5tuple {
 	struct rte_ipv6_addr da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_addr {
 	uint32_t addr;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_addr {
 	struct rte_ipv6_addr addr;
-} __rte_packed;
+};
 
 static uint32_t
 parse_match(char **tokens,
Signature · 1 line
2.47.0.vfs.0.3
#304 lore raw

PATCH v11 20/30 examples/ipsec_secgw: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/ipsec-secgw/ipsec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ipsec-secgw/ipsec.h +2 -2
index f12f57e2d5..e3cc43ef3b 100644
@@ -274,11 +274,11 @@ struct socket_ctx {
 	struct rte_mempool *session_pool;
 };
 
-struct cnt_blk {
+struct __rte_packed_begin cnt_blk {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
 struct __rte_cache_aligned lcore_rx_queue {
 	uint16_t port_id;
Signature · 1 line
2.47.0.vfs.0.3
#305 lore raw

PATCH v11 21/30 examples/l3fwd-power: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/l3fwd-power/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/l3fwd-power/main.c +4 -4
index ae8b55924e..d279e664b3 100644
@@ -282,21 +282,21 @@ static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
 #define DEFAULT_HASH_FUNC       rte_jhash
 #endif
 
-struct ipv4_5tuple {
+struct __rte_packed_begin ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ipv6_5tuple {
+struct __rte_packed_begin ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
 struct ipv4_l3fwd_route {
 	struct ipv4_5tuple key;
Signature · 1 line
2.47.0.vfs.0.3
#306 lore raw

PATCH v11 22/30 examples/l3fwd: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/l3fwd/l3fwd_route.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/l3fwd/l3fwd_route.h +4 -4
index 62263c3540..b02b9cc11c 100644
@@ -36,21 +36,21 @@ struct ipv6_l3fwd_route {
 	uint8_t if_out;
 };
 
-struct ipv4_5tuple {
+struct __rte_packed_begin ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
-struct ipv6_5tuple {
+struct __rte_packed_begin ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
 	uint16_t port_dst;
 	uint16_t port_src;
 	uint8_t  proto;
-} __rte_packed;
+} __rte_packed_end;
 
 struct lpm_route_rule {
 	union {
Signature · 1 line
2.47.0.vfs.0.3
#307 lore raw

PATCH v11 23/30 examples/ptpclient: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/ptpclient/ptpclient.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
examples/ptpclient/ptpclient.c +16 -16
index 7b6862d951..9c64313fa9 100644
@@ -56,22 +56,22 @@ static const struct rte_ether_addr ether_multicast = {
 };
 
 /* Structs used for PTP handling. */
-struct tstamp {
+struct __rte_packed_begin tstamp {
 	uint16_t   sec_msb;
 	uint32_t   sec_lsb;
 	uint32_t   ns;
-}  __rte_packed;
+}  __rte_packed_end;
 
 struct clock_id {
 	uint8_t id[8];
 };
 
-struct port_id {
+struct __rte_packed_begin port_id {
 	struct clock_id        clock_id;
 	uint16_t               port_number;
-}  __rte_packed;
+}  __rte_packed_end;
 
-struct ptp_header {
+struct __rte_packed_begin ptp_header {
 	uint8_t              msg_type;
 	uint8_t              ver;
 	uint16_t             message_length;
@@ -84,39 +84,39 @@ struct ptp_header {
 	uint16_t             seq_id;
 	uint8_t              control;
 	int8_t               log_message_interval;
-} __rte_packed;
+} __rte_packed_end;
 
-struct sync_msg {
+struct __rte_packed_begin sync_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
-} __rte_packed;
+} __rte_packed_end;
 
-struct follow_up_msg {
+struct __rte_packed_begin follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
 	uint8_t             suffix[];
-} __rte_packed;
+} __rte_packed_end;
 
-struct delay_req_msg {
+struct __rte_packed_begin delay_req_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
-} __rte_packed;
+} __rte_packed_end;
 
-struct delay_resp_msg {
+struct __rte_packed_begin delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
 	struct port_id       req_port_id;
 	uint8_t              suffix[];
-} __rte_packed;
+} __rte_packed_end;
 
 struct ptp_message {
-	union {
+	union __rte_packed_begin {
 		struct ptp_header          header;
 		struct sync_msg            sync;
 		struct delay_req_msg       delay_req;
 		struct follow_up_msg       follow_up;
 		struct delay_resp_msg      delay_resp;
-	} __rte_packed;
+	} __rte_packed_end;
 };
 
 struct ptpv2_time_receiver_ordinary {
Signature · 1 line
2.47.0.vfs.0.3
#308 lore raw

PATCH v11 24/30 examples/vhost_blk: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 examples/vhost_blk/blk_spec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/vhost_blk/blk_spec.h +2 -2
index 3c54f70eaf..7f785fa563 100644
@@ -73,7 +73,7 @@ struct vhost_memory_padded {
 	struct vhost_memory_region regions[VHOST_USER_MEMORY_MAX_NREGIONS];
 };
 
-struct vhost_user_msg {
+struct __rte_packed_begin vhost_user_msg {
 	enum vhost_user_request request;
 
 #define VHOST_USER_VERSION_MASK     0x3
@@ -89,6 +89,6 @@ struct vhost_user_msg {
 		struct vhost_memory_padded memory;
 		struct vhost_user_config cfg;
 	} payload;
-} __rte_packed;
+} __rte_packed_end;
 
 #endif
Signature · 1 line
2.47.0.vfs.0.3
#309 lore raw

PATCH v11 25/30 eal: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

Removed the packed attributes from some structures that don't need them.

---
 lib/eal/common/eal_private.h      |  2 +-
 lib/eal/include/rte_memory.h      |  4 ++--
 lib/eal/include/rte_memzone.h     |  4 ++--
 lib/eal/include/rte_trace_point.h |  2 +-
 lib/eal/x86/include/rte_memcpy.h  | 12 ++++++------
 5 files changed, 12 insertions(+), 12 deletions(-)
lib/eal/common/eal_private.h +1 -1
index bb315dab04..3b94e01b5b 100644
@@ -62,7 +62,7 @@ struct rte_config {
 	 * DPDK instances
 	 */
 	struct rte_mem_config *mem_config;
-} __rte_packed;
+};
 
 /**
  * Get the global configuration structure.
lib/eal/include/rte_memory.h +2 -2
index dbd0a6bedc..249e0f5690 100644
@@ -46,7 +46,7 @@ extern "C" {
 /**
  * Physical memory segment descriptor.
  */
-struct rte_memseg {
+struct __rte_packed_begin rte_memseg {
 	rte_iova_t iova;            /**< Start IO address. */
 	union {
 		void *addr;         /**< Start virtual address. */
@@ -58,7 +58,7 @@ struct rte_memseg {
 	uint32_t nchannel;          /**< Number of channels. */
 	uint32_t nrank;             /**< Number of ranks. */
 	uint32_t flags;             /**< Memseg-specific flags */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * memseg list is a special case as we need to store a bunch of other data
lib/eal/include/rte_memzone.h +2 -2
index e1563994d5..5a0e1b8a15 100644
@@ -45,7 +45,7 @@ extern "C" {
  * A structure describing a memzone, which is a contiguous portion of
  * physical memory identified by a name.
  */
-struct rte_memzone {
+struct __rte_packed_begin rte_memzone {
 
 #define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
 	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
@@ -62,7 +62,7 @@ struct rte_memzone {
 	int32_t socket_id;                /**< NUMA socket ID. */
 
 	uint32_t flags;                   /**< Characteristics of this memzone. */
-} __rte_packed;
+} __rte_packed_end;
 
 /**
  * Set the maximum number of memzones.
lib/eal/include/rte_trace_point.h +1 -1
index 87b5f43c3c..b24db3b6da 100644
@@ -298,7 +298,7 @@ struct __rte_trace_stream_header {
 	rte_uuid_t uuid;
 	uint32_t lcore_id;
 	char thread_name[__RTE_TRACE_EMIT_STRING_LEN_MAX];
-} __rte_packed;
+};
 
 struct __rte_trace_header {
 	uint32_t offset;
lib/eal/x86/include/rte_memcpy.h +6 -6
index 42058e4a3f..46d34b8081 100644
@@ -67,15 +67,15 @@ rte_mov15_or_less(void *dst, const void *src, size_t n)
 	 * Use the following structs to avoid violating C standard
 	 * alignment requirements and to avoid strict aliasing bugs
 	 */
-	struct rte_uint64_alias {
+	struct __rte_packed_begin rte_uint64_alias {
 		uint64_t val;
-	} __rte_packed __rte_may_alias;
-	struct rte_uint32_alias {
+	} __rte_packed_end __rte_may_alias;
+	struct __rte_packed_begin rte_uint32_alias {
 		uint32_t val;
-	} __rte_packed __rte_may_alias;
-	struct rte_uint16_alias {
+	} __rte_packed_end __rte_may_alias;
+	struct __rte_packed_begin rte_uint16_alias {
 		uint16_t val;
-	} __rte_packed __rte_may_alias;
+	} __rte_packed_end __rte_may_alias;
 
 	void *ret = dst;
 	if (n & 8) {
Signature · 1 line
2.47.0.vfs.0.3
#310 lore raw

PATCH v11 26/30 ipsec: replace packed attributes

In reply to Andre Muezerie

MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.

---
 lib/ipsec/crypto.h | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)
lib/ipsec/crypto.h +22 -22
index 93d20aaaa0..dc6210a49a 100644
@@ -15,11 +15,11 @@
  * AES-CTR counter block format.
  */
 
-struct aesctr_cnt_blk {
+struct __rte_packed_begin aesctr_cnt_blk {
 	uint32_t nonce;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * CHACHA20-POLY1305 devices have some specific requirements
@@ -27,13 +27,13 @@ struct aesctr_cnt_blk {
   * Ideally that to be done by the driver itself.
   */
 
-struct aead_chacha20_poly1305_iv {
+struct __rte_packed_begin aead_chacha20_poly1305_iv {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_chacha20_poly1305_aad {
+struct __rte_packed_begin aead_chacha20_poly1305_aad {
 	uint32_t spi;
 	/*
 	 * RFC 4106, section 5:
@@ -45,25 +45,25 @@ struct aead_chacha20_poly1305_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct chacha20_poly1305_esph_iv {
+struct __rte_packed_begin chacha20_poly1305_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * AES-GCM devices have some specific requirements for IV and AAD formats.
   * Ideally that to be done by the driver itself.
   */
 
-struct aead_gcm_iv {
+struct __rte_packed_begin aead_gcm_iv {
 	uint32_t salt;
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_gcm_aad {
+struct __rte_packed_begin aead_gcm_aad {
 	uint32_t spi;
 	/*
 	 * RFC 4106, section 5:
@@ -75,34 +75,34 @@ struct aead_gcm_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct gcm_esph_iv {
+struct __rte_packed_begin gcm_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
  /*
   * AES-CCM devices have some specific requirements for IV and AAD formats.
   * Ideally that to be done by the driver itself.
   */
-union aead_ccm_salt {
+union __rte_packed_begin aead_ccm_salt {
 	uint32_t salt;
 	struct inner {
 		uint8_t salt8[3];
 		uint8_t ccm_flags;
 	} inner;
-} __rte_packed;
+} __rte_packed_end;
 
 
-struct aead_ccm_iv {
+struct __rte_packed_begin aead_ccm_iv {
 	uint8_t ccm_flags;
 	uint8_t salt[3];
 	uint64_t iv;
 	uint32_t cnt;
-} __rte_packed;
+} __rte_packed_end;
 
-struct aead_ccm_aad {
+struct __rte_packed_begin aead_ccm_aad {
 	uint8_t padding[18];
 	uint32_t spi;
 	/*
@@ -115,12 +115,12 @@ struct aead_ccm_aad {
 		uint64_t u64;
 	} sqn;
 	uint32_t align0; /* align to 16B boundary */
-} __rte_packed;
+} __rte_packed_end;
 
-struct ccm_esph_iv {
+struct __rte_packed_begin ccm_esph_iv {
 	struct rte_esp_hdr esph;
 	uint64_t iv;
-} __rte_packed;
+} __rte_packed_end;
 
 
 static inline void
Signature · 1 line
2.47.0.vfs.0.3