Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/axgbe/if_axgbe_pci.c
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static void | static void | ||||
axgbe_miibus_statchg(device_t dev) | axgbe_miibus_statchg(device_t dev) | ||||
{ | { | ||||
struct axgbe_if_softc *sc = iflib_get_softc(device_get_softc(dev)); | struct axgbe_if_softc *sc = iflib_get_softc(device_get_softc(dev)); | ||||
struct xgbe_prv_data *pdata = &sc->pdata; | struct xgbe_prv_data *pdata = &sc->pdata; | ||||
struct mii_data *mii = device_get_softc(pdata->axgbe_miibus); | struct mii_data *mii = device_get_softc(pdata->axgbe_miibus); | ||||
struct ifnet *ifp = pdata->netdev; | if_t ifp = pdata->netdev; | ||||
int bmsr; | int bmsr; | ||||
axgbe_printf(2, "%s: Link %d/%d\n", __func__, pdata->phy.link, | axgbe_printf(2, "%s: Link %d/%d\n", __func__, pdata->phy.link, | ||||
pdata->phy_link); | pdata->phy_link); | ||||
if (mii == NULL || ifp == NULL || | if (mii == NULL || ifp == NULL || | ||||
(ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) | (if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) | ||||
return; | return; | ||||
if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == | if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == | ||||
(IFM_ACTIVE | IFM_AVALID)) { | (IFM_ACTIVE | IFM_AVALID)) { | ||||
switch (IFM_SUBTYPE(mii->mii_media_active)) { | switch (IFM_SUBTYPE(mii->mii_media_active)) { | ||||
case IFM_10_T: | case IFM_10_T: | ||||
case IFM_100_TX: | case IFM_100_TX: | ||||
▲ Show 20 Lines • Show All 988 Lines • ▼ Show 20 Lines | xgbe_default_config(struct xgbe_prv_data *pdata) | ||||
pdata->enable_rss = 1; | pdata->enable_rss = 1; | ||||
} | } | ||||
static int | static int | ||||
axgbe_if_attach_post(if_ctx_t ctx) | axgbe_if_attach_post(if_ctx_t ctx) | ||||
{ | { | ||||
struct axgbe_if_softc *sc = iflib_get_softc(ctx); | struct axgbe_if_softc *sc = iflib_get_softc(ctx); | ||||
struct xgbe_prv_data *pdata = &sc->pdata; | struct xgbe_prv_data *pdata = &sc->pdata; | ||||
struct ifnet *ifp = pdata->netdev; | if_t ifp = pdata->netdev; | ||||
struct xgbe_phy_if *phy_if = &pdata->phy_if; | struct xgbe_phy_if *phy_if = &pdata->phy_if; | ||||
struct xgbe_hw_if *hw_if = &pdata->hw_if; | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||||
if_softc_ctx_t scctx = sc->scctx; | if_softc_ctx_t scctx = sc->scctx; | ||||
int i, ret; | int i, ret; | ||||
/* set split header support based on tunable */ | /* set split header support based on tunable */ | ||||
pdata->sph_enable = axgbe_sph_enable; | pdata->sph_enable = axgbe_sph_enable; | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | #endif | ||||
/* | /* | ||||
* Mark the device down until it is initialized, which happens | * Mark the device down until it is initialized, which happens | ||||
* when the device is accessed first (for configuring the iface, | * when the device is accessed first (for configuring the iface, | ||||
* eg: setting IP) | * eg: setting IP) | ||||
*/ | */ | ||||
set_bit(XGBE_DOWN, &pdata->dev_state); | set_bit(XGBE_DOWN, &pdata->dev_state); | ||||
DBGPR("mtu %d\n", ifp->if_mtu); | DBGPR("mtu %d\n", if_getmtu(ifp)); | ||||
scctx->isc_max_frame_size = ifp->if_mtu + 18; | scctx->isc_max_frame_size = if_getmtu(ifp) + 18; | ||||
scctx->isc_min_frame_size = XGMAC_MIN_PACKET; | scctx->isc_min_frame_size = XGMAC_MIN_PACKET; | ||||
axgbe_sysctl_init(pdata); | axgbe_sysctl_init(pdata); | ||||
axgbe_pci_init(pdata); | axgbe_pci_init(pdata); | ||||
return (0); | return (0); | ||||
} /* axgbe_if_attach_post */ | } /* axgbe_if_attach_post */ | ||||
▲ Show 20 Lines • Show All 848 Lines • ▼ Show 20 Lines | axgbe_if_media_change(if_ctx_t ctx) | ||||
return (-sc->pdata.phy_if.phy_config_aneg(&sc->pdata)); | return (-sc->pdata.phy_if.phy_config_aneg(&sc->pdata)); | ||||
} | } | ||||
static int | static int | ||||
axgbe_if_promisc_set(if_ctx_t ctx, int flags) | axgbe_if_promisc_set(if_ctx_t ctx, int flags) | ||||
{ | { | ||||
struct axgbe_if_softc *sc = iflib_get_softc(ctx); | struct axgbe_if_softc *sc = iflib_get_softc(ctx); | ||||
struct xgbe_prv_data *pdata = &sc->pdata; | struct xgbe_prv_data *pdata = &sc->pdata; | ||||
struct ifnet *ifp = pdata->netdev; | if_t ifp = pdata->netdev; | ||||
axgbe_printf(1, "%s: MAC_PFR 0x%x drv_flags 0x%x if_flags 0x%x\n", | axgbe_printf(1, "%s: MAC_PFR 0x%x drv_flags 0x%x if_flags 0x%x\n", | ||||
__func__, XGMAC_IOREAD(pdata, MAC_PFR), ifp->if_drv_flags, ifp->if_flags); | __func__, XGMAC_IOREAD(pdata, MAC_PFR), if_getdrvflags(ifp), | ||||
if_getflags(ifp)); | |||||
if (ifp->if_flags & IFF_PPROMISC) { | if (if_getflags(ifp) & IFF_PPROMISC) { | ||||
axgbe_printf(1, "User requested to enter promisc mode\n"); | axgbe_printf(1, "User requested to enter promisc mode\n"); | ||||
if (XGMAC_IOREAD_BITS(pdata, MAC_PFR, PR) == 1) { | if (XGMAC_IOREAD_BITS(pdata, MAC_PFR, PR) == 1) { | ||||
axgbe_printf(1, "Already in promisc mode\n"); | axgbe_printf(1, "Already in promisc mode\n"); | ||||
return (0); | return (0); | ||||
} | } | ||||
Show All 16 Lines | axgbe_if_promisc_set(if_ctx_t ctx, int flags) | ||||
return (0); | return (0); | ||||
} | } | ||||
static uint64_t | static uint64_t | ||||
axgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt) | axgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt) | ||||
{ | { | ||||
struct axgbe_if_softc *sc = iflib_get_softc(ctx); | struct axgbe_if_softc *sc = iflib_get_softc(ctx); | ||||
struct ifnet *ifp = iflib_get_ifp(ctx); | if_t ifp = iflib_get_ifp(ctx); | ||||
struct xgbe_prv_data *pdata = &sc->pdata; | struct xgbe_prv_data *pdata = &sc->pdata; | ||||
struct xgbe_mmc_stats *pstats = &pdata->mmc_stats; | struct xgbe_mmc_stats *pstats = &pdata->mmc_stats; | ||||
pdata->hw_if.read_mmc_stats(pdata); | pdata->hw_if.read_mmc_stats(pdata); | ||||
switch(cnt) { | switch(cnt) { | ||||
case IFCOUNTER_IPACKETS: | case IFCOUNTER_IPACKETS: | ||||
return (pstats->rxframecount_gb); | return (pstats->rxframecount_gb); | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |