Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/cxgbe/t4_main.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1,339 Lines • ▼ Show 20 Lines | for_each_port(sc, i) { | ||||
struct vi_info *vi; | struct vi_info *vi; | ||||
if (pi == NULL) | if (pi == NULL) | ||||
continue; | continue; | ||||
pi->nvi = num_vis; | pi->nvi = num_vis; | ||||
for_each_vi(pi, j, vi) { | for_each_vi(pi, j, vi) { | ||||
vi->pi = pi; | vi->pi = pi; | ||||
vi->adapter = sc; | |||||
vi->qsize_rxq = t4_qsize_rxq; | vi->qsize_rxq = t4_qsize_rxq; | ||||
vi->qsize_txq = t4_qsize_txq; | vi->qsize_txq = t4_qsize_txq; | ||||
vi->first_rxq = rqidx; | vi->first_rxq = rqidx; | ||||
vi->first_txq = tqidx; | vi->first_txq = tqidx; | ||||
vi->tmr_idx = t4_tmr_idx; | vi->tmr_idx = t4_tmr_idx; | ||||
vi->pktc_idx = t4_pktc_idx; | vi->pktc_idx = t4_pktc_idx; | ||||
vi->nrxq = j == 0 ? iaq.nrxq : iaq.nrxq_vi; | vi->nrxq = j == 0 ? iaq.nrxq : iaq.nrxq_vi; | ||||
▲ Show 20 Lines • Show All 387 Lines • ▼ Show 20 Lines | |||||
#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; | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
if (vi->nofldrxq != 0 && (vi->pi->adapter->flags & KERN_TLS_OK) == 0) | if (vi->nofldrxq != 0 && (vi->adapter->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->pi->adapter) && vi->nofldtxq != 0) { | if (is_ethoffload(vi->adapter) && 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 | | ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | | ||||
CSUM_UDP_IPV6 | CSUM_TCP_IPV6; | 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->pi->adapter) && vi->nofldtxq != 0) | if (is_ethoffload(vi->adapter) && 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->pi->adapter->flags & KERN_TLS_OK) { | if (vi->adapter->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 123 Lines • ▼ Show 20 Lines | cxgbe_detach(device_t dev) | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
cxgbe_init(void *arg) | cxgbe_init(void *arg) | ||||
{ | { | ||||
struct vi_info *vi = arg; | struct vi_info *vi = arg; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
if (begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4init") != 0) | if (begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4init") != 0) | ||||
return; | return; | ||||
cxgbe_init_synchronized(vi); | cxgbe_init_synchronized(vi); | ||||
end_synchronized_op(sc, 0); | end_synchronized_op(sc, 0); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static uint64_t | static uint64_t | ||||
vi_get_counter(struct ifnet *ifp, ift_counter c) | vi_get_counter(struct ifnet *ifp, ift_counter c) | ||||
{ | { | ||||
struct vi_info *vi = ifp->if_softc; | struct vi_info *vi = ifp->if_softc; | ||||
struct fw_vi_stats_vf *s = &vi->stats; | struct fw_vi_stats_vf *s = &vi->stats; | ||||
vi_refresh_stats(vi->pi->adapter, vi); | vi_refresh_stats(vi->adapter, vi); | ||||
switch (c) { | switch (c) { | ||||
case IFCOUNTER_IPACKETS: | case IFCOUNTER_IPACKETS: | ||||
return (s->rx_bcast_frames + s->rx_mcast_frames + | return (s->rx_bcast_frames + s->rx_mcast_frames + | ||||
s->rx_ucast_frames); | s->rx_ucast_frames); | ||||
case IFCOUNTER_IERRORS: | case IFCOUNTER_IERRORS: | ||||
return (s->rx_err_frames); | return (s->rx_err_frames); | ||||
case IFCOUNTER_OPACKETS: | case IFCOUNTER_OPACKETS: | ||||
▲ Show 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
vcxgbe_detach(device_t dev) | vcxgbe_detach(device_t dev) | ||||
{ | { | ||||
struct vi_info *vi; | struct vi_info *vi; | ||||
struct adapter *sc; | struct adapter *sc; | ||||
vi = device_get_softc(dev); | vi = device_get_softc(dev); | ||||
sc = vi->pi->adapter; | sc = vi->adapter; | ||||
doom_vi(sc, vi); | doom_vi(sc, vi); | ||||
cxgbe_vi_detach(vi); | cxgbe_vi_detach(vi); | ||||
t4_free_vi(sc, sc->mbox, sc->pf, 0, vi->viid); | t4_free_vi(sc, sc->mbox, sc->pf, 0, vi->viid); | ||||
end_synchronized_op(sc, 0); | end_synchronized_op(sc, 0); | ||||
▲ Show 20 Lines • Show All 2,987 Lines • ▼ Show 20 Lines | hashen_to_hashconfig(int hashen) | ||||
return (hashconfig); | return (hashconfig); | ||||
} | } | ||||
#endif | #endif | ||||
int | int | ||||
vi_full_init(struct vi_info *vi) | vi_full_init(struct vi_info *vi) | ||||
{ | { | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
struct ifnet *ifp = vi->ifp; | struct ifnet *ifp = vi->ifp; | ||||
uint16_t *rss; | uint16_t *rss; | ||||
struct sge_rxq *rxq; | struct sge_rxq *rxq; | ||||
int rc, i, j; | int rc, i, j; | ||||
#ifdef RSS | #ifdef RSS | ||||
int nbuckets = rss_getnumbuckets(); | int nbuckets = rss_getnumbuckets(); | ||||
int hashconfig = rss_gethashconfig(); | int hashconfig = rss_gethashconfig(); | ||||
int extra; | int extra; | ||||
▲ Show 20 Lines • Show All 413 Lines • ▼ Show 20 Lines | cxgbe_tick(void *arg) | ||||
callout_schedule(&pi->tick, hz); | callout_schedule(&pi->tick, hz); | ||||
} | } | ||||
void | void | ||||
vi_tick(void *arg) | vi_tick(void *arg) | ||||
{ | { | ||||
struct vi_info *vi = arg; | struct vi_info *vi = arg; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
vi_refresh_stats(sc, vi); | vi_refresh_stats(sc, vi); | ||||
callout_schedule(&vi->tick, hz); | callout_schedule(&vi->tick, hz); | ||||
} | } | ||||
/* | /* | ||||
* Should match fw_caps_config_<foo> enums in t4fw_interface.h | * Should match fw_caps_config_<foo> enums in t4fw_interface.h | ||||
▲ Show 20 Lines • Show All 970 Lines • ▼ Show 20 Lines | sysctl_noflowq(SYSCTL_HANDLER_ARGS) | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static int | static int | ||||
sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS) | sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct vi_info *vi = arg1; | struct vi_info *vi = arg1; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
int idx, rc, i; | int idx, rc, i; | ||||
struct sge_rxq *rxq; | struct sge_rxq *rxq; | ||||
uint8_t v; | uint8_t v; | ||||
idx = vi->tmr_idx; | idx = vi->tmr_idx; | ||||
rc = sysctl_handle_int(oidp, &idx, 0, req); | rc = sysctl_handle_int(oidp, &idx, 0, req); | ||||
if (rc != 0 || req->newptr == NULL) | if (rc != 0 || req->newptr == NULL) | ||||
Show All 20 Lines | #endif | ||||
end_synchronized_op(sc, LOCK_HELD); | end_synchronized_op(sc, LOCK_HELD); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS) | sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct vi_info *vi = arg1; | struct vi_info *vi = arg1; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
int idx, rc; | int idx, rc; | ||||
idx = vi->pktc_idx; | idx = vi->pktc_idx; | ||||
rc = sysctl_handle_int(oidp, &idx, 0, req); | rc = sysctl_handle_int(oidp, &idx, 0, req); | ||||
if (rc != 0 || req->newptr == NULL) | if (rc != 0 || req->newptr == NULL) | ||||
return (rc); | return (rc); | ||||
Show All 13 Lines | sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS) | ||||
end_synchronized_op(sc, LOCK_HELD); | end_synchronized_op(sc, LOCK_HELD); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static int | static int | ||||
sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS) | sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct vi_info *vi = arg1; | struct vi_info *vi = arg1; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
int qsize, rc; | int qsize, rc; | ||||
qsize = vi->qsize_rxq; | qsize = vi->qsize_rxq; | ||||
rc = sysctl_handle_int(oidp, &qsize, 0, req); | rc = sysctl_handle_int(oidp, &qsize, 0, req); | ||||
if (rc != 0 || req->newptr == NULL) | if (rc != 0 || req->newptr == NULL) | ||||
return (rc); | return (rc); | ||||
Show All 13 Lines | sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS) | ||||
end_synchronized_op(sc, LOCK_HELD); | end_synchronized_op(sc, LOCK_HELD); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static int | static int | ||||
sysctl_qsize_txq(SYSCTL_HANDLER_ARGS) | sysctl_qsize_txq(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct vi_info *vi = arg1; | struct vi_info *vi = arg1; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
int qsize, rc; | int qsize, rc; | ||||
qsize = vi->qsize_txq; | qsize = vi->qsize_txq; | ||||
rc = sysctl_handle_int(oidp, &qsize, 0, req); | rc = sysctl_handle_int(oidp, &qsize, 0, req); | ||||
if (rc != 0 || req->newptr == NULL) | if (rc != 0 || req->newptr == NULL) | ||||
return (rc); | return (rc); | ||||
▲ Show 20 Lines • Show All 2,578 Lines • ▼ Show 20 Lines | sysctl_tp_backoff(SYSCTL_HANDLER_ARGS) | ||||
return (sysctl_handle_int(oidp, &v, 0, req)); | return (sysctl_handle_int(oidp, &v, 0, req)); | ||||
} | } | ||||
static int | static int | ||||
sysctl_holdoff_tmr_idx_ofld(SYSCTL_HANDLER_ARGS) | sysctl_holdoff_tmr_idx_ofld(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct vi_info *vi = arg1; | struct vi_info *vi = arg1; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
int idx, rc, i; | int idx, rc, i; | ||||
struct sge_ofld_rxq *ofld_rxq; | struct sge_ofld_rxq *ofld_rxq; | ||||
uint8_t v; | uint8_t v; | ||||
idx = vi->ofld_tmr_idx; | idx = vi->ofld_tmr_idx; | ||||
rc = sysctl_handle_int(oidp, &idx, 0, req); | rc = sysctl_handle_int(oidp, &idx, 0, req); | ||||
if (rc != 0 || req->newptr == NULL) | if (rc != 0 || req->newptr == NULL) | ||||
Show All 20 Lines | #endif | ||||
end_synchronized_op(sc, LOCK_HELD); | end_synchronized_op(sc, LOCK_HELD); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
sysctl_holdoff_pktc_idx_ofld(SYSCTL_HANDLER_ARGS) | sysctl_holdoff_pktc_idx_ofld(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct vi_info *vi = arg1; | struct vi_info *vi = arg1; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
int idx, rc; | int idx, rc; | ||||
idx = vi->ofld_pktc_idx; | idx = vi->ofld_pktc_idx; | ||||
rc = sysctl_handle_int(oidp, &idx, 0, req); | rc = sysctl_handle_int(oidp, &idx, 0, req); | ||||
if (rc != 0 || req->newptr == NULL) | if (rc != 0 || req->newptr == NULL) | ||||
return (rc); | return (rc); | ||||
▲ Show 20 Lines • Show All 1,436 Lines • Show Last 20 Lines |