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

[PATCH] bonding cleanup 2.6 - death of typedefs

Eliminate bonding_t/slave_t types and consolidate casting.
parent 7987c426
......@@ -2356,8 +2356,8 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
{
slave_t *slave, *start_at;
struct bonding *bond = (struct bonding *) dev->priv;
struct slave *slave, *start_at;
struct bonding *bond = (struct bonding *)dev->priv;
struct ethhdr *data = (struct ethhdr *)skb->data;
int slave_agg_no;
int slaves_in_agg;
......@@ -2379,7 +2379,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
slave = bond->prev;
/* check if bond is empty */
if ((slave == (struct slave *) bond) || (bond->slave_cnt == 0)) {
if ((slave == (struct slave *)bond) || (bond->slave_cnt == 0)) {
printk(KERN_DEBUG DRV_NAME ": Error: bond is empty\n");
dev_kfree_skb(skb);
read_unlock(&bond->lock);
......@@ -2413,7 +2413,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
}
slave_agg_no = (data->h_dest[5]^slave->dev->dev_addr[5]) % slaves_in_agg;
while (slave != (slave_t *)bond) {
while (slave != (struct slave *)bond) {
struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator;
if (agg && (agg->aggregator_identifier == agg_id)) {
......@@ -2432,7 +2432,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
}
}
if (slave == (slave_t *)bond) {
if (slave == (struct slave *)bond) {
printk(KERN_ERR DRV_NAME ": Error: Couldn't find a slave to tx on for aggregator ID %d\n", agg_id);
dev_kfree_skb(skb);
read_unlock(&bond->lock);
......
......@@ -257,7 +257,7 @@ tlb_deinitialize(struct bonding *bond)
}
/* Caller must hold bond lock for read */
static struct slave*
static struct slave *
tlb_get_least_loaded_slave(struct bonding *bond)
{
struct slave *slave;
......@@ -299,7 +299,7 @@ tlb_get_least_loaded_slave(struct bonding *bond)
}
/* Caller must hold bond lock for read */
struct slave*
struct slave *
tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -397,7 +397,7 @@ rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
static int
rlb_arp_recv(struct sk_buff *skb,
struct net_device *dev,
struct packet_type* ptype)
struct packet_type *ptype)
{
struct bonding *bond = (struct bonding *)dev->priv;
int ret = NET_RX_DROP;
......@@ -432,7 +432,7 @@ rlb_arp_recv(struct sk_buff *skb,
}
/* Caller must hold bond lock for read */
static struct slave*
static struct slave *
rlb_next_rx_slave(struct bonding *bond)
{
struct slave *rx_slave = NULL, *slave = NULL;
......@@ -607,7 +607,7 @@ rlb_req_update_slave_clients(struct bonding *bond, struct slave *slave)
u8 ntt = 0;
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
u8 mac_bcast[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
struct rlb_client_info* client_info = NULL;
struct rlb_client_info *client_info = NULL;
_lock_rx_hashtbl(bond);
......@@ -680,7 +680,7 @@ rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip)
}
/* Caller must hold both bond and ptr locks for read */
struct slave*
struct slave *
rlb_choose_channel(struct bonding *bond, struct arp_pkt *arp)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
......@@ -768,7 +768,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*
static struct slave *
rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
{
struct arp_pkt *arp = (struct arp_pkt *)skb->nh.raw;
......@@ -1287,7 +1287,7 @@ bond_alb_deinitialize(struct bonding *bond)
int
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 alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct slave *tx_slave = NULL;
......@@ -1652,7 +1652,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)
{
struct bonding *bond = dev->priv;
struct bonding *bond = (struct bonding *)dev->priv;
struct sockaddr *sa = addr;
struct slave *swap_slave = NULL;
int error = 0;
......
This diff is collapsed.
......@@ -61,7 +61,7 @@
((slave)->state == BOND_STATE_ACTIVE))
typedef struct slave {
struct slave {
struct slave *next;
struct slave *prev;
struct net_device *dev;
......@@ -76,7 +76,7 @@ typedef struct slave {
u8 perm_hwaddr[ETH_ALEN];
struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
struct tlb_slave_info tlb_info;
} slave_t;
};
/*
* Here are the locking policies for the two bonding locks:
......@@ -87,12 +87,12 @@ typedef struct slave {
* 3) When we lock with bond->ptrlock, we must lock with bond->lock
* beforehand.
*/
typedef struct bonding {
slave_t *next;
slave_t *prev;
slave_t *current_slave;
slave_t *primary_slave;
slave_t *current_arp_slave;
struct bonding {
struct slave *next;
struct slave *prev;
struct slave *current_slave;
struct slave *primary_slave;
struct slave *current_arp_slave;
__s32 slave_cnt;
rwlock_t lock;
rwlock_t ptrlock;
......@@ -109,22 +109,22 @@ typedef struct bonding {
unsigned short flags;
struct ad_bond_info ad_info;
struct alb_bond_info alb_info;
} bonding_t;
};
/* Forward declarations */
void bond_set_slave_active_flags(slave_t *slave);
void bond_set_slave_inactive_flags(slave_t *slave);
void bond_set_slave_active_flags(struct slave *slave);
void bond_set_slave_inactive_flags(struct slave *slave);
/**
* These functions can be used for iterating the slave list
* (which is circular)
* Caller must hold bond lock for read
*/
extern inline struct slave*
extern inline struct slave *
bond_get_first_slave(struct bonding *bond)
{
/* if there are no slaves return NULL */
if (bond->next == (slave_t *)bond) {
if (bond->next == (struct slave *)bond) {
return NULL;
}
return bond->next;
......@@ -133,7 +133,7 @@ bond_get_first_slave(struct bonding *bond)
/**
* Caller must hold bond lock for read
*/
extern inline struct slave*
extern inline struct slave *
bond_get_next_slave(struct bonding *bond, struct slave *slave)
{
/* If we have reached the last slave return NULL */
......@@ -148,13 +148,13 @@ bond_get_next_slave(struct bonding *bond, struct slave *slave)
*
* 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)
{
struct slave *our_slave = bond->next;
/* check if the list of slaves is empty */
if (our_slave == (slave_t *)bond) {
if (our_slave == (struct slave *)bond) {
return NULL;
}
......@@ -166,14 +166,14 @@ bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev)
return our_slave;
}
extern inline struct bonding*
extern inline struct bonding *
bond_get_bond_by_slave(struct slave *slave)
{
if (!slave || !slave->dev->master) {
return NULL;
}
return (struct bonding *)(slave->dev->master->priv);
return (struct bonding *)slave->dev->master->priv;
}
#endif /* _LINUX_BONDING_H */
......
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