Changeset View
Changeset View
Standalone View
Standalone View
sys/net/ieee8023ad_lacp.c
Show All 24 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_ratelimit.h" | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/eventhandler.h> | #include <sys/eventhandler.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/kernel.h> /* hz */ | #include <sys/kernel.h> /* hz */ | ||||
#include <sys/socket.h> /* for net/if.h */ | #include <sys/socket.h> /* for net/if.h */ | ||||
▲ Show 20 Lines • Show All 807 Lines • ▼ Show 20 Lines | lacp_select_tx_port(struct lagg_softc *sc, struct mbuf *m) | ||||
hash %= pm->pm_count; | hash %= pm->pm_count; | ||||
lp = pm->pm_map[hash]; | lp = pm->pm_map[hash]; | ||||
KASSERT((lp->lp_state & LACP_STATE_DISTRIBUTING) != 0, | KASSERT((lp->lp_state & LACP_STATE_DISTRIBUTING) != 0, | ||||
("aggregated port is not distributing")); | ("aggregated port is not distributing")); | ||||
return (lp->lp_lagg); | return (lp->lp_lagg); | ||||
} | } | ||||
#ifdef RATELIMIT | |||||
struct lagg_port * | |||||
lacp_select_tx_port_by_hash(struct lagg_softc *sc, uint32_t flowid) | |||||
{ | |||||
struct lacp_softc *lsc = LACP_SOFTC(sc); | |||||
struct lacp_portmap *pm; | |||||
struct lacp_port *lp; | |||||
uint32_t hash; | |||||
if (__predict_false(lsc->lsc_suppress_distributing)) { | |||||
LACP_DPRINTF((NULL, "%s: waiting transit\n", __func__)); | |||||
return (NULL); | |||||
} | |||||
pm = &lsc->lsc_pmap[lsc->lsc_activemap]; | |||||
if (pm->pm_count == 0) { | |||||
LACP_DPRINTF((NULL, "%s: no active aggregator\n", __func__)); | |||||
return (NULL); | |||||
} | |||||
hash = flowid >> sc->flowid_shift; | |||||
hash %= pm->pm_count; | |||||
lp = pm->pm_map[hash]; | |||||
return (lp->lp_lagg); | |||||
} | |||||
#endif | |||||
/* | /* | ||||
* lacp_suppress_distributing: drop transmit packets for a while | * lacp_suppress_distributing: drop transmit packets for a while | ||||
* to preserve packet ordering. | * to preserve packet ordering. | ||||
*/ | */ | ||||
static void | static void | ||||
lacp_suppress_distributing(struct lacp_softc *lsc, struct lacp_aggregator *la) | lacp_suppress_distributing(struct lacp_softc *lsc, struct lacp_aggregator *la) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,206 Lines • Show Last 20 Lines |