You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement Link Aggregation Control Protocol (802.3ad/802.1AX) for bond
interfaces. LACP provides dynamic link aggregation with automatic member
discovery, synchronization, and failover based on protocol negotiation
rather than simple link state monitoring.
Add a new GR_BOND_MODE_LACP operational mode alongside the existing
active-backup mode. LACP mode includes three load balancing algorithms
for distributing egress traffic across active members:
- rss: Reuse hardware RSS hash when available for zero-cost balancing
- l2: Hash based on destination MAC address and VLAN tag
- l3+l4: Hash based on IP addresses and TCP/UDP port numbers
The control plane implementation handles LACP protocol state machines
including receiving and validating LACP PDUs, tracking partner state,
managing synchronization and collecting/distributing flags, and handling
fast/slow periodic timers and timeout detection. A periodic timer runs
every second to send LACP PDUs and detect partner timeouts based on the
negotiated timeout intervals.
NB: port numbers in LACP PDUs are 1-based rather than 0-based to ensure
interoperability with switches that reject port ID zero as invalid.
Members transition to active state when LACP negotiation succeeds and
both sides report synchronized state.
Active members are added to a 256-entry redirection table that maps hash
values to member indices. The table is populated by distributing active
member IDs in round-robin fashion across all entries, ensuring even load
distribution while maintaining flow consistency.
For example, with 3 active members, entry 0 maps to member 0, entry 1 to
member 1, entry 2 to member 2, entry 3 back to member 0, and so on.
Traffic is directed by computing a hash from packet headers, taking
modulo 256 to get a table index, and using the stored member ID at that
position. This provides deterministic per-flow member selection with
minimal disruption when members are added or removed.
The bond interface transitions to running state when at least one member
becomes active.
Signed-off-by: Robin Jarry <[email protected]>
0 commit comments