1 /*
2 * Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
3 *
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.
8 *
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.
13 *
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.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 */
21
22 #ifndef __BOND_ALB_H__
23 #define __BOND_ALB_H__
24
25 #include <linux/if_ether.h>
26
27 struct bonding;
28 struct slave;
29
30 #define BOND_ALB_INFO(bond) ((bond)->alb_info)
31 #define SLAVE_TLB_INFO(slave) ((slave)->tlb_info)
32
33 struct tlb_client_info {
34 struct slave *tx_slave; /* A pointer to slave used for transmiting
35 * packets to a Client that the Hash function
36 * gave this entry index.
37 */
38 u32 tx_bytes; /* Each Client acumulates the BytesTx that
39 * were tranmitted to it, and after each
40 * CallBack the LoadHistory is devided
41 * by the balance interval
42 */
43 u32 load_history; /* This field contains the amount of Bytes
44 * that were transmitted to this client by
45 * the server on the previous balance
46 * interval in Bps.
47 */
48 u32 next; /* The next Hash table entry index, assigned
49 * to use the same adapter for transmit.
50 */
51 u32 prev; /* The previous Hash table entry index,
52 * assigned to use the same
53 */
54 };
55
56 /* -------------------------------------------------------------------------
57 * struct rlb_client_info contains all info related to a specific rx client
58 * connection. This is the Clients Hash Table entry struct
59 * -------------------------------------------------------------------------
60 */
61 struct rlb_client_info {
62 u32 ip_src; /* the server IP address */
63 u32 ip_dst; /* the client IP address */
64 u8 mac_dst[ETH_ALEN]; /* the client MAC address */
65 u32 next; /* The next Hash table entry index */
66 u32 prev; /* The previous Hash table entry index */
67 u8 assigned; /* checking whether this entry is assigned */
68 u8 ntt; /* flag - need to transmit client info */
69 struct slave *slave; /* the slave assigned to this client */
70 };
71
72 struct tlb_slave_info {
73 u32 head; /* Index to the head of the bi-directional clients
74 * hash table entries list. The entries in the list
75 * are the entries that were assigned to use this
76 * slave for transmit.
77 */
78 u32 load; /* Each slave sums the loadHistory of all clients
79 * assigned to it
80 */
81 };
82
83 struct alb_bond_info {
84 struct timer_list alb_timer;
85 struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */
86 spinlock_t tx_hashtbl_lock;
87 u32 unbalanced_load;
88 int tx_rebalance_counter;
89 int lp_counter;
90 /* -------- rlb parameters -------- */
91 int rlb_enabled;
92 struct packet_type rlb_pkt_type;
93 struct rlb_client_info *rx_hashtbl; /* Receive hash table */
94 spinlock_t rx_hashtbl_lock;
95 u32 rx_hashtbl_head;
96 u8 rx_ntt; /* flag - need to transmit
97 * to all rx clients
98 */
99 struct slave *next_rx_slave;/* next slave to be assigned
100 * to a new rx client for
101 */
102 u32 rlb_interval_counter;
103 u8 primary_is_promisc; /* boolean */
104 u32 rlb_promisc_timeout_counter;/* counts primary
105 * promiscuity time
106 */
107 u32 rlb_update_delay_counter;
108 u32 rlb_update_retry_counter;/* counter of retries
109 * of client update
110 */
111 u8 rlb_rebalance; /* flag - indicates that the
112 * rx traffic should be
113 * rebalanced
114 */
115 };
116
117 int bond_alb_initialize(struct bonding *bond, int rlb_enabled);
118 void bond_alb_deinitialize(struct bonding *bond);
119 int bond_alb_init_slave(struct bonding *bond, struct slave *slave);
120 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave);
121 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link);
122 void bond_alb_assign_current_slave(struct bonding *bond, struct slave *new_slave);
123 int bond_alb_xmit(struct sk_buff *skb, struct net_device *dev);
124 void bond_alb_monitor(struct bonding *bond);
125
126 #endif /* __BOND_ALB_H__ */
127
Cache object: 53e33759c2afe7b8bfce2b9f3a3cf190
|