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,
*/
if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) {
if (set_mark)
bat_set_bit(seq_bits, -seq_num_diff);
batadv_set_bit(seq_bits, -seq_num_diff);
return 0;
}
......@@ -59,19 +59,19 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
batadv_bitmap_shift_left(seq_bits, seq_num_diff);
if (set_mark)
bat_set_bit(seq_bits, 0);
batadv_set_bit(seq_bits, 0);
return 1;
}
/* sequence number is much newer, probably missed a lot of packets */
if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) &&
(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",
seq_num_diff - 1);
bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark)
bat_set_bit(seq_bits, 0);
batadv_set_bit(seq_bits, 0);
return 1;
}
......@@ -83,12 +83,12 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
(seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
bat_dbg(DBG_BATMAN, bat_priv,
batadv_dbg(DBG_BATMAN, bat_priv,
"Other host probably restarted!\n");
bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark)
bat_set_bit(seq_bits, 0);
batadv_set_bit(seq_bits, 0);
return 1;
}
......
......@@ -23,7 +23,7 @@
/* returns true if the corresponding bit in the given seq_bits indicates true
* 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)
{
int32_t diff;
......@@ -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 */
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 (n < 0 || n >= TQ_LOCAL_WINDOW_SIZE)
......
This diff is collapsed.
This diff is collapsed.
......@@ -22,7 +22,7 @@
#include "gateway_client.h"
/* 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;
uint8_t sbit, part;
......@@ -73,7 +73,7 @@ void batadv_gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up)
*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 ret, multi = 1;
......@@ -142,7 +142,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
int up = 0, down = 0;
bool ret;
ret = parse_gw_bandwidth(net_dev, buff, &up, &down);
ret = batadv_parse_gw_bandwidth(net_dev, buff, &up, &down);
if (!ret)
goto end;
......@@ -152,7 +152,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
if (!up)
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
* 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)
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)
return 0;
......@@ -75,7 +75,8 @@ static int is_valid_iface(const struct net_device *net_dev)
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;
......@@ -96,13 +97,13 @@ static struct hard_iface *hardif_get_active(const struct net_device *soft_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 vis_packet *vis_packet;
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)
goto out;
......@@ -115,10 +116,10 @@ static void primary_if_update_addr(struct bat_priv *bat_priv,
batadv_bla_update_orig_address(bat_priv, primary_if, oldif);
out:
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 *curr_hard_iface;
......@@ -135,14 +136,14 @@ static void primary_if_select(struct bat_priv *bat_priv,
goto out;
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:
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)
return true;
......@@ -150,7 +151,7 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
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;
......@@ -163,7 +164,7 @@ static void check_known_mac_addr(const struct net_device *net_dev)
if (hard_iface->net_dev == net_dev)
continue;
if (!compare_eth(hard_iface->net_dev->dev_addr,
if (!batadv_compare_eth(hard_iface->net_dev->dev_addr,
net_dev->dev_addr))
continue;
......@@ -213,7 +214,7 @@ void batadv_update_min_mtu(struct net_device *soft_iface)
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 hard_iface *primary_if = NULL;
......@@ -229,9 +230,9 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
/* the first active interface becomes our primary interface or
* 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)
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",
hard_iface->net_dev->name);
......@@ -240,10 +241,10 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
out:
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) &&
(hard_iface->if_status != IF_TO_BE_ACTIVATED))
......@@ -331,8 +332,8 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
hard_iface->net_dev->name, hard_iface->net_dev->mtu,
ETH_DATA_LEN + BAT_HEADER_LEN);
if (hardif_is_iface_up(hard_iface))
hardif_activate_interface(hard_iface);
if (batadv_hardif_is_iface_up(hard_iface))
batadv_hardif_activate_interface(hard_iface);
else
bat_err(hard_iface->soft_iface,
"Not using interface %s (retrying later): interface not active\n",
......@@ -347,7 +348,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
err_dev:
dev_put(soft_iface);
err:
hardif_free_ref(hard_iface);
batadv_hardif_free_ref(hard_iface);
return ret;
}
......@@ -357,7 +358,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
struct hard_iface *primary_if = NULL;
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)
goto out;
......@@ -369,15 +370,15 @@ void batadv_hardif_disable_interface(struct hard_iface *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) {
struct hard_iface *new_if;
new_if = hardif_get_active(hard_iface->soft_iface);
primary_if_select(bat_priv, new_if);
new_if = batadv_hardif_get_active(hard_iface->soft_iface);
batadv_primary_if_select(bat_priv, 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);
......@@ -393,21 +394,22 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
batadv_softif_destroy(hard_iface->soft_iface);
hard_iface->soft_iface = NULL;
hardif_free_ref(hard_iface);
batadv_hardif_free_ref(hard_iface);
out:
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;
int ret;
ASSERT_RTNL();
ret = is_valid_iface(net_dev);
ret = batadv_is_valid_iface(net_dev);
if (ret != 1)
goto out;
......@@ -429,7 +431,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
/* extra reference for return */
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);
/* 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)
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();
......@@ -461,7 +463,7 @@ static void hardif_remove_interface(struct hard_iface *hard_iface)
hard_iface->if_status = IF_TO_BE_REMOVED;
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)
......@@ -472,12 +474,12 @@ void batadv_hardif_remove_interfaces(void)
list_for_each_entry_safe(hard_iface, hard_iface_tmp,
&batadv_hardif_list, list) {
list_del_rcu(&hard_iface->list);
hardif_remove_interface(hard_iface);
batadv_hardif_remove_interface(hard_iface);
}
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)
{
struct net_device *net_dev = ptr;
......@@ -486,23 +488,23 @@ static int hard_if_event(struct notifier_block *this,
struct bat_priv *bat_priv;
if (!hard_iface && event == NETDEV_REGISTER)
hard_iface = hardif_add_interface(net_dev);
hard_iface = batadv_hardif_add_interface(net_dev);
if (!hard_iface)
goto out;
switch (event) {
case NETDEV_UP:
hardif_activate_interface(hard_iface);
batadv_hardif_activate_interface(hard_iface);
break;
case NETDEV_GOING_DOWN:
case NETDEV_DOWN:
hardif_deactivate_interface(hard_iface);
batadv_hardif_deactivate_interface(hard_iface);
break;
case NETDEV_UNREGISTER:
list_del_rcu(&hard_iface->list);
hardif_remove_interface(hard_iface);
batadv_hardif_remove_interface(hard_iface);
break;
case NETDEV_CHANGEMTU:
if (hard_iface->soft_iface)
......@@ -512,27 +514,27 @@ static int hard_if_event(struct notifier_block *this,
if (hard_iface->if_status == IF_NOT_IN_USE)
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->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)
goto hardif_put;
if (hard_iface == primary_if)
primary_if_update_addr(bat_priv, NULL);
batadv_primary_if_update_addr(bat_priv, NULL);
break;
default:
break;
}
hardif_put:
hardif_free_ref(hard_iface);
batadv_hardif_free_ref(hard_iface);
out:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
return NOTIFY_DONE;
}
......@@ -569,5 +571,5 @@ bool batadv_is_wifi_iface(int ifindex)
}
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);
void batadv_hardif_free_rcu(struct rcu_head *rcu);
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))
call_rcu(&hard_iface->rcu, batadv_hardif_free_rcu);
}
static inline struct hard_iface *primary_if_get_selected(
struct bat_priv *bat_priv)
static inline struct hard_iface *
batadv_primary_if_get_selected(struct bat_priv *bat_priv)
{
struct hard_iface *hard_iface;
......
......@@ -21,7 +21,7 @@
#include "hash.h"
/* clears the hash */
static void hash_init(struct hashtable_t *hash)
static void batadv_hash_init(struct hashtable_t *hash)
{
uint32_t i;
......@@ -58,7 +58,7 @@ struct hashtable_t *batadv_hash_new(uint32_t size)
goto free_table;
hash->size = size;
hash_init(hash);
batadv_hash_init(hash);
return hash;
free_table:
......
......@@ -54,7 +54,7 @@ void batadv_hash_destroy(struct hashtable_t *hash);
* called to remove the elements inside of the hash. if you don't remove the
* 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)
{
struct hlist_head *head;
......@@ -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
* 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_choose_cb choose,
const void *data, struct hlist_node *data_node)
const void *data,
struct hlist_node *data_node)
{
uint32_t index;
int ret = -1;
......@@ -133,7 +134,7 @@ static inline int hash_add(struct hashtable_t *hash,
* structure you use with just the key filled, we just need the key for
* 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_choose_cb choose, void *data)
{
......
......@@ -26,18 +26,18 @@
#include "originator.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,
size_t icmp_len);
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;
struct socket_client *socket_client;
......@@ -49,14 +49,14 @@ static int bat_socket_open(struct inode *inode, struct file *file)
if (!socket_client)
return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(socket_client_hash); i++) {
if (!socket_client_hash[i]) {
socket_client_hash[i] = socket_client;
for (i = 0; i < ARRAY_SIZE(batadv_socket_client_hash); i++) {
if (!batadv_socket_client_hash[i]) {
batadv_socket_client_hash[i] = socket_client;
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");
kfree(socket_client);
return -EXFULL;
......@@ -75,7 +75,7 @@ static int bat_socket_open(struct inode *inode, struct file *file)
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_packet *socket_packet;
......@@ -92,7 +92,7 @@ static int bat_socket_release(struct inode *inode, struct file *file)
kfree(socket_packet);
}
socket_client_hash[socket_client->index] = NULL;
batadv_socket_client_hash[socket_client->index] = NULL;
spin_unlock_bh(&socket_client->lock);
kfree(socket_client);
......@@ -101,7 +101,7 @@ static int bat_socket_release(struct inode *inode, struct file *file)
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)
{
struct socket_client *socket_client = file->private_data;
......@@ -144,7 +144,7 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,
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)
{
struct socket_client *socket_client = file->private_data;
......@@ -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);
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");
return -EINVAL;
}
primary_if = primary_if_get_selected(bat_priv);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
len = -EFAULT;
......@@ -188,14 +188,14 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
}
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");
len = -EINVAL;
goto free_skb;
}
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");
len = -EINVAL;
goto free_skb;
......@@ -206,14 +206,15 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
if (icmp_packet->header.version != COMPAT_VERSION) {
icmp_packet->msg_type = PARAMETER_PROBLEM;
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;
}
if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
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)
goto dst_unreach;
......@@ -239,12 +240,12 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
dst_unreach:
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:
kfree_skb(skb);
out:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
if (neigh_node)
batadv_neigh_node_free_ref(neigh_node);
if (orig_node)
......@@ -252,7 +253,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
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;
......@@ -264,13 +265,13 @@ static unsigned int bat_socket_poll(struct file *file, poll_table *wait)
return 0;
}
static const struct file_operations fops = {
static const struct file_operations batadv_fops = {
.owner = THIS_MODULE,
.open = bat_socket_open,
.release = bat_socket_release,
.read = bat_socket_read,
.write = bat_socket_write,
.poll = bat_socket_poll,
.open = batadv_socket_open,
.release = batadv_socket_release,
.read = batadv_socket_read,
.write = batadv_socket_write,
.poll = batadv_socket_poll,
.llseek = no_llseek,
};
......@@ -282,7 +283,7 @@ int batadv_socket_setup(struct bat_priv *bat_priv)
goto err;
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)
goto err;
......@@ -292,7 +293,7 @@ int batadv_socket_setup(struct bat_priv *bat_priv)
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,
size_t icmp_len)
{
......@@ -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
* deleted
*/
if (!socket_client_hash[icmp_packet->uid]) {
if (!batadv_socket_client_hash[icmp_packet->uid]) {
spin_unlock_bh(&socket_client->lock);
kfree(socket_packet);
return;
......@@ -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,
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)
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)
if (hard_iface->if_status != IF_ACTIVE)
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();
return 1;
}
......@@ -238,7 +238,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
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",
batman_ogm_packet->header.version);
goto err_free;
......
......@@ -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, ...)
__printf(2, 3);
#define bat_dbg(type, bat_priv, fmt, arg...) \
#define batadv_dbg(type, bat_priv, fmt, arg...) \
do { \
if (atomic_read(&bat_priv->log_level) & type) \
batadv_debug_log(bat_priv, fmt, ## arg);\
......@@ -183,7 +183,7 @@ __printf(2, 3);
while (0)
#else /* !CONFIG_BATMAN_ADV_DEBUG */
__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,
const char *fmt __always_unused, ...)
{
......@@ -194,14 +194,14 @@ static inline void bat_dbg(int type __always_unused,
do { \
struct net_device *_netdev = (net_dev); \
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); \
} while (0)
#define bat_err(net_dev, fmt, arg...) \
do { \
struct net_device *_netdev = (net_dev); \
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); \
} while (0)
......@@ -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
*/
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);
}
......@@ -220,7 +220,8 @@ static inline int compare_eth(const void *data1, const void *data2)
*
* 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));
}
......
......@@ -28,17 +28,17 @@
#include "soft-interface.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,
&bat_priv->orig_work, msecs_to_jiffies(1000));
}
/* 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);
......@@ -55,7 +55,7 @@ int batadv_originator_init(struct bat_priv *bat_priv)
if (!bat_priv->orig_hash)
goto err;
start_purge_timer(bat_priv);
batadv_start_purge_timer(bat_priv);
return 0;
err:
......@@ -102,7 +102,7 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface,
/* extra reference for return */
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",
neigh_addr, seqno);
......@@ -110,7 +110,7 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface,
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 neigh_node *neigh_node, *tmp_neigh_node;
......@@ -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)
{
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)
......@@ -195,12 +195,12 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
int size;
int hash_added;
orig_node = orig_hash_find(bat_priv, addr);
orig_node = batadv_orig_hash_find(bat_priv, addr);
if (orig_node)
return orig_node;
bat_dbg(DBG_BATMAN, bat_priv,
"Creating new originator: %pM\n", addr);
batadv_dbg(DBG_BATMAN, bat_priv, "Creating new originator: %pM\n",
addr);
orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC);
if (!orig_node)
......@@ -248,8 +248,9 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
if (!orig_node->bcast_own_sum)
goto free_bcast_own;
hash_added = hash_add(bat_priv->orig_hash, compare_orig,
choose_orig, orig_node, &orig_node->hash_entry);
hash_added = batadv_hash_add(bat_priv->orig_hash, batadv_compare_orig,
batadv_choose_orig, orig_node,
&orig_node->hash_entry);
if (hash_added != 0)
goto free_bcast_own_sum;
......@@ -263,7 +264,7 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
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 neigh_node **best_neigh_node)
{
......@@ -271,6 +272,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
struct neigh_node *neigh_node;
bool neigh_purged = false;
unsigned long last_seen;
struct hard_iface *if_incoming;
*best_neigh_node = NULL;
......@@ -280,25 +282,23 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
hlist_for_each_entry_safe(neigh_node, node, node_tmp,
&orig_node->neigh_list, list) {
if ((has_timed_out(neigh_node->last_seen, PURGE_TIMEOUT)) ||
(neigh_node->if_incoming->if_status == IF_INACTIVE) ||
(neigh_node->if_incoming->if_status == IF_NOT_IN_USE) ||
(neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) {
last_seen = neigh_node->last_seen;
if_incoming = neigh_node->if_incoming;
if ((batadv_has_timed_out(last_seen, PURGE_TIMEOUT)) ||
(if_incoming->if_status == IF_INACTIVE) ||
(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) ||
(neigh_node->if_incoming->if_status ==
IF_NOT_IN_USE) ||
(neigh_node->if_incoming->if_status ==
IF_TO_BE_REMOVED))
bat_dbg(DBG_BATMAN, bat_priv,
if ((if_incoming->if_status == IF_INACTIVE) ||
(if_incoming->if_status == IF_NOT_IN_USE) ||
(if_incoming->if_status == IF_TO_BE_REMOVED))
batadv_dbg(DBG_BATMAN, bat_priv,
"neighbor purge: originator %pM, neighbor: %pM, iface: %s\n",
orig_node->orig, neigh_node->addr,
neigh_node->if_incoming->net_dev->name);
if_incoming->net_dev->name);
else
bat_dbg(DBG_BATMAN, bat_priv,
batadv_dbg(DBG_BATMAN, bat_priv,
"neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n",
orig_node->orig, neigh_node->addr,
jiffies_to_msecs(last_seen));
......@@ -319,19 +319,19 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
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 neigh_node *best_neigh_node;
if (has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) {
bat_dbg(DBG_BATMAN, bat_priv,
if (batadv_has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) {
batadv_dbg(DBG_BATMAN, bat_priv,
"Originator timeout: originator %pM, last_seen %u\n",
orig_node->orig,
jiffies_to_msecs(orig_node->last_seen));
return true;
} else {
if (purge_orig_neighbors(bat_priv, orig_node,
if (batadv_purge_orig_neighbors(bat_priv, orig_node,
&best_neigh_node))
batadv_update_route(bat_priv, orig_node,
best_neigh_node);
......@@ -340,7 +340,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
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 hlist_node *node, *node_tmp;
......@@ -360,7 +360,7 @@ static void _purge_orig(struct bat_priv *bat_priv)
spin_lock_bh(list_lock);
hlist_for_each_entry_safe(orig_node, node, node_tmp,
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)
batadv_gw_node_delete(bat_priv,
orig_node);
......@@ -369,7 +369,7 @@ static void _purge_orig(struct bat_priv *bat_priv)
continue;
}
if (has_timed_out(orig_node->last_frag_packet,
if (batadv_has_timed_out(orig_node->last_frag_packet,
FRAG_TIMEOUT))
batadv_frag_list_free(&orig_node->frag_list);
}
......@@ -380,20 +380,20 @@ static void _purge_orig(struct bat_priv *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 =
container_of(work, struct delayed_work, work);
struct bat_priv *bat_priv =
container_of(delayed_work, struct bat_priv, orig_work);
_purge_orig(bat_priv);
start_purge_timer(bat_priv);
_batadv_purge_orig(bat_priv);
batadv_start_purge_timer(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)
......@@ -412,7 +412,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
uint32_t i;
int ret = 0;
primary_if = primary_if_get_selected(bat_priv);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
ret = seq_printf(seq,
......@@ -479,11 +479,11 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
out:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
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;
......@@ -528,7 +528,7 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
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);
if (ret == -ENOMEM)
......@@ -544,7 +544,7 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
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)
{
void *data_ptr = NULL;
......@@ -612,7 +612,7 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
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);
spin_unlock_bh(&orig_node->ogm_cnt_lock);
......
......@@ -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
* 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;
uint32_t hash = 0;
......@@ -60,7 +60,7 @@ static inline uint32_t choose_orig(const void *data, uint32_t 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)
{
struct hashtable_t *hash = bat_priv->orig_hash;
......@@ -72,12 +72,12 @@ static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv,
if (!hash)
return NULL;
index = choose_orig(data, hash->size);
index = batadv_choose_orig(data, hash->size);
head = &hash->table[index];
rcu_read_lock();
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;
if (!atomic_inc_not_zero(&orig_node->refcount))
......
This diff is collapsed.
......@@ -27,7 +27,7 @@
#include "gateway_common.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
* specified batman interface
......@@ -96,16 +96,16 @@ void batadv_schedule_bat_ogm(struct hard_iface *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)
kfree_skb(forw_packet->skb);
if (forw_packet->if_incoming)
hardif_free_ref(forw_packet->if_incoming);
batadv_hardif_free_ref(forw_packet->if_incoming);
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,
unsigned long send_time)
{
......@@ -118,7 +118,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,
/* start timer for this packet */
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,
send_time);
}
......@@ -142,11 +142,11 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
struct sk_buff *newskb;
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;
}
primary_if = primary_if_get_selected(bat_priv);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out_and_inc;
......@@ -171,7 +171,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
/* how often did we send the bcast packet ? */
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;
packet_free:
......@@ -180,11 +180,11 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
atomic_inc(&bat_priv->bcast_queue_left);
out:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
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 delayed_work *delayed_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 (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));
return;
}
out:
forw_packet_free(forw_packet);
batadv_forw_packet_free(forw_packet);
atomic_inc(&bat_priv->bcast_queue_left);
}
......@@ -260,7 +260,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
if (!forw_packet->own)
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,
......@@ -271,11 +271,11 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
bool pending;
if (hard_iface)
bat_dbg(DBG_BATMAN, bat_priv,
batadv_dbg(DBG_BATMAN, bat_priv,
"purge_outstanding_packets(): %s\n",
hard_iface->net_dev->name);
else
bat_dbg(DBG_BATMAN, bat_priv,
batadv_dbg(DBG_BATMAN, bat_priv,
"purge_outstanding_packets()\n");
/* free bcast list */
......@@ -292,7 +292,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
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
*/
pending = cancel_delayed_work_sync(&forw_packet->delayed_work);
......@@ -300,7 +300,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
if (pending) {
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);
......@@ -327,7 +327,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
if (pending) {
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);
......
......@@ -37,23 +37,23 @@
#include "bridge_loop_avoidance.h"
static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
static void bat_get_drvinfo(struct net_device *dev,
static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
static void batadv_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info);
static u32 bat_get_msglevel(struct net_device *dev);
static void bat_set_msglevel(struct net_device *dev, u32 value);
static u32 bat_get_link(struct net_device *dev);
static u32 batadv_get_msglevel(struct net_device *dev);
static void batadv_set_msglevel(struct net_device *dev, u32 value);
static u32 batadv_get_link(struct net_device *dev);
static void batadv_get_strings(struct net_device *dev, u32 stringset, u8 *data);
static void batadv_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data);
static int batadv_get_sset_count(struct net_device *dev, int stringset);
static const struct ethtool_ops bat_ethtool_ops = {
.get_settings = bat_get_settings,
.get_drvinfo = bat_get_drvinfo,
.get_msglevel = bat_get_msglevel,
.set_msglevel = bat_set_msglevel,
.get_link = bat_get_link,
static const struct ethtool_ops batadv_ethtool_ops = {
.get_settings = batadv_get_settings,
.get_drvinfo = batadv_get_drvinfo,
.get_msglevel = batadv_get_msglevel,
.set_msglevel = batadv_set_msglevel,
.get_link = batadv_get_link,
.get_strings = batadv_get_strings,
.get_ethtool_stats = batadv_get_ethtool_stats,
.get_sset_count = batadv_get_sset_count,
......@@ -78,25 +78,25 @@ int batadv_skb_head_push(struct sk_buff *skb, unsigned int len)
return 0;
}
static int interface_open(struct net_device *dev)
static int batadv_interface_open(struct net_device *dev)
{
netif_start_queue(dev);
return 0;
}
static int interface_release(struct net_device *dev)
static int batadv_interface_release(struct net_device *dev)
{
netif_stop_queue(dev);
return 0;
}
static struct net_device_stats *interface_stats(struct net_device *dev)
static struct net_device_stats *batadv_interface_stats(struct net_device *dev)
{
struct bat_priv *bat_priv = netdev_priv(dev);
return &bat_priv->stats;
}
static int interface_set_mac_addr(struct net_device *dev, void *p)
static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
{
struct bat_priv *bat_priv = netdev_priv(dev);
struct sockaddr *addr = p;
......@@ -116,7 +116,7 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)
return 0;
}
static int interface_change_mtu(struct net_device *dev, int new_mtu)
static int batadv_interface_change_mtu(struct net_device *dev, int new_mtu)
{
/* check ranges */
if ((new_mtu < 68) || (new_mtu > batadv_hardif_min_mtu(dev)))
......@@ -127,7 +127,8 @@ static int interface_change_mtu(struct net_device *dev, int new_mtu)
return 0;
}
static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
static int batadv_interface_tx(struct sk_buff *skb,
struct net_device *soft_iface)
{
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
struct bat_priv *bat_priv = netdev_priv(soft_iface);
......@@ -168,7 +169,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
/* don't accept stp packets. STP does not help in meshes.
* better use the bridge loop avoidance ...
*/
if (compare_eth(ethhdr->h_dest, stp_addr))
if (batadv_compare_eth(ethhdr->h_dest, stp_addr))
goto dropped;
if (is_multicast_ether_addr(ethhdr->h_dest)) {
......@@ -199,7 +200,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
/* ethernet packet should be broadcasted */
if (do_bcast) {
primary_if = primary_if_get_selected(bat_priv);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto dropped;
......@@ -253,7 +254,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
bat_priv->stats.tx_dropped++;
end:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
return NETDEV_TX_OK;
}
......@@ -323,23 +324,23 @@ void batadv_interface_rx(struct net_device *soft_iface,
return;
}
static const struct net_device_ops bat_netdev_ops = {
.ndo_open = interface_open,
.ndo_stop = interface_release,
.ndo_get_stats = interface_stats,
.ndo_set_mac_address = interface_set_mac_addr,
.ndo_change_mtu = interface_change_mtu,
.ndo_start_xmit = interface_tx,
static const struct net_device_ops batadv_netdev_ops = {
.ndo_open = batadv_interface_open,
.ndo_stop = batadv_interface_release,
.ndo_get_stats = batadv_interface_stats,
.ndo_set_mac_address = batadv_interface_set_mac_addr,
.ndo_change_mtu = batadv_interface_change_mtu,
.ndo_start_xmit = batadv_interface_tx,
.ndo_validate_addr = eth_validate_addr
};
static void interface_setup(struct net_device *dev)
static void batadv_interface_setup(struct net_device *dev)
{
struct bat_priv *priv = netdev_priv(dev);
ether_setup(dev);
dev->netdev_ops = &bat_netdev_ops;
dev->netdev_ops = &batadv_netdev_ops;
dev->destructor = free_netdev;
dev->tx_queue_len = 0;
......@@ -353,7 +354,7 @@ static void interface_setup(struct net_device *dev)
/* generate random address */
eth_hw_addr_random(dev);
SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
SET_ETHTOOL_OPS(dev, &batadv_ethtool_ops);
memset(priv, 0, sizeof(*priv));
}
......@@ -364,7 +365,8 @@ struct net_device *batadv_softif_create(const char *name)
struct bat_priv *bat_priv;
int ret;
soft_iface = alloc_netdev(sizeof(*bat_priv), name, interface_setup);
soft_iface = alloc_netdev(sizeof(*bat_priv), name,
batadv_interface_setup);
if (!soft_iface)
goto out;
......@@ -456,14 +458,14 @@ void batadv_softif_destroy(struct net_device *soft_iface)
int batadv_softif_is_valid(const struct net_device *net_dev)
{
if (net_dev->netdev_ops->ndo_start_xmit == interface_tx)
if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx)
return 1;
return 0;
}
/* ethtool */
static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
cmd->supported = 0;
cmd->advertising = 0;
......@@ -479,7 +481,7 @@ static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return 0;
}
static void bat_get_drvinfo(struct net_device *dev,
static void batadv_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
strcpy(info->driver, "B.A.T.M.A.N. advanced");
......@@ -488,16 +490,16 @@ static void bat_get_drvinfo(struct net_device *dev,
strcpy(info->bus_info, "batman");
}
static u32 bat_get_msglevel(struct net_device *dev)
static u32 batadv_get_msglevel(struct net_device *dev)
{
return -EOPNOTSUPP;
}
static void bat_set_msglevel(struct net_device *dev, u32 value)
static void batadv_set_msglevel(struct net_device *dev, u32 value)
{
}
static u32 bat_get_link(struct net_device *dev)
static u32 batadv_get_link(struct net_device *dev)
{
return 1;
}
......@@ -508,7 +510,7 @@ static u32 bat_get_link(struct net_device *dev)
*/
static const struct {
const char name[ETH_GSTRING_LEN];
} bat_counters_strings[] = {
} batadv_counters_strings[] = {
{ "forward" },
{ "forward_bytes" },
{ "mgmt_tx" },
......@@ -527,8 +529,8 @@ static void batadv_get_strings(struct net_device *dev, uint32_t stringset,
uint8_t *data)
{
if (stringset == ETH_SS_STATS)
memcpy(data, bat_counters_strings,
sizeof(bat_counters_strings));
memcpy(data, batadv_counters_strings,
sizeof(batadv_counters_strings));
}
static void batadv_get_ethtool_stats(struct net_device *dev,
......
This diff is collapsed.
......@@ -181,7 +181,7 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
*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)
goto out;
......@@ -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;
uint16_t seqno;
primary_if = primary_if_get_selected(bat_priv);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto dropped;
......@@ -277,7 +277,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
kfree_skb(skb);
out:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
return ret;
}
......
......@@ -33,7 +33,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface,
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;
int uneven_correction = 0;
......
......@@ -59,7 +59,7 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2)
d2 = data2;
p1 = (struct vis_packet *)d1->skb_packet->data;
p2 = (struct vis_packet *)d2->skb_packet->data;
return compare_eth(p1->vis_orig, p2->vis_orig);
return batadv_compare_eth(p1->vis_orig, p2->vis_orig);
}
/* hash function to choose an entry in a hash table of given size
......@@ -127,7 +127,7 @@ static void vis_data_insert_interface(const uint8_t *interface,
struct hlist_node *pos;
hlist_for_each_entry(entry, pos, if_list, list) {
if (compare_eth(entry->addr, interface))
if (batadv_compare_eth(entry->addr, interface))
return;
}
......@@ -181,7 +181,7 @@ static ssize_t vis_data_read_entry(char *buff,
/* maximal length: max(4+17+2, 3+17+1+3+2) == 26 */
if (primary && entry->quality == 0)
return sprintf(buff, "TT %pM, ", entry->dest);
else if (compare_eth(entry->src, src))
else if (batadv_compare_eth(entry->src, src))
return sprintf(buff, "TQ %pM %d, ", entry->dest,
entry->quality);
......@@ -208,7 +208,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
size_t buff_pos, buf_size;
char *buff;
primary_if = primary_if_get_selected(bat_priv);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
......@@ -233,7 +233,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
for (j = 0; j < packet->entries; j++) {
if (entries[j].quality == 0)
continue;
if (compare_eth(entries[j].src,
if (batadv_compare_eth(entries[j].src,
packet->vis_orig))
continue;
vis_data_insert_interface(entries[j].src,
......@@ -245,7 +245,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
buf_size += 18 + 26 * packet->entries;
/* add primary/secondary records */
if (compare_eth(entry->addr, packet->vis_orig))
if (batadv_compare_eth(entry->addr,
packet->vis_orig))
buf_size +=
vis_data_count_prim_sec(&vis_if_list);
......@@ -285,7 +286,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
for (j = 0; j < packet->entries; j++) {
if (entries[j].quality == 0)
continue;
if (compare_eth(entries[j].src,
if (batadv_compare_eth(entries[j].src,
packet->vis_orig))
continue;
vis_data_insert_interface(entries[j].src,
......@@ -305,7 +306,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
entry->primary);
/* add primary/secondary records */
if (compare_eth(entry->addr, packet->vis_orig))
if (batadv_compare_eth(entry->addr,
packet->vis_orig))
buff_pos +=
vis_data_read_prim_sec(buff + buff_pos,
&vis_if_list);
......@@ -329,7 +331,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
out:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
return ret;
}
......@@ -379,7 +381,7 @@ static int recv_list_is_in(struct bat_priv *bat_priv,
spin_lock_bh(&bat_priv->vis_list_lock);
list_for_each_entry(entry, recv_list, list) {
if (compare_eth(entry->mac, mac)) {
if (batadv_compare_eth(entry->mac, mac)) {
spin_unlock_bh(&bat_priv->vis_list_lock);
return 1;
}
......@@ -433,8 +435,8 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
}
}
/* remove old entry */
hash_remove(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
old_info);
batadv_hash_remove(bat_priv->vis_hash, vis_info_cmp,
vis_info_choose, old_info);
send_list_del(old_info);
kref_put(&old_info->refcount, free_info);
}
......@@ -474,8 +476,8 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
recv_list_add(bat_priv, &info->recv_list, packet->sender_orig);
/* try to add it */
hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
info, &info->hash_entry);
hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
vis_info_choose, info, &info->hash_entry);
if (hash_added != 0) {
/* did not work (for some reason) */
kref_put(&info->refcount, free_info);
......@@ -651,7 +653,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
if (!router)
continue;
if (!compare_eth(router->addr, orig_node->orig))
if (!batadv_compare_eth(router->addr, orig_node->orig))
goto next;
if (router->if_incoming->if_status != IF_ACTIVE)
......@@ -728,7 +730,8 @@ static void purge_vis_packets(struct bat_priv *bat_priv)
if (info == bat_priv->my_vis_info)
continue;
if (has_timed_out(info->first_seen, VIS_TIMEOUT)) {
if (batadv_has_timed_out(info->first_seen,
VIS_TIMEOUT)) {
hlist_del(node);
send_list_del(info);
kref_put(&info->refcount, free_info);
......@@ -803,7 +806,7 @@ static void unicast_vis_packet(struct bat_priv *bat_priv,
packet = (struct vis_packet *)info->skb_packet->data;
orig_node = orig_hash_find(bat_priv, packet->target_orig);
orig_node = batadv_orig_hash_find(bat_priv, packet->target_orig);
if (!orig_node)
goto out;
......@@ -828,7 +831,7 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
struct hard_iface *primary_if;
struct vis_packet *packet;
primary_if = primary_if_get_selected(bat_priv);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
......@@ -849,7 +852,7 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
out:
if (primary_if)
hardif_free_ref(primary_if);
batadv_hardif_free_ref(primary_if);
}
/* called from timer; send (and maybe generate) vis packet. */
......@@ -934,8 +937,8 @@ int batadv_vis_init(struct bat_priv *bat_priv)
INIT_LIST_HEAD(&bat_priv->vis_send_list);
hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
bat_priv->my_vis_info,
hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
vis_info_choose, bat_priv->my_vis_info,
&bat_priv->my_vis_info->hash_entry);
if (hash_added != 0) {
pr_err("Can't add own vis packet into hash\n");
......@@ -977,7 +980,7 @@ void batadv_vis_quit(struct bat_priv *bat_priv)
spin_lock_bh(&bat_priv->vis_hash_lock);
/* properly remove, kill timers ... */
hash_delete(bat_priv->vis_hash, free_info_ref, NULL);
batadv_hash_delete(bat_priv->vis_hash, free_info_ref, NULL);
bat_priv->vis_hash = NULL;
bat_priv->my_vis_info = NULL;
spin_unlock_bh(&bat_priv->vis_hash_lock);
......
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