[PATCH] aic7xxx_osm build fix
[cris-mirror.git] / drivers / net / bonding / bond_alb.h
blobe4091cd8d6547e6474c622f71283f794c8557f5e
1 /*
2 * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
22 * Changes:
24 * 2003/08/06 - Amir Noam <amir.noam at intel dot com>
25 * - Add support for setting bond's MAC address with special
26 * handling required for ALB/TLB.
28 * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
29 * - Code cleanup and style changes
32 #ifndef __BOND_ALB_H__
33 #define __BOND_ALB_H__
35 #include <linux/if_ether.h>
37 struct bonding;
38 struct slave;
40 #define BOND_ALB_INFO(bond) ((bond)->alb_info)
41 #define SLAVE_TLB_INFO(slave) ((slave)->tlb_info)
43 struct tlb_client_info {
44 struct slave *tx_slave; /* A pointer to slave used for transmiting
45 * packets to a Client that the Hash function
46 * gave this entry index.
48 u32 tx_bytes; /* Each Client acumulates the BytesTx that
49 * were tranmitted to it, and after each
50 * CallBack the LoadHistory is devided
51 * by the balance interval
53 u32 load_history; /* This field contains the amount of Bytes
54 * that were transmitted to this client by
55 * the server on the previous balance
56 * interval in Bps.
58 u32 next; /* The next Hash table entry index, assigned
59 * to use the same adapter for transmit.
61 u32 prev; /* The previous Hash table entry index,
62 * assigned to use the same
66 /* -------------------------------------------------------------------------
67 * struct rlb_client_info contains all info related to a specific rx client
68 * connection. This is the Clients Hash Table entry struct
69 * -------------------------------------------------------------------------
71 struct rlb_client_info {
72 u32 ip_src; /* the server IP address */
73 u32 ip_dst; /* the client IP address */
74 u8 mac_dst[ETH_ALEN]; /* the client MAC address */
75 u32 next; /* The next Hash table entry index */
76 u32 prev; /* The previous Hash table entry index */
77 u8 assigned; /* checking whether this entry is assigned */
78 u8 ntt; /* flag - need to transmit client info */
79 struct slave *slave; /* the slave assigned to this client */
80 u8 tag; /* flag - need to tag skb */
81 unsigned short vlan_id; /* VLAN tag associated with IP address */
84 struct tlb_slave_info {
85 u32 head; /* Index to the head of the bi-directional clients
86 * hash table entries list. The entries in the list
87 * are the entries that were assigned to use this
88 * slave for transmit.
90 u32 load; /* Each slave sums the loadHistory of all clients
91 * assigned to it
95 struct alb_bond_info {
96 struct timer_list alb_timer;
97 struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */
98 spinlock_t tx_hashtbl_lock;
99 u32 unbalanced_load;
100 int tx_rebalance_counter;
101 int lp_counter;
102 /* -------- rlb parameters -------- */
103 int rlb_enabled;
104 struct packet_type rlb_pkt_type;
105 struct rlb_client_info *rx_hashtbl; /* Receive hash table */
106 spinlock_t rx_hashtbl_lock;
107 u32 rx_hashtbl_head;
108 u8 rx_ntt; /* flag - need to transmit
109 * to all rx clients
111 struct slave *next_rx_slave;/* next slave to be assigned
112 * to a new rx client for
114 u32 rlb_interval_counter;
115 u8 primary_is_promisc; /* boolean */
116 u32 rlb_promisc_timeout_counter;/* counts primary
117 * promiscuity time
119 u32 rlb_update_delay_counter;
120 u32 rlb_update_retry_counter;/* counter of retries
121 * of client update
123 u8 rlb_rebalance; /* flag - indicates that the
124 * rx traffic should be
125 * rebalanced
127 struct vlan_entry *current_alb_vlan;
130 int bond_alb_initialize(struct bonding *bond, int rlb_enabled);
131 void bond_alb_deinitialize(struct bonding *bond);
132 int bond_alb_init_slave(struct bonding *bond, struct slave *slave);
133 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave);
134 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link);
135 void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave);
136 int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
137 void bond_alb_monitor(struct bonding *bond);
138 int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr);
139 void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id);
140 #endif /* __BOND_ALB_H__ */