diff options
author | Simon Wunderlich <sw@simonwunderlich.de> | 2013-12-02 14:38:31 -0500 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-12-28 06:51:16 -0500 |
commit | a40d9b075c21f06872de3f05cc2eb3d06665e2ff (patch) | |
tree | 85aefae654246aa4f89e046bb0bca6b5b85b76f6 /net/batman-adv/soft-interface.c | |
parent | 46b76e0b8b5e21fa5a2387d6f72b193514e7f722 (diff) |
batman-adv: fix header alignment by unrolling batadv_header
The size of the batadv_header of 3 is problematic on some architectures
which automatically pad all structures to a 32 bit boundary. To not lose
performance by packing this struct, better embed it into the various
host structures.
Reported-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/soft-interface.c')
-rw-r--r-- | net/batman-adv/soft-interface.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 36f050876f82..b4881f8e28e8 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -264,11 +264,11 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
264 | goto dropped; | 264 | goto dropped; |
265 | 265 | ||
266 | bcast_packet = (struct batadv_bcast_packet *)skb->data; | 266 | bcast_packet = (struct batadv_bcast_packet *)skb->data; |
267 | bcast_packet->header.version = BATADV_COMPAT_VERSION; | 267 | bcast_packet->version = BATADV_COMPAT_VERSION; |
268 | bcast_packet->header.ttl = BATADV_TTL; | 268 | bcast_packet->ttl = BATADV_TTL; |
269 | 269 | ||
270 | /* batman packet type: broadcast */ | 270 | /* batman packet type: broadcast */ |
271 | bcast_packet->header.packet_type = BATADV_BCAST; | 271 | bcast_packet->packet_type = BATADV_BCAST; |
272 | bcast_packet->reserved = 0; | 272 | bcast_packet->reserved = 0; |
273 | 273 | ||
274 | /* hw address of first interface is the orig mac because only | 274 | /* hw address of first interface is the orig mac because only |
@@ -328,7 +328,7 @@ void batadv_interface_rx(struct net_device *soft_iface, | |||
328 | struct sk_buff *skb, struct batadv_hard_iface *recv_if, | 328 | struct sk_buff *skb, struct batadv_hard_iface *recv_if, |
329 | int hdr_size, struct batadv_orig_node *orig_node) | 329 | int hdr_size, struct batadv_orig_node *orig_node) |
330 | { | 330 | { |
331 | struct batadv_header *batadv_header = (struct batadv_header *)skb->data; | 331 | struct batadv_bcast_packet *batadv_bcast_packet; |
332 | struct batadv_priv *bat_priv = netdev_priv(soft_iface); | 332 | struct batadv_priv *bat_priv = netdev_priv(soft_iface); |
333 | __be16 ethertype = htons(ETH_P_BATMAN); | 333 | __be16 ethertype = htons(ETH_P_BATMAN); |
334 | struct vlan_ethhdr *vhdr; | 334 | struct vlan_ethhdr *vhdr; |
@@ -336,7 +336,8 @@ void batadv_interface_rx(struct net_device *soft_iface, | |||
336 | unsigned short vid; | 336 | unsigned short vid; |
337 | bool is_bcast; | 337 | bool is_bcast; |
338 | 338 | ||
339 | is_bcast = (batadv_header->packet_type == BATADV_BCAST); | 339 | batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data; |
340 | is_bcast = (batadv_bcast_packet->packet_type == BATADV_BCAST); | ||
340 | 341 | ||
341 | /* check if enough space is available for pulling, and pull */ | 342 | /* check if enough space is available for pulling, and pull */ |
342 | if (!pskb_may_pull(skb, hdr_size)) | 343 | if (!pskb_may_pull(skb, hdr_size)) |