From patchwork Fri Feb 17 07:18:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1534 Return-Path: Received: from nm13.bullet.mail.ukl.yahoo.com (nm13.bullet.mail.ukl.yahoo.com [217.146.183.187]) by open-mesh.org (Postfix) with SMTP id CF75B60086D for ; Fri, 17 Feb 2012 08:19:04 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.209] by nm13.bullet.mail.ukl.yahoo.com with NNFMP; 17 Feb 2012 07:19:04 -0000 Received: from [77.238.184.75] by tm2.bullet.mail.ukl.yahoo.com with NNFMP; 17 Feb 2012 07:19:04 -0000 Received: from [127.0.0.1] by smtp144.mail.ukl.yahoo.com with NNFMP; 17 Feb 2012 07:19:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1329463144; bh=dxXmhioz8jP0P+WE6d0+2ERWKW/0iGgNcNHjxbegs24=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=OvS28tosIsQFRdf6SpEiO49YOaPSSKN+DzH/SUjyXODkPl2trcoz/84ZI3ZoPEtS3hvnrBs0Sr3IP6mUrjdvFiComq+9djAN38UJQstGn/oz13AwP9MYlQYd5Ye3o6uWZybVYAoA1gZYzLUXoY/+zYpje7pxNzmrbjFop6wWTOE= X-Yahoo-Newman-Id: 686814.78630.bm@smtp144.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: dbdKlNUVM1lDygYn121kZKX2x7og0OGIoTHe0V.PnoYWFZl DddER2mojy5IUln12DE8GtGa5NycZdC7BkcVv95dtCnvyUPlZmpEYX72UAOL eqA2WwvyIXYlBVTEKpzt4Cp_wWrDWK07lunAaN3SXxvRpW46mOP0CIzDF7SJ rPUZ7h7xStKWVLSyyZ.ayxkHTIvCPbFrl8Mn0to5yktvxNN9YHgSqE8rOyfu 1zM_L9s6MK6gcLS_1OjgJJl4N2J92vhw1FEHqlxwW_z8XsRlJ8He0_ImKtxm 2K3ipwJyWsxLcJhFJi6QgDP.uI8OvD_eI.bcf6CWG4Ly8OsV8K6sLbmXLI8s tX4DiWuWlTE3RQi7aSLoD4sWdlN5rSAcRViWFUPGKpyEIOeDmjkVWv.NWvIh ADr11MONpZg-- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@210.177.7.38 with plain) by smtp144.mail.ukl.yahoo.com with SMTP; 17 Feb 2012 07:19:03 +0000 GMT From: Marek Lindner To: davem@davemloft.net Date: Fri, 17 Feb 2012 15:18:23 +0800 Message-Id: <1329463110-856-4-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1329463110-856-1-git-send-email-lindner_marek@yahoo.de> References: <1329463110-856-1-git-send-email-lindner_marek@yahoo.de> 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 03/10] batman-adv: simplify bat_ogm_receive API call X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 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: Fri, 17 Feb 2012 07:19:05 -0000 Most of the values in that call are derived from the skb, so we can hand over the skb instead. Reported-by: Simon Wunderlich Signed-off-by: Marek Lindner --- net/batman-adv/bat_iv_ogm.c | 11 +++++++---- net/batman-adv/bat_ogm.h | 3 +-- net/batman-adv/routing.c | 4 +--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index d60e1ba..3402fa5 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -1140,13 +1140,16 @@ out: orig_node_free_ref(orig_node); } -void bat_ogm_receive(const struct ethhdr *ethhdr, unsigned char *packet_buff, - int packet_len, struct hard_iface *if_incoming) +void bat_ogm_receive(struct hard_iface *if_incoming, struct sk_buff *skb) { struct batman_ogm_packet *batman_ogm_packet; - int buff_pos = 0; - unsigned char *tt_buff; + struct ethhdr *ethhdr; + int buff_pos = 0, packet_len; + unsigned char *tt_buff, *packet_buff; + packet_len = skb_headlen(skb); + ethhdr = (struct ethhdr *)skb_mac_header(skb); + packet_buff = skb->data; batman_ogm_packet = (struct batman_ogm_packet *)packet_buff; /* unpack the aggregated packets and process them one by one */ diff --git a/net/batman-adv/bat_ogm.h b/net/batman-adv/bat_ogm.h index 69329c1..47edfde 100644 --- a/net/batman-adv/bat_ogm.h +++ b/net/batman-adv/bat_ogm.h @@ -29,7 +29,6 @@ void bat_ogm_init_primary(struct hard_iface *hard_iface); void bat_ogm_update_mac(struct hard_iface *hard_iface); void bat_ogm_schedule(struct hard_iface *hard_iface, int tt_num_changes); void bat_ogm_emit(struct forw_packet *forw_packet); -void bat_ogm_receive(const struct ethhdr *ethhdr, unsigned char *packet_buff, - int packet_len, struct hard_iface *if_incoming); +void bat_ogm_receive(struct hard_iface *if_incoming, struct sk_buff *skb); #endif /* _NET_BATMAN_ADV_OGM_H_ */ diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 4363d19..5bc41c8 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -272,9 +272,7 @@ int recv_bat_ogm_packet(struct sk_buff *skb, struct hard_iface *hard_iface) if (skb_linearize(skb) < 0) return NET_RX_DROP; - ethhdr = (struct ethhdr *)skb_mac_header(skb); - - bat_ogm_receive(ethhdr, skb->data, skb_headlen(skb), hard_iface); + bat_ogm_receive(hard_iface, skb); kfree_skb(skb); return NET_RX_SUCCESS;