From patchwork Tue Oct 11 12:07:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1292 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id 99DFF600673 for ; Tue, 11 Oct 2011 14:08:17 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [217.150.252.179] (confino [217.150.252.179]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id E624FC8642; Tue, 11 Oct 2011 12:08:16 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org E624FC8642 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1318334897; bh=6tgRdGL6s2jKb503Y5/Vg83SSWTAKb8+v77AAvAi2yo=; h=From:To:Cc:Subject:Date:Message-Id; b=qOk7JjqEjXXYDI+pMwUj7wVEZ8KmsW4HmjoG+bjFBoI+AJQk1VTQ0jlXfQ2JLZeZc tyCfZ3fDEAAEpvOaRkUqDlBkOBl9YtOydpQFG1CqE1Fk4YXzcmVQNOY9ZHPBdwSyuJ duUoOHDWPazewBctWd5gnFqJcE6hljKHbxqCbw0U= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 11 Oct 2011 14:07:25 +0200 Message-Id: <1318334846-15625-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 Subject: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: linearise the tt_response only if needed 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: Tue, 11 Oct 2011 12:08:17 -0000 The TT_RESPONSE m essage can be linearised only if we plan to access the tt payload (only if the message is directed to me). In all the other cases we can avoid this memory operation Signed-off-by: Antonio Quartulli --- routing.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/routing.c b/routing.c index f961cc5..1a5d046 100644 --- a/routing.c +++ b/routing.c @@ -616,13 +616,13 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) } break; case TT_RESPONSE: - /* packet needs to be linearized to access the TT changes */ - if (skb_linearize(skb) < 0) - goto out; + if (is_my_mac(tt_query->dst)) { + /* packet needs to be linearized to access the TT changes */ + if (skb_linearize(skb) < 0) + goto out; - if (is_my_mac(tt_query->dst)) handle_tt_response(bat_priv, tt_query); - else { + } else { bat_dbg(DBG_TT, bat_priv, "Routing TT_RESPONSE to %pM [%c]\n", tt_query->dst,