Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_lagg.h
Show All 15 Lines | |||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _NET_LAGG_H | #ifndef _NET_LAGG_H | ||||
#define _NET_LAGG_H | #define _NET_LAGG_H | ||||
#include <sys/condvar.h> | |||||
/* | /* | ||||
* Global definitions | * Global definitions | ||||
*/ | */ | ||||
#define LAGG_MAX_PORTS 32 /* logically */ | #define LAGG_MAX_PORTS 32 /* logically */ | ||||
#define LAGG_MAX_NAMESIZE 32 /* name of a protocol */ | #define LAGG_MAX_NAMESIZE 32 /* name of a protocol */ | ||||
#define LAGG_MAX_STACKING 4 /* maximum number of stacked laggs */ | #define LAGG_MAX_STACKING 4 /* maximum number of stacked laggs */ | ||||
▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | struct lagg_mc { | ||||
SLIST_ENTRY(lagg_mc) mc_entries; | SLIST_ENTRY(lagg_mc) mc_entries; | ||||
}; | }; | ||||
typedef enum { | typedef enum { | ||||
LAGG_LLQTYPE_PHYS = 0, /* Task related to physical (underlying) port */ | LAGG_LLQTYPE_PHYS = 0, /* Task related to physical (underlying) port */ | ||||
LAGG_LLQTYPE_VIRT, /* Task related to lagg interface itself */ | LAGG_LLQTYPE_VIRT, /* Task related to lagg interface itself */ | ||||
} lagg_llqtype; | } lagg_llqtype; | ||||
/* List of interfaces to have the MAC address modified */ | /* Adding new entry here, SHOULD also have relevant entry in llq_action */ | ||||
struct lagg_llq { | typedef enum { | ||||
LAGG_LLQ_MIN = 0, | |||||
LAGG_LLQ_LLADDR = LAGG_LLQ_MIN, /* MAC Address index */ | |||||
LAGG_LLQ_MTU, /* MTU index */ | |||||
LAGG_LLQ_MAX /* This SHOULD be the last entry */ | |||||
smh: Any reason for the blank line here? | |||||
} lagg_llq_idx; | |||||
/* Common list entry definition for each taskq operation */ | |||||
struct lagg_llq_slist_entry { | |||||
SLIST_ENTRY(lagg_llq_slist_entry) llq_entries; | |||||
}; | |||||
/* Context for lladdr llq operation part of lagg soft context */ | |||||
struct lagg_lladdr_llq_ctxt { | |||||
struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first | |||||
member */ | |||||
struct ifnet *llq_ifp; | struct ifnet *llq_ifp; | ||||
uint8_t llq_lladdr[ETHER_ADDR_LEN]; | uint8_t llq_lladdr[ETHER_ADDR_LEN]; | ||||
lagg_llqtype llq_type; | lagg_llqtype llq_type; | ||||
SLIST_ENTRY(lagg_llq) llq_entries; | |||||
}; | }; | ||||
/* Context for mtu llq operation part of lagg soft context */ | |||||
struct lagg_mtu_llq_ctxt { | |||||
struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first | |||||
member */ | |||||
Done Inline ActionsPlease add "llq_" prefix to the members. hrs: Please add "llq_" prefix to the members. | |||||
struct ifnet *llq_ifp; | |||||
Done Inline ActionsIs there any reason to have ifr as a pointer? malloc is generally expensive in kernel, and overhead of struct ifreq is acceptable for me even if every llq has one. I feel this complicates the error handling at least. hrs: Is there any reason to have ifr as a pointer? malloc is generally expensive in kernel, and… | |||||
struct ifreq llq_ifr; | |||||
uint32_t llq_old_mtu; | |||||
int (*llq_ioctl)(struct ifnet *, u_long, caddr_t); | |||||
Done Inline Actionsnot sure but looks like there are alignment issues here? smh: not sure but looks like there are alignment issues here? | |||||
rpokalaAuthorUnsubmitted Not Done Inline ActionsI think it's an artifact of Phabricator; it's aligned correctly in the file. rpokala: I think it's an artifact of Phabricator; it's aligned correctly in the file. | |||||
}; | |||||
struct lagg_counters { | struct lagg_counters { | ||||
uint64_t val[IFCOUNTERS]; | uint64_t val[IFCOUNTERS]; | ||||
}; | }; | ||||
/* Conditional variables context for lagg operations */ | |||||
struct lagg_signal { | |||||
struct mtx lock; | |||||
struct cv cv; | |||||
}; | |||||
/* Lagg MTU context */ | |||||
struct lagg_mtu_ctxt { | |||||
struct lagg_signal mtu_sync; /* Synchronize cmd completion */ | |||||
int mtu_cmd_ret; | |||||
bool busy; | |||||
}; | |||||
struct lagg_softc { | struct lagg_softc { | ||||
struct ifnet *sc_ifp; /* virtual interface */ | struct ifnet *sc_ifp; /* virtual interface */ | ||||
struct rmlock sc_mtx; | struct rmlock sc_mtx; | ||||
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_flags; | uint32_t sc_flags; | ||||
SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ | SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ | ||||
SLIST_ENTRY(lagg_softc) sc_entries; | SLIST_ENTRY(lagg_softc) sc_entries; | ||||
struct task sc_lladdr_task; | struct task sc_llq_task; /* SYNC & ASYNC ops | ||||
SLIST_HEAD(__llqhd, lagg_llq) sc_llq_head; /* interfaces to program | enqueued here */ | ||||
the lladdr on */ | struct lagg_mtu_ctxt sc_mtu_ctxt; /* MTU programming */ | ||||
/* List of LLQs */ | |||||
SLIST_HEAD(__llqhd, lagg_llq_slist_entry) sc_llq[LAGG_LLQ_MAX]; | |||||
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 */ | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
Any reason for the blank line here?