From patchwork Wed Oct 12 13:10:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1297 Return-Path: Received: from contumacia.investici.org (contumacia.investici.org [178.255.144.35]) by open-mesh.org (Postfix) with ESMTPS id A292E6006A8 for ; Wed, 12 Oct 2011 15:11:49 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 3D508E83F7; Wed, 12 Oct 2011 13:11:47 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org 3D508E83F7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1318425108; bh=5xhTnfh3U/aqBPZ6Ns/AvsfdV3yI7MzDbvfDVJiM2BU=; h=From:To:Cc:Subject:Date:Message-Id; b=ucAPLn5O4qXIEYG4EpKCZEdl8r8wlHuml7akJNhy+uk5X9IYO7iAter4g0pl0Ntcm iZvRiqDS7Nv/PQZRpK2jCvatAQwY8l6bPLXixfO+RcVbJR+DxdS1jXZX5yODS1uQXP iwqqlojyzFPUVvByFnH0bladfXQStYAFCR60bgeg= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Wed, 12 Oct 2011 15:10:57 +0200 Message-Id: <1318425058-715-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 Subject: [B.A.T.M.A.N.] [PATCHv2 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: Wed, 12 Oct 2011 13:11:49 -0000 The TT_RESPONSE message 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 --- corrected typo in the commit message routing.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/routing.c b/routing.c index f961cc5..20804f4 100644 --- a/routing.c +++ b/routing.c @@ -616,13 +616,14 @@ 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,