[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/7] net/eth: use the QEMU_PACKED macro
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 2/7] net/eth: use the QEMU_PACKED macro |
Date: |
Mon, 8 Jan 2018 15:02:26 -0300 |
---
include/net/eth.h | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/include/net/eth.h b/include/net/eth.h
index 09054a506d..87c6499f18 100644
--- a/include/net/eth.h
+++ b/include/net/eth.h
@@ -36,12 +36,12 @@ struct eth_header {
uint8_t h_dest[ETH_ALEN]; /* destination eth addr */
uint8_t h_source[ETH_ALEN]; /* source ether addr */
uint16_t h_proto; /* packet type ID field */
-};
+} QEMU_PACKED;
struct vlan_header {
uint16_t h_tci; /* priority and VLAN ID */
uint16_t h_proto; /* encapsulated protocol */
-};
+} QEMU_PACKED;
struct ip_header {
uint8_t ip_ver_len; /* version and header length */
@@ -53,9 +53,9 @@ struct ip_header {
uint8_t ip_p; /* protocol */
uint16_t ip_sum; /* checksum */
uint32_t ip_src, ip_dst; /* source and destination address */
-};
+} QEMU_PACKED;
-typedef struct tcp_header {
+typedef struct QEMU_PACKED tcp_header {
uint16_t th_sport; /* source port */
uint16_t th_dport; /* destination port */
uint32_t th_seq; /* sequence number */
@@ -77,14 +77,14 @@ typedef struct tcp_header {
#define TCP_HEADER_DATA_OFFSET(tcp) \
(((be16_to_cpu((tcp)->th_offset_flags) >> 12) & 0xf) << 2)
-typedef struct udp_header {
+typedef struct QEMU_PACKED udp_header {
uint16_t uh_sport; /* source port */
uint16_t uh_dport; /* destination port */
uint16_t uh_ulen; /* udp length */
uint16_t uh_sum; /* udp checksum */
} udp_header;
-typedef struct ip_pseudo_header {
+typedef struct QEMU_PACKED ip_pseudo_header {
uint32_t ip_src;
uint32_t ip_dst;
uint8_t zeros;
@@ -116,9 +116,9 @@ struct ip6_header {
} ip6_ctlun;
struct in6_address ip6_src; /* source address */
struct in6_address ip6_dst; /* destination address */
-};
+} QEMU_PACKED;
-typedef struct ip6_pseudo_header {
+typedef struct QEMU_PACKED ip6_pseudo_header {
struct in6_address ip6_src;
struct in6_address ip6_dst;
uint32_t len;
@@ -129,7 +129,7 @@ typedef struct ip6_pseudo_header {
struct ip6_ext_hdr {
uint8_t ip6r_nxt; /* next header */
uint8_t ip6r_len; /* length in units of 8 octets */
-};
+} QEMU_PACKED;
struct ip6_ext_hdr_routing {
uint8_t nxt;
@@ -137,21 +137,21 @@ struct ip6_ext_hdr_routing {
uint8_t rtype;
uint8_t segleft;
uint8_t rsvd[4];
-};
+} QEMU_PACKED;
struct ip6_option_hdr {
#define IP6_OPT_PAD1 (0x00)
#define IP6_OPT_HOME (0xC9)
uint8_t type;
uint8_t len;
-};
+} QEMU_PACKED;
struct udp_hdr {
uint16_t uh_sport; /* source port */
uint16_t uh_dport; /* destination port */
uint16_t uh_ulen; /* udp length */
uint16_t uh_sum; /* udp checksum */
-};
+} QEMU_PACKED;
struct tcp_hdr {
u_short th_sport; /* source port */
@@ -180,7 +180,7 @@ struct tcp_hdr {
u_short th_win; /* window */
u_short th_sum; /* checksum */
u_short th_urp; /* urgent pointer */
-};
+} QEMU_PACKED;
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
#define ip6_ecn_acc ip6_ctlun.ip6_un3.ip6_un3_ecn
--
2.15.1
- [Qemu-devel] [PATCH 0/7] use QEMU_PACKED and QEMU_ALIGNED macros, Philippe Mathieu-Daudé, 2018/01/08
- [Qemu-devel] [PATCH 1/7] net: struct MACAddr can use the QEMU_PACKED macro, Philippe Mathieu-Daudé, 2018/01/08
- [Qemu-devel] [PATCH 2/7] net/eth: use the QEMU_PACKED macro,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 4/7] net/rocker: move struct rocker_desc to C file, Philippe Mathieu-Daudé, 2018/01/08
- [Qemu-devel] [PATCH 5/7] net/eepro100: use QEMU_ALIGNED() macro, Philippe Mathieu-Daudé, 2018/01/08
- [Qemu-devel] [PATCH 3/7] net/rocker: use QEMU_PACKED and QEMU_ALIGNED() macros, Philippe Mathieu-Daudé, 2018/01/08
- [Qemu-devel] [RFC PATCH 6/7] net/eepro100: reduce alignment to DWORD (32bit), Philippe Mathieu-Daudé, 2018/01/08
- [Qemu-devel] [PATCH 7/7] i386/pc: use the QEMU_ALIGNED() macro, Philippe Mathieu-Daudé, 2018/01/08