Commit b04af6ee authored by Shmulik Hen's avatar Shmulik Hen Committed by Jeff Garzik

[PATCH] bonding cleanup 2.6 - Consolidate function declarations

All functions begin with bond_
Return value, function name and all params are on the same line.
parent 3d91647a
......@@ -112,8 +112,7 @@ struct arp_pkt {
/* Forward declaration */
static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]);
static inline u8
_simple_hash(u8 *hash_start, int hash_size)
static inline u8 _simple_hash(u8 *hash_start, int hash_size)
{
int i;
u8 hash = 0;
......@@ -127,21 +126,18 @@ _simple_hash(u8 *hash_start, int hash_size)
/*********************** tlb specific functions ***************************/
static inline void
_lock_tx_hashtbl(struct bonding *bond)
static inline void _lock_tx_hashtbl(struct bonding *bond)
{
spin_lock(&(BOND_ALB_INFO(bond).tx_hashtbl_lock));
}
static inline void
_unlock_tx_hashtbl(struct bonding *bond)
static inline void _unlock_tx_hashtbl(struct bonding *bond)
{
spin_unlock(&(BOND_ALB_INFO(bond).tx_hashtbl_lock));
}
/* Caller must hold tx_hashtbl lock */
static inline void
tlb_init_table_entry(struct tlb_client_info *entry, u8 save_load)
static inline void tlb_init_table_entry(struct tlb_client_info *entry, u8 save_load)
{
if (save_load) {
entry->load_history = 1 + entry->tx_bytes /
......@@ -153,16 +149,14 @@ tlb_init_table_entry(struct tlb_client_info *entry, u8 save_load)
entry->prev = TLB_NULL_INDEX;
}
static inline void
tlb_init_slave(struct slave *slave)
static inline void tlb_init_slave(struct slave *slave)
{
SLAVE_TLB_INFO(slave).load = 0;
SLAVE_TLB_INFO(slave).head = TLB_NULL_INDEX;
}
/* Caller must hold bond lock for read */
static inline void
tlb_clear_slave(struct bonding *bond, struct slave *slave, u8 save_load)
static void tlb_clear_slave(struct bonding *bond, struct slave *slave, u8 save_load)
{
struct tlb_client_info *tx_hash_table = NULL;
u32 index;
......@@ -183,8 +177,7 @@ tlb_clear_slave(struct bonding *bond, struct slave *slave, u8 save_load)
}
/* Must be called before starting the monitor timer */
static int
tlb_initialize(struct bonding *bond)
static int tlb_initialize(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
int i;
......@@ -214,8 +207,7 @@ tlb_initialize(struct bonding *bond)
}
/* Must be called only after all slaves have been released */
static void
tlb_deinitialize(struct bonding *bond)
static void tlb_deinitialize(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -226,8 +218,7 @@ tlb_deinitialize(struct bonding *bond)
}
/* Caller must hold bond lock for read */
static struct slave *
tlb_get_least_loaded_slave(struct bonding *bond)
static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
{
struct slave *slave;
struct slave *least_loaded;
......@@ -266,8 +257,7 @@ tlb_get_least_loaded_slave(struct bonding *bond)
}
/* Caller must hold bond lock for read */
struct slave *
tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len)
struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct tlb_client_info *hash_table = NULL;
......@@ -309,14 +299,12 @@ tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len)
}
/*********************** rlb specific functions ***************************/
static inline void
_lock_rx_hashtbl(struct bonding *bond)
static inline void _lock_rx_hashtbl(struct bonding *bond)
{
spin_lock(&(BOND_ALB_INFO(bond).rx_hashtbl_lock));
}
static inline void
_unlock_rx_hashtbl(struct bonding *bond)
static inline void _unlock_rx_hashtbl(struct bonding *bond)
{
spin_unlock(&(BOND_ALB_INFO(bond).rx_hashtbl_lock));
}
......@@ -324,8 +312,7 @@ _unlock_rx_hashtbl(struct bonding *bond)
/* when an ARP REPLY is received from a client update its info
* in the rx_hashtbl
*/
static void
rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
{
u32 hash_index;
struct rlb_client_info *client_info = NULL;
......@@ -349,10 +336,7 @@ rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
_unlock_rx_hashtbl(bond);
}
static int
rlb_arp_recv(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *ptype)
static int rlb_arp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype)
{
struct bonding *bond = (struct bonding *)dev->priv;
int ret = NET_RX_DROP;
......@@ -387,8 +371,7 @@ rlb_arp_recv(struct sk_buff *skb,
}
/* Caller must hold bond lock for read */
static struct slave *
rlb_next_rx_slave(struct bonding *bond)
static struct slave *rlb_next_rx_slave(struct bonding *bond)
{
struct slave *rx_slave = NULL, *slave = NULL;
unsigned int i = 0;
......@@ -422,8 +405,7 @@ rlb_next_rx_slave(struct bonding *bond)
*
* Caller must hold bond->ptrlock for write or bond lock for write
*/
static void
rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
{
if (!bond->current_slave) {
return;
......@@ -441,8 +423,7 @@ rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
*
* Caller must hold bond lock for read
*/
static void
rlb_clear_slave(struct bonding *bond, struct slave *slave)
static void rlb_clear_slave(struct bonding *bond, struct slave *slave)
{
struct rlb_client_info *rx_hash_table = NULL;
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -491,8 +472,7 @@ rlb_clear_slave(struct bonding *bond, struct slave *slave)
write_unlock(&bond->ptrlock);
}
static void
rlb_update_client(struct rlb_client_info *client_info)
static void rlb_update_client(struct rlb_client_info *client_info)
{
int i = 0;
......@@ -512,8 +492,7 @@ rlb_update_client(struct rlb_client_info *client_info)
}
/* sends ARP REPLIES that update the clients that need updating */
static void
rlb_update_rx_clients(struct bonding *bond)
static void rlb_update_rx_clients(struct bonding *bond)
{
u32 hash_index;
struct rlb_client_info *client_info = NULL;
......@@ -541,8 +520,7 @@ rlb_update_rx_clients(struct bonding *bond)
}
/* The slave was assigned a new mac address - update the clients */
static void
rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave)
static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave)
{
u32 hash_index;
u8 ntt = 0;
......@@ -574,8 +552,7 @@ rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave)
}
/* mark all clients using src_ip to be updated */
static void
rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip)
static void rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip)
{
u32 hash_index;
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -611,8 +588,7 @@ rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip)
}
/* Caller must hold both bond and ptr locks for read */
struct slave *
rlb_choose_channel(struct bonding *bond, struct arp_pkt *arp)
struct slave *rlb_choose_channel(struct bonding *bond, struct arp_pkt *arp)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct rlb_client_info *client_info = NULL;
......@@ -694,8 +670,7 @@ rlb_choose_channel(struct bonding *bond, struct arp_pkt *arp)
* does not choose channel for other arp types since they are
* sent on the current_slave
*/
static struct slave *
rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
{
struct arp_pkt *arp = (struct arp_pkt *)skb->nh.raw;
struct slave *tx_slave = NULL;
......@@ -736,8 +711,7 @@ rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
}
/* Caller must hold bond lock for read */
static void
rlb_rebalance(struct bonding *bond)
static void rlb_rebalance(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct slave *assigned_slave = NULL;
......@@ -766,16 +740,14 @@ rlb_rebalance(struct bonding *bond)
}
/* Caller must hold rx_hashtbl lock */
static inline void
rlb_init_table_entry(struct rlb_client_info *entry)
static void rlb_init_table_entry(struct rlb_client_info *entry)
{
memset(entry, 0, sizeof(struct rlb_client_info));
entry->next = RLB_NULL_INDEX;
entry->prev = RLB_NULL_INDEX;
}
static int
rlb_initialize(struct bonding *bond)
static int rlb_initialize(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type);
......@@ -814,8 +786,7 @@ rlb_initialize(struct bonding *bond)
return 0;
}
static void
rlb_deinitialize(struct bonding *bond)
static void rlb_deinitialize(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -829,8 +800,7 @@ rlb_deinitialize(struct bonding *bond)
/*********************** tlb/rlb shared functions *********************/
static void
alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
{
struct sk_buff *skb = NULL;
struct learning_pkt pkt;
......@@ -866,8 +836,7 @@ alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
* set the hw address of the device as well as the hw address of the
* net_device
*/
static int
alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
{
struct net_device *dev = NULL;
struct sockaddr s_addr;
......@@ -896,10 +865,7 @@ alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
}
/* Caller must hold bond lock for write or ptrlock for write*/
static void
alb_swap_mac_addr(struct bonding *bond,
struct slave *slave1,
struct slave *slave2)
static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct slave *slave2)
{
u8 tmp_mac_addr[ETH_ALEN];
struct slave *disabled_slave = NULL;
......@@ -959,8 +925,7 @@ alb_swap_mac_addr(struct bonding *bond,
*
* Caller must hold bond lock
*/
static void
alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
{
struct slave *tmp_slave;
int perm_curr_diff;
......@@ -1014,8 +979,7 @@ alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
* caller must hold the bond lock for write since the mac addresses are compared
* and may be swapped.
*/
static int
alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave)
static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave)
{
struct slave *tmp_slave1, *tmp_slave2, *free_mac_slave;
int i, j, found = 0;
......@@ -1109,8 +1073,7 @@ alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave)
*
* Unwinding assumes bond's mac address has not yet changed.
*/
static inline int
alb_set_mac_address(struct bonding *bond, void *addr)
static int alb_set_mac_address(struct bonding *bond, void *addr)
{
struct sockaddr sa;
struct slave *slave, *stop_at;
......@@ -1160,8 +1123,7 @@ alb_set_mac_address(struct bonding *bond, void *addr)
/************************ exported alb funcions ************************/
int
bond_alb_initialize(struct bonding *bond, int rlb_enabled)
int bond_alb_initialize(struct bonding *bond, int rlb_enabled)
{
int res;
......@@ -1183,8 +1145,7 @@ bond_alb_initialize(struct bonding *bond, int rlb_enabled)
return 0;
}
void
bond_alb_deinitialize(struct bonding *bond)
void bond_alb_deinitialize(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -1195,8 +1156,7 @@ bond_alb_deinitialize(struct bonding *bond)
}
}
int
bond_alb_xmit(struct sk_buff *skb, struct net_device *dev)
int bond_alb_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct bonding *bond = (struct bonding *)dev->priv;
struct ethhdr *eth_data = (struct ethhdr *)skb->data;
......@@ -1314,8 +1274,7 @@ bond_alb_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}
void
bond_alb_monitor(struct bonding *bond)
void bond_alb_monitor(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct slave *slave = NULL;
......@@ -1421,8 +1380,7 @@ bond_alb_monitor(struct bonding *bond)
/* assumption: called before the slave is attched to the bond
* and not locked by the bond lock
*/
int
bond_alb_init_slave(struct bonding *bond, struct slave *slave)
int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
{
int err = 0;
......@@ -1458,8 +1416,7 @@ bond_alb_init_slave(struct bonding *bond, struct slave *slave)
}
/* Caller must hold bond lock for write */
void
bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
{
if (bond->slave_cnt > 1) {
alb_change_hw_addr_on_detach(bond, slave);
......@@ -1474,9 +1431,7 @@ bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
}
/* Caller must hold bond lock for read */
void
bond_alb_handle_link_change(struct bonding *bond, struct slave *slave,
char link)
void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -1500,7 +1455,7 @@ bond_alb_handle_link_change(struct bonding *bond, struct slave *slave,
}
/**
* bond_alb_assign_current_slave - assign new current_slave
* bond_alb_handle_active_change - assign new current_slave
* @bond: our bonding struct
* @new_slave: new slave to assign
*
......@@ -1509,8 +1464,7 @@ bond_alb_handle_link_change(struct bonding *bond, struct slave *slave,
*
* Caller must hold bond ptrlock for write (or bond lock for write)
*/
void
bond_alb_assign_current_slave(struct bonding *bond, struct slave *new_slave)
void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave)
{
struct slave *swap_slave = bond->current_slave;
int i, found = 0;
......@@ -1558,8 +1512,7 @@ bond_alb_assign_current_slave(struct bonding *bond, struct slave *new_slave)
}
}
int
bond_alb_set_mac_address(struct net_device *dev, void *addr)
int bond_alb_set_mac_address(struct net_device *dev, void *addr)
{
struct bonding *bond = (struct bonding *)dev->priv;
struct sockaddr *sa = addr;
......
......@@ -126,7 +126,7 @@ void bond_alb_deinitialize(struct bonding *bond);
int bond_alb_init_slave(struct bonding *bond, struct slave *slave);
void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave);
void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link);
void bond_alb_assign_current_slave(struct bonding *bond, struct slave *new_slave);
void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave);
int bond_alb_xmit(struct sk_buff *skb, struct net_device *dev);
void bond_alb_monitor(struct bonding *bond);
int bond_alb_set_mac_address(struct net_device *dev, void *addr);
......
......@@ -577,27 +577,27 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *dev);
static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *dev);
static struct net_device_stats *bond_get_stats(struct net_device *dev);
static void bond_mii_monitor(struct net_device *dev);
static void loadbalance_arp_monitor(struct net_device *dev);
static void activebackup_arp_monitor(struct net_device *dev);
static void bond_loadbalance_arp_mon(struct net_device *dev);
static void bond_activebackup_arp_mon(struct net_device *dev);
static void bond_mc_list_destroy(struct bonding *bond);
static void bond_mc_add(struct bonding *bond, void *addr, int alen);
static void bond_mc_delete(struct bonding *bond, void *addr, int alen);
static int bond_mc_list_copy (struct dev_mc_list *src, struct bonding *dst, int gpf_flag);
static inline int dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2);
static int bond_mc_list_copy(struct dev_mc_list *src, struct bonding *dst, int gpf_flag);
static inline int bond_is_dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2);
static void bond_set_promiscuity(struct bonding *bond, int inc);
static void bond_set_allmulti(struct bonding *bond, int inc);
static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, struct dev_mc_list *mc_list);
static void bond_mc_update(struct bonding *bond, struct slave *new, struct slave *old);
static void bond_mc_swap(struct bonding *bond, struct slave *new, struct slave *old);
static int bond_enslave(struct net_device *master, struct net_device *slave);
static int bond_release(struct net_device *master, struct net_device *slave);
static int bond_release_all(struct net_device *master);
static int bond_sethwaddr(struct net_device *master, struct net_device *slave);
static void change_active_interface(struct bonding *bond, struct slave *new);
static void reselect_active_interface(struct bonding *bond);
static struct slave *find_best_interface(struct bonding *bond);
static void bond_change_active_slave(struct bonding *bond, struct slave *new);
static void bond_select_active_slave(struct bonding *bond);
static struct slave *bond_find_best_slave(struct bonding *bond);
static void arp_send_all(struct slave *slave)
static void bond_arp_send_all(struct slave *slave)
{
int i;
......@@ -609,8 +609,7 @@ static void arp_send_all(struct slave *slave)
}
static const char *
bond_mode_name(void)
static const char *bond_mode_name(void)
{
switch (bond_mode) {
case BOND_MODE_ROUNDROBIN :
......@@ -654,8 +653,7 @@ void bond_set_slave_active_flags(struct slave *slave)
*
* bond->lock held for writing by caller.
*/
static void
bond_detach_slave(struct bonding *bond, struct slave *slave)
static void bond_detach_slave(struct bonding *bond, struct slave *slave)
{
if (slave->next) {
slave->next->prev = slave->prev;
......@@ -683,8 +681,7 @@ bond_detach_slave(struct bonding *bond, struct slave *slave)
*
* bond->lock held for writing by caller.
*/
static void
bond_attach_slave(struct bonding *bond, struct slave *new_slave)
static void bond_attach_slave(struct bonding *bond, struct slave *new_slave)
{
if (bond->first_slave == NULL) { /* attaching the first slave */
new_slave->next = new_slave;
......@@ -783,8 +780,7 @@ static int bond_update_speed_duplex(struct slave *slave)
* It'd be nice if there was a good way to tell if a driver supports
* netif_carrier, but there really isn't.
*/
static int
bond_check_dev_link(struct net_device *dev, int reporting)
static int bond_check_dev_link(struct net_device *dev, int reporting)
{
static int (* ioctl)(struct net_device *, struct ifreq *, int);
struct ifreq ifr;
......@@ -902,9 +898,9 @@ static int bond_open(struct net_device *dev)
arp_timer->expires = jiffies + 1;
arp_timer->data = (unsigned long)dev;
if (bond_mode == BOND_MODE_ACTIVEBACKUP) {
arp_timer->function = (void *)&activebackup_arp_monitor;
arp_timer->function = (void *)&bond_activebackup_arp_mon;
} else {
arp_timer->function = (void *)&loadbalance_arp_monitor;
arp_timer->function = (void *)&bond_loadbalance_arp_mon;
}
add_timer(arp_timer);
}
......@@ -930,7 +926,7 @@ static int bond_close(struct net_device *master)
write_lock_bh(&bond->lock);
bond_mc_list_destroy (bond);
bond_mc_list_destroy(bond);
if (bond_mode == BOND_MODE_8023AD) {
/* Unregister the receive of LACPDUs */
......@@ -1054,8 +1050,7 @@ static void bond_mc_delete(struct bonding *bond, void *addr, int alen)
/*
* Copy all the Multicast addresses from src to the bonding device dst
*/
static int bond_mc_list_copy (struct dev_mc_list *src, struct bonding *dst,
int gpf_flag)
static int bond_mc_list_copy(struct dev_mc_list *src, struct bonding *dst, int gpf_flag)
{
struct dev_mc_list *dmi, *new_dmi;
......@@ -1080,7 +1075,7 @@ static int bond_mc_list_copy (struct dev_mc_list *src, struct bonding *dst,
/*
* Returns 0 if dmi1 and dmi2 are the same, non-0 otherwise
*/
static inline int dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2)
static inline int bond_is_dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2)
{
return memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0 &&
dmi1->dmi_addrlen == dmi2->dmi_addrlen;
......@@ -1127,20 +1122,19 @@ static void bond_set_allmulti(struct bonding *bond, int inc)
/*
* returns dmi entry if found, NULL otherwise
*/
static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi,
struct dev_mc_list *mc_list)
static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, struct dev_mc_list *mc_list)
{
struct dev_mc_list *idmi;
for (idmi = mc_list; idmi != NULL; idmi = idmi->next) {
if (dmi_same(dmi, idmi)) {
if (bond_is_dmi_same(dmi, idmi)) {
return idmi;
}
}
return NULL;
}
static void set_multicast_list(struct net_device *master)
static void bond_set_multicast_list(struct net_device *master)
{
struct bonding *bond = (struct bonding *)master->priv;
struct dev_mc_list *dmi;
......@@ -1179,8 +1173,8 @@ static void set_multicast_list(struct net_device *master)
/* save master's multicast list */
bond_mc_list_destroy (bond);
bond_mc_list_copy (master->mc_list, bond, GFP_ATOMIC);
bond_mc_list_destroy(bond);
bond_mc_list_copy(master->mc_list, bond, GFP_ATOMIC);
write_unlock_bh(&bond->lock);
}
......@@ -1190,7 +1184,7 @@ static void set_multicast_list(struct net_device *master)
* old active slaves (if any) according to the multicast mode, and
* promiscuous flags unconditionally.
*/
static void bond_mc_update(struct bonding *bond, struct slave *new, struct slave *old)
static void bond_mc_swap(struct bonding *bond, struct slave *new, struct slave *old)
{
struct dev_mc_list *dmi;
......@@ -1227,8 +1221,7 @@ static void bond_mc_update(struct bonding *bond, struct slave *new, struct slave
}
/* enslave device <slave> to bond device <master> */
static int bond_enslave(struct net_device *master_dev,
struct net_device *slave_dev)
static int bond_enslave(struct net_device *master_dev, struct net_device *slave_dev)
{
struct bonding *bond = NULL;
struct slave *new_slave = NULL;
......@@ -1484,7 +1477,7 @@ static int bond_enslave(struct net_device *master_dev,
dprintk("This is the first active slave\n");
/* first slave or no active slave yet, and this link
is OK, so make this interface the active one */
change_active_interface(bond, new_slave);
bond_change_active_slave(bond, new_slave);
}
else {
dprintk("This is just a backup slave\n");
......@@ -1519,7 +1512,7 @@ static int bond_enslave(struct net_device *master_dev,
/* first slave or no active slave yet, and this link
* is OK, so make this interface the active one
*/
change_active_interface(bond, new_slave);
bond_change_active_slave(bond, new_slave);
}
break;
default:
......@@ -1608,7 +1601,7 @@ static int bond_enslave(struct net_device *master_dev,
* In these cases, this fuction does nothing.
* In the other cases, currnt_slave pointer is changed and 0 is returned.
*/
static int bond_change_active(struct net_device *master_dev, struct net_device *slave_dev)
static int bond_ioctl_change_active(struct net_device *master_dev, struct net_device *slave_dev)
{
struct bonding *bond;
struct slave *oldactive = NULL;
......@@ -1640,7 +1633,7 @@ static int bond_change_active(struct net_device *master_dev, struct net_device *
(oldactive != NULL)&&
(newactive->link == BOND_LINK_UP)&&
IS_UP(newactive->dev)) {
change_active_interface(bond, newactive);
bond_change_active_slave(bond, newactive);
} else {
ret = -EINVAL;
}
......@@ -1654,7 +1647,7 @@ static int bond_change_active(struct net_device *master_dev, struct net_device *
*
* Warning: Caller must hold ptrlock for writing.
*/
static struct slave *find_best_interface(struct bonding *bond)
static struct slave *bond_find_best_slave(struct bonding *bond)
{
struct slave *newslave, *oldslave;
struct slave *bestslave = NULL;
......@@ -1719,7 +1712,7 @@ static struct slave *find_best_interface(struct bonding *bond)
*
* Warning: Caller must hold ptrlock for writing.
*/
static void change_active_interface(struct bonding *bond, struct slave *new)
static void bond_change_active_slave(struct bonding *bond, struct slave *new)
{
struct slave *old = bond->current_slave;
......@@ -1770,12 +1763,12 @@ static void change_active_interface(struct bonding *bond, struct slave *new)
}
if (USES_PRIMARY(bond_mode)) {
bond_mc_update(bond, new, old);
bond_mc_swap(bond, new, old);
}
if ((bond_mode == BOND_MODE_TLB) ||
(bond_mode == BOND_MODE_ALB)) {
bond_alb_assign_current_slave(bond, new);
bond_alb_handle_active_change(bond, new);
} else {
bond->current_slave = new;
}
......@@ -1792,14 +1785,14 @@ static void change_active_interface(struct bonding *bond, struct slave *new)
*
* Warning: Caller must hold ptrlock for writing.
*/
static void reselect_active_interface(struct bonding *bond)
static void bond_select_active_slave(struct bonding *bond)
{
struct slave *best_slave;
best_slave = find_best_interface(bond);
best_slave = bond_find_best_slave(bond);
if (best_slave != bond->current_slave) {
change_active_interface(bond, best_slave);
bond_change_active_slave(bond, best_slave);
}
}
......@@ -1889,8 +1882,8 @@ static int bond_release(struct net_device *master, struct net_device *slave)
}
if (bond->current_slave == our_slave) {
change_active_interface(bond, NULL);
reselect_active_interface(bond);
bond_change_active_slave(bond, NULL);
bond_select_active_slave(bond);
}
if (bond->current_slave == NULL) {
......@@ -1982,7 +1975,7 @@ static int bond_release_all(struct net_device *master)
bond->current_arp_slave = NULL;
bond->primary_slave = NULL;
change_active_interface(bond, NULL);
bond_change_active_slave(bond, NULL);
while ((our_slave = bond->first_slave) != NULL) {
/* Inform AD package of unbinding of slave
......@@ -2282,7 +2275,7 @@ static void bond_mii_monitor(struct net_device *master)
if (do_failover) {
write_lock(&bond->ptrlock);
reselect_active_interface(bond);
bond_select_active_slave(bond);
if (oldcurrent && !bond->current_slave) {
printk(KERN_INFO DRV_NAME
": %s: now running without any active "
......@@ -2306,7 +2299,7 @@ static void bond_mii_monitor(struct net_device *master)
* arp is transmitted to generate traffic. see activebackup_arp_monitor for
* arp monitoring in active backup mode.
*/
static void loadbalance_arp_monitor(struct net_device *master)
static void bond_loadbalance_arp_mon(struct net_device *master)
{
struct bonding *bond = (struct bonding *)master->priv;
struct slave *slave, *oldcurrent;
......@@ -2402,14 +2395,14 @@ static void loadbalance_arp_monitor(struct net_device *master)
* to be unstable during low/no traffic periods
*/
if (IS_UP(slave->dev)) {
arp_send_all(slave);
bond_arp_send_all(slave);
}
}
if (do_failover) {
write_lock(&bond->ptrlock);
reselect_active_interface(bond);
bond_select_active_slave(bond);
if (oldcurrent && !bond->current_slave) {
printk(KERN_INFO DRV_NAME
": %s: now running without any active "
......@@ -2441,7 +2434,7 @@ static void loadbalance_arp_monitor(struct net_device *master)
* may have received.
* see loadbalance_arp_monitor for arp monitoring in load balancing mode
*/
static void activebackup_arp_monitor(struct net_device *master)
static void bond_activebackup_arp_mon(struct net_device *master)
{
struct bonding *bond = (struct bonding *)master->priv;
struct slave *slave;
......@@ -2474,7 +2467,7 @@ static void activebackup_arp_monitor(struct net_device *master)
if ((bond->current_slave == NULL) &&
((jiffies - slave->dev->trans_start) <=
the_delta_in_ticks)) {
change_active_interface(bond, slave);
bond_change_active_slave(bond, slave);
bond->current_arp_slave = NULL;
} else if (bond->current_slave != slave) {
/* this slave has just come up but we
......@@ -2565,7 +2558,7 @@ static void activebackup_arp_monitor(struct net_device *master)
master->name,
slave->dev->name);
write_lock(&bond->ptrlock);
reselect_active_interface(bond);
bond_select_active_slave(bond);
slave = bond->current_slave;
write_unlock(&bond->ptrlock);
bond->current_arp_slave = slave;
......@@ -2586,7 +2579,7 @@ static void activebackup_arp_monitor(struct net_device *master)
/* primary is up so switch to it */
write_lock(&bond->ptrlock);
change_active_interface(bond, bond->primary_slave);
bond_change_active_slave(bond, bond->primary_slave);
write_unlock(&bond->ptrlock);
slave = bond->primary_slave;
slave->jiffies = jiffies;
......@@ -2598,7 +2591,7 @@ static void activebackup_arp_monitor(struct net_device *master)
* rx traffic
*/
if ((slave != NULL) && (my_ip != 0)) {
arp_send_all(slave);
bond_arp_send_all(slave);
}
}
......@@ -2620,7 +2613,7 @@ static void activebackup_arp_monitor(struct net_device *master)
if (IS_UP(slave->dev)) {
slave->link = BOND_LINK_BACK;
bond_set_slave_active_flags(slave);
arp_send_all(slave);
bond_arp_send_all(slave);
slave->jiffies = jiffies;
bond->current_arp_slave = slave;
break;
......@@ -2680,8 +2673,7 @@ static int bond_info_query(struct net_device *master, struct ifbond *info)
return 0;
}
static int bond_slave_info_query(struct net_device *master,
struct ifslave *info)
static int bond_slave_info_query(struct net_device *master, struct ifslave *info)
{
struct bonding *bond = (struct bonding *)master->priv;
struct slave *slave;
......@@ -2765,7 +2757,7 @@ static int bond_ethtool_ioctl(struct net_device *master_dev, struct ifreq *ifr)
}
}
static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd)
static int bond_do_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd)
{
struct net_device *slave_dev = NULL;
struct ifbond *u_binfo = NULL, k_binfo;
......@@ -2880,7 +2872,7 @@ static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd)
case BOND_CHANGE_ACTIVE_OLD:
case SIOCBONDCHANGEACTIVE:
if (USES_PRIMARY(bond_mode)) {
ret = bond_change_active(master_dev, slave_dev);
ret = bond_ioctl_change_active(master_dev, slave_dev);
}
else {
ret = -EINVAL;
......@@ -3349,7 +3341,7 @@ static struct file_operations bond_info_fops = {
.release = seq_release,
};
static int bond_create_proc_info(struct bonding *bond)
static int bond_create_proc_entry(struct bonding *bond)
{
struct net_device *dev = bond->device;
......@@ -3372,7 +3364,7 @@ static int bond_create_proc_info(struct bonding *bond)
return 0;
}
static void bond_destroy_proc_info(struct bonding *bond)
static void bond_remove_proc_entry(struct bonding *bond)
{
if (bond_proc_dir && bond->bond_proc_file) {
remove_proc_entry(bond->procdir_name, bond_proc_dir);
......@@ -3445,8 +3437,7 @@ static void bond_destroy_proc_dir(void)
* downing the master releases all slaves. We can make bonds full of
* bonding devices to test this, however.
*/
static inline int
bond_set_mac_address(struct net_device *dev, void *addr)
static int bond_set_mac_address(struct net_device *dev, void *addr)
{
struct bonding *bond = (struct bonding *)dev->priv;
struct sockaddr *sa = addr, tmp_sa;
......@@ -3522,8 +3513,7 @@ bond_set_mac_address(struct net_device *dev, void *addr)
/*
* Change the MTU of all of a master's slaves to match the master
*/
static inline int
bond_change_mtu(struct net_device *dev, int newmtu)
static int bond_change_mtu(struct net_device *dev, int newmtu)
{
struct bonding *bond = (struct bonding *)dev->priv;
struct slave *slave, *stop_at;
......@@ -3593,11 +3583,11 @@ bond_change_mtu(struct net_device *dev, int newmtu)
/*
* Change device name
*/
static inline int bond_event_changename(struct bonding *bond)
static int bond_event_changename(struct bonding *bond)
{
#ifdef CONFIG_PROC_FS
bond_destroy_proc_info(bond);
bond_create_proc_info(bond);
bond_remove_proc_entry(bond);
bond_create_proc_entry(bond);
#endif
return NOTIFY_DONE;
......@@ -3713,7 +3703,7 @@ static inline void bond_deinit(struct net_device *dev)
list_del(&bond->bond_list);
#ifdef CONFIG_PROC_FS
bond_destroy_proc_info(bond);
bond_remove_proc_entry(bond);
#endif
}
......@@ -3794,8 +3784,8 @@ static int __init bond_init(struct net_device *dev)
dev->get_stats = bond_get_stats;
dev->open = bond_open;
dev->stop = bond_close;
dev->set_multicast_list = set_multicast_list;
dev->do_ioctl = bond_ioctl;
dev->set_multicast_list = bond_set_multicast_list;
dev->do_ioctl = bond_do_ioctl;
dev->change_mtu = bond_change_mtu;
dev->tx_queue_len = 0;
dev->flags |= IFF_MASTER|IFF_MULTICAST;
......@@ -3825,7 +3815,7 @@ static int __init bond_init(struct net_device *dev)
}
#ifdef CONFIG_PROC_FS
bond_create_proc_info(bond);
bond_create_proc_entry(bond);
#endif
dev->destructor = free_netdev;
......@@ -3839,8 +3829,7 @@ static int __init bond_init(struct net_device *dev)
* Convert string input module parms. Accept either the
* number of the mode or its string name.
*/
static inline int
bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl)
static inline int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl)
{
int i;
......
......@@ -121,8 +121,8 @@ struct bonding {
* Caller must hold bond->lock
*/
#define bond_for_each_slave_from(bond, pos, cnt, start) \
for (cnt = 0, pos = start; \
cnt < (bond)->slave_cnt; \
for (cnt = 0, pos = start; \
cnt < (bond)->slave_cnt; \
cnt++, pos = (pos)->next)
/**
......@@ -156,8 +156,7 @@ struct bonding {
*
* Caller must hold bond lock for read
*/
extern inline struct slave *
bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev)
extern inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev)
{
struct slave *slave = NULL;
int i;
......@@ -171,8 +170,7 @@ bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev)
return slave;
}
extern inline struct bonding *
bond_get_bond_by_slave(struct slave *slave)
extern inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
{
if (!slave || !slave->dev->master) {
return NULL;
......
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