aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/packet.h
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-11-05 15:25:26 -0500
committerAntonio Quartulli <ordex@autistici.org>2012-11-07 14:00:17 -0500
commitf6c57a460913f3c83b0e8eb51f4021fcf1c83cdc (patch)
tree052488fe9d8be43336a99837f7d380f083e52437 /net/batman-adv/packet.h
parent5b246574430f808e5b98ef40b8058bf5ac1df02d (diff)
batman-adv: Mark correctly aligned headers not as __packed
Headers which are already perfectly aligned and create a 4 byte boundary non-ethernet header payload can have the __packed attribute removed. The __packed attribute doesn't change the appeareance of the packet for these headers because no extra padding is necessary to align the data members. The compiler will also create slightly faster code for loads of multi-byte members. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/packet.h')
-rw-r--r--net/batman-adv/packet.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index 2d23a14c220e..b5f67a2687b1 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -106,13 +106,16 @@ struct batadv_bla_claim_dst {
106 uint8_t magic[3]; /* FF:43:05 */ 106 uint8_t magic[3]; /* FF:43:05 */
107 uint8_t type; /* bla_claimframe */ 107 uint8_t type; /* bla_claimframe */
108 __be16 group; /* group id */ 108 __be16 group; /* group id */
109} __packed; 109};
110 110
111struct batadv_header { 111struct batadv_header {
112 uint8_t packet_type; 112 uint8_t packet_type;
113 uint8_t version; /* batman version field */ 113 uint8_t version; /* batman version field */
114 uint8_t ttl; 114 uint8_t ttl;
115} __packed; 115 /* the parent struct has to add a byte after the header to make
116 * everything 4 bytes aligned again
117 */
118};
116 119
117struct batadv_ogm_packet { 120struct batadv_ogm_packet {
118 struct batadv_header header; 121 struct batadv_header header;
@@ -137,7 +140,7 @@ struct batadv_icmp_packet {
137 __be16 seqno; 140 __be16 seqno;
138 uint8_t uid; 141 uint8_t uid;
139 uint8_t reserved; 142 uint8_t reserved;
140} __packed; 143};
141 144
142#define BATADV_RR_LEN 16 145#define BATADV_RR_LEN 16
143 146
@@ -153,13 +156,16 @@ struct batadv_icmp_packet_rr {
153 uint8_t uid; 156 uint8_t uid;
154 uint8_t rr_cur; 157 uint8_t rr_cur;
155 uint8_t rr[BATADV_RR_LEN][ETH_ALEN]; 158 uint8_t rr[BATADV_RR_LEN][ETH_ALEN];
156} __packed; 159};
157 160
158struct batadv_unicast_packet { 161struct batadv_unicast_packet {
159 struct batadv_header header; 162 struct batadv_header header;
160 uint8_t ttvn; /* destination translation table version number */ 163 uint8_t ttvn; /* destination translation table version number */
161 uint8_t dest[ETH_ALEN]; 164 uint8_t dest[ETH_ALEN];
162} __packed; 165 /* "4 bytes boundary + 2 bytes" long to make the payload after the
166 * following ethernet header again 4 bytes boundary aligned
167 */
168};
163 169
164struct batadv_unicast_frag_packet { 170struct batadv_unicast_frag_packet {
165 struct batadv_header header; 171 struct batadv_header header;
@@ -176,6 +182,9 @@ struct batadv_bcast_packet {
176 uint8_t reserved; 182 uint8_t reserved;
177 __be32 seqno; 183 __be32 seqno;
178 uint8_t orig[ETH_ALEN]; 184 uint8_t orig[ETH_ALEN];
185 /* "4 bytes boundary + 2 bytes" long to make the payload after the
186 * following ethernet header again 4 bytes boundary aligned
187 */
179} __packed; 188} __packed;
180 189
181struct batadv_vis_packet { 190struct batadv_vis_packet {
@@ -187,7 +196,7 @@ struct batadv_vis_packet {
187 uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */ 196 uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */
188 uint8_t target_orig[ETH_ALEN]; /* who should receive this packet */ 197 uint8_t target_orig[ETH_ALEN]; /* who should receive this packet */
189 uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */ 198 uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */
190} __packed; 199};
191 200
192struct batadv_tt_query_packet { 201struct batadv_tt_query_packet {
193 struct batadv_header header; 202 struct batadv_header header;