Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_lagg.h
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | #define LAGG_PROTOS { \ | ||||
{ "lacp", LAGG_PROTO_LACP }, \ | { "lacp", LAGG_PROTO_LACP }, \ | ||||
{ "loadbalance", LAGG_PROTO_LOADBALANCE }, \ | { "loadbalance", LAGG_PROTO_LOADBALANCE }, \ | ||||
{ "roundrobin", LAGG_PROTO_ROUNDROBIN }, \ | { "roundrobin", LAGG_PROTO_ROUNDROBIN }, \ | ||||
{ "broadcast", LAGG_PROTO_BROADCAST }, \ | { "broadcast", LAGG_PROTO_BROADCAST }, \ | ||||
{ "none", LAGG_PROTO_NONE }, \ | { "none", LAGG_PROTO_NONE }, \ | ||||
{ "default", LAGG_PROTO_DEFAULT } \ | { "default", LAGG_PROTO_DEFAULT } \ | ||||
} | } | ||||
/* Supported lagg TYPEs */ | |||||
typedef enum { | |||||
LAGG_TYPE_ETHERNET = 0, /* ethernet (default) */ | |||||
LAGG_TYPE_INFINIBAND, /* infiniband */ | |||||
LAGG_TYPE_MAX, | |||||
} lagg_type; | |||||
struct lagg_types { | |||||
const char *lt_name; | |||||
lagg_type lt_value; | |||||
}; | |||||
#define LAGG_TYPE_DEFAULT LAGG_TYPE_ETHERNET | |||||
#define LAGG_TYPES { \ | |||||
{ "ethernet", LAGG_TYPE_ETHERNET }, \ | |||||
{ "infiniband", LAGG_TYPE_INFINIBAND }, \ | |||||
} | |||||
/* | /* | ||||
* lagg create clone params | |||||
*/ | |||||
struct iflaggparam { | |||||
uint8_t lagg_type; /* see LAGG_TYPE_XXX */ | |||||
uint8_t reserved_8[3]; | |||||
uint32_t reserved_32[3]; | |||||
melifaro: Nit: maybe it's worth adding a bit more spare fields just in case? e.g. making it 16 or 32… | |||||
}; | |||||
/* | |||||
* lagg ioctls. | * lagg ioctls. | ||||
*/ | */ | ||||
/* | /* | ||||
* LACP current operational parameters structure. | * LACP current operational parameters structure. | ||||
*/ | */ | ||||
struct lacp_opreq { | struct lacp_opreq { | ||||
uint16_t actor_prio; | uint16_t actor_prio; | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct lagg_counters { | struct lagg_counters { | ||||
uint64_t val[IFCOUNTERS]; | uint64_t val[IFCOUNTERS]; | ||||
}; | }; | ||||
struct lagg_softc { | struct lagg_softc { | ||||
struct ifnet *sc_ifp; /* virtual interface */ | struct ifnet *sc_ifp; /* virtual interface */ | ||||
struct rmlock sc_mtx; | struct mtx sc_mtx; /* watchdog mutex */ | ||||
Done Inline ActionsProbably worth adding some comment what does this lock protect? :-) melifaro: Probably worth adding some comment what does this lock protect? :-) | |||||
struct sx sc_sx; | struct sx sc_sx; | ||||
int sc_proto; /* lagg protocol */ | int sc_proto; /* lagg protocol */ | ||||
u_int sc_count; /* number of ports */ | u_int sc_count; /* number of ports */ | ||||
u_int sc_active; /* active port count */ | u_int sc_active; /* active port count */ | ||||
u_int sc_flapping; /* number of flapping | u_int sc_flapping; /* number of flapping | ||||
* events */ | * events */ | ||||
struct lagg_port *sc_primary; /* primary port */ | struct lagg_port *sc_primary; /* primary port */ | ||||
struct ifmedia sc_media; /* media config */ | struct ifmedia sc_media; /* media config */ | ||||
void *sc_psc; /* protocol data */ | void *sc_psc; /* protocol data */ | ||||
uint32_t sc_seq; /* sequence counter */ | uint32_t sc_seq; /* sequence counter */ | ||||
uint32_t sc_stride; /* stride for RR */ | uint32_t sc_stride; /* stride for RR */ | ||||
uint32_t sc_flags; | uint32_t sc_flags; | ||||
int sc_destroying; /* destroying lagg */ | int sc_destroying; /* destroying lagg */ | ||||
CK_SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ | CK_SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ | ||||
SLIST_ENTRY(lagg_softc) sc_entries; | SLIST_ENTRY(lagg_softc) sc_entries; | ||||
eventhandler_tag vlan_attach; | eventhandler_tag vlan_attach; | ||||
eventhandler_tag vlan_detach; | eventhandler_tag vlan_detach; | ||||
struct callout sc_callout; | struct callout sc_callout; | ||||
u_int sc_opts; | u_int sc_opts; | ||||
int flowid_shift; /* shift the flowid */ | int flowid_shift; /* shift the flowid */ | ||||
struct lagg_counters detached_counters; /* detached ports sum */ | struct lagg_counters detached_counters; /* detached ports sum */ | ||||
struct callout sc_watchdog; /* watchdog timer */ | |||||
}; | }; | ||||
struct lagg_port { | struct lagg_port { | ||||
struct ifnet *lp_ifp; /* physical interface */ | struct ifnet *lp_ifp; /* physical interface */ | ||||
struct lagg_softc *lp_softc; /* parent lagg */ | struct lagg_softc *lp_softc; /* parent lagg */ | ||||
uint8_t lp_lladdr[ETHER_ADDR_LEN]; | #define LAGG_ADDR_LEN \ | ||||
MAX(INFINIBAND_ADDR_LEN, ETHER_ADDR_LEN) | |||||
uint8_t lp_lladdr[LAGG_ADDR_LEN]; | |||||
u_char lp_iftype; /* interface type */ | u_char lp_iftype; /* interface type */ | ||||
uint32_t lp_prio; /* port priority */ | uint32_t lp_prio; /* port priority */ | ||||
uint32_t lp_flags; /* port flags */ | uint32_t lp_flags; /* port flags */ | ||||
int lp_ifflags; /* saved ifp flags */ | int lp_ifflags; /* saved ifp flags */ | ||||
int lp_ifcapenable; /* saved ifp capenable */ | int lp_ifcapenable; /* saved ifp capenable */ | ||||
void *lh_cookie; /* if state hook */ | void *lh_cookie; /* if state hook */ | ||||
void *lp_psc; /* protocol data */ | void *lp_psc; /* protocol data */ | ||||
int lp_detaching; /* ifnet is detaching */ | int lp_detaching; /* ifnet is detaching */ | ||||
SLIST_HEAD(__mclhd, lagg_mc) lp_mc_head; /* multicast addresses */ | SLIST_HEAD(__mclhd, lagg_mc) lp_mc_head; /* multicast addresses */ | ||||
/* Redirected callbacks */ | /* Redirected callbacks */ | ||||
int (*lp_ioctl)(struct ifnet *, u_long, caddr_t); | int (*lp_ioctl)(struct ifnet *, u_long, caddr_t); | ||||
int (*lp_output)(struct ifnet *, struct mbuf *, | int (*lp_output)(struct ifnet *, struct mbuf *, | ||||
const struct sockaddr *, struct route *); | const struct sockaddr *, struct route *); | ||||
struct lagg_counters port_counters; /* ifp counters copy */ | struct lagg_counters port_counters; /* ifp counters copy */ | ||||
CK_SLIST_ENTRY(lagg_port) lp_entries; | CK_SLIST_ENTRY(lagg_port) lp_entries; | ||||
struct epoch_context lp_epoch_ctx; | struct epoch_context lp_epoch_ctx; | ||||
}; | }; | ||||
extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *); | extern struct mbuf *(*lagg_input_ethernet_p)(struct ifnet *, struct mbuf *); | ||||
extern struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); | |||||
extern void (*lagg_linkstate_p)(struct ifnet *, int ); | extern void (*lagg_linkstate_p)(struct ifnet *, int ); | ||||
int lagg_enqueue(struct ifnet *, struct mbuf *); | int lagg_enqueue(struct ifnet *, struct mbuf *); | ||||
SYSCTL_DECL(_net_link_lagg); | SYSCTL_DECL(_net_link_lagg); | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _NET_LAGG_H */ | #endif /* _NET_LAGG_H */ |
Nit: maybe it's worth adding a bit more spare fields just in case? e.g. making it 16 or 32 bytes?