Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/sfxge/sfxge_port.c
Show All 12 Lines | |||||
stat_list = SYSCTL_CHILDREN(sc->stats_node); | stat_list = SYSCTL_CHILDREN(sc->stats_node); | ||||
/* Initialise the named stats */ | /* Initialise the named stats */ | ||||
for (id = 0; id < EFX_MAC_NSTATS; id++) { | for (id = 0; id < EFX_MAC_NSTATS; id++) { | ||||
name = efx_mac_stat_name(sc->enp, id); | name = efx_mac_stat_name(sc->enp, id); | ||||
SYSCTL_ADD_PROC( | SYSCTL_ADD_PROC( | ||||
ctx, stat_list, | ctx, stat_list, | ||||
OID_AUTO, name, CTLTYPE_U64|CTLFLAG_RD, | OID_AUTO, name, | ||||
CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
sc, id, sfxge_mac_stat_handler, "Q", | sc, id, sfxge_mac_stat_handler, "Q", | ||||
""); | ""); | ||||
} | } | ||||
} | } | ||||
#ifdef SFXGE_HAVE_PAUSE_MEDIAOPTS | #ifdef SFXGE_HAVE_PAUSE_MEDIAOPTS | ||||
static unsigned int | static unsigned int | ||||
Show All 24 Lines | |||||
/* Initialise the named stats */ | /* Initialise the named stats */ | ||||
for (id = 0; id < EFX_PHY_NSTATS; id++) { | for (id = 0; id < EFX_PHY_NSTATS; id++) { | ||||
if (!(stat_mask & ((uint64_t)1 << id))) | if (!(stat_mask & ((uint64_t)1 << id))) | ||||
continue; | continue; | ||||
name = efx_phy_stat_name(sc->enp, id); | name = efx_phy_stat_name(sc->enp, id); | ||||
SYSCTL_ADD_PROC( | SYSCTL_ADD_PROC( | ||||
ctx, stat_list, | ctx, stat_list, | ||||
OID_AUTO, name, CTLTYPE_UINT|CTLFLAG_RD, | OID_AUTO, name, | ||||
CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
sc, id, sfxge_phy_stat_handler, | sc, id, sfxge_phy_stat_handler, | ||||
id == EFX_PHY_STAT_OUI ? "IX" : "IU", | id == EFX_PHY_STAT_OUI ? "IX" : "IU", | ||||
""); | ""); | ||||
} | } | ||||
} | } | ||||
void | void | ||||
sfxge_port_fini(struct sfxge_softc *sc) | sfxge_port_fini(struct sfxge_softc *sc) | ||||
Show All 24 Lines | |||||
sysctl_ctx = device_get_sysctl_ctx(sc->dev); | sysctl_ctx = device_get_sysctl_ctx(sc->dev); | ||||
sysctl_tree = device_get_sysctl_tree(sc->dev); | sysctl_tree = device_get_sysctl_tree(sc->dev); | ||||
#ifndef SFXGE_HAVE_PAUSE_MEDIAOPTS | #ifndef SFXGE_HAVE_PAUSE_MEDIAOPTS | ||||
/* If flow control cannot be configured or reported through | /* If flow control cannot be configured or reported through | ||||
* ifmedia, provide sysctls for it. */ | * ifmedia, provide sysctls for it. */ | ||||
port->wanted_fc = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE; | port->wanted_fc = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE; | ||||
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, | SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, | ||||
"wanted_fc", CTLTYPE_UINT|CTLFLAG_RW, sc, 0, | "wanted_fc", | ||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | |||||
sfxge_port_wanted_fc_handler, "IU", "wanted flow control mode"); | sfxge_port_wanted_fc_handler, "IU", "wanted flow control mode"); | ||||
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, | SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, | ||||
"link_fc", CTLTYPE_UINT|CTLFLAG_RD, sc, 0, | "link_fc", | ||||
CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, | |||||
sfxge_port_link_fc_handler, "IU", "link flow control mode"); | sfxge_port_link_fc_handler, "IU", "link flow control mode"); | ||||
#endif | #endif | ||||
DBGPRINT(sc->dev, "alloc MAC stats"); | DBGPRINT(sc->dev, "alloc MAC stats"); | ||||
port->mac_stats.decode_buf = malloc(EFX_MAC_NSTATS * sizeof(uint64_t), | port->mac_stats.decode_buf = malloc(EFX_MAC_NSTATS * sizeof(uint64_t), | ||||
M_SFXGE, M_WAITOK | M_ZERO); | M_SFXGE, M_WAITOK | M_ZERO); | ||||
mac_nstats = efx_nic_cfg_get(sc->enp)->enc_mac_stats_nstats; | mac_nstats = efx_nic_cfg_get(sc->enp)->enc_mac_stats_nstats; | ||||
mac_stats_size = EFX_P2ROUNDUP(size_t, mac_nstats * sizeof(uint64_t), | mac_stats_size = EFX_P2ROUNDUP(size_t, mac_nstats * sizeof(uint64_t), | ||||
EFX_BUF_SIZE); | EFX_BUF_SIZE); | ||||
if ((rc = sfxge_dma_alloc(sc, mac_stats_size, mac_stats_buf)) != 0) | if ((rc = sfxge_dma_alloc(sc, mac_stats_size, mac_stats_buf)) != 0) | ||||
goto fail2; | goto fail2; | ||||
port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc); | port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc); | ||||
sfxge_mac_stat_init(sc); | sfxge_mac_stat_init(sc); | ||||
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, | SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, | ||||
"stats_update_period_ms", CTLTYPE_UINT|CTLFLAG_RW, sc, 0, | "stats_update_period_ms", | ||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | |||||
sfxge_port_stats_update_period_ms_handler, "IU", | sfxge_port_stats_update_period_ms_handler, "IU", | ||||
"interface statistics refresh period"); | "interface statistics refresh period"); | ||||
port->init_state = SFXGE_PORT_INITIALIZED; | port->init_state = SFXGE_PORT_INITIALIZED; | ||||
DBGPRINT(sc->dev, "success"); | DBGPRINT(sc->dev, "success"); | ||||
return (0); | return (0); | ||||
Show All 12 Lines |