From patchwork Wed Mar 24 04:52:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 77 Return-Path: Received: from smtp149.mail.ukl.yahoo.com (smtp149.mail.ukl.yahoo.com [77.238.184.80]) by open-mesh.net (Postfix) with SMTP id D1DED1542F6 for ; Wed, 24 Mar 2010 05:57:52 +0100 (CET) Received: (qmail 49105 invoked from network); 24 Mar 2010 04:57:51 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.de; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=PGufFDBWSyqsMY8c1WfLv5/62R8dypdYbi3rIBf8qXbxC/aXKPptNZ1IwrstjCmKPdQisUlwBFP3JN8HaID+VfeKdnAQ0ySlFr9U2KE9DegALAMwEDNUPOLXjM7JJe06WIspxe1E7x/XVvzwPxi3VB8wa90zA8V8SNyqTMvom7w= ; Received: from 61-59-128-157.static.seed.net.tw (lindner_marek@61.59.128.157 with plain) by smtp149.mail.ukl.yahoo.com with SMTP; 24 Mar 2010 04:57:50 +0000 GMT X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- X-YMail-OSG: LgLvVlwVM1mEith.WcI12TFgjj_s2g2OvgblTj91jBszLzoNlqJreRoOCytb65NBY_WzqEKcRfeUPbi0qK9Il6Z8BQGinJjhPIrfDOphLatiUeudAiuKAkt6olm1tSxN3mmP9EJ0Kc7P2Ybsw3fbZu9AVM4nfHG7ypUZb238wfJ5NTL__BrglTFBMnsvPuAXTan.ncx8i6yZ9IpxOnnxTWYruw4KqN4ixtRSKWquZcZTX5woMWeSteTFsPkqyLKaKWiU2Z1rgpeZOg-- X-Yahoo-Newman-Property: ymail-3 From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.net Date: Wed, 24 Mar 2010 12:52:41 +0800 Message-Id: <1269406363-9593-3-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.0 In-Reply-To: <201003241252.18954.lindner_marek@yahoo.de> References: <201003241252.18954.lindner_marek@yahoo.de> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: remove redundant pointer to originator interface X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 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, 24 Mar 2010 04:57:53 -0000 Signed-off-by: Marek Lindner --- batman-adv-kernelland/device.c | 2 +- batman-adv-kernelland/originator.c | 1 - batman-adv-kernelland/routing.c | 14 +++----------- batman-adv-kernelland/types.h | 1 - batman-adv-kernelland/vis.c | 15 +++++++-------- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/batman-adv-kernelland/device.c b/batman-adv-kernelland/device.c index 484b2a1..a3e066a 100644 --- a/batman-adv-kernelland/device.c +++ b/batman-adv-kernelland/device.c @@ -260,7 +260,7 @@ ssize_t bat_device_write(struct file *file, const char __user *buff, if (!orig_node->router) goto unlock; - batman_if = orig_node->batman_if; + batman_if = orig_node->router->if_incoming; memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); spin_unlock_irqrestore(&orig_hash_lock, flags); diff --git a/batman-adv-kernelland/originator.c b/batman-adv-kernelland/originator.c index 1f607f4..dbc7cbf 100644 --- a/batman-adv-kernelland/originator.c +++ b/batman-adv-kernelland/originator.c @@ -139,7 +139,6 @@ struct orig_node *get_orig_node(uint8_t *addr) memcpy(orig_node->orig, addr, ETH_ALEN); orig_node->router = NULL; - orig_node->batman_if = NULL; orig_node->hna_buff = NULL; size = num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS; diff --git a/batman-adv-kernelland/routing.c b/batman-adv-kernelland/routing.c index 2e357bf..3168215 100644 --- a/batman-adv-kernelland/routing.c +++ b/batman-adv-kernelland/routing.c @@ -99,11 +99,6 @@ static void update_route(struct orig_node *orig_node, bat_dbg(DBG_ROUTES, "Changing route towards: %pM (now via %pM - was via %pM)\n", orig_node->orig, neigh_node->addr, orig_node->router->addr); } - if (neigh_node != NULL) - orig_node->batman_if = neigh_node->if_incoming; - else - orig_node->batman_if = NULL; - orig_node->router = neigh_node; } @@ -747,12 +742,11 @@ static int recv_my_icmp_packet(struct sk_buff *skb, size_t icmp_len) ret = NET_RX_DROP; if ((orig_node != NULL) && - (orig_node->batman_if != NULL) && (orig_node->router != NULL)) { /* don't lock while sending the packets ... we therefore * copy the required data before sending */ - batman_if = orig_node->batman_if; + batman_if = orig_node->router->if_incoming; memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); spin_unlock_irqrestore(&orig_hash_lock, flags); @@ -809,12 +803,11 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb, size_t icmp_len) ret = NET_RX_DROP; if ((orig_node != NULL) && - (orig_node->batman_if != NULL) && (orig_node->router != NULL)) { /* don't lock while sending the packets ... we therefore * copy the required data before sending */ - batman_if = orig_node->batman_if; + batman_if = orig_node->router->if_incoming; memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); spin_unlock_irqrestore(&orig_hash_lock, flags); @@ -905,12 +898,11 @@ int recv_icmp_packet(struct sk_buff *skb) hash_find(orig_hash, icmp_packet->dst)); if ((orig_node != NULL) && - (orig_node->batman_if != NULL) && (orig_node->router != NULL)) { /* don't lock while sending the packets ... we therefore * copy the required data before sending */ - batman_if = orig_node->batman_if; + batman_if = orig_node->router->if_incoming; memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); spin_unlock_irqrestore(&orig_hash_lock, flags); diff --git a/batman-adv-kernelland/types.h b/batman-adv-kernelland/types.h index 0794dfc..de13c99 100644 --- a/batman-adv-kernelland/types.h +++ b/batman-adv-kernelland/types.h @@ -49,7 +49,6 @@ struct orig_node { /* structure for orig_list maintaining nodes of uint8_t orig[ETH_ALEN]; uint8_t primary_addr[ETH_ALEN]; /* hosts primary interface address */ struct neigh_node *router; - struct batman_if *batman_if; TYPE_OF_WORD *bcast_own; uint8_t *bcast_own_sum; uint8_t tq_own; diff --git a/batman-adv-kernelland/vis.c b/batman-adv-kernelland/vis.c index 91849f4..a774de7 100644 --- a/batman-adv-kernelland/vis.c +++ b/batman-adv-kernelland/vis.c @@ -499,14 +499,14 @@ static int generate_vis_packet(struct bat_priv *bat_priv) if (orig_node->router != NULL && compare_orig(orig_node->router->addr, orig_node->orig) - && orig_node->batman_if - && (orig_node->batman_if->if_active == IF_ACTIVE) + && (orig_node->router->if_incoming->if_status == + IF_ACTIVE) && orig_node->router->tq_avg > 0) { /* fill one entry into buffer. */ entry = &entry_array[info->packet.entries]; memcpy(entry->src, - orig_node->batman_if->net_dev->dev_addr, + orig_node->router->if_incoming->net_dev->dev_addr, ETH_ALEN); memcpy(entry->dest, orig_node->orig, ETH_ALEN); entry->quality = orig_node->router->tq_avg; @@ -574,8 +574,7 @@ static void broadcast_vis_packet(struct vis_info *info, int packet_length) orig_node = hashit.bucket->data; /* if it's a vis server and reachable, send it. */ - if ((!orig_node) || (!orig_node->batman_if) || - (!orig_node->router)) + if ((!orig_node) || (!orig_node->router)) continue; if (!(orig_node->flags & VIS_SERVER)) continue; @@ -585,7 +584,7 @@ static void broadcast_vis_packet(struct vis_info *info, int packet_length) continue; memcpy(info->packet.target_orig, orig_node->orig, ETH_ALEN); - batman_if = orig_node->batman_if; + batman_if = orig_node->router->if_incoming; memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); spin_unlock_irqrestore(&orig_hash_lock, flags); @@ -610,12 +609,12 @@ static void unicast_vis_packet(struct vis_info *info, int packet_length) orig_node = ((struct orig_node *) hash_find(orig_hash, info->packet.target_orig)); - if ((!orig_node) || (!orig_node->batman_if) || (!orig_node->router)) + if ((!orig_node) || (!orig_node->router)) goto out; /* don't lock while sending the packets ... we therefore * copy the required data before sending */ - batman_if = orig_node->batman_if; + batman_if = orig_node->router->if_incoming; memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); spin_unlock_irqrestore(&orig_hash_lock, flags);