Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/t4_main.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show All 36 Lines | |||||
#include "opt_ratelimit.h" | #include "opt_ratelimit.h" | ||||
#include "opt_rss.h" | #include "opt_rss.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/eventhandler.h> | |||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
#include <sys/pciio.h> | #include <sys/pciio.h> | ||||
#include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <dev/pci/pci_private.h> | #include <dev/pci/pci_private.h> | ||||
▲ Show 20 Lines • Show All 1,010 Lines • ▼ Show 20 Lines | #endif | ||||
rw_init(&sc->policy_lock, "connection offload policy"); | rw_init(&sc->policy_lock, "connection offload policy"); | ||||
callout_init(&sc->ktls_tick, 1); | callout_init(&sc->ktls_tick, 1); | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
TASK_INIT(&sc->async_event_task, 0, t4_async_event, sc); | TASK_INIT(&sc->async_event_task, 0, t4_async_event, sc); | ||||
#endif | #endif | ||||
refcount_init(&sc->vxlan_refcount, 0); | |||||
rc = t4_map_bars_0_and_4(sc); | rc = t4_map_bars_0_and_4(sc); | ||||
if (rc != 0) | if (rc != 0) | ||||
goto done; /* error message displayed already */ | goto done; /* error message displayed already */ | ||||
memset(sc->chan_map, 0xff, sizeof(sc->chan_map)); | memset(sc->chan_map, 0xff, sizeof(sc->chan_map)); | ||||
/* Prepare the adapter for operation. */ | /* Prepare the adapter for operation. */ | ||||
buf = malloc(PAGE_SIZE, M_CXGBE, M_ZERO | M_WAITOK); | buf = malloc(PAGE_SIZE, M_CXGBE, M_ZERO | M_WAITOK); | ||||
▲ Show 20 Lines • Show All 631 Lines • ▼ Show 20 Lines | |||||
#define T4_CAP_ENABLE (T4_CAP) | #define T4_CAP_ENABLE (T4_CAP) | ||||
static int | static int | ||||
cxgbe_vi_attach(device_t dev, struct vi_info *vi) | cxgbe_vi_attach(device_t dev, struct vi_info *vi) | ||||
{ | { | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct sbuf *sb; | struct sbuf *sb; | ||||
struct pfil_head_args pa; | struct pfil_head_args pa; | ||||
struct adapter *sc = vi->adapter; | |||||
vi->xact_addr_filt = -1; | vi->xact_addr_filt = -1; | ||||
callout_init(&vi->tick, 1); | callout_init(&vi->tick, 1); | ||||
/* Allocate an ifnet and set it up */ | /* Allocate an ifnet and set it up */ | ||||
ifp = if_alloc_dev(IFT_ETHER, dev); | ifp = if_alloc_dev(IFT_ETHER, dev); | ||||
if (ifp == NULL) { | if (ifp == NULL) { | ||||
device_printf(dev, "Cannot allocate ifnet\n"); | device_printf(dev, "Cannot allocate ifnet\n"); | ||||
Show All 17 Lines | #if defined(KERN_TLS) || defined(RATELIMIT) | ||||
ifp->if_snd_tag_free = cxgbe_snd_tag_free; | ifp->if_snd_tag_free = cxgbe_snd_tag_free; | ||||
#endif | #endif | ||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
ifp->if_ratelimit_query = cxgbe_ratelimit_query; | ifp->if_ratelimit_query = cxgbe_ratelimit_query; | ||||
#endif | #endif | ||||
ifp->if_capabilities = T4_CAP; | ifp->if_capabilities = T4_CAP; | ||||
ifp->if_capenable = T4_CAP_ENABLE; | ifp->if_capenable = T4_CAP_ENABLE; | ||||
ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | | |||||
CSUM_UDP_IPV6 | CSUM_TCP_IPV6; | |||||
if (chip_id(sc) >= CHELSIO_T6) { | |||||
ifp->if_capabilities |= IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO; | |||||
ifp->if_capenable |= IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO; | |||||
ifp->if_hwassist |= CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP | | |||||
CSUM_INNER_IP6_TSO | CSUM_INNER_IP | CSUM_INNER_IP_UDP | | |||||
CSUM_INNER_IP_TCP | CSUM_INNER_IP_TSO | CSUM_ENCAP_VXLAN; | |||||
} | |||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
if (vi->nofldrxq != 0 && (vi->adapter->flags & KERN_TLS_OK) == 0) | if (vi->nofldrxq != 0 && (sc->flags & KERN_TLS_OK) == 0) | ||||
ifp->if_capabilities |= IFCAP_TOE; | ifp->if_capabilities |= IFCAP_TOE; | ||||
#endif | #endif | ||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
if (is_ethoffload(vi->adapter) && vi->nofldtxq != 0) { | if (is_ethoffload(sc) && vi->nofldtxq != 0) { | ||||
ifp->if_capabilities |= IFCAP_TXRTLMT; | ifp->if_capabilities |= IFCAP_TXRTLMT; | ||||
ifp->if_capenable |= IFCAP_TXRTLMT; | ifp->if_capenable |= IFCAP_TXRTLMT; | ||||
} | } | ||||
#endif | #endif | ||||
ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | | |||||
CSUM_UDP_IPV6 | CSUM_TCP_IPV6; | |||||
ifp->if_hw_tsomax = IP_MAXPACKET; | ifp->if_hw_tsomax = IP_MAXPACKET; | ||||
ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_TSO; | ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_TSO; | ||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
if (is_ethoffload(vi->adapter) && vi->nofldtxq != 0) | if (is_ethoffload(sc) && vi->nofldtxq != 0) | ||||
ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_EO_TSO; | ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_EO_TSO; | ||||
#endif | #endif | ||||
ifp->if_hw_tsomaxsegsize = 65536; | ifp->if_hw_tsomaxsegsize = 65536; | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
if (vi->adapter->flags & KERN_TLS_OK) { | if (sc->flags & KERN_TLS_OK) { | ||||
ifp->if_capabilities |= IFCAP_TXTLS; | ifp->if_capabilities |= IFCAP_TXTLS; | ||||
ifp->if_capenable |= IFCAP_TXTLS; | ifp->if_capenable |= IFCAP_TXTLS; | ||||
} | } | ||||
#endif | #endif | ||||
ether_ifattach(ifp, vi->hw_addr); | ether_ifattach(ifp, vi->hw_addr); | ||||
#ifdef DEV_NETMAP | #ifdef DEV_NETMAP | ||||
if (vi->nnmrxq != 0) | if (vi->nnmrxq != 0) | ||||
▲ Show 20 Lines • Show All 313 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
if (mask & IFCAP_NOMAP) | if (mask & IFCAP_NOMAP) | ||||
ifp->if_capenable ^= IFCAP_NOMAP; | ifp->if_capenable ^= IFCAP_NOMAP; | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
if (mask & IFCAP_TXTLS) | if (mask & IFCAP_TXTLS) | ||||
ifp->if_capenable ^= (mask & IFCAP_TXTLS); | ifp->if_capenable ^= (mask & IFCAP_TXTLS); | ||||
#endif | #endif | ||||
if (mask & IFCAP_VXLAN_HWCSUM) { | |||||
ifp->if_capenable ^= IFCAP_VXLAN_HWCSUM; | |||||
ifp->if_hwassist ^= CSUM_INNER_IP6_UDP | | |||||
CSUM_INNER_IP6_TCP | CSUM_INNER_IP | | |||||
CSUM_INNER_IP_UDP | CSUM_INNER_IP_TCP; | |||||
} | |||||
if (mask & IFCAP_VXLAN_HWTSO) { | |||||
ifp->if_capenable ^= IFCAP_VXLAN_HWTSO; | |||||
ifp->if_hwassist ^= CSUM_INNER_IP6_TSO | | |||||
CSUM_INNER_IP_TSO; | |||||
} | |||||
#ifdef VLAN_CAPABILITIES | #ifdef VLAN_CAPABILITIES | ||||
VLAN_CAPABILITIES(ifp); | VLAN_CAPABILITIES(ifp); | ||||
#endif | #endif | ||||
fail: | fail: | ||||
end_synchronized_op(sc, 0); | end_synchronized_op(sc, 0); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 2,295 Lines • ▼ Show 20 Lines | if ((int)val[1] > (int)val[0]) { | ||||
/* | /* | ||||
* These should go off if the layout changes and the | * These should go off if the layout changes and the | ||||
* driver needs to catch up. | * driver needs to catch up. | ||||
*/ | */ | ||||
MPASS(sc->tids.hpftid_base == 0); | MPASS(sc->tids.hpftid_base == 0); | ||||
MPASS(sc->tids.tid_base == sc->tids.nhpftids); | MPASS(sc->tids.tid_base == sc->tids.nhpftids); | ||||
} | } | ||||
param[0] = FW_PARAM_PFVF(RAWF_START); | |||||
param[1] = FW_PARAM_PFVF(RAWF_END); | |||||
rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 2, param, val); | |||||
if (rc != 0) { | |||||
device_printf(sc->dev, | |||||
"failed to query rawf parameters: %d.\n", rc); | |||||
return (rc); | |||||
} | } | ||||
if ((int)val[1] > (int)val[0]) { | |||||
sc->rawf_base = val[0]; | |||||
sc->nrawf = val[1] - val[0] + 1; | |||||
} | |||||
} | |||||
/* | /* | ||||
* MPSBGMAP is queried separately because only recent firmwares support | * MPSBGMAP is queried separately because only recent firmwares support | ||||
* it as a parameter and we don't want the compound query above to fail | * it as a parameter and we don't want the compound query above to fail | ||||
* on older firmwares. | * on older firmwares. | ||||
*/ | */ | ||||
param[0] = FW_PARAM_DEV(MPSBGMAP); | param[0] = FW_PARAM_DEV(MPSBGMAP); | ||||
val[0] = 0; | val[0] = 0; | ||||
▲ Show 20 Lines • Show All 714 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
update_mac_settings(struct ifnet *ifp, int flags) | update_mac_settings(struct ifnet *ifp, int flags) | ||||
{ | { | ||||
int rc = 0; | int rc = 0; | ||||
struct vi_info *vi = ifp->if_softc; | struct vi_info *vi = ifp->if_softc; | ||||
struct port_info *pi = vi->pi; | struct port_info *pi = vi->pi; | ||||
struct adapter *sc = pi->adapter; | struct adapter *sc = pi->adapter; | ||||
int mtu = -1, promisc = -1, allmulti = -1, vlanex = -1; | int mtu = -1, promisc = -1, allmulti = -1, vlanex = -1; | ||||
uint8_t match_all_mac[ETHER_ADDR_LEN] = {0}; | |||||
ASSERT_SYNCHRONIZED_OP(sc); | ASSERT_SYNCHRONIZED_OP(sc); | ||||
KASSERT(flags, ("%s: not told what to update.", __func__)); | KASSERT(flags, ("%s: not told what to update.", __func__)); | ||||
if (flags & XGMAC_MTU) | if (flags & XGMAC_MTU) | ||||
mtu = ifp->if_mtu; | mtu = ifp->if_mtu; | ||||
if (flags & XGMAC_PROMISC) | if (flags & XGMAC_PROMISC) | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | if (flags & XGMAC_MCADDRS) { | ||||
if (ctx.i > 0) { | if (ctx.i > 0) { | ||||
rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, | rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, | ||||
ctx.del, ctx.i, ctx.mcaddr, NULL, &ctx.hash, 0); | ctx.del, ctx.i, ctx.mcaddr, NULL, &ctx.hash, 0); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
if (rc < 0) { | if (rc < 0) { | ||||
rc = -rc; | rc = -rc; | ||||
for (j = 0; j < ctx.i; j++) { | for (j = 0; j < ctx.i; j++) { | ||||
if_printf(ifp, | if_printf(ifp, | ||||
"failed to add mc address" | "failed to add mcast address" | ||||
" %02x:%02x:%02x:" | " %02x:%02x:%02x:" | ||||
"%02x:%02x:%02x rc=%d\n", | "%02x:%02x:%02x rc=%d\n", | ||||
ctx.mcaddr[j][0], ctx.mcaddr[j][1], | ctx.mcaddr[j][0], ctx.mcaddr[j][1], | ||||
ctx.mcaddr[j][2], ctx.mcaddr[j][3], | ctx.mcaddr[j][2], ctx.mcaddr[j][3], | ||||
ctx.mcaddr[j][4], ctx.mcaddr[j][5], | ctx.mcaddr[j][4], ctx.mcaddr[j][5], | ||||
rc); | rc); | ||||
} | } | ||||
return (rc); | return (rc); | ||||
} | } | ||||
ctx.del = 0; | |||||
} else | } else | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
rc = -t4_set_addr_hash(sc, sc->mbox, vi->viid, 0, ctx.hash, 0); | rc = -t4_set_addr_hash(sc, sc->mbox, vi->viid, 0, ctx.hash, 0); | ||||
if (rc != 0) | if (rc != 0) | ||||
if_printf(ifp, "failed to set mc address hash: %d", rc); | if_printf(ifp, "failed to set mcast address hash: %d\n", | ||||
rc); | |||||
if (ctx.del == 0) { | |||||
/* We clobbered the VXLAN entry if there was one. */ | |||||
pi->vxlan_tcam_entry = false; | |||||
} | } | ||||
} | |||||
if (IS_MAIN_VI(vi) && sc->vxlan_refcount > 0 && | |||||
pi->vxlan_tcam_entry == false) { | |||||
rc = t4_alloc_raw_mac_filt(sc, vi->viid, match_all_mac, | |||||
match_all_mac, sc->rawf_base + pi->port_id, 1, pi->port_id, | |||||
true); | |||||
if (rc < 0) { | |||||
rc = -rc; | |||||
if_printf(ifp, "failed to add VXLAN TCAM entry: %d.\n", | |||||
rc); | |||||
} else { | |||||
MPASS(rc == sc->rawf_base + pi->port_id); | |||||
rc = 0; | |||||
pi->vxlan_tcam_entry = true; | |||||
} | |||||
} | |||||
return (rc); | return (rc); | ||||
} | } | ||||
/* | /* | ||||
* {begin|end}_synchronized_op must be called from the same thread. | * {begin|end}_synchronized_op must be called from the same thread. | ||||
*/ | */ | ||||
int | int | ||||
begin_synchronized_op(struct adapter *sc, struct vi_info *vi, int flags, | begin_synchronized_op(struct adapter *sc, struct vi_info *vi, int flags, | ||||
▲ Show 20 Lines • Show All 5,126 Lines • ▼ Show 20 Lines | if (vi->flags & VI_INIT_DONE) { | ||||
for_each_rxq(vi, i, rxq) { | for_each_rxq(vi, i, rxq) { | ||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
rxq->lro.lro_queued = 0; | rxq->lro.lro_queued = 0; | ||||
rxq->lro.lro_flushed = 0; | rxq->lro.lro_flushed = 0; | ||||
#endif | #endif | ||||
rxq->rxcsum = 0; | rxq->rxcsum = 0; | ||||
rxq->vlan_extraction = 0; | rxq->vlan_extraction = 0; | ||||
rxq->vxlan_rxcsum = 0; | |||||
rxq->fl.cl_allocated = 0; | rxq->fl.cl_allocated = 0; | ||||
rxq->fl.cl_recycled = 0; | rxq->fl.cl_recycled = 0; | ||||
rxq->fl.cl_fast_recycled = 0; | rxq->fl.cl_fast_recycled = 0; | ||||
} | } | ||||
for_each_txq(vi, i, txq) { | for_each_txq(vi, i, txq) { | ||||
txq->txcsum = 0; | txq->txcsum = 0; | ||||
txq->tso_wrs = 0; | txq->tso_wrs = 0; | ||||
txq->vlan_insertion = 0; | txq->vlan_insertion = 0; | ||||
txq->imm_wrs = 0; | txq->imm_wrs = 0; | ||||
txq->sgl_wrs = 0; | txq->sgl_wrs = 0; | ||||
txq->txpkt_wrs = 0; | txq->txpkt_wrs = 0; | ||||
txq->txpkts0_wrs = 0; | txq->txpkts0_wrs = 0; | ||||
txq->txpkts1_wrs = 0; | txq->txpkts1_wrs = 0; | ||||
txq->txpkts0_pkts = 0; | txq->txpkts0_pkts = 0; | ||||
txq->txpkts1_pkts = 0; | txq->txpkts1_pkts = 0; | ||||
txq->raw_wrs = 0; | txq->raw_wrs = 0; | ||||
txq->vxlan_tso_wrs = 0; | |||||
txq->vxlan_txcsum = 0; | |||||
txq->kern_tls_records = 0; | txq->kern_tls_records = 0; | ||||
txq->kern_tls_short = 0; | txq->kern_tls_short = 0; | ||||
txq->kern_tls_partial = 0; | txq->kern_tls_partial = 0; | ||||
txq->kern_tls_full = 0; | txq->kern_tls_full = 0; | ||||
txq->kern_tls_octets = 0; | txq->kern_tls_octets = 0; | ||||
txq->kern_tls_waste = 0; | txq->kern_tls_waste = 0; | ||||
txq->kern_tls_options = 0; | txq->kern_tls_options = 0; | ||||
txq->kern_tls_header = 0; | txq->kern_tls_header = 0; | ||||
▲ Show 20 Lines • Show All 794 Lines • ▼ Show 20 Lines | if (tid < 0) { | ||||
db_printf("invalid tid\n"); | db_printf("invalid tid\n"); | ||||
return; | return; | ||||
} | } | ||||
t4_dump_tcb(device_get_softc(dev), tid); | t4_dump_tcb(device_get_softc(dev), tid); | ||||
} | } | ||||
#endif | #endif | ||||
static eventhandler_tag vxlan_start_evtag; | |||||
static eventhandler_tag vxlan_stop_evtag; | |||||
struct vxlan_evargs { | |||||
struct ifnet *ifp; | |||||
uint16_t port; | |||||
}; | |||||
static void | |||||
t4_vxlan_start(struct adapter *sc, void *arg) | |||||
kib: Why the arg argument has void type instead of vxlan_evargs ? | |||||
npAuthorUnsubmitted Done Inline ActionsIt is invoked indirectly via t4_iterate and matches what t4_iterate deals with: void t4_iterate(void (*)(struct adapter *, void *), void *); np: It is invoked indirectly via t4_iterate and matches what t4_iterate deals with:
void… | |||||
{ | |||||
struct vxlan_evargs *v = arg; | |||||
struct port_info *pi; | |||||
uint8_t match_all_mac[ETHER_ADDR_LEN] = {0}; | |||||
int i, rc; | |||||
if (sc->nrawf == 0 || chip_id(sc) <= CHELSIO_T5) | |||||
return; | |||||
if (begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4vxst") != 0) | |||||
return; | |||||
if (sc->vxlan_refcount == 0) { | |||||
sc->vxlan_port = v->port; | |||||
sc->vxlan_refcount = 1; | |||||
t4_write_reg(sc, A_MPS_RX_VXLAN_TYPE, | |||||
V_VXLAN(v->port) | F_VXLAN_EN); | |||||
for_each_port(sc, i) { | |||||
pi = sc->port[i]; | |||||
if (pi->vxlan_tcam_entry == true) | |||||
continue; | |||||
rc = t4_alloc_raw_mac_filt(sc, pi->vi[0].viid, | |||||
match_all_mac, match_all_mac, | |||||
sc->rawf_base + pi->port_id, 1, pi->port_id, true); | |||||
if (rc < 0) { | |||||
rc = -rc; | |||||
log(LOG_ERR, | |||||
"%s: failed to add VXLAN TCAM entry: %d.\n", | |||||
device_get_name(pi->vi[0].dev), rc); | |||||
} else { | |||||
MPASS(rc == sc->rawf_base + pi->port_id); | |||||
rc = 0; | |||||
pi->vxlan_tcam_entry = true; | |||||
} | |||||
} | |||||
} else if (sc->vxlan_port == v->port) { | |||||
sc->vxlan_refcount++; | |||||
} else { | |||||
log(LOG_ERR, "%s: VXLAN already configured on port %d; " | |||||
"ignoring attempt to configure it on port %d\n", | |||||
device_get_nameunit(sc->dev), sc->vxlan_port, v->port); | |||||
} | |||||
end_synchronized_op(sc, 0); | |||||
} | |||||
static void | |||||
t4_vxlan_stop(struct adapter *sc, void *arg) | |||||
{ | |||||
struct vxlan_evargs *v = arg; | |||||
if (sc->nrawf == 0 || chip_id(sc) <= CHELSIO_T5) | |||||
return; | |||||
if (begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4vxsp") != 0) | |||||
return; | |||||
/* | |||||
* VXLANs may have been configured before the driver was loaded so we | |||||
* may see more stops than starts. This is not handled cleanly but at | |||||
* least we keep the refcount sane. | |||||
*/ | |||||
if (sc->vxlan_port != v->port) | |||||
goto done; | |||||
if (sc->vxlan_refcount == 0) { | |||||
log(LOG_ERR, | |||||
"%s: VXLAN operation on port %d was stopped earlier; " | |||||
"ignoring attempt to stop it again.\n", | |||||
device_get_nameunit(sc->dev), sc->vxlan_port); | |||||
} else if (--sc->vxlan_refcount == 0) { | |||||
t4_set_reg_field(sc, A_MPS_RX_VXLAN_TYPE, F_VXLAN_EN, 0); | |||||
} | |||||
done: | |||||
end_synchronized_op(sc, 0); | |||||
} | |||||
static void | |||||
t4_vxlan_start_handler(void *arg __unused, struct ifnet *ifp, | |||||
sa_family_t family, u_int port) | |||||
{ | |||||
struct vxlan_evargs v; | |||||
MPASS(family == AF_INET || family == AF_INET6); | |||||
v.ifp = ifp; | |||||
v.port = port; | |||||
t4_iterate(t4_vxlan_start, &v); | |||||
} | |||||
static void | |||||
t4_vxlan_stop_handler(void *arg __unused, struct ifnet *ifp, sa_family_t family, | |||||
u_int port) | |||||
{ | |||||
struct vxlan_evargs v; | |||||
MPASS(family == AF_INET || family == AF_INET6); | |||||
v.ifp = ifp; | |||||
v.port = port; | |||||
t4_iterate(t4_vxlan_stop, &v); | |||||
} | |||||
static struct sx mlu; /* mod load unload */ | static struct sx mlu; /* mod load unload */ | ||||
SX_SYSINIT(cxgbe_mlu, &mlu, "cxgbe mod load/unload"); | SX_SYSINIT(cxgbe_mlu, &mlu, "cxgbe mod load/unload"); | ||||
static int | static int | ||||
mod_event(module_t mod, int cmd, void *arg) | mod_event(module_t mod, int cmd, void *arg) | ||||
{ | { | ||||
int rc = 0; | int rc = 0; | ||||
static int loaded = 0; | static int loaded = 0; | ||||
Show All 27 Lines | |||||
#ifdef INET6 | #ifdef INET6 | ||||
t4_clip_modload(); | t4_clip_modload(); | ||||
#endif | #endif | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
t6_ktls_modload(); | t6_ktls_modload(); | ||||
#endif | #endif | ||||
t4_tracer_modload(); | t4_tracer_modload(); | ||||
tweak_tunables(); | tweak_tunables(); | ||||
vxlan_start_evtag = | |||||
EVENTHANDLER_REGISTER(vxlan_start, | |||||
t4_vxlan_start_handler, NULL, | |||||
EVENTHANDLER_PRI_ANY); | |||||
vxlan_stop_evtag = | |||||
EVENTHANDLER_REGISTER(vxlan_stop, | |||||
t4_vxlan_stop_handler, NULL, | |||||
EVENTHANDLER_PRI_ANY); | |||||
} | } | ||||
sx_xunlock(&mlu); | sx_xunlock(&mlu); | ||||
break; | break; | ||||
case MOD_UNLOAD: | case MOD_UNLOAD: | ||||
sx_xlock(&mlu); | sx_xlock(&mlu); | ||||
if (--loaded == 0) { | if (--loaded == 0) { | ||||
int tries; | int tries; | ||||
Show All 20 Lines | #endif | ||||
pause("t4unload", 2 * hz); | pause("t4unload", 2 * hz); | ||||
} | } | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
sx_sunlock(&t4_uld_list_lock); | sx_sunlock(&t4_uld_list_lock); | ||||
#endif | #endif | ||||
sx_sunlock(&t4_list_lock); | sx_sunlock(&t4_list_lock); | ||||
if (t4_sge_extfree_refs() == 0) { | if (t4_sge_extfree_refs() == 0) { | ||||
EVENTHANDLER_DEREGISTER(vxlan_start, | |||||
vxlan_start_evtag); | |||||
EVENTHANDLER_DEREGISTER(vxlan_stop, | |||||
vxlan_stop_evtag); | |||||
t4_tracer_modunload(); | t4_tracer_modunload(); | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
t6_ktls_modunload(); | t6_ktls_modunload(); | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
t4_clip_modunload(); | t4_clip_modunload(); | ||||
#endif | #endif | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |
Why the arg argument has void type instead of vxlan_evargs ?