#ifndef _NET_AGR_IEEE8023AD_LACP_H_
#define _NET_AGR_IEEE8023AD_LACP_H_
struct lacp_systemid {
uint16_t lsi_prio;
uint8_t lsi_mac[6];
} __packed;
struct lacp_portid {
uint16_t lpi_prio;
uint16_t lpi_portno;
} __packed;
struct lacp_peerinfo {
struct lacp_systemid lip_systemid;
uint16_t lip_key;
struct lacp_portid lip_portid;
uint8_t lip_state;
uint8_t lip_resv[3];
} __packed;
#define LACP_STATE_ACTIVITY (1<<0)
#define LACP_STATE_TIMEOUT (1<<1)
#define LACP_STATE_AGGREGATION (1<<2)
#define LACP_STATE_SYNC (1<<3)
#define LACP_STATE_COLLECTING (1<<4)
#define LACP_STATE_DISTRIBUTING (1<<5)
#define LACP_STATE_DEFAULTED (1<<6)
#define LACP_STATE_EXPIRED (1<<7)
#define LACP_STATE_BITS \
"\177\020" \
"b\0ACTIVITY\0" \
"b\1TIMEOUT\0" \
"b\2AGGREGATION\0" \
"b\3SYNC\0" \
"b\4COLLECTING\0" \
"b\5DISTRIBUTING\0" \
"b\6DEFAULTED\0" \
"b\7EXPIRED\0"
struct lacp_collectorinfo {
uint16_t lci_maxdelay;
uint8_t lci_resv[12];
} __packed;
struct lacpdu {
struct ether_header ldu_eh;
struct slowprothdr ldu_sph;
struct tlvhdr ldu_tlv_actor;
struct lacp_peerinfo ldu_actor;
struct tlvhdr ldu_tlv_partner;
struct lacp_peerinfo ldu_partner;
struct tlvhdr ldu_tlv_collector;
struct lacp_collectorinfo ldu_collector;
struct tlvhdr ldu_tlv_term;
uint8_t ldu_resv[50];
} __packed;
#define LACP_TYPE_ACTORINFO 1
#define LACP_TYPE_PARTNERINFO 2
#define LACP_TYPE_COLLECTORINFO 3
#define LACP_FAST_PERIODIC_TIME (1)
#define LACP_SLOW_PERIODIC_TIME (30)
#define LACP_SHORT_TIMEOUT_TIME (3 * LACP_FAST_PERIODIC_TIME)
#define LACP_LONG_TIMEOUT_TIME (3 * LACP_SLOW_PERIODIC_TIME)
#define LACP_CHURN_DETECTION_TIME (60)
#define LACP_AGGREGATE_WAIT_TIME (2)
#endif