bond_3ad.h revision a10e14667635dde504ed9e7ee851494c2cf2ae8e
11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved. 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is free software; you can redistribute it and/or modify it 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * under the terms of the GNU General Public License as published by the Free 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Software Foundation; either version 2 of the License, or (at your option) 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * any later version. 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is distributed in the hope that it will be useful, but WITHOUT 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * more details. 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * You should have received a copy of the GNU General Public License along with 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * this program; if not, write to the Free Software Foundation, Inc., 59 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Temple Place - Suite 330, Boston, MA 02111-1307, USA. 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * The full GNU General Public License is included in this distribution in the 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * file called LICENSE. 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef __BOND_3AD_H__ 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define __BOND_3AD_H__ 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/byteorder.h> 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/skbuff.h> 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/netdevice.h> 29ed9b58bc443a1210b5be1ded6421b17e015bf985Richard Genoud#include <linux/if_ether.h> 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// General definitions 32ed9b58bc443a1210b5be1ded6421b17e015bf985Richard Genoud#define PKT_TYPE_LACPDU cpu_to_be16(ETH_P_SLOW) 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define AD_TIMER_INTERVAL 100 /*msec*/ 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02} 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define AD_LACP_SLOW 0 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define AD_LACP_FAST 1 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct mac_addr { 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 mac_addr_value[ETH_ALEN]; 42a10e14667635dde504ed9e7ee851494c2cf2ae8eVitalii Demianets} __packed mac_addr_t; 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 44fd989c83325cb34795bc4d4aa6b13c06f90eac99Jay Vosburghenum { 45fd989c83325cb34795bc4d4aa6b13c06f90eac99Jay Vosburgh BOND_AD_STABLE = 0, 46fd989c83325cb34795bc4d4aa6b13c06f90eac99Jay Vosburgh BOND_AD_BANDWIDTH = 1, 47fd989c83325cb34795bc4d4aa6b13c06f90eac99Jay Vosburgh BOND_AD_COUNT = 2, 48fd989c83325cb34795bc4d4aa6b13c06f90eac99Jay Vosburgh}; 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// rx machine states(43.4.11 in the 802.3ad standard) 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef enum { 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_RX_DUMMY, 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_RX_INITIALIZE, // rx Machine 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_RX_PORT_DISABLED, // rx Machine 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_RX_LACP_DISABLED, // rx Machine 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_RX_EXPIRED, // rx Machine 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_RX_DEFAULTED, // rx Machine 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_RX_CURRENT // rx Machine 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} rx_states_t; 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// periodic machine states(43.4.12 in the 802.3ad standard) 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef enum { 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_PERIODIC_DUMMY, 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_NO_PERIODIC, // periodic machine 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_FAST_PERIODIC, // periodic machine 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_SLOW_PERIODIC, // periodic machine 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_PERIODIC_TX // periodic machine 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} periodic_states_t; 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// mux machine states(43.4.13 in the 802.3ad standard) 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef enum { 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_MUX_DUMMY, 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_MUX_DETACHED, // mux machine 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_MUX_WAITING, // mux machine 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_MUX_ATTACHED, // mux machine 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_MUX_COLLECTING_DISTRIBUTING // mux machine 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} mux_states_t; 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// tx machine states(43.4.15 in the 802.3ad standard) 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef enum { 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_TX_DUMMY, 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_TRANSMIT // tx Machine 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} tx_states_t; 841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// rx indication types 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef enum { 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_TYPE_LACPDU = 1, // type lacpdu 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_TYPE_MARKER // type marker 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} pdu_type_t; 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// rx marker indication types 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef enum { 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_MARKER_INFORMATION_SUBTYPE = 1, // marker imformation subtype 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_MARKER_RESPONSE_SUBTYPE // marker response subtype 951c3f0b8e07de78a86f2dce911f5e245845ce40a8Mathieu Desnoyers} bond_marker_subtype_t; 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// timers types(43.4.9 in the 802.3ad standard) 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef enum { 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_CURRENT_WHILE_TIMER, 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_ACTOR_CHURN_TIMER, 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_PERIODIC_TIMER, 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_PARTNER_CHURN_TIMER, 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds AD_WAIT_WHILE_TIMER 1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} ad_timers_t; 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#pragma pack(1) 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// Link Aggregation Control Protocol(LACP) data unit structure(43.4.2.2 in the 802.3ad standard) 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct lacpdu { 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 subtype; // = LACP(= 0x01) 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 version_number; 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 tlv_type_actor_info; // = actor information(type/length/value) 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 actor_information_length; // = 20 114d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 actor_system_priority; 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct mac_addr actor_system; 116d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 actor_key; 117d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 actor_port_priority; 118d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 actor_port; 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 actor_state; 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 reserved_3_1[3]; // = 0 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 tlv_type_partner_info; // = partner information 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 partner_information_length; // = 20 123d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 partner_system_priority; 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct mac_addr partner_system; 125d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 partner_key; 126d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 partner_port_priority; 127d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 partner_port; 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 partner_state; 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 reserved_3_2[3]; // = 0 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 tlv_type_collector_info; // = collector information 1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 collector_information_length; // = 16 132d3bb52b0948cf118131c951c5a34a2d4d0246171Al Viro __be16 collector_max_delay; 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 reserved_12[12]; 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 tlv_type_terminator; // = terminator 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 terminator_length; // = 0 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 reserved_50[50]; // = 0 137a10e14667635dde504ed9e7ee851494c2cf2ae8eVitalii Demianets} __packed lacpdu_t; 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct lacpdu_header { 140e727149e26b08550269a7786fda977aed65578f6Holger Eitzenberger struct ethhdr hdr; 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct lacpdu lacpdu; 142a10e14667635dde504ed9e7ee851494c2cf2ae8eVitalii Demianets} __packed lacpdu_header_t; 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard) 1451c3f0b8e07de78a86f2dce911f5e245845ce40a8Mathieu Desnoyerstypedef struct bond_marker { 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 subtype; // = 0x02 (marker PDU) 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 version_number; // = 0x01 1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 tlv_type; // = 0x01 (marker information) 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds // = 0x02 (marker response information) 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 marker_length; // = 0x16 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 requester_port; // The number assigned to the port by the requester 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct mac_addr requester_system; // The requester's system id 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 requester_transaction_id; // The transaction id allocated by the requester, 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 pad; // = 0 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 tlv_type_terminator; // = 0x00 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 terminator_length; // = 0x00 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 reserved_90[90]; // = 0 158a10e14667635dde504ed9e7ee851494c2cf2ae8eVitalii Demianets} __packed bond_marker_t; 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1601c3f0b8e07de78a86f2dce911f5e245845ce40a8Mathieu Desnoyerstypedef struct bond_marker_header { 161e727149e26b08550269a7786fda977aed65578f6Holger Eitzenberger struct ethhdr hdr; 1621c3f0b8e07de78a86f2dce911f5e245845ce40a8Mathieu Desnoyers struct bond_marker marker; 163a10e14667635dde504ed9e7ee851494c2cf2ae8eVitalii Demianets} __packed bond_marker_header_t; 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#pragma pack() 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct slave; 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bonding; 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct ad_info; 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct port; 1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef __ia64__ 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#pragma pack(8) 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// aggregator structure(43.4.5 in the 802.3ad standard) 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct aggregator { 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct mac_addr aggregator_mac_address; 1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 aggregator_identifier; 1801624db7be0d9f77f5494efe1b066d1d44b46c96cHolger Eitzenberger bool is_individual; 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_admin_aggregator_key; 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_oper_aggregator_key; 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct mac_addr partner_system; 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 partner_system_priority; 1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 partner_oper_aggregator_key; 1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 receive_state; // BOOLEAN 1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 transmit_state; // BOOLEAN 1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct port *lag_ports; 1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds // ****** PRIVATE PARAMETERS ****** 1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct slave *slave; // pointer to the bond slave that this aggregator belongs to 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 is_active; // BOOLEAN. Indicates if this aggregator is active 1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 num_of_ports; 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} aggregator_t; 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1951055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenbergerstruct port_params { 1961055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger struct mac_addr system; 1971055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger u16 system_priority; 1981055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger u16 key; 1991055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger u16 port_number; 2001055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger u16 port_priority; 2011055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger u16 port_state; 2021055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger}; 2031055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger 2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// port structure(43.4.6 in the 802.3ad standard) 2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct port { 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_port_number; 2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_port_priority; 2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct mac_addr actor_system; // This parameter is added here although it is not specified in the standard, just for simplification 2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_system_priority; // This parameter is added here although it is not specified in the standard, just for simplification 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_port_aggregator_identifier; 211d238d458a70ad134cb421c3ffc66242277f30ddaHolger Eitzenberger bool ntt; 2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_admin_port_key; 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 actor_oper_port_key; 2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 actor_admin_port_state; 2151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 actor_oper_port_state; 2161055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger 2171055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger struct port_params partner_admin; 2181055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger struct port_params partner_oper; 2191055c9aba3b6850245fe3bbb533d4747e7f904bfHolger Eitzenberger 220f48127b6f3270cf7234a7a9f770533332e85e8aeHolger Eitzenberger bool is_enabled; 221f48127b6f3270cf7234a7a9f770533332e85e8aeHolger Eitzenberger 2221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds // ****** PRIVATE PARAMETERS ****** 2231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 sm_vars; // all state machines variables for this port 2241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rx_states_t sm_rx_state; // state machine rx state 2251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 sm_rx_timer_counter; // state machine rx timer counter 2261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds periodic_states_t sm_periodic_state;// state machine periodic state 2271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 sm_periodic_timer_counter; // state machine periodic timer counter 2281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds mux_states_t sm_mux_state; // state machine mux state 2291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 sm_mux_timer_counter; // state machine mux timer counter 2301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds tx_states_t sm_tx_state; // state machine tx state 2311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 sm_tx_timer_counter; // state machine tx timer counter(allways on - enter to transmit state 3 time per second) 2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct slave *slave; // pointer to the bond slave that this port belongs to 2331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct aggregator *aggregator; // pointer to an aggregator that this port related to 2341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct port *next_port_in_aggregator; // Next port on the linked list of the parent aggregator 2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 transaction_id; // continuous number for identification of Marker PDU's; 2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct lacpdu lacpdu; // the lacpdu that will be sent for this port 2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} port_t; 2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// system structure 24087f422f8618c541db0f96194cca9465817f76b89Holger Eitzenbergerstruct ad_system { 2411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 sys_priority; 2421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct mac_addr sys_mac_addr; 24387f422f8618c541db0f96194cca9465817f76b89Holger Eitzenberger}; 2441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef __ia64__ 2461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#pragma pack() 2471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 2481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// ================= AD Exported structures to the main bonding code ================== 2501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BOND_AD_INFO(bond) ((bond)->ad_info) 2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SLAVE_AD_INFO(slave) ((slave)->ad_info) 2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct ad_bond_info { 25487f422f8618c541db0f96194cca9465817f76b89Holger Eitzenberger struct ad_system system; /* 802.3ad system structure */ 2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 agg_select_timer; // Timer to select aggregator after all adapter's hand shakes 2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 agg_select_mode; // Mode of selection of active aggregator(bandwidth/count) 2571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int lacp_fast; /* whether fast periodic tx should be 2581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * requested 2591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 2601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct timer_list ad_timer; 2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct packet_type ad_pkt_type; 2621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct ad_slave_info { 2651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct aggregator aggregator; // 802.3ad aggregator structure 2661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct port port; // 802.3ad port structure 2679ac3524a948cab48137a8b40a4fa8ae1092b0a24Nils Carlson spinlock_t state_machine_lock; /* mutex state machines vs. 2689ac3524a948cab48137a8b40a4fa8ae1092b0a24Nils Carlson incoming LACPDU */ 2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 id; 2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// ================= AD Exported functions to the main bonding code ================== 2731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid bond_3ad_initialize(struct bonding *bond, u16 tick_resolution, int lacp_fast); 2741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bond_3ad_bind_slave(struct slave *slave); 2751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid bond_3ad_unbind_slave(struct slave *slave); 2761b76b31693d4a6088dec104ff6a6ead54081a3c2Jay Vosburghvoid bond_3ad_state_machine_handler(struct work_struct *); 277fd989c83325cb34795bc4d4aa6b13c06f90eac99Jay Vosburghvoid bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout); 2781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid bond_3ad_adapter_speed_changed(struct slave *slave); 2791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid bond_3ad_adapter_duplex_changed(struct slave *slave); 2801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid bond_3ad_handle_link_change(struct slave *slave, char link); 2811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); 2821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); 283f2ccd8fa06c8e302116e71df372f5c1f83432e03David S. Millerint bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev); 284ff59c4563a8d1b39597aab4917959146c61f09b0Jay Vosburghint bond_3ad_set_carrier(struct bonding *bond); 2851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif //__BOND_3AD_H__ 2861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 287