![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-or-later */ 0002 /* 0003 * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved. 0004 */ 0005 0006 #ifndef _NET_BOND_ALB_H 0007 #define _NET_BOND_ALB_H 0008 0009 #include <linux/if_ether.h> 0010 0011 struct bonding; 0012 struct slave; 0013 0014 #define BOND_ALB_INFO(bond) ((bond)->alb_info) 0015 #define SLAVE_TLB_INFO(slave) ((slave)->tlb_info) 0016 0017 #define ALB_TIMER_TICKS_PER_SEC 10 /* should be a divisor of HZ */ 0018 #define BOND_TLB_REBALANCE_INTERVAL 10 /* In seconds, periodic re-balancing. 0019 * Used for division - never set 0020 * to zero !!! 0021 */ 0022 #define BOND_ALB_DEFAULT_LP_INTERVAL 1 0023 #define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval) /* In seconds, periodic send of 0024 * learning packets to the switch 0025 */ 0026 0027 #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ 0028 * ALB_TIMER_TICKS_PER_SEC) 0029 0030 #define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \ 0031 * ALB_TIMER_TICKS_PER_SEC) 0032 0033 #define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table. 0034 * Note that this value MUST NOT be smaller 0035 * because the key hash table is BYTE wide ! 0036 */ 0037 0038 0039 #define TLB_NULL_INDEX 0xffffffff 0040 0041 /* rlb defs */ 0042 #define RLB_HASH_TABLE_SIZE 256 0043 #define RLB_NULL_INDEX 0xffffffff 0044 #define RLB_UPDATE_DELAY (2*ALB_TIMER_TICKS_PER_SEC) /* 2 seconds */ 0045 #define RLB_ARP_BURST_SIZE 2 0046 #define RLB_UPDATE_RETRY 3 /* 3-ticks - must be smaller than the rlb 0047 * rebalance interval (5 min). 0048 */ 0049 /* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is 0050 * promiscuous after failover 0051 */ 0052 #define RLB_PROMISC_TIMEOUT (10*ALB_TIMER_TICKS_PER_SEC) 0053 0054 0055 struct tlb_client_info { 0056 struct slave *tx_slave; /* A pointer to slave used for transmiting 0057 * packets to a Client that the Hash function 0058 * gave this entry index. 0059 */ 0060 u32 tx_bytes; /* Each Client accumulates the BytesTx that 0061 * were transmitted to it, and after each 0062 * CallBack the LoadHistory is divided 0063 * by the balance interval 0064 */ 0065 u32 load_history; /* This field contains the amount of Bytes 0066 * that were transmitted to this client by 0067 * the server on the previous balance 0068 * interval in Bps. 0069 */ 0070 u32 next; /* The next Hash table entry index, assigned 0071 * to use the same adapter for transmit. 0072 */ 0073 u32 prev; /* The previous Hash table entry index, 0074 * assigned to use the same 0075 */ 0076 }; 0077 0078 /* ------------------------------------------------------------------------- 0079 * struct rlb_client_info contains all info related to a specific rx client 0080 * connection. This is the Clients Hash Table entry struct. 0081 * Note that this is not a proper hash table; if a new client's IP address 0082 * hash collides with an existing client entry, the old entry is replaced. 0083 * 0084 * There is a linked list (linked by the used_next and used_prev members) 0085 * linking all the used entries of the hash table. This allows updating 0086 * all the clients without walking over all the unused elements of the table. 0087 * 0088 * There are also linked lists of entries with identical hash(ip_src). These 0089 * allow cleaning up the table from ip_src<->mac_src associations that have 0090 * become outdated and would cause sending out invalid ARP updates to the 0091 * network. These are linked by the (src_next and src_prev members). 0092 * ------------------------------------------------------------------------- 0093 */ 0094 struct rlb_client_info { 0095 __be32 ip_src; /* the server IP address */ 0096 __be32 ip_dst; /* the client IP address */ 0097 u8 mac_src[ETH_ALEN]; /* the server MAC address */ 0098 u8 mac_dst[ETH_ALEN]; /* the client MAC address */ 0099 0100 /* list of used hash table entries, starting at rx_hashtbl_used_head */ 0101 u32 used_next; 0102 u32 used_prev; 0103 0104 /* ip_src based hashing */ 0105 u32 src_next; /* next entry with same hash(ip_src) */ 0106 u32 src_prev; /* prev entry with same hash(ip_src) */ 0107 u32 src_first; /* first entry with hash(ip_src) == this entry's index */ 0108 0109 u8 assigned; /* checking whether this entry is assigned */ 0110 u8 ntt; /* flag - need to transmit client info */ 0111 struct slave *slave; /* the slave assigned to this client */ 0112 unsigned short vlan_id; /* VLAN tag associated with IP address */ 0113 }; 0114 0115 struct tlb_slave_info { 0116 u32 head; /* Index to the head of the bi-directional clients 0117 * hash table entries list. The entries in the list 0118 * are the entries that were assigned to use this 0119 * slave for transmit. 0120 */ 0121 u32 load; /* Each slave sums the loadHistory of all clients 0122 * assigned to it 0123 */ 0124 }; 0125 0126 struct alb_bond_info { 0127 struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */ 0128 u32 unbalanced_load; 0129 atomic_t tx_rebalance_counter; 0130 int lp_counter; 0131 /* -------- rlb parameters -------- */ 0132 int rlb_enabled; 0133 struct rlb_client_info *rx_hashtbl; /* Receive hash table */ 0134 u32 rx_hashtbl_used_head; 0135 u8 rx_ntt; /* flag - need to transmit 0136 * to all rx clients 0137 */ 0138 struct slave *rx_slave;/* last slave to xmit from */ 0139 u8 primary_is_promisc; /* boolean */ 0140 u32 rlb_promisc_timeout_counter;/* counts primary 0141 * promiscuity time 0142 */ 0143 u32 rlb_update_delay_counter; 0144 u32 rlb_update_retry_counter;/* counter of retries 0145 * of client update 0146 */ 0147 u8 rlb_rebalance; /* flag - indicates that the 0148 * rx traffic should be 0149 * rebalanced 0150 */ 0151 }; 0152 0153 int bond_alb_initialize(struct bonding *bond, int rlb_enabled); 0154 void bond_alb_deinitialize(struct bonding *bond); 0155 int bond_alb_init_slave(struct bonding *bond, struct slave *slave); 0156 void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave); 0157 void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link); 0158 void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave); 0159 int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev); 0160 int bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev); 0161 struct slave *bond_xmit_alb_slave_get(struct bonding *bond, 0162 struct sk_buff *skb); 0163 struct slave *bond_xmit_tlb_slave_get(struct bonding *bond, 0164 struct sk_buff *skb); 0165 void bond_alb_monitor(struct work_struct *); 0166 int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr); 0167 void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id); 0168 #endif /* _NET_BOND_ALB_H */ 0169
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |