Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_lagg.c
Show First 20 Lines • Show All 1,842 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
lagg_snd_tag_alloc(struct ifnet *ifp, | lagg_snd_tag_alloc(struct ifnet *ifp, | ||||
union if_snd_tag_alloc_params *params, | union if_snd_tag_alloc_params *params, | ||||
struct m_snd_tag **ppmt) | struct m_snd_tag **ppmt) | ||||
{ | { | ||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
const struct if_snd_tag_sw *sw; | const struct if_snd_tag_sw *sw; | ||||
struct lagg_softc *sc; | |||||
struct lagg_snd_tag *lst; | struct lagg_snd_tag *lst; | ||||
struct lagg_port *lp; | struct lagg_port *lp; | ||||
struct ifnet *lp_ifp; | struct ifnet *lp_ifp; | ||||
struct m_snd_tag *mst; | struct m_snd_tag *mst; | ||||
int error; | int error; | ||||
static bool warned; | |||||
switch (params->hdr.type) { | switch (params->hdr.type) { | ||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
case IF_SND_TAG_TYPE_UNLIMITED: | case IF_SND_TAG_TYPE_UNLIMITED: | ||||
sw = &lagg_snd_tag_ul_sw; | sw = &lagg_snd_tag_ul_sw; | ||||
break; | break; | ||||
case IF_SND_TAG_TYPE_RATE_LIMIT: | case IF_SND_TAG_TYPE_RATE_LIMIT: | ||||
sw = &lagg_snd_tag_rl_sw; | sw = &lagg_snd_tag_rl_sw; | ||||
Show All 17 Lines | default: | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
} | } | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
lp = lookup_snd_tag_port(ifp, params->hdr.flowid, | lp = lookup_snd_tag_port(ifp, params->hdr.flowid, | ||||
params->hdr.flowtype, params->hdr.numa_domain); | params->hdr.flowtype, params->hdr.numa_domain); | ||||
if (lp == NULL) { | if (lp == NULL) { | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
sc = ifp->if_softc; | |||||
melifaro: Maybe make `warned` another sc flag that gets removed/set on `LAGG_OPT_USE_FLOWID` flag change? | |||||
if (!warned && (sc->sc_opts & LAGG_OPT_USE_FLOWID) == 0 && | |||||
(sc->sc_proto == LAGG_PROTO_LOADBALANCE || | |||||
sc->sc_proto == LAGG_PROTO_LACP)) { | |||||
warned = true; | |||||
if_printf(ifp, | |||||
"Must enable use_flowid to use NIC kTLS or RATELIMIT. See lagg(4)\n"); | |||||
} | |||||
hselaskyUnsubmitted Not Done Inline ActionsI wonder if the NET_EPOCH_EXIT(et) should be last! You are reading some fields, and they may be freed!? hselasky: I wonder if the NET_EPOCH_EXIT(et) should be last! You are reading some fields, and they may be… | |||||
gallatinAuthorUnsubmitted Done Inline ActionsI thought it was there to protect against the lagg port interfaces going away, but its easy enough to move it after the warning out of an abundance of caution. gallatin: I thought it was there to protect against the lagg port interfaces going away, but its easy… | |||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
} | } | ||||
if (lp->lp_ifp == NULL) { | if (lp->lp_ifp == NULL) { | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
} | } | ||||
lp_ifp = lp->lp_ifp; | lp_ifp = lp->lp_ifp; | ||||
if_ref(lp_ifp); | if_ref(lp_ifp); | ||||
▲ Show 20 Lines • Show All 838 Lines • Show Last 20 Lines |
Maybe make warned another sc flag that gets removed/set on LAGG_OPT_USE_FLOWID flag change?
In that case we'd avoid having 'static' function variable and can write something like
?