diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2010-09-18 21:01:22 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-09-20 16:29:51 -0700 |
commit | 037dafa8673dbe71c64be7d1021b85c6692a6f7d (patch) | |
tree | b7283b9d727665943d8c441db3a7cbe1ea8c09e6 /drivers/staging/batman-adv | |
parent | 7e8158b341b2b043047b6f570c343fd9b0efd9c9 (diff) | |
download | kernel_samsung_smdk4412-037dafa8673dbe71c64be7d1021b85c6692a6f7d.zip kernel_samsung_smdk4412-037dafa8673dbe71c64be7d1021b85c6692a6f7d.tar.gz kernel_samsung_smdk4412-037dafa8673dbe71c64be7d1021b85c6692a6f7d.tar.bz2 |
Staging: batman-adv: Introduce update_primary_addr to update mac address
set_primary_if is currently misused to update the mac address in vis
packets. This unneeded and introduces overhead due to other operations
which must be done when updating the primary interface.
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv')
-rw-r--r-- | drivers/staging/batman-adv/hard-interface.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c index a9d6f1d..7b77cf2 100644 --- a/drivers/staging/batman-adv/hard-interface.c +++ b/drivers/staging/batman-adv/hard-interface.c @@ -106,11 +106,22 @@ out: return batman_if; } +static void update_primary_addr(struct bat_priv *bat_priv) +{ + struct vis_packet *vis_packet; + + vis_packet = (struct vis_packet *) + bat_priv->my_vis_info->skb_packet->data; + memcpy(vis_packet->vis_orig, + bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN); + memcpy(vis_packet->sender_orig, + bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN); +} + static void set_primary_if(struct bat_priv *bat_priv, struct batman_if *batman_if) { struct batman_packet *batman_packet; - struct vis_packet *vis_packet; struct batman_if *old_if; if (batman_if) @@ -129,12 +140,7 @@ static void set_primary_if(struct bat_priv *bat_priv, batman_packet->flags = PRIMARIES_FIRST_HOP; batman_packet->ttl = TTL; - vis_packet = (struct vis_packet *) - bat_priv->my_vis_info->skb_packet->data; - memcpy(vis_packet->vis_orig, - bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN); - memcpy(vis_packet->sender_orig, - bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN); + update_primary_addr(bat_priv); /*** * hacky trick to make sure that we send the HNA information via @@ -516,7 +522,7 @@ static int hard_if_event(struct notifier_block *this, bat_priv = netdev_priv(batman_if->soft_iface); if (batman_if == bat_priv->primary_if) - set_primary_if(bat_priv, batman_if); + update_primary_addr(bat_priv); break; default: break; |