Commit 1d5873e9 authored by David S. Miller's avatar David S. Miller

Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge

Included changes:
- yet another batch of 'namespace cleaning' patches

Conflicts:
	net/batman-adv/translation-table.c
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7665de15 a513088d
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -48,7 +48,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, ...@@ -48,7 +48,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
*/ */
if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) { if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) {
if (set_mark) if (set_mark)
bat_set_bit(seq_bits, -seq_num_diff); batadv_set_bit(seq_bits, -seq_num_diff);
return 0; return 0;
} }
...@@ -59,19 +59,19 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, ...@@ -59,19 +59,19 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
batadv_bitmap_shift_left(seq_bits, seq_num_diff); batadv_bitmap_shift_left(seq_bits, seq_num_diff);
if (set_mark) if (set_mark)
bat_set_bit(seq_bits, 0); batadv_set_bit(seq_bits, 0);
return 1; return 1;
} }
/* sequence number is much newer, probably missed a lot of packets */ /* sequence number is much newer, probably missed a lot of packets */
if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) && if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) &&
(seq_num_diff < EXPECTED_SEQNO_RANGE)) { (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"We missed a lot of packets (%i) !\n", "We missed a lot of packets (%i) !\n",
seq_num_diff - 1); seq_num_diff - 1);
bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE); bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark) if (set_mark)
bat_set_bit(seq_bits, 0); batadv_set_bit(seq_bits, 0);
return 1; return 1;
} }
...@@ -83,12 +83,12 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, ...@@ -83,12 +83,12 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
(seq_num_diff >= EXPECTED_SEQNO_RANGE)) { (seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Other host probably restarted!\n"); "Other host probably restarted!\n");
bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE); bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark) if (set_mark)
bat_set_bit(seq_bits, 0); batadv_set_bit(seq_bits, 0);
return 1; return 1;
} }
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
/* returns true if the corresponding bit in the given seq_bits indicates true /* returns true if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno * and curr_seqno is within range of last_seqno
*/ */
static inline int bat_test_bit(const unsigned long *seq_bits, static inline int batadv_test_bit(const unsigned long *seq_bits,
uint32_t last_seqno, uint32_t curr_seqno) uint32_t last_seqno, uint32_t curr_seqno)
{ {
int32_t diff; int32_t diff;
...@@ -36,7 +36,7 @@ static inline int bat_test_bit(const unsigned long *seq_bits, ...@@ -36,7 +36,7 @@ static inline int bat_test_bit(const unsigned long *seq_bits,
} }
/* turn corresponding bit on, so we can remember that we got the packet */ /* turn corresponding bit on, so we can remember that we got the packet */
static inline void bat_set_bit(unsigned long *seq_bits, int32_t n) static inline void batadv_set_bit(unsigned long *seq_bits, int32_t n)
{ {
/* if too old, just drop it */ /* if too old, just drop it */
if (n < 0 || n >= TQ_LOCAL_WINDOW_SIZE) if (n < 0 || n >= TQ_LOCAL_WINDOW_SIZE)
......
This diff is collapsed.
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "gateway_client.h" #include "gateway_client.h"
/* calculates the gateway class from kbit */ /* calculates the gateway class from kbit */
static void kbit_to_gw_bandwidth(int down, int up, long *gw_srv_class) static void batadv_kbit_to_gw_bandwidth(int down, int up, long *gw_srv_class)
{ {
int mdown = 0, tdown, tup, difference; int mdown = 0, tdown, tup, difference;
uint8_t sbit, part; uint8_t sbit, part;
...@@ -73,8 +73,8 @@ void batadv_gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up) ...@@ -73,8 +73,8 @@ void batadv_gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up)
*up = ((upart + 1) * (*down)) / 8; *up = ((upart + 1) * (*down)) / 8;
} }
static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff, static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff,
int *up, int *down) int *up, int *down)
{ {
int ret, multi = 1; int ret, multi = 1;
char *slash_ptr, *tmp_ptr; char *slash_ptr, *tmp_ptr;
...@@ -142,7 +142,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, ...@@ -142,7 +142,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
int up = 0, down = 0; int up = 0, down = 0;
bool ret; bool ret;
ret = parse_gw_bandwidth(net_dev, buff, &up, &down); ret = batadv_parse_gw_bandwidth(net_dev, buff, &up, &down);
if (!ret) if (!ret)
goto end; goto end;
...@@ -152,7 +152,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, ...@@ -152,7 +152,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
if (!up) if (!up)
up = down / 5; up = down / 5;
kbit_to_gw_bandwidth(down, up, &gw_bandwidth_tmp); batadv_kbit_to_gw_bandwidth(down, up, &gw_bandwidth_tmp);
/* the gw bandwidth we guessed above might not match the given /* the gw bandwidth we guessed above might not match the given
* speeds, hence we need to calculate it back to show the number * speeds, hence we need to calculate it back to show the number
......
...@@ -57,7 +57,7 @@ struct hard_iface *batadv_hardif_get_by_netdev(const struct net_device *net_dev) ...@@ -57,7 +57,7 @@ struct hard_iface *batadv_hardif_get_by_netdev(const struct net_device *net_dev)
return hard_iface; return hard_iface;
} }
static int is_valid_iface(const struct net_device *net_dev) static int batadv_is_valid_iface(const struct net_device *net_dev)
{ {
if (net_dev->flags & IFF_LOOPBACK) if (net_dev->flags & IFF_LOOPBACK)
return 0; return 0;
...@@ -75,7 +75,8 @@ static int is_valid_iface(const struct net_device *net_dev) ...@@ -75,7 +75,8 @@ static int is_valid_iface(const struct net_device *net_dev)
return 1; return 1;
} }
static struct hard_iface *hardif_get_active(const struct net_device *soft_iface) static struct hard_iface *
batadv_hardif_get_active(const struct net_device *soft_iface)
{ {
struct hard_iface *hard_iface; struct hard_iface *hard_iface;
...@@ -96,13 +97,13 @@ static struct hard_iface *hardif_get_active(const struct net_device *soft_iface) ...@@ -96,13 +97,13 @@ static struct hard_iface *hardif_get_active(const struct net_device *soft_iface)
return hard_iface; return hard_iface;
} }
static void primary_if_update_addr(struct bat_priv *bat_priv, static void batadv_primary_if_update_addr(struct bat_priv *bat_priv,
struct hard_iface *oldif) struct hard_iface *oldif)
{ {
struct vis_packet *vis_packet; struct vis_packet *vis_packet;
struct hard_iface *primary_if; struct hard_iface *primary_if;
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) if (!primary_if)
goto out; goto out;
...@@ -115,11 +116,11 @@ static void primary_if_update_addr(struct bat_priv *bat_priv, ...@@ -115,11 +116,11 @@ static void primary_if_update_addr(struct bat_priv *bat_priv,
batadv_bla_update_orig_address(bat_priv, primary_if, oldif); batadv_bla_update_orig_address(bat_priv, primary_if, oldif);
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
} }
static void primary_if_select(struct bat_priv *bat_priv, static void batadv_primary_if_select(struct bat_priv *bat_priv,
struct hard_iface *new_hard_iface) struct hard_iface *new_hard_iface)
{ {
struct hard_iface *curr_hard_iface; struct hard_iface *curr_hard_iface;
...@@ -135,14 +136,14 @@ static void primary_if_select(struct bat_priv *bat_priv, ...@@ -135,14 +136,14 @@ static void primary_if_select(struct bat_priv *bat_priv,
goto out; goto out;
bat_priv->bat_algo_ops->bat_primary_iface_set(new_hard_iface); bat_priv->bat_algo_ops->bat_primary_iface_set(new_hard_iface);
primary_if_update_addr(bat_priv, curr_hard_iface); batadv_primary_if_update_addr(bat_priv, curr_hard_iface);
out: out:
if (curr_hard_iface) if (curr_hard_iface)
hardif_free_ref(curr_hard_iface); batadv_hardif_free_ref(curr_hard_iface);
} }
static bool hardif_is_iface_up(const struct hard_iface *hard_iface) static bool batadv_hardif_is_iface_up(const struct hard_iface *hard_iface)
{ {
if (hard_iface->net_dev->flags & IFF_UP) if (hard_iface->net_dev->flags & IFF_UP)
return true; return true;
...@@ -150,7 +151,7 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface) ...@@ -150,7 +151,7 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
return false; return false;
} }
static void check_known_mac_addr(const struct net_device *net_dev) static void batadv_check_known_mac_addr(const struct net_device *net_dev)
{ {
const struct hard_iface *hard_iface; const struct hard_iface *hard_iface;
...@@ -163,8 +164,8 @@ static void check_known_mac_addr(const struct net_device *net_dev) ...@@ -163,8 +164,8 @@ static void check_known_mac_addr(const struct net_device *net_dev)
if (hard_iface->net_dev == net_dev) if (hard_iface->net_dev == net_dev)
continue; continue;
if (!compare_eth(hard_iface->net_dev->dev_addr, if (!batadv_compare_eth(hard_iface->net_dev->dev_addr,
net_dev->dev_addr)) net_dev->dev_addr))
continue; continue;
pr_warn("The newly added mac address (%pM) already exists on: %s\n", pr_warn("The newly added mac address (%pM) already exists on: %s\n",
...@@ -213,7 +214,7 @@ void batadv_update_min_mtu(struct net_device *soft_iface) ...@@ -213,7 +214,7 @@ void batadv_update_min_mtu(struct net_device *soft_iface)
soft_iface->mtu = min_mtu; soft_iface->mtu = min_mtu;
} }
static void hardif_activate_interface(struct hard_iface *hard_iface) static void batadv_hardif_activate_interface(struct hard_iface *hard_iface)
{ {
struct bat_priv *bat_priv; struct bat_priv *bat_priv;
struct hard_iface *primary_if = NULL; struct hard_iface *primary_if = NULL;
...@@ -229,9 +230,9 @@ static void hardif_activate_interface(struct hard_iface *hard_iface) ...@@ -229,9 +230,9 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
/* the first active interface becomes our primary interface or /* the first active interface becomes our primary interface or
* the next active interface after the old primary interface was removed * the next active interface after the old primary interface was removed
*/ */
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) if (!primary_if)
primary_if_select(bat_priv, hard_iface); batadv_primary_if_select(bat_priv, hard_iface);
bat_info(hard_iface->soft_iface, "Interface activated: %s\n", bat_info(hard_iface->soft_iface, "Interface activated: %s\n",
hard_iface->net_dev->name); hard_iface->net_dev->name);
...@@ -240,10 +241,10 @@ static void hardif_activate_interface(struct hard_iface *hard_iface) ...@@ -240,10 +241,10 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
} }
static void hardif_deactivate_interface(struct hard_iface *hard_iface) static void batadv_hardif_deactivate_interface(struct hard_iface *hard_iface)
{ {
if ((hard_iface->if_status != IF_ACTIVE) && if ((hard_iface->if_status != IF_ACTIVE) &&
(hard_iface->if_status != IF_TO_BE_ACTIVATED)) (hard_iface->if_status != IF_TO_BE_ACTIVATED))
...@@ -331,8 +332,8 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, ...@@ -331,8 +332,8 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
hard_iface->net_dev->name, hard_iface->net_dev->mtu, hard_iface->net_dev->name, hard_iface->net_dev->mtu,
ETH_DATA_LEN + BAT_HEADER_LEN); ETH_DATA_LEN + BAT_HEADER_LEN);
if (hardif_is_iface_up(hard_iface)) if (batadv_hardif_is_iface_up(hard_iface))
hardif_activate_interface(hard_iface); batadv_hardif_activate_interface(hard_iface);
else else
bat_err(hard_iface->soft_iface, bat_err(hard_iface->soft_iface,
"Not using interface %s (retrying later): interface not active\n", "Not using interface %s (retrying later): interface not active\n",
...@@ -347,7 +348,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, ...@@ -347,7 +348,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
err_dev: err_dev:
dev_put(soft_iface); dev_put(soft_iface);
err: err:
hardif_free_ref(hard_iface); batadv_hardif_free_ref(hard_iface);
return ret; return ret;
} }
...@@ -357,7 +358,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface) ...@@ -357,7 +358,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
struct hard_iface *primary_if = NULL; struct hard_iface *primary_if = NULL;
if (hard_iface->if_status == IF_ACTIVE) if (hard_iface->if_status == IF_ACTIVE)
hardif_deactivate_interface(hard_iface); batadv_hardif_deactivate_interface(hard_iface);
if (hard_iface->if_status != IF_INACTIVE) if (hard_iface->if_status != IF_INACTIVE)
goto out; goto out;
...@@ -369,15 +370,15 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface) ...@@ -369,15 +370,15 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
bat_priv->num_ifaces--; bat_priv->num_ifaces--;
batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces); batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces);
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (hard_iface == primary_if) { if (hard_iface == primary_if) {
struct hard_iface *new_if; struct hard_iface *new_if;
new_if = hardif_get_active(hard_iface->soft_iface); new_if = batadv_hardif_get_active(hard_iface->soft_iface);
primary_if_select(bat_priv, new_if); batadv_primary_if_select(bat_priv, new_if);
if (new_if) if (new_if)
hardif_free_ref(new_if); batadv_hardif_free_ref(new_if);
} }
bat_priv->bat_algo_ops->bat_iface_disable(hard_iface); bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
...@@ -393,21 +394,22 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface) ...@@ -393,21 +394,22 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
batadv_softif_destroy(hard_iface->soft_iface); batadv_softif_destroy(hard_iface->soft_iface);
hard_iface->soft_iface = NULL; hard_iface->soft_iface = NULL;
hardif_free_ref(hard_iface); batadv_hardif_free_ref(hard_iface);
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
} }
static struct hard_iface *hardif_add_interface(struct net_device *net_dev) static struct hard_iface *
batadv_hardif_add_interface(struct net_device *net_dev)
{ {
struct hard_iface *hard_iface; struct hard_iface *hard_iface;
int ret; int ret;
ASSERT_RTNL(); ASSERT_RTNL();
ret = is_valid_iface(net_dev); ret = batadv_is_valid_iface(net_dev);
if (ret != 1) if (ret != 1)
goto out; goto out;
...@@ -429,7 +431,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev) ...@@ -429,7 +431,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
/* extra reference for return */ /* extra reference for return */
atomic_set(&hard_iface->refcount, 2); atomic_set(&hard_iface->refcount, 2);
check_known_mac_addr(hard_iface->net_dev); batadv_check_known_mac_addr(hard_iface->net_dev);
list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list); list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
/* This can't be called via a bat_priv callback because /* This can't be called via a bat_priv callback because
...@@ -448,7 +450,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev) ...@@ -448,7 +450,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
return NULL; return NULL;
} }
static void hardif_remove_interface(struct hard_iface *hard_iface) static void batadv_hardif_remove_interface(struct hard_iface *hard_iface)
{ {
ASSERT_RTNL(); ASSERT_RTNL();
...@@ -461,7 +463,7 @@ static void hardif_remove_interface(struct hard_iface *hard_iface) ...@@ -461,7 +463,7 @@ static void hardif_remove_interface(struct hard_iface *hard_iface)
hard_iface->if_status = IF_TO_BE_REMOVED; hard_iface->if_status = IF_TO_BE_REMOVED;
batadv_sysfs_del_hardif(&hard_iface->hardif_obj); batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
hardif_free_ref(hard_iface); batadv_hardif_free_ref(hard_iface);
} }
void batadv_hardif_remove_interfaces(void) void batadv_hardif_remove_interfaces(void)
...@@ -472,13 +474,13 @@ void batadv_hardif_remove_interfaces(void) ...@@ -472,13 +474,13 @@ void batadv_hardif_remove_interfaces(void)
list_for_each_entry_safe(hard_iface, hard_iface_tmp, list_for_each_entry_safe(hard_iface, hard_iface_tmp,
&batadv_hardif_list, list) { &batadv_hardif_list, list) {
list_del_rcu(&hard_iface->list); list_del_rcu(&hard_iface->list);
hardif_remove_interface(hard_iface); batadv_hardif_remove_interface(hard_iface);
} }
rtnl_unlock(); rtnl_unlock();
} }
static int hard_if_event(struct notifier_block *this, static int batadv_hard_if_event(struct notifier_block *this,
unsigned long event, void *ptr) unsigned long event, void *ptr)
{ {
struct net_device *net_dev = ptr; struct net_device *net_dev = ptr;
struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
...@@ -486,23 +488,23 @@ static int hard_if_event(struct notifier_block *this, ...@@ -486,23 +488,23 @@ static int hard_if_event(struct notifier_block *this,
struct bat_priv *bat_priv; struct bat_priv *bat_priv;
if (!hard_iface && event == NETDEV_REGISTER) if (!hard_iface && event == NETDEV_REGISTER)
hard_iface = hardif_add_interface(net_dev); hard_iface = batadv_hardif_add_interface(net_dev);
if (!hard_iface) if (!hard_iface)
goto out; goto out;
switch (event) { switch (event) {
case NETDEV_UP: case NETDEV_UP:
hardif_activate_interface(hard_iface); batadv_hardif_activate_interface(hard_iface);
break; break;
case NETDEV_GOING_DOWN: case NETDEV_GOING_DOWN:
case NETDEV_DOWN: case NETDEV_DOWN:
hardif_deactivate_interface(hard_iface); batadv_hardif_deactivate_interface(hard_iface);
break; break;
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
list_del_rcu(&hard_iface->list); list_del_rcu(&hard_iface->list);
hardif_remove_interface(hard_iface); batadv_hardif_remove_interface(hard_iface);
break; break;
case NETDEV_CHANGEMTU: case NETDEV_CHANGEMTU:
if (hard_iface->soft_iface) if (hard_iface->soft_iface)
...@@ -512,27 +514,27 @@ static int hard_if_event(struct notifier_block *this, ...@@ -512,27 +514,27 @@ static int hard_if_event(struct notifier_block *this,
if (hard_iface->if_status == IF_NOT_IN_USE) if (hard_iface->if_status == IF_NOT_IN_USE)
goto hardif_put; goto hardif_put;
check_known_mac_addr(hard_iface->net_dev); batadv_check_known_mac_addr(hard_iface->net_dev);
bat_priv = netdev_priv(hard_iface->soft_iface); bat_priv = netdev_priv(hard_iface->soft_iface);
bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface); bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface);
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) if (!primary_if)
goto hardif_put; goto hardif_put;
if (hard_iface == primary_if) if (hard_iface == primary_if)
primary_if_update_addr(bat_priv, NULL); batadv_primary_if_update_addr(bat_priv, NULL);
break; break;
default: default:
break; break;
} }
hardif_put: hardif_put:
hardif_free_ref(hard_iface); batadv_hardif_free_ref(hard_iface);
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
...@@ -569,5 +571,5 @@ bool batadv_is_wifi_iface(int ifindex) ...@@ -569,5 +571,5 @@ bool batadv_is_wifi_iface(int ifindex)
} }
struct notifier_block batadv_hard_if_notifier = { struct notifier_block batadv_hard_if_notifier = {
.notifier_call = hard_if_event, .notifier_call = batadv_hard_if_event,
}; };
...@@ -42,14 +42,15 @@ void batadv_update_min_mtu(struct net_device *soft_iface); ...@@ -42,14 +42,15 @@ void batadv_update_min_mtu(struct net_device *soft_iface);
void batadv_hardif_free_rcu(struct rcu_head *rcu); void batadv_hardif_free_rcu(struct rcu_head *rcu);
bool batadv_is_wifi_iface(int ifindex); bool batadv_is_wifi_iface(int ifindex);
static inline void hardif_free_ref(struct hard_iface *hard_iface) static inline void
batadv_hardif_free_ref(struct hard_iface *hard_iface)
{ {
if (atomic_dec_and_test(&hard_iface->refcount)) if (atomic_dec_and_test(&hard_iface->refcount))
call_rcu(&hard_iface->rcu, batadv_hardif_free_rcu); call_rcu(&hard_iface->rcu, batadv_hardif_free_rcu);
} }
static inline struct hard_iface *primary_if_get_selected( static inline struct hard_iface *
struct bat_priv *bat_priv) batadv_primary_if_get_selected(struct bat_priv *bat_priv)
{ {
struct hard_iface *hard_iface; struct hard_iface *hard_iface;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "hash.h" #include "hash.h"
/* clears the hash */ /* clears the hash */
static void hash_init(struct hashtable_t *hash) static void batadv_hash_init(struct hashtable_t *hash)
{ {
uint32_t i; uint32_t i;
...@@ -58,7 +58,7 @@ struct hashtable_t *batadv_hash_new(uint32_t size) ...@@ -58,7 +58,7 @@ struct hashtable_t *batadv_hash_new(uint32_t size)
goto free_table; goto free_table;
hash->size = size; hash->size = size;
hash_init(hash); batadv_hash_init(hash);
return hash; return hash;
free_table: free_table:
......
...@@ -54,8 +54,8 @@ void batadv_hash_destroy(struct hashtable_t *hash); ...@@ -54,8 +54,8 @@ void batadv_hash_destroy(struct hashtable_t *hash);
* called to remove the elements inside of the hash. if you don't remove the * called to remove the elements inside of the hash. if you don't remove the
* elements, memory might be leaked. * elements, memory might be leaked.
*/ */
static inline void hash_delete(struct hashtable_t *hash, static inline void batadv_hash_delete(struct hashtable_t *hash,
hashdata_free_cb free_cb, void *arg) hashdata_free_cb free_cb, void *arg)
{ {
struct hlist_head *head; struct hlist_head *head;
struct hlist_node *node, *node_tmp; struct hlist_node *node, *node_tmp;
...@@ -89,10 +89,11 @@ static inline void hash_delete(struct hashtable_t *hash, ...@@ -89,10 +89,11 @@ static inline void hash_delete(struct hashtable_t *hash,
* Returns 0 on success, 1 if the element already is in the hash * Returns 0 on success, 1 if the element already is in the hash
* and -1 on error. * and -1 on error.
*/ */
static inline int hash_add(struct hashtable_t *hash, static inline int batadv_hash_add(struct hashtable_t *hash,
hashdata_compare_cb compare, hashdata_compare_cb compare,
hashdata_choose_cb choose, hashdata_choose_cb choose,
const void *data, struct hlist_node *data_node) const void *data,
struct hlist_node *data_node)
{ {
uint32_t index; uint32_t index;
int ret = -1; int ret = -1;
...@@ -133,9 +134,9 @@ static inline int hash_add(struct hashtable_t *hash, ...@@ -133,9 +134,9 @@ static inline int hash_add(struct hashtable_t *hash,
* structure you use with just the key filled, we just need the key for * structure you use with just the key filled, we just need the key for
* comparing. * comparing.
*/ */
static inline void *hash_remove(struct hashtable_t *hash, static inline void *batadv_hash_remove(struct hashtable_t *hash,
hashdata_compare_cb compare, hashdata_compare_cb compare,
hashdata_choose_cb choose, void *data) hashdata_choose_cb choose, void *data)
{ {
uint32_t index; uint32_t index;
struct hlist_node *node; struct hlist_node *node;
......
...@@ -26,18 +26,18 @@ ...@@ -26,18 +26,18 @@
#include "originator.h" #include "originator.h"
#include "hard-interface.h" #include "hard-interface.h"
static struct socket_client *socket_client_hash[256]; static struct socket_client *batadv_socket_client_hash[256];
static void bat_socket_add_packet(struct socket_client *socket_client, static void batadv_socket_add_packet(struct socket_client *socket_client,
struct icmp_packet_rr *icmp_packet, struct icmp_packet_rr *icmp_packet,
size_t icmp_len); size_t icmp_len);
void batadv_socket_init(void) void batadv_socket_init(void)
{ {
memset(socket_client_hash, 0, sizeof(socket_client_hash)); memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash));
} }
static int bat_socket_open(struct inode *inode, struct file *file) static int batadv_socket_open(struct inode *inode, struct file *file)
{ {
unsigned int i; unsigned int i;
struct socket_client *socket_client; struct socket_client *socket_client;
...@@ -49,14 +49,14 @@ static int bat_socket_open(struct inode *inode, struct file *file) ...@@ -49,14 +49,14 @@ static int bat_socket_open(struct inode *inode, struct file *file)
if (!socket_client) if (!socket_client)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(socket_client_hash); i++) { for (i = 0; i < ARRAY_SIZE(batadv_socket_client_hash); i++) {
if (!socket_client_hash[i]) { if (!batadv_socket_client_hash[i]) {
socket_client_hash[i] = socket_client; batadv_socket_client_hash[i] = socket_client;
break; break;
} }
} }
if (i == ARRAY_SIZE(socket_client_hash)) { if (i == ARRAY_SIZE(batadv_socket_client_hash)) {
pr_err("Error - can't add another packet client: maximum number of clients reached\n"); pr_err("Error - can't add another packet client: maximum number of clients reached\n");
kfree(socket_client); kfree(socket_client);
return -EXFULL; return -EXFULL;
...@@ -75,7 +75,7 @@ static int bat_socket_open(struct inode *inode, struct file *file) ...@@ -75,7 +75,7 @@ static int bat_socket_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
static int bat_socket_release(struct inode *inode, struct file *file) static int batadv_socket_release(struct inode *inode, struct file *file)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
struct socket_packet *socket_packet; struct socket_packet *socket_packet;
...@@ -92,7 +92,7 @@ static int bat_socket_release(struct inode *inode, struct file *file) ...@@ -92,7 +92,7 @@ static int bat_socket_release(struct inode *inode, struct file *file)
kfree(socket_packet); kfree(socket_packet);
} }
socket_client_hash[socket_client->index] = NULL; batadv_socket_client_hash[socket_client->index] = NULL;
spin_unlock_bh(&socket_client->lock); spin_unlock_bh(&socket_client->lock);
kfree(socket_client); kfree(socket_client);
...@@ -101,8 +101,8 @@ static int bat_socket_release(struct inode *inode, struct file *file) ...@@ -101,8 +101,8 @@ static int bat_socket_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static ssize_t bat_socket_read(struct file *file, char __user *buf, static ssize_t batadv_socket_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
struct socket_packet *socket_packet; struct socket_packet *socket_packet;
...@@ -144,8 +144,8 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf, ...@@ -144,8 +144,8 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,
return packet_len; return packet_len;
} }
static ssize_t bat_socket_write(struct file *file, const char __user *buff, static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
size_t len, loff_t *off) size_t len, loff_t *off)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
struct bat_priv *bat_priv = socket_client->bat_priv; struct bat_priv *bat_priv = socket_client->bat_priv;
...@@ -158,12 +158,12 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, ...@@ -158,12 +158,12 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
size_t packet_len = sizeof(struct icmp_packet); size_t packet_len = sizeof(struct icmp_packet);
if (len < sizeof(struct icmp_packet)) { if (len < sizeof(struct icmp_packet)) {
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: invalid packet size\n"); "Error - can't send packet from char device: invalid packet size\n");
return -EINVAL; return -EINVAL;
} }
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) { if (!primary_if) {
len = -EFAULT; len = -EFAULT;
...@@ -188,15 +188,15 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, ...@@ -188,15 +188,15 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
} }
if (icmp_packet->header.packet_type != BAT_ICMP) { if (icmp_packet->header.packet_type != BAT_ICMP) {
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n"); "Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n");
len = -EINVAL; len = -EINVAL;
goto free_skb; goto free_skb;
} }
if (icmp_packet->msg_type != ECHO_REQUEST) { if (icmp_packet->msg_type != ECHO_REQUEST) {
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n"); "Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n");
len = -EINVAL; len = -EINVAL;
goto free_skb; goto free_skb;
} }
...@@ -206,14 +206,15 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, ...@@ -206,14 +206,15 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
if (icmp_packet->header.version != COMPAT_VERSION) { if (icmp_packet->header.version != COMPAT_VERSION) {
icmp_packet->msg_type = PARAMETER_PROBLEM; icmp_packet->msg_type = PARAMETER_PROBLEM;
icmp_packet->header.version = COMPAT_VERSION; icmp_packet->header.version = COMPAT_VERSION;
bat_socket_add_packet(socket_client, icmp_packet, packet_len); batadv_socket_add_packet(socket_client, icmp_packet,
packet_len);
goto free_skb; goto free_skb;
} }
if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
goto dst_unreach; goto dst_unreach;
orig_node = orig_hash_find(bat_priv, icmp_packet->dst); orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->dst);
if (!orig_node) if (!orig_node)
goto dst_unreach; goto dst_unreach;
...@@ -239,12 +240,12 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, ...@@ -239,12 +240,12 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
dst_unreach: dst_unreach:
icmp_packet->msg_type = DESTINATION_UNREACHABLE; icmp_packet->msg_type = DESTINATION_UNREACHABLE;
bat_socket_add_packet(socket_client, icmp_packet, packet_len); batadv_socket_add_packet(socket_client, icmp_packet, packet_len);
free_skb: free_skb:
kfree_skb(skb); kfree_skb(skb);
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
if (neigh_node) if (neigh_node)
batadv_neigh_node_free_ref(neigh_node); batadv_neigh_node_free_ref(neigh_node);
if (orig_node) if (orig_node)
...@@ -252,7 +253,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, ...@@ -252,7 +253,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
return len; return len;
} }
static unsigned int bat_socket_poll(struct file *file, poll_table *wait) static unsigned int batadv_socket_poll(struct file *file, poll_table *wait)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
...@@ -264,13 +265,13 @@ static unsigned int bat_socket_poll(struct file *file, poll_table *wait) ...@@ -264,13 +265,13 @@ static unsigned int bat_socket_poll(struct file *file, poll_table *wait)
return 0; return 0;
} }
static const struct file_operations fops = { static const struct file_operations batadv_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = bat_socket_open, .open = batadv_socket_open,
.release = bat_socket_release, .release = batadv_socket_release,
.read = bat_socket_read, .read = batadv_socket_read,
.write = bat_socket_write, .write = batadv_socket_write,
.poll = bat_socket_poll, .poll = batadv_socket_poll,
.llseek = no_llseek, .llseek = no_llseek,
}; };
...@@ -282,7 +283,7 @@ int batadv_socket_setup(struct bat_priv *bat_priv) ...@@ -282,7 +283,7 @@ int batadv_socket_setup(struct bat_priv *bat_priv)
goto err; goto err;
d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR, d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR,
bat_priv->debug_dir, bat_priv, &fops); bat_priv->debug_dir, bat_priv, &batadv_fops);
if (!d) if (!d)
goto err; goto err;
...@@ -292,9 +293,9 @@ int batadv_socket_setup(struct bat_priv *bat_priv) ...@@ -292,9 +293,9 @@ int batadv_socket_setup(struct bat_priv *bat_priv)
return -ENOMEM; return -ENOMEM;
} }
static void bat_socket_add_packet(struct socket_client *socket_client, static void batadv_socket_add_packet(struct socket_client *socket_client,
struct icmp_packet_rr *icmp_packet, struct icmp_packet_rr *icmp_packet,
size_t icmp_len) size_t icmp_len)
{ {
struct socket_packet *socket_packet; struct socket_packet *socket_packet;
...@@ -312,7 +313,7 @@ static void bat_socket_add_packet(struct socket_client *socket_client, ...@@ -312,7 +313,7 @@ static void bat_socket_add_packet(struct socket_client *socket_client,
/* while waiting for the lock the socket_client could have been /* while waiting for the lock the socket_client could have been
* deleted * deleted
*/ */
if (!socket_client_hash[icmp_packet->uid]) { if (!batadv_socket_client_hash[icmp_packet->uid]) {
spin_unlock_bh(&socket_client->lock); spin_unlock_bh(&socket_client->lock);
kfree(socket_packet); kfree(socket_packet);
return; return;
...@@ -338,8 +339,9 @@ static void bat_socket_add_packet(struct socket_client *socket_client, ...@@ -338,8 +339,9 @@ static void bat_socket_add_packet(struct socket_client *socket_client,
void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet, void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet,
size_t icmp_len) size_t icmp_len)
{ {
struct socket_client *hash = socket_client_hash[icmp_packet->uid]; struct socket_client *hash;
hash = batadv_socket_client_hash[icmp_packet->uid];
if (hash) if (hash)
bat_socket_add_packet(hash, icmp_packet, icmp_len); batadv_socket_add_packet(hash, icmp_packet, icmp_len);
} }
...@@ -180,7 +180,7 @@ int batadv_is_my_mac(const uint8_t *addr) ...@@ -180,7 +180,7 @@ int batadv_is_my_mac(const uint8_t *addr)
if (hard_iface->if_status != IF_ACTIVE) if (hard_iface->if_status != IF_ACTIVE)
continue; continue;
if (compare_eth(hard_iface->net_dev->dev_addr, addr)) { if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) {
rcu_read_unlock(); rcu_read_unlock();
return 1; return 1;
} }
...@@ -238,9 +238,9 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, ...@@ -238,9 +238,9 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
batman_ogm_packet = (struct batman_ogm_packet *)skb->data; batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
if (batman_ogm_packet->header.version != COMPAT_VERSION) { if (batman_ogm_packet->header.version != COMPAT_VERSION) {
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Drop packet: incompatible batman version (%i)\n", "Drop packet: incompatible batman version (%i)\n",
batman_ogm_packet->header.version); batman_ogm_packet->header.version);
goto err_free; goto err_free;
} }
......
...@@ -175,7 +175,7 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset); ...@@ -175,7 +175,7 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset);
int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...) int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
__printf(2, 3); __printf(2, 3);
#define bat_dbg(type, bat_priv, fmt, arg...) \ #define batadv_dbg(type, bat_priv, fmt, arg...) \
do { \ do { \
if (atomic_read(&bat_priv->log_level) & type) \ if (atomic_read(&bat_priv->log_level) & type) \
batadv_debug_log(bat_priv, fmt, ## arg);\ batadv_debug_log(bat_priv, fmt, ## arg);\
...@@ -183,9 +183,9 @@ __printf(2, 3); ...@@ -183,9 +183,9 @@ __printf(2, 3);
while (0) while (0)
#else /* !CONFIG_BATMAN_ADV_DEBUG */ #else /* !CONFIG_BATMAN_ADV_DEBUG */
__printf(3, 4) __printf(3, 4)
static inline void bat_dbg(int type __always_unused, static inline void batadv_dbg(int type __always_unused,
struct bat_priv *bat_priv __always_unused, struct bat_priv *bat_priv __always_unused,
const char *fmt __always_unused, ...) const char *fmt __always_unused, ...)
{ {
} }
#endif #endif
...@@ -194,14 +194,14 @@ static inline void bat_dbg(int type __always_unused, ...@@ -194,14 +194,14 @@ static inline void bat_dbg(int type __always_unused,
do { \ do { \
struct net_device *_netdev = (net_dev); \ struct net_device *_netdev = (net_dev); \
struct bat_priv *_batpriv = netdev_priv(_netdev); \ struct bat_priv *_batpriv = netdev_priv(_netdev); \
bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \
pr_info("%s: " fmt, _netdev->name, ## arg); \ pr_info("%s: " fmt, _netdev->name, ## arg); \
} while (0) } while (0)
#define bat_err(net_dev, fmt, arg...) \ #define bat_err(net_dev, fmt, arg...) \
do { \ do { \
struct net_device *_netdev = (net_dev); \ struct net_device *_netdev = (net_dev); \
struct bat_priv *_batpriv = netdev_priv(_netdev); \ struct bat_priv *_batpriv = netdev_priv(_netdev); \
bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \
pr_err("%s: " fmt, _netdev->name, ## arg); \ pr_err("%s: " fmt, _netdev->name, ## arg); \
} while (0) } while (0)
...@@ -209,7 +209,7 @@ static inline void bat_dbg(int type __always_unused, ...@@ -209,7 +209,7 @@ static inline void bat_dbg(int type __always_unused,
* *
* note: can't use compare_ether_addr() as it requires aligned memory * note: can't use compare_ether_addr() as it requires aligned memory
*/ */
static inline int compare_eth(const void *data1, const void *data2) static inline int batadv_compare_eth(const void *data1, const void *data2)
{ {
return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
} }
...@@ -220,7 +220,8 @@ static inline int compare_eth(const void *data1, const void *data2) ...@@ -220,7 +220,8 @@ static inline int compare_eth(const void *data1, const void *data2)
* *
* Returns true if current time is after timestamp + timeout * Returns true if current time is after timestamp + timeout
*/ */
static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout) static inline bool batadv_has_timed_out(unsigned long timestamp,
unsigned int timeout)
{ {
return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout));
} }
......
...@@ -28,17 +28,17 @@ ...@@ -28,17 +28,17 @@
#include "soft-interface.h" #include "soft-interface.h"
#include "bridge_loop_avoidance.h" #include "bridge_loop_avoidance.h"
static void purge_orig(struct work_struct *work); static void batadv_purge_orig(struct work_struct *work);
static void start_purge_timer(struct bat_priv *bat_priv) static void batadv_start_purge_timer(struct bat_priv *bat_priv)
{ {
INIT_DELAYED_WORK(&bat_priv->orig_work, purge_orig); INIT_DELAYED_WORK(&bat_priv->orig_work, batadv_purge_orig);
queue_delayed_work(batadv_event_workqueue, queue_delayed_work(batadv_event_workqueue,
&bat_priv->orig_work, msecs_to_jiffies(1000)); &bat_priv->orig_work, msecs_to_jiffies(1000));
} }
/* returns 1 if they are the same originator */ /* returns 1 if they are the same originator */
static int compare_orig(const struct hlist_node *node, const void *data2) static int batadv_compare_orig(const struct hlist_node *node, const void *data2)
{ {
const void *data1 = container_of(node, struct orig_node, hash_entry); const void *data1 = container_of(node, struct orig_node, hash_entry);
...@@ -55,7 +55,7 @@ int batadv_originator_init(struct bat_priv *bat_priv) ...@@ -55,7 +55,7 @@ int batadv_originator_init(struct bat_priv *bat_priv)
if (!bat_priv->orig_hash) if (!bat_priv->orig_hash)
goto err; goto err;
start_purge_timer(bat_priv); batadv_start_purge_timer(bat_priv);
return 0; return 0;
err: err:
...@@ -102,15 +102,15 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface, ...@@ -102,15 +102,15 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface,
/* extra reference for return */ /* extra reference for return */
atomic_set(&neigh_node->refcount, 2); atomic_set(&neigh_node->refcount, 2);
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Creating new neighbor %pM, initial seqno %d\n", "Creating new neighbor %pM, initial seqno %d\n",
neigh_addr, seqno); neigh_addr, seqno);
out: out:
return neigh_node; return neigh_node;
} }
static void orig_node_free_rcu(struct rcu_head *rcu) static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
{ {
struct hlist_node *node, *node_tmp; struct hlist_node *node, *node_tmp;
struct neigh_node *neigh_node, *tmp_neigh_node; struct neigh_node *neigh_node, *tmp_neigh_node;
...@@ -149,7 +149,7 @@ static void orig_node_free_rcu(struct rcu_head *rcu) ...@@ -149,7 +149,7 @@ static void orig_node_free_rcu(struct rcu_head *rcu)
void batadv_orig_node_free_ref(struct orig_node *orig_node) void batadv_orig_node_free_ref(struct orig_node *orig_node)
{ {
if (atomic_dec_and_test(&orig_node->refcount)) if (atomic_dec_and_test(&orig_node->refcount))
call_rcu(&orig_node->rcu, orig_node_free_rcu); call_rcu(&orig_node->rcu, batadv_orig_node_free_rcu);
} }
void batadv_originator_free(struct bat_priv *bat_priv) void batadv_originator_free(struct bat_priv *bat_priv)
...@@ -195,12 +195,12 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv, ...@@ -195,12 +195,12 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
int size; int size;
int hash_added; int hash_added;
orig_node = orig_hash_find(bat_priv, addr); orig_node = batadv_orig_hash_find(bat_priv, addr);
if (orig_node) if (orig_node)
return orig_node; return orig_node;
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv, "Creating new originator: %pM\n",
"Creating new originator: %pM\n", addr); addr);
orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC); orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC);
if (!orig_node) if (!orig_node)
...@@ -248,8 +248,9 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv, ...@@ -248,8 +248,9 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
if (!orig_node->bcast_own_sum) if (!orig_node->bcast_own_sum)
goto free_bcast_own; goto free_bcast_own;
hash_added = hash_add(bat_priv->orig_hash, compare_orig, hash_added = batadv_hash_add(bat_priv->orig_hash, batadv_compare_orig,
choose_orig, orig_node, &orig_node->hash_entry); batadv_choose_orig, orig_node,
&orig_node->hash_entry);
if (hash_added != 0) if (hash_added != 0)
goto free_bcast_own_sum; goto free_bcast_own_sum;
...@@ -263,14 +264,15 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv, ...@@ -263,14 +264,15 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
return NULL; return NULL;
} }
static bool purge_orig_neighbors(struct bat_priv *bat_priv, static bool batadv_purge_orig_neighbors(struct bat_priv *bat_priv,
struct orig_node *orig_node, struct orig_node *orig_node,
struct neigh_node **best_neigh_node) struct neigh_node **best_neigh_node)
{ {
struct hlist_node *node, *node_tmp; struct hlist_node *node, *node_tmp;
struct neigh_node *neigh_node; struct neigh_node *neigh_node;
bool neigh_purged = false; bool neigh_purged = false;
unsigned long last_seen; unsigned long last_seen;
struct hard_iface *if_incoming;
*best_neigh_node = NULL; *best_neigh_node = NULL;
...@@ -280,28 +282,26 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, ...@@ -280,28 +282,26 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
hlist_for_each_entry_safe(neigh_node, node, node_tmp, hlist_for_each_entry_safe(neigh_node, node, node_tmp,
&orig_node->neigh_list, list) { &orig_node->neigh_list, list) {
if ((has_timed_out(neigh_node->last_seen, PURGE_TIMEOUT)) || last_seen = neigh_node->last_seen;
(neigh_node->if_incoming->if_status == IF_INACTIVE) || if_incoming = neigh_node->if_incoming;
(neigh_node->if_incoming->if_status == IF_NOT_IN_USE) ||
(neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) { if ((batadv_has_timed_out(last_seen, PURGE_TIMEOUT)) ||
(if_incoming->if_status == IF_INACTIVE) ||
last_seen = neigh_node->last_seen; (if_incoming->if_status == IF_NOT_IN_USE) ||
(if_incoming->if_status == IF_TO_BE_REMOVED)) {
if ((neigh_node->if_incoming->if_status ==
IF_INACTIVE) || if ((if_incoming->if_status == IF_INACTIVE) ||
(neigh_node->if_incoming->if_status == (if_incoming->if_status == IF_NOT_IN_USE) ||
IF_NOT_IN_USE) || (if_incoming->if_status == IF_TO_BE_REMOVED))
(neigh_node->if_incoming->if_status == batadv_dbg(DBG_BATMAN, bat_priv,
IF_TO_BE_REMOVED)) "neighbor purge: originator %pM, neighbor: %pM, iface: %s\n",
bat_dbg(DBG_BATMAN, bat_priv, orig_node->orig, neigh_node->addr,
"neighbor purge: originator %pM, neighbor: %pM, iface: %s\n", if_incoming->net_dev->name);
orig_node->orig, neigh_node->addr,
neigh_node->if_incoming->net_dev->name);
else else
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n", "neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n",
orig_node->orig, neigh_node->addr, orig_node->orig, neigh_node->addr,
jiffies_to_msecs(last_seen)); jiffies_to_msecs(last_seen));
neigh_purged = true; neigh_purged = true;
...@@ -319,20 +319,20 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, ...@@ -319,20 +319,20 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
return neigh_purged; return neigh_purged;
} }
static bool purge_orig_node(struct bat_priv *bat_priv, static bool batadv_purge_orig_node(struct bat_priv *bat_priv,
struct orig_node *orig_node) struct orig_node *orig_node)
{ {
struct neigh_node *best_neigh_node; struct neigh_node *best_neigh_node;
if (has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) { if (batadv_has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) {
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Originator timeout: originator %pM, last_seen %u\n", "Originator timeout: originator %pM, last_seen %u\n",
orig_node->orig, orig_node->orig,
jiffies_to_msecs(orig_node->last_seen)); jiffies_to_msecs(orig_node->last_seen));
return true; return true;
} else { } else {
if (purge_orig_neighbors(bat_priv, orig_node, if (batadv_purge_orig_neighbors(bat_priv, orig_node,
&best_neigh_node)) &best_neigh_node))
batadv_update_route(bat_priv, orig_node, batadv_update_route(bat_priv, orig_node,
best_neigh_node); best_neigh_node);
} }
...@@ -340,7 +340,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv, ...@@ -340,7 +340,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
return false; return false;
} }
static void _purge_orig(struct bat_priv *bat_priv) static void _batadv_purge_orig(struct bat_priv *bat_priv)
{ {
struct hashtable_t *hash = bat_priv->orig_hash; struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_node *node, *node_tmp; struct hlist_node *node, *node_tmp;
...@@ -360,7 +360,7 @@ static void _purge_orig(struct bat_priv *bat_priv) ...@@ -360,7 +360,7 @@ static void _purge_orig(struct bat_priv *bat_priv)
spin_lock_bh(list_lock); spin_lock_bh(list_lock);
hlist_for_each_entry_safe(orig_node, node, node_tmp, hlist_for_each_entry_safe(orig_node, node, node_tmp,
head, hash_entry) { head, hash_entry) {
if (purge_orig_node(bat_priv, orig_node)) { if (batadv_purge_orig_node(bat_priv, orig_node)) {
if (orig_node->gw_flags) if (orig_node->gw_flags)
batadv_gw_node_delete(bat_priv, batadv_gw_node_delete(bat_priv,
orig_node); orig_node);
...@@ -369,8 +369,8 @@ static void _purge_orig(struct bat_priv *bat_priv) ...@@ -369,8 +369,8 @@ static void _purge_orig(struct bat_priv *bat_priv)
continue; continue;
} }
if (has_timed_out(orig_node->last_frag_packet, if (batadv_has_timed_out(orig_node->last_frag_packet,
FRAG_TIMEOUT)) FRAG_TIMEOUT))
batadv_frag_list_free(&orig_node->frag_list); batadv_frag_list_free(&orig_node->frag_list);
} }
spin_unlock_bh(list_lock); spin_unlock_bh(list_lock);
...@@ -380,20 +380,20 @@ static void _purge_orig(struct bat_priv *bat_priv) ...@@ -380,20 +380,20 @@ static void _purge_orig(struct bat_priv *bat_priv)
batadv_gw_election(bat_priv); batadv_gw_election(bat_priv);
} }
static void purge_orig(struct work_struct *work) static void batadv_purge_orig(struct work_struct *work)
{ {
struct delayed_work *delayed_work = struct delayed_work *delayed_work =
container_of(work, struct delayed_work, work); container_of(work, struct delayed_work, work);
struct bat_priv *bat_priv = struct bat_priv *bat_priv =
container_of(delayed_work, struct bat_priv, orig_work); container_of(delayed_work, struct bat_priv, orig_work);
_purge_orig(bat_priv); _batadv_purge_orig(bat_priv);
start_purge_timer(bat_priv); batadv_start_purge_timer(bat_priv);
} }
void batadv_purge_orig_ref(struct bat_priv *bat_priv) void batadv_purge_orig_ref(struct bat_priv *bat_priv)
{ {
_purge_orig(bat_priv); _batadv_purge_orig(bat_priv);
} }
int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
...@@ -412,7 +412,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) ...@@ -412,7 +412,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
uint32_t i; uint32_t i;
int ret = 0; int ret = 0;
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) { if (!primary_if) {
ret = seq_printf(seq, ret = seq_printf(seq,
...@@ -479,11 +479,11 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) ...@@ -479,11 +479,11 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
return ret; return ret;
} }
static int orig_node_add_if(struct orig_node *orig_node, int max_if_num) static int batadv_orig_node_add_if(struct orig_node *orig_node, int max_if_num)
{ {
void *data_ptr; void *data_ptr;
...@@ -528,7 +528,7 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num) ...@@ -528,7 +528,7 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
spin_lock_bh(&orig_node->ogm_cnt_lock); spin_lock_bh(&orig_node->ogm_cnt_lock);
ret = orig_node_add_if(orig_node, max_if_num); ret = batadv_orig_node_add_if(orig_node, max_if_num);
spin_unlock_bh(&orig_node->ogm_cnt_lock); spin_unlock_bh(&orig_node->ogm_cnt_lock);
if (ret == -ENOMEM) if (ret == -ENOMEM)
...@@ -544,8 +544,8 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num) ...@@ -544,8 +544,8 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
return -ENOMEM; return -ENOMEM;
} }
static int orig_node_del_if(struct orig_node *orig_node, static int batadv_orig_node_del_if(struct orig_node *orig_node,
int max_if_num, int del_if_num) int max_if_num, int del_if_num)
{ {
void *data_ptr = NULL; void *data_ptr = NULL;
int chunk_size; int chunk_size;
...@@ -612,8 +612,8 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num) ...@@ -612,8 +612,8 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
spin_lock_bh(&orig_node->ogm_cnt_lock); spin_lock_bh(&orig_node->ogm_cnt_lock);
ret = orig_node_del_if(orig_node, max_if_num, ret = batadv_orig_node_del_if(orig_node, max_if_num,
hard_iface->if_num); hard_iface->if_num);
spin_unlock_bh(&orig_node->ogm_cnt_lock); spin_unlock_bh(&orig_node->ogm_cnt_lock);
if (ret == -ENOMEM) if (ret == -ENOMEM)
......
...@@ -41,7 +41,7 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num); ...@@ -41,7 +41,7 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num);
/* hashfunction to choose an entry in a hash table of given size /* hashfunction to choose an entry in a hash table of given size
* hash algorithm from http://en.wikipedia.org/wiki/Hash_table * hash algorithm from http://en.wikipedia.org/wiki/Hash_table
*/ */
static inline uint32_t choose_orig(const void *data, uint32_t size) static inline uint32_t batadv_choose_orig(const void *data, uint32_t size)
{ {
const unsigned char *key = data; const unsigned char *key = data;
uint32_t hash = 0; uint32_t hash = 0;
...@@ -60,8 +60,8 @@ static inline uint32_t choose_orig(const void *data, uint32_t size) ...@@ -60,8 +60,8 @@ static inline uint32_t choose_orig(const void *data, uint32_t size)
return hash % size; return hash % size;
} }
static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv, static inline struct orig_node *batadv_orig_hash_find(struct bat_priv *bat_priv,
const void *data) const void *data)
{ {
struct hashtable_t *hash = bat_priv->orig_hash; struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_head *head; struct hlist_head *head;
...@@ -72,12 +72,12 @@ static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv, ...@@ -72,12 +72,12 @@ static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv,
if (!hash) if (!hash)
return NULL; return NULL;
index = choose_orig(data, hash->size); index = batadv_choose_orig(data, hash->size);
head = &hash->table[index]; head = &hash->table[index];
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
if (!compare_eth(orig_node, data)) if (!batadv_compare_eth(orig_node, data))
continue; continue;
if (!atomic_inc_not_zero(&orig_node->refcount)) if (!atomic_inc_not_zero(&orig_node->refcount))
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "gateway_common.h" #include "gateway_common.h"
#include "originator.h" #include "originator.h"
static void send_outstanding_bcast_packet(struct work_struct *work); static void batadv_send_outstanding_bcast_packet(struct work_struct *work);
/* send out an already prepared packet to the given address via the /* send out an already prepared packet to the given address via the
* specified batman interface * specified batman interface
...@@ -96,18 +96,18 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface) ...@@ -96,18 +96,18 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface)
bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface); bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface);
} }
static void forw_packet_free(struct forw_packet *forw_packet) static void batadv_forw_packet_free(struct forw_packet *forw_packet)
{ {
if (forw_packet->skb) if (forw_packet->skb)
kfree_skb(forw_packet->skb); kfree_skb(forw_packet->skb);
if (forw_packet->if_incoming) if (forw_packet->if_incoming)
hardif_free_ref(forw_packet->if_incoming); batadv_hardif_free_ref(forw_packet->if_incoming);
kfree(forw_packet); kfree(forw_packet);
} }
static void _add_bcast_packet_to_list(struct bat_priv *bat_priv, static void _batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
struct forw_packet *forw_packet, struct forw_packet *forw_packet,
unsigned long send_time) unsigned long send_time)
{ {
INIT_HLIST_NODE(&forw_packet->list); INIT_HLIST_NODE(&forw_packet->list);
...@@ -118,7 +118,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv, ...@@ -118,7 +118,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,
/* start timer for this packet */ /* start timer for this packet */
INIT_DELAYED_WORK(&forw_packet->delayed_work, INIT_DELAYED_WORK(&forw_packet->delayed_work,
send_outstanding_bcast_packet); batadv_send_outstanding_bcast_packet);
queue_delayed_work(batadv_event_workqueue, &forw_packet->delayed_work, queue_delayed_work(batadv_event_workqueue, &forw_packet->delayed_work,
send_time); send_time);
} }
...@@ -142,11 +142,11 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, ...@@ -142,11 +142,11 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
struct sk_buff *newskb; struct sk_buff *newskb;
if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) {
bat_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); batadv_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n");
goto out; goto out;
} }
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) if (!primary_if)
goto out_and_inc; goto out_and_inc;
...@@ -171,7 +171,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, ...@@ -171,7 +171,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
/* how often did we send the bcast packet ? */ /* how often did we send the bcast packet ? */
forw_packet->num_packets = 0; forw_packet->num_packets = 0;
_add_bcast_packet_to_list(bat_priv, forw_packet, delay); _batadv_add_bcast_packet_to_list(bat_priv, forw_packet, delay);
return NETDEV_TX_OK; return NETDEV_TX_OK;
packet_free: packet_free:
...@@ -180,11 +180,11 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, ...@@ -180,11 +180,11 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
atomic_inc(&bat_priv->bcast_queue_left); atomic_inc(&bat_priv->bcast_queue_left);
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
static void send_outstanding_bcast_packet(struct work_struct *work) static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
{ {
struct hard_iface *hard_iface; struct hard_iface *hard_iface;
struct delayed_work *delayed_work = struct delayed_work *delayed_work =
...@@ -220,13 +220,13 @@ static void send_outstanding_bcast_packet(struct work_struct *work) ...@@ -220,13 +220,13 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
/* if we still have some more bcasts to send */ /* if we still have some more bcasts to send */
if (forw_packet->num_packets < 3) { if (forw_packet->num_packets < 3) {
_add_bcast_packet_to_list(bat_priv, forw_packet, _batadv_add_bcast_packet_to_list(bat_priv, forw_packet,
msecs_to_jiffies(5)); msecs_to_jiffies(5));
return; return;
} }
out: out:
forw_packet_free(forw_packet); batadv_forw_packet_free(forw_packet);
atomic_inc(&bat_priv->bcast_queue_left); atomic_inc(&bat_priv->bcast_queue_left);
} }
...@@ -260,7 +260,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) ...@@ -260,7 +260,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
if (!forw_packet->own) if (!forw_packet->own)
atomic_inc(&bat_priv->batman_queue_left); atomic_inc(&bat_priv->batman_queue_left);
forw_packet_free(forw_packet); batadv_forw_packet_free(forw_packet);
} }
void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
...@@ -271,12 +271,12 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, ...@@ -271,12 +271,12 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
bool pending; bool pending;
if (hard_iface) if (hard_iface)
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"purge_outstanding_packets(): %s\n", "purge_outstanding_packets(): %s\n",
hard_iface->net_dev->name); hard_iface->net_dev->name);
else else
bat_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"purge_outstanding_packets()\n"); "purge_outstanding_packets()\n");
/* free bcast list */ /* free bcast list */
spin_lock_bh(&bat_priv->forw_bcast_list_lock); spin_lock_bh(&bat_priv->forw_bcast_list_lock);
...@@ -292,7 +292,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, ...@@ -292,7 +292,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
spin_unlock_bh(&bat_priv->forw_bcast_list_lock); spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
/* send_outstanding_bcast_packet() will lock the list to /* batadv_send_outstanding_bcast_packet() will lock the list to
* delete the item from the list * delete the item from the list
*/ */
pending = cancel_delayed_work_sync(&forw_packet->delayed_work); pending = cancel_delayed_work_sync(&forw_packet->delayed_work);
...@@ -300,7 +300,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, ...@@ -300,7 +300,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
if (pending) { if (pending) {
hlist_del(&forw_packet->list); hlist_del(&forw_packet->list);
forw_packet_free(forw_packet); batadv_forw_packet_free(forw_packet);
} }
} }
spin_unlock_bh(&bat_priv->forw_bcast_list_lock); spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
...@@ -327,7 +327,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, ...@@ -327,7 +327,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
if (pending) { if (pending) {
hlist_del(&forw_packet->list); hlist_del(&forw_packet->list);
forw_packet_free(forw_packet); batadv_forw_packet_free(forw_packet);
} }
} }
spin_unlock_bh(&bat_priv->forw_bat_list_lock); spin_unlock_bh(&bat_priv->forw_bat_list_lock);
......
This diff is collapsed.
This diff is collapsed.
...@@ -181,7 +181,7 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -181,7 +181,7 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
*new_skb = NULL; *new_skb = NULL;
orig_node = orig_hash_find(bat_priv, unicast_packet->orig); orig_node = batadv_orig_hash_find(bat_priv, unicast_packet->orig);
if (!orig_node) if (!orig_node)
goto out; goto out;
...@@ -227,7 +227,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -227,7 +227,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
int large_tail = 0, ret = NET_RX_DROP; int large_tail = 0, ret = NET_RX_DROP;
uint16_t seqno; uint16_t seqno;
primary_if = primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) if (!primary_if)
goto dropped; goto dropped;
...@@ -277,7 +277,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -277,7 +277,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
kfree_skb(skb); kfree_skb(skb);
out: out:
if (primary_if) if (primary_if)
hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
return ret; return ret;
} }
......
...@@ -33,7 +33,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -33,7 +33,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface, struct hard_iface *hard_iface,
const uint8_t dstaddr[]); const uint8_t dstaddr[]);
static inline int frag_can_reassemble(const struct sk_buff *skb, int mtu) static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu)
{ {
const struct unicast_frag_packet *unicast_packet; const struct unicast_frag_packet *unicast_packet;
int uneven_correction = 0; int uneven_correction = 0;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment