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