提交 e6c10f43 编写于 作者: M Marek Lindner

batman-adv: rename batman_if struct to hard_iface

Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
上级 4389e47a
...@@ -35,7 +35,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet, ...@@ -35,7 +35,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
int packet_len, int packet_len,
unsigned long send_time, unsigned long send_time,
bool directlink, bool directlink,
struct batman_if *if_incoming, struct hard_iface *if_incoming,
struct forw_packet *forw_packet) struct forw_packet *forw_packet)
{ {
struct batman_packet *batman_packet = struct batman_packet *batman_packet =
...@@ -99,7 +99,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet, ...@@ -99,7 +99,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
/* create a new aggregated packet and add this packet to it */ /* create a new aggregated packet and add this packet to it */
static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, static void new_aggregated_packet(unsigned char *packet_buff, int packet_len,
unsigned long send_time, bool direct_link, unsigned long send_time, bool direct_link,
struct batman_if *if_incoming, struct hard_iface *if_incoming,
int own_packet) int own_packet)
{ {
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
...@@ -188,7 +188,7 @@ static void aggregate(struct forw_packet *forw_packet_aggr, ...@@ -188,7 +188,7 @@ static void aggregate(struct forw_packet *forw_packet_aggr,
void add_bat_packet_to_list(struct bat_priv *bat_priv, void add_bat_packet_to_list(struct bat_priv *bat_priv,
unsigned char *packet_buff, int packet_len, unsigned char *packet_buff, int packet_len,
struct batman_if *if_incoming, char own_packet, struct hard_iface *if_incoming, char own_packet,
unsigned long send_time) unsigned long send_time)
{ {
/** /**
...@@ -247,7 +247,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, ...@@ -247,7 +247,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
/* unpack the aggregated packets and process them one by one */ /* unpack the aggregated packets and process them one by one */
void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
int packet_len, struct batman_if *if_incoming) int packet_len, struct hard_iface *if_incoming)
{ {
struct batman_packet *batman_packet; struct batman_packet *batman_packet;
int buff_pos = 0; int buff_pos = 0;
......
...@@ -35,9 +35,9 @@ static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna) ...@@ -35,9 +35,9 @@ static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna)
void add_bat_packet_to_list(struct bat_priv *bat_priv, void add_bat_packet_to_list(struct bat_priv *bat_priv,
unsigned char *packet_buff, int packet_len, unsigned char *packet_buff, int packet_len,
struct batman_if *if_incoming, char own_packet, struct hard_iface *if_incoming, char own_packet,
unsigned long send_time); unsigned long send_time);
void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
int packet_len, struct batman_if *if_incoming); int packet_len, struct hard_iface *if_incoming);
#endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */ #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */
...@@ -441,16 +441,16 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr, ...@@ -441,16 +441,16 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
char *buff) char *buff)
{ {
struct net_device *net_dev = kobj_to_netdev(kobj); struct net_device *net_dev = kobj_to_netdev(kobj);
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
ssize_t length; ssize_t length;
if (!batman_if) if (!hard_iface)
return 0; return 0;
length = sprintf(buff, "%s\n", batman_if->if_status == IF_NOT_IN_USE ? length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ?
"none" : batman_if->soft_iface->name); "none" : hard_iface->soft_iface->name);
hardif_free_ref(batman_if); hardif_free_ref(hard_iface);
return length; return length;
} }
...@@ -459,11 +459,11 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, ...@@ -459,11 +459,11 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
char *buff, size_t count) char *buff, size_t count)
{ {
struct net_device *net_dev = kobj_to_netdev(kobj); struct net_device *net_dev = kobj_to_netdev(kobj);
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
int status_tmp = -1; int status_tmp = -1;
int ret = count; int ret = count;
if (!batman_if) if (!hard_iface)
return count; return count;
if (buff[count - 1] == '\n') if (buff[count - 1] == '\n')
...@@ -472,7 +472,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, ...@@ -472,7 +472,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
if (strlen(buff) >= IFNAMSIZ) { if (strlen(buff) >= IFNAMSIZ) {
pr_err("Invalid parameter for 'mesh_iface' setting received: " pr_err("Invalid parameter for 'mesh_iface' setting received: "
"interface name too long '%s'\n", buff); "interface name too long '%s'\n", buff);
hardif_free_ref(batman_if); hardif_free_ref(hard_iface);
return -EINVAL; return -EINVAL;
} }
...@@ -481,28 +481,31 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, ...@@ -481,28 +481,31 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
else else
status_tmp = IF_I_WANT_YOU; status_tmp = IF_I_WANT_YOU;
if ((batman_if->if_status == status_tmp) || ((batman_if->soft_iface) && if (hard_iface->if_status == status_tmp)
(strncmp(batman_if->soft_iface->name, buff, IFNAMSIZ) == 0))) goto out;
if ((hard_iface->soft_iface) &&
(strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0))
goto out; goto out;
if (status_tmp == IF_NOT_IN_USE) { if (status_tmp == IF_NOT_IN_USE) {
rtnl_lock(); rtnl_lock();
hardif_disable_interface(batman_if); hardif_disable_interface(hard_iface);
rtnl_unlock(); rtnl_unlock();
goto out; goto out;
} }
/* if the interface already is in use */ /* if the interface already is in use */
if (batman_if->if_status != IF_NOT_IN_USE) { if (hard_iface->if_status != IF_NOT_IN_USE) {
rtnl_lock(); rtnl_lock();
hardif_disable_interface(batman_if); hardif_disable_interface(hard_iface);
rtnl_unlock(); rtnl_unlock();
} }
ret = hardif_enable_interface(batman_if, buff); ret = hardif_enable_interface(hard_iface, buff);
out: out:
hardif_free_ref(batman_if); hardif_free_ref(hard_iface);
return ret; return ret;
} }
...@@ -510,13 +513,13 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr, ...@@ -510,13 +513,13 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
char *buff) char *buff)
{ {
struct net_device *net_dev = kobj_to_netdev(kobj); struct net_device *net_dev = kobj_to_netdev(kobj);
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev); struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
ssize_t length; ssize_t length;
if (!batman_if) if (!hard_iface)
return 0; return 0;
switch (batman_if->if_status) { switch (hard_iface->if_status) {
case IF_TO_BE_REMOVED: case IF_TO_BE_REMOVED:
length = sprintf(buff, "disabling\n"); length = sprintf(buff, "disabling\n");
break; break;
...@@ -535,7 +538,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr, ...@@ -535,7 +538,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
break; break;
} }
hardif_free_ref(batman_if); hardif_free_ref(hard_iface);
return length; return length;
} }
......
此差异已折叠。
...@@ -31,18 +31,18 @@ ...@@ -31,18 +31,18 @@
extern struct notifier_block hard_if_notifier; extern struct notifier_block hard_if_notifier;
struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev); struct hard_iface *hardif_get_by_netdev(struct net_device *net_dev);
int hardif_enable_interface(struct batman_if *batman_if, char *iface_name); int hardif_enable_interface(struct hard_iface *hard_iface, char *iface_name);
void hardif_disable_interface(struct batman_if *batman_if); void hardif_disable_interface(struct hard_iface *hard_iface);
void hardif_remove_interfaces(void); void hardif_remove_interfaces(void);
int hardif_min_mtu(struct net_device *soft_iface); int hardif_min_mtu(struct net_device *soft_iface);
void update_min_mtu(struct net_device *soft_iface); void update_min_mtu(struct net_device *soft_iface);
void hardif_free_rcu(struct rcu_head *rcu); void hardif_free_rcu(struct rcu_head *rcu);
static inline void hardif_free_ref(struct batman_if *batman_if) static inline void hardif_free_ref(struct hard_iface *hard_iface)
{ {
if (atomic_dec_and_test(&batman_if->refcount)) if (atomic_dec_and_test(&hard_iface->refcount))
call_rcu(&batman_if->rcu, hardif_free_rcu); call_rcu(&hard_iface->rcu, hardif_free_rcu);
} }
#endif /* _NET_BATMAN_ADV_HARD_INTERFACE_H_ */ #endif /* _NET_BATMAN_ADV_HARD_INTERFACE_H_ */
...@@ -153,14 +153,14 @@ void dec_module_count(void) ...@@ -153,14 +153,14 @@ void dec_module_count(void)
int is_my_mac(uint8_t *addr) int is_my_mac(uint8_t *addr)
{ {
struct batman_if *batman_if; struct hard_iface *hard_iface;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &hardif_list, list) { list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
if (batman_if->if_status != IF_ACTIVE) if (hard_iface->if_status != IF_ACTIVE)
continue; continue;
if (compare_eth(batman_if->net_dev->dev_addr, addr)) { if (compare_eth(hard_iface->net_dev->dev_addr, addr)) {
rcu_read_unlock(); rcu_read_unlock();
return 1; return 1;
} }
......
...@@ -73,7 +73,7 @@ void neigh_node_free_ref(struct neigh_node *neigh_node) ...@@ -73,7 +73,7 @@ void neigh_node_free_ref(struct neigh_node *neigh_node)
struct neigh_node *create_neighbor(struct orig_node *orig_node, struct neigh_node *create_neighbor(struct orig_node *orig_node,
struct orig_node *orig_neigh_node, struct orig_node *orig_neigh_node,
uint8_t *neigh, uint8_t *neigh,
struct batman_if *if_incoming) struct hard_iface *if_incoming)
{ {
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
struct neigh_node *neigh_node; struct neigh_node *neigh_node;
...@@ -487,9 +487,9 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num) ...@@ -487,9 +487,9 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
return 0; return 0;
} }
int orig_hash_add_if(struct batman_if *batman_if, int max_if_num) int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
{ {
struct bat_priv *bat_priv = netdev_priv(batman_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
struct hashtable_t *hash = bat_priv->orig_hash; struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_node *node; struct hlist_node *node;
struct hlist_head *head; struct hlist_head *head;
...@@ -572,13 +572,13 @@ static int orig_node_del_if(struct orig_node *orig_node, ...@@ -572,13 +572,13 @@ static int orig_node_del_if(struct orig_node *orig_node,
return 0; return 0;
} }
int orig_hash_del_if(struct batman_if *batman_if, int max_if_num) int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
{ {
struct bat_priv *bat_priv = netdev_priv(batman_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
struct hashtable_t *hash = bat_priv->orig_hash; struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_node *node; struct hlist_node *node;
struct hlist_head *head; struct hlist_head *head;
struct batman_if *batman_if_tmp; struct hard_iface *hard_iface_tmp;
struct orig_node *orig_node; struct orig_node *orig_node;
int i, ret; int i, ret;
...@@ -591,7 +591,7 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num) ...@@ -591,7 +591,7 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num)
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 = orig_node_del_if(orig_node, max_if_num,
batman_if->if_num); hard_iface->if_num);
spin_unlock_bh(&orig_node->ogm_cnt_lock); spin_unlock_bh(&orig_node->ogm_cnt_lock);
if (ret == -1) if (ret == -1)
...@@ -602,22 +602,22 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num) ...@@ -602,22 +602,22 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num)
/* renumber remaining batman interfaces _inside_ of orig_hash_lock */ /* renumber remaining batman interfaces _inside_ of orig_hash_lock */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if_tmp, &hardif_list, list) { list_for_each_entry_rcu(hard_iface_tmp, &hardif_list, list) {
if (batman_if_tmp->if_status == IF_NOT_IN_USE) if (hard_iface_tmp->if_status == IF_NOT_IN_USE)
continue; continue;
if (batman_if == batman_if_tmp) if (hard_iface == hard_iface_tmp)
continue; continue;
if (batman_if->soft_iface != batman_if_tmp->soft_iface) if (hard_iface->soft_iface != hard_iface_tmp->soft_iface)
continue; continue;
if (batman_if_tmp->if_num > batman_if->if_num) if (hard_iface_tmp->if_num > hard_iface->if_num)
batman_if_tmp->if_num--; hard_iface_tmp->if_num--;
} }
rcu_read_unlock(); rcu_read_unlock();
batman_if->if_num = -1; hard_iface->if_num = -1;
return 0; return 0;
err: err:
......
...@@ -32,11 +32,11 @@ struct orig_node *get_orig_node(struct bat_priv *bat_priv, uint8_t *addr); ...@@ -32,11 +32,11 @@ struct orig_node *get_orig_node(struct bat_priv *bat_priv, uint8_t *addr);
struct neigh_node *create_neighbor(struct orig_node *orig_node, struct neigh_node *create_neighbor(struct orig_node *orig_node,
struct orig_node *orig_neigh_node, struct orig_node *orig_neigh_node,
uint8_t *neigh, uint8_t *neigh,
struct batman_if *if_incoming); struct hard_iface *if_incoming);
void neigh_node_free_ref(struct neigh_node *neigh_node); void neigh_node_free_ref(struct neigh_node *neigh_node);
int orig_seq_print_text(struct seq_file *seq, void *offset); int orig_seq_print_text(struct seq_file *seq, void *offset);
int orig_hash_add_if(struct batman_if *batman_if, int max_if_num); int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num);
int orig_hash_del_if(struct batman_if *batman_if, int max_if_num); int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num);
/* returns 1 if they are the same originator */ /* returns 1 if they are the same originator */
......
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
#include "gateway_client.h" #include "gateway_client.h"
#include "unicast.h" #include "unicast.h"
void slide_own_bcast_window(struct batman_if *batman_if) void slide_own_bcast_window(struct hard_iface *hard_iface)
{ {
struct bat_priv *bat_priv = netdev_priv(batman_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
struct hashtable_t *hash = bat_priv->orig_hash; struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_node *node; struct hlist_node *node;
struct hlist_head *head; struct hlist_head *head;
...@@ -52,11 +52,11 @@ void slide_own_bcast_window(struct batman_if *batman_if) ...@@ -52,11 +52,11 @@ void slide_own_bcast_window(struct batman_if *batman_if)
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);
word_index = batman_if->if_num * NUM_WORDS; word_index = hard_iface->if_num * NUM_WORDS;
word = &(orig_node->bcast_own[word_index]); word = &(orig_node->bcast_own[word_index]);
bit_get_packet(bat_priv, word, 1, 0); bit_get_packet(bat_priv, word, 1, 0);
orig_node->bcast_own_sum[batman_if->if_num] = orig_node->bcast_own_sum[hard_iface->if_num] =
bit_packet_count(word); bit_packet_count(word);
spin_unlock_bh(&orig_node->ogm_cnt_lock); spin_unlock_bh(&orig_node->ogm_cnt_lock);
} }
...@@ -143,7 +143,7 @@ void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node, ...@@ -143,7 +143,7 @@ void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node,
static int is_bidirectional_neigh(struct orig_node *orig_node, static int is_bidirectional_neigh(struct orig_node *orig_node,
struct orig_node *orig_neigh_node, struct orig_node *orig_neigh_node,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
struct batman_if *if_incoming) struct hard_iface *if_incoming)
{ {
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
struct neigh_node *neigh_node = NULL, *tmp_neigh_node; struct neigh_node *neigh_node = NULL, *tmp_neigh_node;
...@@ -368,7 +368,7 @@ static void update_orig(struct bat_priv *bat_priv, ...@@ -368,7 +368,7 @@ static void update_orig(struct bat_priv *bat_priv,
struct orig_node *orig_node, struct orig_node *orig_node,
struct ethhdr *ethhdr, struct ethhdr *ethhdr,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
struct batman_if *if_incoming, struct hard_iface *if_incoming,
unsigned char *hna_buff, int hna_buff_len, unsigned char *hna_buff, int hna_buff_len,
char is_duplicate) char is_duplicate)
{ {
...@@ -533,7 +533,7 @@ static int window_protected(struct bat_priv *bat_priv, ...@@ -533,7 +533,7 @@ static int window_protected(struct bat_priv *bat_priv,
*/ */
static char count_real_packets(struct ethhdr *ethhdr, static char count_real_packets(struct ethhdr *ethhdr,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
struct batman_if *if_incoming) struct hard_iface *if_incoming)
{ {
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
struct orig_node *orig_node; struct orig_node *orig_node;
...@@ -598,10 +598,10 @@ static char count_real_packets(struct ethhdr *ethhdr, ...@@ -598,10 +598,10 @@ static char count_real_packets(struct ethhdr *ethhdr,
void receive_bat_packet(struct ethhdr *ethhdr, void receive_bat_packet(struct ethhdr *ethhdr,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
unsigned char *hna_buff, int hna_buff_len, unsigned char *hna_buff, int hna_buff_len,
struct batman_if *if_incoming) struct hard_iface *if_incoming)
{ {
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
struct batman_if *batman_if; struct hard_iface *hard_iface;
struct orig_node *orig_neigh_node, *orig_node; struct orig_node *orig_neigh_node, *orig_node;
char has_directlink_flag; char has_directlink_flag;
char is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0; char is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0;
...@@ -643,23 +643,23 @@ void receive_bat_packet(struct ethhdr *ethhdr, ...@@ -643,23 +643,23 @@ void receive_bat_packet(struct ethhdr *ethhdr,
has_directlink_flag); has_directlink_flag);
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &hardif_list, list) { list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
if (batman_if->if_status != IF_ACTIVE) if (hard_iface->if_status != IF_ACTIVE)
continue; continue;
if (batman_if->soft_iface != if_incoming->soft_iface) if (hard_iface->soft_iface != if_incoming->soft_iface)
continue; continue;
if (compare_eth(ethhdr->h_source, if (compare_eth(ethhdr->h_source,
batman_if->net_dev->dev_addr)) hard_iface->net_dev->dev_addr))
is_my_addr = 1; is_my_addr = 1;
if (compare_eth(batman_packet->orig, if (compare_eth(batman_packet->orig,
batman_if->net_dev->dev_addr)) hard_iface->net_dev->dev_addr))
is_my_orig = 1; is_my_orig = 1;
if (compare_eth(batman_packet->prev_sender, if (compare_eth(batman_packet->prev_sender,
batman_if->net_dev->dev_addr)) hard_iface->net_dev->dev_addr))
is_my_oldorig = 1; is_my_oldorig = 1;
if (compare_eth(ethhdr->h_source, broadcast_addr)) if (compare_eth(ethhdr->h_source, broadcast_addr))
...@@ -828,7 +828,7 @@ void receive_bat_packet(struct ethhdr *ethhdr, ...@@ -828,7 +828,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
orig_node_free_ref(orig_node); orig_node_free_ref(orig_node);
} }
int recv_bat_packet(struct sk_buff *skb, struct batman_if *batman_if) int recv_bat_packet(struct sk_buff *skb, struct hard_iface *hard_iface)
{ {
struct ethhdr *ethhdr; struct ethhdr *ethhdr;
...@@ -859,7 +859,7 @@ int recv_bat_packet(struct sk_buff *skb, struct batman_if *batman_if) ...@@ -859,7 +859,7 @@ int recv_bat_packet(struct sk_buff *skb, struct batman_if *batman_if)
receive_aggr_bat_packet(ethhdr, receive_aggr_bat_packet(ethhdr,
skb->data, skb->data,
skb_headlen(skb), skb_headlen(skb),
batman_if); hard_iface);
kfree_skb(skb); kfree_skb(skb);
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
...@@ -997,7 +997,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, ...@@ -997,7 +997,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
} }
int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if) int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct icmp_packet_rr *icmp_packet; struct icmp_packet_rr *icmp_packet;
...@@ -1097,7 +1097,7 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if) ...@@ -1097,7 +1097,7 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if)
* refcount.*/ * refcount.*/
struct neigh_node *find_router(struct bat_priv *bat_priv, struct neigh_node *find_router(struct bat_priv *bat_priv,
struct orig_node *orig_node, struct orig_node *orig_node,
struct batman_if *recv_if) struct hard_iface *recv_if)
{ {
struct orig_node *primary_orig_node; struct orig_node *primary_orig_node;
struct orig_node *router_orig; struct orig_node *router_orig;
...@@ -1263,7 +1263,7 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size) ...@@ -1263,7 +1263,7 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
return 0; return 0;
} }
int route_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if, int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if,
int hdr_size) int hdr_size)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
...@@ -1349,7 +1349,7 @@ int route_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if, ...@@ -1349,7 +1349,7 @@ int route_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if,
return ret; return ret;
} }
int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if) int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct unicast_packet *unicast_packet; struct unicast_packet *unicast_packet;
int hdr_size = sizeof(struct unicast_packet); int hdr_size = sizeof(struct unicast_packet);
...@@ -1368,7 +1368,7 @@ int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if) ...@@ -1368,7 +1368,7 @@ int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if)
return route_unicast_packet(skb, recv_if, hdr_size); return route_unicast_packet(skb, recv_if, hdr_size);
} }
int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if) int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct unicast_frag_packet *unicast_packet; struct unicast_frag_packet *unicast_packet;
...@@ -1402,7 +1402,7 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if) ...@@ -1402,7 +1402,7 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if)
} }
int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if) int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct orig_node *orig_node = NULL; struct orig_node *orig_node = NULL;
...@@ -1487,7 +1487,7 @@ int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if) ...@@ -1487,7 +1487,7 @@ int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if)
return ret; return ret;
} }
int recv_vis_packet(struct sk_buff *skb, struct batman_if *recv_if) int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct vis_packet *vis_packet; struct vis_packet *vis_packet;
struct ethhdr *ethhdr; struct ethhdr *ethhdr;
......
...@@ -22,25 +22,25 @@ ...@@ -22,25 +22,25 @@
#ifndef _NET_BATMAN_ADV_ROUTING_H_ #ifndef _NET_BATMAN_ADV_ROUTING_H_
#define _NET_BATMAN_ADV_ROUTING_H_ #define _NET_BATMAN_ADV_ROUTING_H_
void slide_own_bcast_window(struct batman_if *batman_if); void slide_own_bcast_window(struct hard_iface *hard_iface);
void receive_bat_packet(struct ethhdr *ethhdr, void receive_bat_packet(struct ethhdr *ethhdr,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
unsigned char *hna_buff, int hna_buff_len, unsigned char *hna_buff, int hna_buff_len,
struct batman_if *if_incoming); struct hard_iface *if_incoming);
void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node, void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node,
struct neigh_node *neigh_node, unsigned char *hna_buff, struct neigh_node *neigh_node, unsigned char *hna_buff,
int hna_buff_len); int hna_buff_len);
int route_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if, int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if,
int hdr_size); int hdr_size);
int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_vis_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_bat_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_bat_packet(struct sk_buff *skb, struct hard_iface *recv_if);
struct neigh_node *find_router(struct bat_priv *bat_priv, struct neigh_node *find_router(struct bat_priv *bat_priv,
struct orig_node *orig_node, struct orig_node *orig_node,
struct batman_if *recv_if); struct hard_iface *recv_if);
void bonding_candidate_del(struct orig_node *orig_node, void bonding_candidate_del(struct orig_node *orig_node,
struct neigh_node *neigh_node); struct neigh_node *neigh_node);
......
...@@ -56,20 +56,20 @@ static unsigned long forward_send_time(void) ...@@ -56,20 +56,20 @@ static unsigned long forward_send_time(void)
/* 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 */
int send_skb_packet(struct sk_buff *skb, int send_skb_packet(struct sk_buff *skb,
struct batman_if *batman_if, struct hard_iface *hard_iface,
uint8_t *dst_addr) uint8_t *dst_addr)
{ {
struct ethhdr *ethhdr; struct ethhdr *ethhdr;
if (batman_if->if_status != IF_ACTIVE) if (hard_iface->if_status != IF_ACTIVE)
goto send_skb_err; goto send_skb_err;
if (unlikely(!batman_if->net_dev)) if (unlikely(!hard_iface->net_dev))
goto send_skb_err; goto send_skb_err;
if (!(batman_if->net_dev->flags & IFF_UP)) { if (!(hard_iface->net_dev->flags & IFF_UP)) {
pr_warning("Interface %s is not up - can't send packet via " pr_warning("Interface %s is not up - can't send packet via "
"that interface!\n", batman_if->net_dev->name); "that interface!\n", hard_iface->net_dev->name);
goto send_skb_err; goto send_skb_err;
} }
...@@ -80,7 +80,7 @@ int send_skb_packet(struct sk_buff *skb, ...@@ -80,7 +80,7 @@ int send_skb_packet(struct sk_buff *skb,
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
ethhdr = (struct ethhdr *) skb_mac_header(skb); ethhdr = (struct ethhdr *) skb_mac_header(skb);
memcpy(ethhdr->h_source, batman_if->net_dev->dev_addr, ETH_ALEN); memcpy(ethhdr->h_source, hard_iface->net_dev->dev_addr, ETH_ALEN);
memcpy(ethhdr->h_dest, dst_addr, ETH_ALEN); memcpy(ethhdr->h_dest, dst_addr, ETH_ALEN);
ethhdr->h_proto = __constant_htons(ETH_P_BATMAN); ethhdr->h_proto = __constant_htons(ETH_P_BATMAN);
...@@ -88,7 +88,7 @@ int send_skb_packet(struct sk_buff *skb, ...@@ -88,7 +88,7 @@ int send_skb_packet(struct sk_buff *skb,
skb->priority = TC_PRIO_CONTROL; skb->priority = TC_PRIO_CONTROL;
skb->protocol = __constant_htons(ETH_P_BATMAN); skb->protocol = __constant_htons(ETH_P_BATMAN);
skb->dev = batman_if->net_dev; skb->dev = hard_iface->net_dev;
/* dev_queue_xmit() returns a negative result on error. However on /* dev_queue_xmit() returns a negative result on error. However on
* congestion and traffic shaping, it drops and returns NET_XMIT_DROP * congestion and traffic shaping, it drops and returns NET_XMIT_DROP
...@@ -102,16 +102,16 @@ int send_skb_packet(struct sk_buff *skb, ...@@ -102,16 +102,16 @@ int send_skb_packet(struct sk_buff *skb,
/* Send a packet to a given interface */ /* Send a packet to a given interface */
static void send_packet_to_if(struct forw_packet *forw_packet, static void send_packet_to_if(struct forw_packet *forw_packet,
struct batman_if *batman_if) struct hard_iface *hard_iface)
{ {
struct bat_priv *bat_priv = netdev_priv(batman_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
char *fwd_str; char *fwd_str;
uint8_t packet_num; uint8_t packet_num;
int16_t buff_pos; int16_t buff_pos;
struct batman_packet *batman_packet; struct batman_packet *batman_packet;
struct sk_buff *skb; struct sk_buff *skb;
if (batman_if->if_status != IF_ACTIVE) if (hard_iface->if_status != IF_ACTIVE)
return; return;
packet_num = 0; packet_num = 0;
...@@ -126,7 +126,7 @@ static void send_packet_to_if(struct forw_packet *forw_packet, ...@@ -126,7 +126,7 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
/* we might have aggregated direct link packets with an /* we might have aggregated direct link packets with an
* ordinary base packet */ * ordinary base packet */
if ((forw_packet->direct_link_flags & (1 << packet_num)) && if ((forw_packet->direct_link_flags & (1 << packet_num)) &&
(forw_packet->if_incoming == batman_if)) (forw_packet->if_incoming == hard_iface))
batman_packet->flags |= DIRECTLINK; batman_packet->flags |= DIRECTLINK;
else else
batman_packet->flags &= ~DIRECTLINK; batman_packet->flags &= ~DIRECTLINK;
...@@ -142,7 +142,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet, ...@@ -142,7 +142,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
batman_packet->tq, batman_packet->ttl, batman_packet->tq, batman_packet->ttl,
(batman_packet->flags & DIRECTLINK ? (batman_packet->flags & DIRECTLINK ?
"on" : "off"), "on" : "off"),
batman_if->net_dev->name, batman_if->net_dev->dev_addr); hard_iface->net_dev->name,
hard_iface->net_dev->dev_addr);
buff_pos += sizeof(struct batman_packet) + buff_pos += sizeof(struct batman_packet) +
(batman_packet->num_hna * ETH_ALEN); (batman_packet->num_hna * ETH_ALEN);
...@@ -154,13 +155,13 @@ static void send_packet_to_if(struct forw_packet *forw_packet, ...@@ -154,13 +155,13 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
/* create clone because function is called more than once */ /* create clone because function is called more than once */
skb = skb_clone(forw_packet->skb, GFP_ATOMIC); skb = skb_clone(forw_packet->skb, GFP_ATOMIC);
if (skb) if (skb)
send_skb_packet(skb, batman_if, broadcast_addr); send_skb_packet(skb, hard_iface, broadcast_addr);
} }
/* send a batman packet */ /* send a batman packet */
static void send_packet(struct forw_packet *forw_packet) static void send_packet(struct forw_packet *forw_packet)
{ {
struct batman_if *batman_if; struct hard_iface *hard_iface;
struct net_device *soft_iface; struct net_device *soft_iface;
struct bat_priv *bat_priv; struct bat_priv *bat_priv;
struct batman_packet *batman_packet = struct batman_packet *batman_packet =
...@@ -204,17 +205,17 @@ static void send_packet(struct forw_packet *forw_packet) ...@@ -204,17 +205,17 @@ static void send_packet(struct forw_packet *forw_packet)
/* broadcast on every interface */ /* broadcast on every interface */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &hardif_list, list) { list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
if (batman_if->soft_iface != soft_iface) if (hard_iface->soft_iface != soft_iface)
continue; continue;
send_packet_to_if(forw_packet, batman_if); send_packet_to_if(forw_packet, hard_iface);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
static void rebuild_batman_packet(struct bat_priv *bat_priv, static void rebuild_batman_packet(struct bat_priv *bat_priv,
struct batman_if *batman_if) struct hard_iface *hard_iface)
{ {
int new_len; int new_len;
unsigned char *new_buff; unsigned char *new_buff;
...@@ -226,7 +227,7 @@ static void rebuild_batman_packet(struct bat_priv *bat_priv, ...@@ -226,7 +227,7 @@ static void rebuild_batman_packet(struct bat_priv *bat_priv,
/* keep old buffer if kmalloc should fail */ /* keep old buffer if kmalloc should fail */
if (new_buff) { if (new_buff) {
memcpy(new_buff, batman_if->packet_buff, memcpy(new_buff, hard_iface->packet_buff,
sizeof(struct batman_packet)); sizeof(struct batman_packet));
batman_packet = (struct batman_packet *)new_buff; batman_packet = (struct batman_packet *)new_buff;
...@@ -234,21 +235,21 @@ static void rebuild_batman_packet(struct bat_priv *bat_priv, ...@@ -234,21 +235,21 @@ static void rebuild_batman_packet(struct bat_priv *bat_priv,
new_buff + sizeof(struct batman_packet), new_buff + sizeof(struct batman_packet),
new_len - sizeof(struct batman_packet)); new_len - sizeof(struct batman_packet));
kfree(batman_if->packet_buff); kfree(hard_iface->packet_buff);
batman_if->packet_buff = new_buff; hard_iface->packet_buff = new_buff;
batman_if->packet_len = new_len; hard_iface->packet_len = new_len;
} }
} }
void schedule_own_packet(struct batman_if *batman_if) void schedule_own_packet(struct hard_iface *hard_iface)
{ {
struct bat_priv *bat_priv = netdev_priv(batman_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
unsigned long send_time; unsigned long send_time;
struct batman_packet *batman_packet; struct batman_packet *batman_packet;
int vis_server; int vis_server;
if ((batman_if->if_status == IF_NOT_IN_USE) || if ((hard_iface->if_status == IF_NOT_IN_USE) ||
(batman_if->if_status == IF_TO_BE_REMOVED)) (hard_iface->if_status == IF_TO_BE_REMOVED))
return; return;
vis_server = atomic_read(&bat_priv->vis_mode); vis_server = atomic_read(&bat_priv->vis_mode);
...@@ -260,51 +261,51 @@ void schedule_own_packet(struct batman_if *batman_if) ...@@ -260,51 +261,51 @@ void schedule_own_packet(struct batman_if *batman_if)
* outdated packets (especially uninitialized mac addresses) in the * outdated packets (especially uninitialized mac addresses) in the
* packet queue * packet queue
*/ */
if (batman_if->if_status == IF_TO_BE_ACTIVATED) if (hard_iface->if_status == IF_TO_BE_ACTIVATED)
batman_if->if_status = IF_ACTIVE; hard_iface->if_status = IF_ACTIVE;
/* if local hna has changed and interface is a primary interface */ /* if local hna has changed and interface is a primary interface */
if ((atomic_read(&bat_priv->hna_local_changed)) && if ((atomic_read(&bat_priv->hna_local_changed)) &&
(batman_if == bat_priv->primary_if)) (hard_iface == bat_priv->primary_if))
rebuild_batman_packet(bat_priv, batman_if); rebuild_batman_packet(bat_priv, hard_iface);
/** /**
* NOTE: packet_buff might just have been re-allocated in * NOTE: packet_buff might just have been re-allocated in
* rebuild_batman_packet() * rebuild_batman_packet()
*/ */
batman_packet = (struct batman_packet *)batman_if->packet_buff; batman_packet = (struct batman_packet *)hard_iface->packet_buff;
/* change sequence number to network order */ /* change sequence number to network order */
batman_packet->seqno = batman_packet->seqno =
htonl((uint32_t)atomic_read(&batman_if->seqno)); htonl((uint32_t)atomic_read(&hard_iface->seqno));
if (vis_server == VIS_TYPE_SERVER_SYNC) if (vis_server == VIS_TYPE_SERVER_SYNC)
batman_packet->flags |= VIS_SERVER; batman_packet->flags |= VIS_SERVER;
else else
batman_packet->flags &= ~VIS_SERVER; batman_packet->flags &= ~VIS_SERVER;
if ((batman_if == bat_priv->primary_if) && if ((hard_iface == bat_priv->primary_if) &&
(atomic_read(&bat_priv->gw_mode) == GW_MODE_SERVER)) (atomic_read(&bat_priv->gw_mode) == GW_MODE_SERVER))
batman_packet->gw_flags = batman_packet->gw_flags =
(uint8_t)atomic_read(&bat_priv->gw_bandwidth); (uint8_t)atomic_read(&bat_priv->gw_bandwidth);
else else
batman_packet->gw_flags = 0; batman_packet->gw_flags = 0;
atomic_inc(&batman_if->seqno); atomic_inc(&hard_iface->seqno);
slide_own_bcast_window(batman_if); slide_own_bcast_window(hard_iface);
send_time = own_send_time(bat_priv); send_time = own_send_time(bat_priv);
add_bat_packet_to_list(bat_priv, add_bat_packet_to_list(bat_priv,
batman_if->packet_buff, hard_iface->packet_buff,
batman_if->packet_len, hard_iface->packet_len,
batman_if, 1, send_time); hard_iface, 1, send_time);
} }
void schedule_forward_packet(struct orig_node *orig_node, void schedule_forward_packet(struct orig_node *orig_node,
struct ethhdr *ethhdr, struct ethhdr *ethhdr,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
uint8_t directlink, int hna_buff_len, uint8_t directlink, int hna_buff_len,
struct batman_if *if_incoming) struct hard_iface *if_incoming)
{ {
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
unsigned char in_tq, in_ttl, tq_avg = 0; unsigned char in_tq, in_ttl, tq_avg = 0;
...@@ -443,7 +444,7 @@ int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb) ...@@ -443,7 +444,7 @@ int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb)
static void send_outstanding_bcast_packet(struct work_struct *work) static void send_outstanding_bcast_packet(struct work_struct *work)
{ {
struct batman_if *batman_if; struct hard_iface *hard_iface;
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 forw_packet *forw_packet = struct forw_packet *forw_packet =
...@@ -461,14 +462,14 @@ static void send_outstanding_bcast_packet(struct work_struct *work) ...@@ -461,14 +462,14 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
/* rebroadcast packet */ /* rebroadcast packet */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &hardif_list, list) { list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
if (batman_if->soft_iface != soft_iface) if (hard_iface->soft_iface != soft_iface)
continue; continue;
/* send a copy of the saved skb */ /* send a copy of the saved skb */
skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC); skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC);
if (skb1) if (skb1)
send_skb_packet(skb1, batman_if, broadcast_addr); send_skb_packet(skb1, hard_iface, broadcast_addr);
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -521,15 +522,15 @@ void send_outstanding_bat_packet(struct work_struct *work) ...@@ -521,15 +522,15 @@ void send_outstanding_bat_packet(struct work_struct *work)
} }
void purge_outstanding_packets(struct bat_priv *bat_priv, void purge_outstanding_packets(struct bat_priv *bat_priv,
struct batman_if *batman_if) struct hard_iface *hard_iface)
{ {
struct forw_packet *forw_packet; struct forw_packet *forw_packet;
struct hlist_node *tmp_node, *safe_tmp_node; struct hlist_node *tmp_node, *safe_tmp_node;
if (batman_if) if (hard_iface)
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"purge_outstanding_packets(): %s\n", "purge_outstanding_packets(): %s\n",
batman_if->net_dev->name); hard_iface->net_dev->name);
else else
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"purge_outstanding_packets()\n"); "purge_outstanding_packets()\n");
...@@ -543,8 +544,8 @@ void purge_outstanding_packets(struct bat_priv *bat_priv, ...@@ -543,8 +544,8 @@ void purge_outstanding_packets(struct bat_priv *bat_priv,
* if purge_outstanding_packets() was called with an argmument * if purge_outstanding_packets() was called with an argmument
* we delete only packets belonging to the given interface * we delete only packets belonging to the given interface
*/ */
if ((batman_if) && if ((hard_iface) &&
(forw_packet->if_incoming != batman_if)) (forw_packet->if_incoming != hard_iface))
continue; continue;
spin_unlock_bh(&bat_priv->forw_bcast_list_lock); spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
...@@ -567,8 +568,8 @@ void purge_outstanding_packets(struct bat_priv *bat_priv, ...@@ -567,8 +568,8 @@ void purge_outstanding_packets(struct bat_priv *bat_priv,
* if purge_outstanding_packets() was called with an argmument * if purge_outstanding_packets() was called with an argmument
* we delete only packets belonging to the given interface * we delete only packets belonging to the given interface
*/ */
if ((batman_if) && if ((hard_iface) &&
(forw_packet->if_incoming != batman_if)) (forw_packet->if_incoming != hard_iface))
continue; continue;
spin_unlock_bh(&bat_priv->forw_bat_list_lock); spin_unlock_bh(&bat_priv->forw_bat_list_lock);
......
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
#define _NET_BATMAN_ADV_SEND_H_ #define _NET_BATMAN_ADV_SEND_H_
int send_skb_packet(struct sk_buff *skb, int send_skb_packet(struct sk_buff *skb,
struct batman_if *batman_if, struct hard_iface *hard_iface,
uint8_t *dst_addr); uint8_t *dst_addr);
void schedule_own_packet(struct batman_if *batman_if); void schedule_own_packet(struct hard_iface *hard_iface);
void schedule_forward_packet(struct orig_node *orig_node, void schedule_forward_packet(struct orig_node *orig_node,
struct ethhdr *ethhdr, struct ethhdr *ethhdr,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
uint8_t directlink, int hna_buff_len, uint8_t directlink, int hna_buff_len,
struct batman_if *if_outgoing); struct hard_iface *if_outgoing);
int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb); int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb);
void send_outstanding_bat_packet(struct work_struct *work); void send_outstanding_bat_packet(struct work_struct *work);
void purge_outstanding_packets(struct bat_priv *bat_priv, void purge_outstanding_packets(struct bat_priv *bat_priv,
struct batman_if *batman_if); struct hard_iface *hard_iface);
#endif /* _NET_BATMAN_ADV_SEND_H_ */ #endif /* _NET_BATMAN_ADV_SEND_H_ */
...@@ -414,7 +414,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) ...@@ -414,7 +414,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
} }
void interface_rx(struct net_device *soft_iface, void interface_rx(struct net_device *soft_iface,
struct sk_buff *skb, struct batman_if *recv_if, struct sk_buff *skb, struct hard_iface *recv_if,
int hdr_size) int hdr_size)
{ {
struct bat_priv *bat_priv = netdev_priv(soft_iface); struct bat_priv *bat_priv = netdev_priv(soft_iface);
......
...@@ -27,7 +27,7 @@ int softif_neigh_seq_print_text(struct seq_file *seq, void *offset); ...@@ -27,7 +27,7 @@ int softif_neigh_seq_print_text(struct seq_file *seq, void *offset);
void softif_neigh_purge(struct bat_priv *bat_priv); void softif_neigh_purge(struct bat_priv *bat_priv);
int interface_tx(struct sk_buff *skb, struct net_device *soft_iface); int interface_tx(struct sk_buff *skb, struct net_device *soft_iface);
void interface_rx(struct net_device *soft_iface, void interface_rx(struct net_device *soft_iface,
struct sk_buff *skb, struct batman_if *recv_if, struct sk_buff *skb, struct hard_iface *recv_if,
int hdr_size); int hdr_size);
struct net_device *softif_create(char *name); struct net_device *softif_create(char *name);
void softif_destroy(struct net_device *soft_iface); void softif_destroy(struct net_device *soft_iface);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
sizeof(struct bcast_packet)))) sizeof(struct bcast_packet))))
struct batman_if { struct hard_iface {
struct list_head list; struct list_head list;
int16_t if_num; int16_t if_num;
char if_status; char if_status;
...@@ -124,7 +124,7 @@ struct neigh_node { ...@@ -124,7 +124,7 @@ struct neigh_node {
atomic_t refcount; atomic_t refcount;
struct rcu_head rcu; struct rcu_head rcu;
struct orig_node *orig_node; struct orig_node *orig_node;
struct batman_if *if_incoming; struct hard_iface *if_incoming;
}; };
...@@ -148,7 +148,7 @@ struct bat_priv { ...@@ -148,7 +148,7 @@ struct bat_priv {
struct hlist_head softif_neigh_list; struct hlist_head softif_neigh_list;
struct softif_neigh *softif_neigh; struct softif_neigh *softif_neigh;
struct debug_log *debug_log; struct debug_log *debug_log;
struct batman_if *primary_if; struct hard_iface *primary_if;
struct kobject *mesh_obj; struct kobject *mesh_obj;
struct dentry *debug_dir; struct dentry *debug_dir;
struct hlist_head forw_bat_list; struct hlist_head forw_bat_list;
...@@ -217,7 +217,7 @@ struct forw_packet { ...@@ -217,7 +217,7 @@ struct forw_packet {
uint32_t direct_link_flags; uint32_t direct_link_flags;
uint8_t num_packets; uint8_t num_packets;
struct delayed_work delayed_work; struct delayed_work delayed_work;
struct batman_if *if_incoming; struct hard_iface *if_incoming;
}; };
/* While scanning for vis-entries of a particular vis-originator /* While scanning for vis-entries of a particular vis-originator
......
...@@ -213,7 +213,7 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -213,7 +213,7 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
} }
int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct batman_if *batman_if, uint8_t dstaddr[]) struct hard_iface *hard_iface, uint8_t dstaddr[])
{ {
struct unicast_packet tmp_uc, *unicast_packet; struct unicast_packet tmp_uc, *unicast_packet;
struct sk_buff *frag_skb; struct sk_buff *frag_skb;
...@@ -258,12 +258,12 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -258,12 +258,12 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
frag1->flags = UNI_FRAG_HEAD | large_tail; frag1->flags = UNI_FRAG_HEAD | large_tail;
frag2->flags = large_tail; frag2->flags = large_tail;
seqno = atomic_add_return(2, &batman_if->frag_seqno); seqno = atomic_add_return(2, &hard_iface->frag_seqno);
frag1->seqno = htons(seqno - 1); frag1->seqno = htons(seqno - 1);
frag2->seqno = htons(seqno); frag2->seqno = htons(seqno);
send_skb_packet(skb, batman_if, dstaddr); send_skb_packet(skb, hard_iface, dstaddr);
send_skb_packet(frag_skb, batman_if, dstaddr); send_skb_packet(frag_skb, hard_iface, dstaddr);
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
drop_frag: drop_frag:
......
...@@ -32,7 +32,7 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -32,7 +32,7 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
void frag_list_free(struct list_head *head); void frag_list_free(struct list_head *head);
int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv); int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv);
int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct batman_if *batman_if, uint8_t dstaddr[]); struct hard_iface *hard_iface, uint8_t dstaddr[]);
static inline int frag_can_reassemble(struct sk_buff *skb, int mtu) static inline int frag_can_reassemble(struct sk_buff *skb, int mtu)
{ {
......
...@@ -730,7 +730,7 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv, ...@@ -730,7 +730,7 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,
struct orig_node *orig_node; struct orig_node *orig_node;
struct vis_packet *packet; struct vis_packet *packet;
struct sk_buff *skb; struct sk_buff *skb;
struct batman_if *batman_if; struct hard_iface *hard_iface;
uint8_t dstaddr[ETH_ALEN]; uint8_t dstaddr[ETH_ALEN];
int i; int i;
...@@ -755,12 +755,12 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv, ...@@ -755,12 +755,12 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,
continue; continue;
memcpy(packet->target_orig, orig_node->orig, ETH_ALEN); memcpy(packet->target_orig, orig_node->orig, ETH_ALEN);
batman_if = orig_node->router->if_incoming; hard_iface = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
skb = skb_clone(info->skb_packet, GFP_ATOMIC); skb = skb_clone(info->skb_packet, GFP_ATOMIC);
if (skb) if (skb)
send_skb_packet(skb, batman_if, dstaddr); send_skb_packet(skb, hard_iface, dstaddr);
} }
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册