From: Andrew Lunn <andrew@lunn.ch>
To: greg@kroah.com
Cc: Marek Lindner <lindner_marek@yahoo.de>, b.a.t.m.a.n@lists.open-mesh.net
Subject: [B.A.T.M.A.N.] [PATCH 16/26] Staging: batman-adv: remove redundant pointer to originator interface
Date: Fri, 7 May 2010 21:47:21 +0200 [thread overview]
Message-ID: <1273261651-21378-17-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1273261651-21378-1-git-send-email-andrew@lunn.ch>
From: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/staging/batman-adv/device.c | 2 +-
drivers/staging/batman-adv/originator.c | 1 -
drivers/staging/batman-adv/routing.c | 17 ++++-------------
drivers/staging/batman-adv/soft-interface.c | 5 ++---
drivers/staging/batman-adv/types.h | 1 -
drivers/staging/batman-adv/vis.c | 15 +++++++--------
6 files changed, 14 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/batman-adv/device.c b/drivers/staging/batman-adv/device.c
index 9887f05..c419c62 100644
--- a/drivers/staging/batman-adv/device.c
+++ b/drivers/staging/batman-adv/device.c
@@ -250,7 +250,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/drivers/staging/batman-adv/originator.c b/drivers/staging/batman-adv/originator.c
index 684db75..4152701 100644
--- a/drivers/staging/batman-adv/originator.c
+++ b/drivers/staging/batman-adv/originator.c
@@ -137,7 +137,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/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c
index 8c055a1..0a9f52b 100644
--- a/drivers/staging/batman-adv/routing.c
+++ b/drivers/staging/batman-adv/routing.c
@@ -97,11 +97,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;
}
@@ -616,12 +611,11 @@ static int recv_my_icmp_packet(struct sk_buff *skb)
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);
@@ -678,12 +672,11 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb)
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);
@@ -760,12 +753,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);
@@ -844,12 +836,11 @@ int recv_unicast_packet(struct sk_buff *skb)
hash_find(orig_hash, unicast_packet->dest));
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/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c
index 829deb6..4cdebe5 100644
--- a/drivers/staging/batman-adv/soft-interface.c
+++ b/drivers/staging/batman-adv/soft-interface.c
@@ -236,7 +236,6 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
orig_node = transtable_search(ethhdr->h_dest);
if ((orig_node) &&
- (orig_node->batman_if) &&
(orig_node->router)) {
if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0)
goto unlock;
@@ -252,13 +251,13 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
/* net_dev won't be available when not active */
- if (orig_node->batman_if->if_active != IF_ACTIVE)
+ if (orig_node->router->if_incoming->if_active != IF_ACTIVE)
goto unlock;
/* 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/drivers/staging/batman-adv/types.h b/drivers/staging/batman-adv/types.h
index a8c6ad7..ffaa16c 100644
--- a/drivers/staging/batman-adv/types.h
+++ b/drivers/staging/batman-adv/types.h
@@ -49,7 +49,6 @@ struct batman_if {
struct orig_node { /* structure for orig_list maintaining nodes of mesh */
uint8_t orig[ETH_ALEN];
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/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c
index 5edeb32..57d69d7 100644
--- a/drivers/staging/batman-adv/vis.c
+++ b/drivers/staging/batman-adv/vis.c
@@ -498,14 +498,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_active ==
+ 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;
@@ -573,8 +573,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;
@@ -584,7 +583,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);
@@ -609,12 +608,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);
--
1.7.1
next prev parent reply other threads:[~2010-05-07 19:47 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 19:47 [B.A.T.M.A.N.] [PATCH 00/26] Staging: batman-adv: linux-next Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 01/26] Staging: batman-adv: only modify hna-table on active module Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 02/26] Staging: batman-adv: Clone shared bat packets before modifying them Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 03/26] Staging: batman-adv: fix aggregation timing bug Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 04/26] Staging: batman-adv: Fix aggregation direct-link bug Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 05/26] Staging: batman-adv: Update copyright years Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 06/26] Staging: batman-adv: remove the beta from main.h for release Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 07/26] Staging: batman-adv: Remove dead max addr and obsolete VIS_FORMAT strings Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 08/26] Staging: batman-adv: Add 0.2.1 changes to the CHANGELOG Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 09/26] Staging: batman-adv: Update README about vis raw output Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 10/26] Staging: batman-adv: Changing version to 0.2.2-beta Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 11/26] Staging: batman-adv: cleanup: change test for end of array Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 12/26] Staging: batman-adv: fix whitespace style issues Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 13/26] Staging: batman-adv: convert multiple /proc files to use sysfs Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 14/26] Staging: batman-adv: convert more files from /proc to /sys Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 15/26] Staging: batman-adv: move originator interval setting " Andrew Lunn
2010-05-07 19:47 ` Andrew Lunn [this message]
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 17/26] Staging: batman-adv: move /proc interface handling " Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 18/26] Staging: batman-adv: fix whitespace style issues Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 19/26] Staging: batman-adv: Reorganize sequence number handling Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 20/26] Staging: batman-adv: Limit queue lengths for batman and broadcast packets Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 21/26] Staging: batman-adv: kfree_skb() in interface_tx() in error case Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 22/26] Staging: batman-adv: Update pointer to ethhdr after skb_copy Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 23/26] Staging: batman-adv: Update TODO file to reflect current state Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 24/26] Staging: batman-adv: Fix whitespace problems criticized by checkpatch.pl Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 25/26] Staging: batman-adv: Reduce max characters on a line to 80 Andrew Lunn
2010-05-07 19:47 ` [B.A.T.M.A.N.] [PATCH 26/26] Staging: batman-adv: updating README Andrew Lunn
-- strict thread matches above, loose matches on Subject: below --
2010-05-06 20:18 [B.A.T.M.A.N.] [PATCH 00/26] staging:batman-adv Andrew Lunn
2010-05-06 20:18 ` [B.A.T.M.A.N.] [PATCH 16/26] staging:batman-adv: remove redundant pointer to originator interface Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273261651-21378-17-git-send-email-andrew@lunn.ch \
--to=andrew@lunn.ch \
--cc=b.a.t.m.a.n@lists.open-mesh.net \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=greg@kroah.com \
--cc=lindner_marek@yahoo.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).