From patchwork Wed Nov 7 19:11:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2474 Return-Path: Received: from contumacia.investici.org (contumacia.investici.org [178.255.144.35]) by open-mesh.org (Postfix) with ESMTPS id A95FB60166F for ; Wed, 7 Nov 2012 20:12:31 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass reason="1024-bit key; insecure key" header.i=@autistici.org header.b=ULvDb9LN; dkim-adsp=pass; dkim-atps=neutral Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 6FEBBE8AF5; Wed, 7 Nov 2012 19:12:30 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org 6FEBBE8AF5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1352315551; bh=IekkupB114p+SMIY/5l8agC5VPgGluiPw8nDyXj3bzg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ULvDb9LNdYvt7VfMdkg5iWaHOiYjosiXmdJhbMtB8IJgA/sye7IW/Pw+iDJ4/TOhc bkFosjmYE65G5Bwo+kLi+/A0Fl8DKsRXMb1UC2d7vY3YQMpDTrHwb3LunlQCci8+YB o6mb0q0cRufFXZOgIZHY+Ah4DY746RghCgUqDMvg= From: Antonio Quartulli To: davem@davemloft.net Date: Wed, 7 Nov 2012 20:11:32 +0100 Message-Id: <1352315502-20324-3-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1352315502-20324-1-git-send-email-ordex@autistici.org> References: <1352315502-20324-1-git-send-email-ordex@autistici.org> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 02/12] batman-adv: Mark correctly aligned headers not as __packed X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2012 19:12:31 -0000 From: Sven Eckelmann 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 Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/packet.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index 2d23a14..b5f67a2 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h @@ -106,13 +106,16 @@ struct batadv_bla_claim_dst { uint8_t magic[3]; /* FF:43:05 */ uint8_t type; /* bla_claimframe */ __be16 group; /* group id */ -} __packed; +}; struct batadv_header { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t ttl; -} __packed; + /* the parent struct has to add a byte after the header to make + * everything 4 bytes aligned again + */ +}; struct batadv_ogm_packet { struct batadv_header header; @@ -137,7 +140,7 @@ struct batadv_icmp_packet { __be16 seqno; uint8_t uid; uint8_t reserved; -} __packed; +}; #define BATADV_RR_LEN 16 @@ -153,13 +156,16 @@ struct batadv_icmp_packet_rr { uint8_t uid; uint8_t rr_cur; uint8_t rr[BATADV_RR_LEN][ETH_ALEN]; -} __packed; +}; struct batadv_unicast_packet { struct batadv_header header; uint8_t ttvn; /* destination translation table version number */ uint8_t dest[ETH_ALEN]; -} __packed; + /* "4 bytes boundary + 2 bytes" long to make the payload after the + * following ethernet header again 4 bytes boundary aligned + */ +}; struct batadv_unicast_frag_packet { struct batadv_header header; @@ -176,6 +182,9 @@ struct batadv_bcast_packet { uint8_t reserved; __be32 seqno; uint8_t orig[ETH_ALEN]; + /* "4 bytes boundary + 2 bytes" long to make the payload after the + * following ethernet header again 4 bytes boundary aligned + */ } __packed; struct batadv_vis_packet { @@ -187,7 +196,7 @@ struct batadv_vis_packet { uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */ uint8_t target_orig[ETH_ALEN]; /* who should receive this packet */ uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */ -} __packed; +}; struct batadv_tt_query_packet { struct batadv_header header;