Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_lagg.h
Show First 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | struct lagg_port { | ||||
/* 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 */ | ||||
SLIST_ENTRY(lagg_port) lp_entries; | SLIST_ENTRY(lagg_port) lp_entries; | ||||
struct epoch_context lp_epoch_ctx; | |||||
}; | }; | ||||
#define LAGG_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "if_lagg rmlock") | |||||
#define LAGG_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) | |||||
#define LAGG_RLOCK(_sc, _p) rm_rlock(&(_sc)->sc_mtx, (_p)) | |||||
#define LAGG_WLOCK(_sc) rm_wlock(&(_sc)->sc_mtx) | |||||
#define LAGG_RUNLOCK(_sc, _p) rm_runlock(&(_sc)->sc_mtx, (_p)) | |||||
#define LAGG_WUNLOCK(_sc) rm_wunlock(&(_sc)->sc_mtx) | |||||
#define LAGG_RLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_RLOCKED) | |||||
#define LAGG_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED) | |||||
#define LAGG_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED) | |||||
#define LAGG_SX_INIT(_sc) sx_init(&(_sc)->sc_sx, "if_lagg sx") | |||||
#define LAGG_SX_DESTROY(_sc) sx_destroy(&(_sc)->sc_sx) | |||||
#define LAGG_SLOCK(_sc) sx_slock(&(_sc)->sc_sx) | |||||
#define LAGG_XLOCK(_sc) sx_xlock(&(_sc)->sc_sx) | |||||
#define LAGG_SUNLOCK(_sc) sx_sunlock(&(_sc)->sc_sx) | |||||
#define LAGG_XUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) | |||||
#define LAGG_SXLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_LOCKED) | |||||
#define LAGG_SLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_SLOCKED) | |||||
#define LAGG_XLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_XLOCKED) | |||||
melifaro: These primitives seem to be used in the control path. Why not convert them to functions?
This… | |||||
Not Done Inline ActionsDone. I also did the lagg_rlock and lagg_runlock() as inline. shurd: Done. I also did the lagg_rlock and lagg_runlock() as inline. | |||||
extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *); | extern struct mbuf *(*lagg_input_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 */ |
These primitives seem to be used in the control path. Why not convert them to functions?
This kind of spaghetti is unmaintainable.