marvell_yukon: sync with FreeBSD 11.1.
* add imin() to libkern.h.
This commit is contained in:
parent
79cb8f02d9
commit
9e095e1ef8
@ -1,7 +1,7 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel drivers network marvell_yukon dev mii ;
|
||||
|
||||
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_network compat ] : true ;
|
||||
|
||||
UsePrivateHeaders net system ;
|
||||
UsePrivateKernelHeaders ;
|
||||
@ -17,5 +17,5 @@ KernelStaticLibrary marvell_yukon_mii.a
|
||||
|
||||
ObjectHdrs [ FGristFiles e1000phy$(SUFOBJ) ]
|
||||
: [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) libs
|
||||
compat freebsd_network ] ;
|
||||
Includes [ FGristFiles e1000phy.c ] : <src!libs!compat!freebsd_network>miidevs.h ;
|
||||
compat freebsd11_network ] ;
|
||||
Includes [ FGristFiles e1000phy.c ] : <src!libs!compat!freebsd11_network>miidevs.h ;
|
||||
|
@ -50,8 +50,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/socket.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <dev/mii/mii.h>
|
||||
@ -106,7 +106,9 @@ static const struct mii_phydesc e1000phys[] = {
|
||||
MII_PHY_DESC(xxMARVELL, E1111),
|
||||
MII_PHY_DESC(xxMARVELL, E1116),
|
||||
MII_PHY_DESC(xxMARVELL, E1116R),
|
||||
MII_PHY_DESC(xxMARVELL, E1116R_29),
|
||||
MII_PHY_DESC(xxMARVELL, E1118),
|
||||
MII_PHY_DESC(xxMARVELL, E1145),
|
||||
MII_PHY_DESC(xxMARVELL, E1149R),
|
||||
MII_PHY_DESC(xxMARVELL, E3016),
|
||||
MII_PHY_DESC(xxMARVELL, PHYG65G),
|
||||
@ -130,14 +132,12 @@ static int
|
||||
e1000phy_attach(device_t dev)
|
||||
{
|
||||
struct mii_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &e1000phy_funcs, 0);
|
||||
|
||||
ifp = sc->mii_pdata->mii_ifp;
|
||||
if (strcmp(ifp->if_dname, "msk") == 0 &&
|
||||
if (mii_dev_mac_match(dev, "msk") &&
|
||||
(sc->mii_flags & MIIF_MACPRIV0) != 0)
|
||||
sc->mii_flags |= MIIF_PHYPRIV0;
|
||||
|
||||
@ -167,8 +167,12 @@ e1000phy_attach(device_t dev)
|
||||
PHY_RESET(sc);
|
||||
|
||||
sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask;
|
||||
if (sc->mii_capabilities & BMSR_EXTSTAT)
|
||||
if (sc->mii_capabilities & BMSR_EXTSTAT) {
|
||||
sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
|
||||
if ((sc->mii_extcapabilities &
|
||||
(EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
|
||||
sc->mii_flags |= MIIF_HAVE_GTCR;
|
||||
}
|
||||
device_printf(dev, " ");
|
||||
mii_phy_add_media(sc);
|
||||
printf("\n");
|
||||
@ -208,6 +212,7 @@ e1000phy_reset(struct mii_softc *sc)
|
||||
case MII_MODEL_xxMARVELL_E1111:
|
||||
case MII_MODEL_xxMARVELL_E1112:
|
||||
case MII_MODEL_xxMARVELL_E1116:
|
||||
case MII_MODEL_xxMARVELL_E1116R_29:
|
||||
case MII_MODEL_xxMARVELL_E1118:
|
||||
case MII_MODEL_xxMARVELL_E1149:
|
||||
case MII_MODEL_xxMARVELL_E1149R:
|
||||
@ -215,7 +220,8 @@ e1000phy_reset(struct mii_softc *sc)
|
||||
/* Disable energy detect mode. */
|
||||
reg &= ~E1000_SCR_EN_DETECT_MASK;
|
||||
reg |= E1000_SCR_AUTO_X_MODE;
|
||||
if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116)
|
||||
if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116 ||
|
||||
sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116R_29)
|
||||
reg &= ~E1000_SCR_POWER_DOWN;
|
||||
reg |= E1000_SCR_ASSERT_CRS_ON_TX;
|
||||
break;
|
||||
@ -243,6 +249,7 @@ e1000phy_reset(struct mii_softc *sc)
|
||||
PHY_WRITE(sc, E1000_SCR, reg);
|
||||
|
||||
if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116 ||
|
||||
sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116R_29 ||
|
||||
sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1149 ||
|
||||
sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1149R) {
|
||||
PHY_WRITE(sc, E1000_EADR, 2);
|
||||
@ -259,6 +266,7 @@ e1000phy_reset(struct mii_softc *sc)
|
||||
case MII_MODEL_xxMARVELL_E1118:
|
||||
break;
|
||||
case MII_MODEL_xxMARVELL_E1116:
|
||||
case MII_MODEL_xxMARVELL_E1116R_29:
|
||||
page = PHY_READ(sc, E1000_EADR);
|
||||
/* Select page 3, LED control register. */
|
||||
PHY_WRITE(sc, E1000_EADR, 3);
|
||||
@ -305,12 +313,6 @@ e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
break;
|
||||
|
||||
case MII_MEDIACHG:
|
||||
/*
|
||||
* If the interface is not up, don't do anything.
|
||||
*/
|
||||
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
|
||||
break;
|
||||
|
||||
if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
|
||||
e1000phy_mii_phy_auto(sc, ife->ifm_media);
|
||||
break;
|
||||
@ -319,8 +321,7 @@ e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
speed = 0;
|
||||
switch (IFM_SUBTYPE(ife->ifm_media)) {
|
||||
case IFM_1000_T:
|
||||
if ((sc->mii_extcapabilities &
|
||||
(EXTSR_1000TFDX | EXTSR_1000THDX)) == 0)
|
||||
if ((sc->mii_flags & MIIF_HAVE_GTCR) == 0)
|
||||
return (EINVAL);
|
||||
speed = E1000_CR_SPEED_1000;
|
||||
break;
|
||||
@ -359,8 +360,7 @@ e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
gig |= E1000_1GCR_MS_ENABLE;
|
||||
if ((ife->ifm_media & IFM_ETH_MASTER) != 0)
|
||||
gig |= E1000_1GCR_MS_VALUE;
|
||||
} else if ((sc->mii_extcapabilities &
|
||||
(EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
|
||||
} else if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0)
|
||||
gig = 0;
|
||||
PHY_WRITE(sc, E1000_1GCR, gig);
|
||||
PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD);
|
||||
@ -368,12 +368,6 @@ e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
done:
|
||||
break;
|
||||
case MII_TICK:
|
||||
/*
|
||||
* Is the interface even up?
|
||||
*/
|
||||
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Only used for autonegotiation.
|
||||
*/
|
||||
@ -491,9 +485,14 @@ e1000phy_mii_phy_auto(struct mii_softc *sc, int media)
|
||||
PHY_WRITE(sc, E1000_AR, reg | E1000_AR_SELECTOR_FIELD);
|
||||
} else
|
||||
PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X);
|
||||
if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
|
||||
PHY_WRITE(sc, E1000_1GCR,
|
||||
E1000_1GCR_1000T_FD | E1000_1GCR_1000T);
|
||||
if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) {
|
||||
reg = 0;
|
||||
if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0)
|
||||
reg |= E1000_1GCR_1000T_FD;
|
||||
if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0)
|
||||
reg |= E1000_1GCR_1000T;
|
||||
PHY_WRITE(sc, E1000_1GCR, reg);
|
||||
}
|
||||
PHY_WRITE(sc, E1000_CR,
|
||||
E1000_CR_AUTO_NEG_ENABLE | E1000_CR_RESTART_AUTO_NEG);
|
||||
|
||||
|
@ -140,12 +140,6 @@ ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
break;
|
||||
|
||||
case MII_MEDIACHG:
|
||||
/*
|
||||
* If the interface is not up, don't do anything.
|
||||
*/
|
||||
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
|
||||
break;
|
||||
|
||||
mii_phy_setmedia(sc);
|
||||
break;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel drivers network marvell_yukon dev msk ;
|
||||
|
||||
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_network compat ] : true ;
|
||||
|
||||
UsePrivateHeaders net system ;
|
||||
UsePrivateKernelHeaders ;
|
||||
@ -11,5 +11,5 @@ SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ;
|
||||
KernelAddon marvell_yukon :
|
||||
if_msk.c
|
||||
glue.c
|
||||
: libfreebsd_network.a marvell_yukon_mii.a
|
||||
: marvell_yukon_mii.a libfreebsd11_network.a
|
||||
;
|
||||
|
@ -117,6 +117,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/bpf.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
@ -961,10 +962,6 @@ msk_jumbo_newbuf(struct msk_if_softc *sc_if, int idx)
|
||||
m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES);
|
||||
if (m == NULL)
|
||||
return (ENOBUFS);
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
m_freem(m);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
m->m_len = m->m_pkthdr.len = MJUM9BYTES;
|
||||
if ((sc_if->msk_flags & MSK_FLAG_RAMBUF) == 0)
|
||||
m_adj(m, ETHER_ALIGN);
|
||||
@ -1626,7 +1623,7 @@ msk_attach(device_t dev)
|
||||
callout_init_mtx(&sc_if->msk_tick_ch, &sc_if->msk_softc->msk_mtx, 0);
|
||||
msk_sysctl_node(sc_if);
|
||||
|
||||
if ((error = msk_txrx_dma_alloc(sc_if) != 0))
|
||||
if ((error = msk_txrx_dma_alloc(sc_if)) != 0)
|
||||
goto fail;
|
||||
msk_rx_dma_jalloc(sc_if);
|
||||
|
||||
@ -1638,7 +1635,6 @@ msk_attach(device_t dev)
|
||||
}
|
||||
ifp->if_softc = sc_if;
|
||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TSO4;
|
||||
/*
|
||||
@ -1710,7 +1706,7 @@ msk_attach(device_t dev)
|
||||
* Must appear after the call to ether_ifattach() because
|
||||
* ether_ifattach() sets ifi_hdrlen to the default value.
|
||||
*/
|
||||
ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
|
||||
ifp->if_hdrlen = sizeof(struct ether_vlan_header);
|
||||
|
||||
/*
|
||||
* Do miibus setup.
|
||||
@ -2063,11 +2059,11 @@ msk_detach(device_t dev)
|
||||
msk_txrx_dma_free(sc_if);
|
||||
bus_generic_detach(dev);
|
||||
|
||||
if (ifp)
|
||||
if_free(ifp);
|
||||
sc = sc_if->msk_softc;
|
||||
sc->msk_if[sc_if->msk_port] = NULL;
|
||||
MSK_IF_UNLOCK(sc_if);
|
||||
if (ifp)
|
||||
if_free(ifp);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -2159,10 +2155,6 @@ msk_status_dma_alloc(struct msk_softc *sc)
|
||||
* status updates.
|
||||
*/
|
||||
count = 3 * MSK_RX_RING_CNT + MSK_TX_RING_CNT;
|
||||
#ifdef __HAIKU__
|
||||
// TODO check this!
|
||||
#define imin min
|
||||
#endif
|
||||
count = imin(4096, roundup2(count, 1024));
|
||||
sc->msk_stat_count = count;
|
||||
stat_sz = count * sizeof(struct msk_stat_desc);
|
||||
@ -2213,15 +2205,15 @@ msk_status_dma_free(struct msk_softc *sc)
|
||||
|
||||
/* Destroy status block. */
|
||||
if (sc->msk_stat_tag) {
|
||||
if (sc->msk_stat_map) {
|
||||
if (sc->msk_stat_ring_paddr) {
|
||||
bus_dmamap_unload(sc->msk_stat_tag, sc->msk_stat_map);
|
||||
sc->msk_stat_ring_paddr = 0;
|
||||
}
|
||||
if (sc->msk_stat_ring) {
|
||||
bus_dmamem_free(sc->msk_stat_tag,
|
||||
sc->msk_stat_ring, sc->msk_stat_map);
|
||||
sc->msk_stat_ring = NULL;
|
||||
}
|
||||
sc->msk_stat_map = NULL;
|
||||
}
|
||||
bus_dma_tag_destroy(sc->msk_stat_tag);
|
||||
sc->msk_stat_tag = NULL;
|
||||
}
|
||||
@ -2531,31 +2523,29 @@ msk_txrx_dma_free(struct msk_if_softc *sc_if)
|
||||
|
||||
/* Tx ring. */
|
||||
if (sc_if->msk_cdata.msk_tx_ring_tag) {
|
||||
if (sc_if->msk_cdata.msk_tx_ring_map)
|
||||
if (sc_if->msk_rdata.msk_tx_ring_paddr)
|
||||
bus_dmamap_unload(sc_if->msk_cdata.msk_tx_ring_tag,
|
||||
sc_if->msk_cdata.msk_tx_ring_map);
|
||||
if (sc_if->msk_cdata.msk_tx_ring_map &&
|
||||
sc_if->msk_rdata.msk_tx_ring)
|
||||
if (sc_if->msk_rdata.msk_tx_ring)
|
||||
bus_dmamem_free(sc_if->msk_cdata.msk_tx_ring_tag,
|
||||
sc_if->msk_rdata.msk_tx_ring,
|
||||
sc_if->msk_cdata.msk_tx_ring_map);
|
||||
sc_if->msk_rdata.msk_tx_ring = NULL;
|
||||
sc_if->msk_cdata.msk_tx_ring_map = NULL;
|
||||
sc_if->msk_rdata.msk_tx_ring_paddr = 0;
|
||||
bus_dma_tag_destroy(sc_if->msk_cdata.msk_tx_ring_tag);
|
||||
sc_if->msk_cdata.msk_tx_ring_tag = NULL;
|
||||
}
|
||||
/* Rx ring. */
|
||||
if (sc_if->msk_cdata.msk_rx_ring_tag) {
|
||||
if (sc_if->msk_cdata.msk_rx_ring_map)
|
||||
if (sc_if->msk_rdata.msk_rx_ring_paddr)
|
||||
bus_dmamap_unload(sc_if->msk_cdata.msk_rx_ring_tag,
|
||||
sc_if->msk_cdata.msk_rx_ring_map);
|
||||
if (sc_if->msk_cdata.msk_rx_ring_map &&
|
||||
sc_if->msk_rdata.msk_rx_ring)
|
||||
if (sc_if->msk_rdata.msk_rx_ring)
|
||||
bus_dmamem_free(sc_if->msk_cdata.msk_rx_ring_tag,
|
||||
sc_if->msk_rdata.msk_rx_ring,
|
||||
sc_if->msk_cdata.msk_rx_ring_map);
|
||||
sc_if->msk_rdata.msk_rx_ring = NULL;
|
||||
sc_if->msk_cdata.msk_rx_ring_map = NULL;
|
||||
sc_if->msk_rdata.msk_rx_ring_paddr = 0;
|
||||
bus_dma_tag_destroy(sc_if->msk_cdata.msk_rx_ring_tag);
|
||||
sc_if->msk_cdata.msk_rx_ring_tag = NULL;
|
||||
}
|
||||
@ -2604,16 +2594,15 @@ msk_rx_dma_jfree(struct msk_if_softc *sc_if)
|
||||
|
||||
/* Jumbo Rx ring. */
|
||||
if (sc_if->msk_cdata.msk_jumbo_rx_ring_tag) {
|
||||
if (sc_if->msk_cdata.msk_jumbo_rx_ring_map)
|
||||
if (sc_if->msk_rdata.msk_jumbo_rx_ring_paddr)
|
||||
bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
|
||||
sc_if->msk_cdata.msk_jumbo_rx_ring_map);
|
||||
if (sc_if->msk_cdata.msk_jumbo_rx_ring_map &&
|
||||
sc_if->msk_rdata.msk_jumbo_rx_ring)
|
||||
if (sc_if->msk_rdata.msk_jumbo_rx_ring)
|
||||
bus_dmamem_free(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
|
||||
sc_if->msk_rdata.msk_jumbo_rx_ring,
|
||||
sc_if->msk_cdata.msk_jumbo_rx_ring_map);
|
||||
sc_if->msk_rdata.msk_jumbo_rx_ring = NULL;
|
||||
sc_if->msk_cdata.msk_jumbo_rx_ring_map = NULL;
|
||||
sc_if->msk_rdata.msk_jumbo_rx_ring_paddr = 0;
|
||||
bus_dma_tag_destroy(sc_if->msk_cdata.msk_jumbo_rx_ring_tag);
|
||||
sc_if->msk_cdata.msk_jumbo_rx_ring_tag = NULL;
|
||||
}
|
||||
@ -2994,14 +2983,14 @@ msk_watchdog(struct msk_if_softc *sc_if)
|
||||
if (bootverbose)
|
||||
if_printf(sc_if->msk_ifp, "watchdog timeout "
|
||||
"(missed link)\n");
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
msk_init_locked(sc_if);
|
||||
return;
|
||||
}
|
||||
|
||||
if_printf(ifp, "watchdog timeout\n");
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
msk_init_locked(sc_if);
|
||||
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
|
||||
@ -3223,7 +3212,7 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
* handle this frame.
|
||||
*/
|
||||
if (len > MSK_MAX_FRAMELEN || len < ETHER_HDR_LEN) {
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
msk_discard_rxbuf(sc_if, cons);
|
||||
break;
|
||||
}
|
||||
@ -3232,7 +3221,7 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
((status & GMR_FS_RX_OK) == 0) || (rxlen != len)) {
|
||||
/* Don't count flow-control packet as errors. */
|
||||
if ((status & GMR_FS_GOOD_FC) == 0)
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
msk_discard_rxbuf(sc_if, cons);
|
||||
break;
|
||||
}
|
||||
@ -3244,7 +3233,7 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
#endif
|
||||
m = rxd->rx_m;
|
||||
if (msk_newbuf(sc_if, cons) != 0) {
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
/* Reuse old buffer. */
|
||||
msk_discard_rxbuf(sc_if, cons);
|
||||
break;
|
||||
@ -3255,7 +3244,7 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
if ((sc_if->msk_flags & MSK_FLAG_RAMBUF) != 0)
|
||||
msk_fixup_rx(m);
|
||||
#endif
|
||||
ifp->if_ipackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
if ((ifp->if_capenable & IFCAP_RXCSUM) != 0)
|
||||
msk_rxcsum(sc_if, control, m);
|
||||
/* Check for VLAN tagged packets. */
|
||||
@ -3297,7 +3286,7 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
((status & GMR_FS_RX_OK) == 0) || (rxlen != len)) {
|
||||
/* Don't count flow-control packet as errors. */
|
||||
if ((status & GMR_FS_GOOD_FC) == 0)
|
||||
ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
msk_discard_jumbo_rxbuf(sc_if, cons);
|
||||
break;
|
||||
}
|
||||
@ -3309,7 +3298,7 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
#endif
|
||||
m = jrxd->rx_m;
|
||||
if (msk_jumbo_newbuf(sc_if, cons) != 0) {
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
/* Reuse old buffer. */
|
||||
msk_discard_jumbo_rxbuf(sc_if, cons);
|
||||
break;
|
||||
@ -3320,7 +3309,7 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
if ((sc_if->msk_flags & MSK_FLAG_RAMBUF) != 0)
|
||||
msk_fixup_rx(m);
|
||||
#endif
|
||||
ifp->if_ipackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
if ((ifp->if_capenable & IFCAP_RXCSUM) != 0)
|
||||
msk_rxcsum(sc_if, control, m);
|
||||
/* Check for VLAN tagged packets. */
|
||||
@ -3375,7 +3364,7 @@ msk_txeof(struct msk_if_softc *sc_if, int idx)
|
||||
BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(sc_if->msk_cdata.msk_tx_tag, txd->tx_dmamap);
|
||||
|
||||
ifp->if_opackets++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
KASSERT(txd->tx_m != NULL, ("%s: freeing NULL mbuf!",
|
||||
__func__));
|
||||
m_freem(txd->tx_m);
|
||||
@ -3504,7 +3493,7 @@ msk_intr_hwerr(struct msk_softc *sc)
|
||||
CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
|
||||
if ((status & Y2_IS_PCI_NEXP) != 0) {
|
||||
/*
|
||||
* PCI Express Error occured which is not described in PEX
|
||||
* PCI Express Error occurred which is not described in PEX
|
||||
* spec.
|
||||
* This error is also mapped either to Master Abort(
|
||||
* Y2_IS_MST_ERR) or Target Abort (Y2_IS_IRQ_STAT) bit and
|
||||
@ -3540,7 +3529,7 @@ msk_intr_hwerr(struct msk_softc *sc)
|
||||
* On PCI Express bus bridges are called root complexes (RC).
|
||||
* PCI Express errors are recognized by the root complex too,
|
||||
* which requests the system to handle the problem. After
|
||||
* error occurence it may be that no access to the adapter
|
||||
* error occurrence it may be that no access to the adapter
|
||||
* may be performed any longer.
|
||||
*/
|
||||
|
||||
|
@ -156,7 +156,7 @@
|
||||
#define DEVICEID_DLINK_DGE560SX 0x4002
|
||||
#define DEVICEID_DLINK_DGE560T 0x4b00
|
||||
|
||||
#define BIT_31 (1 << 31)
|
||||
#define BIT_31 (1U << 31)
|
||||
#define BIT_30 (1 << 30)
|
||||
#define BIT_29 (1 << 29)
|
||||
#define BIT_28 (1 << 28)
|
||||
@ -1309,7 +1309,7 @@
|
||||
#define PHY_ST_EXT_ST (1<<8) /* Bit 8: Extended Status Present */
|
||||
#define PHY_ST_PRE_SUP (1<<6) /* Bit 6: Preamble Suppression */
|
||||
#define PHY_ST_AN_OVER (1<<5) /* Bit 5: Auto-Negotiation Over */
|
||||
#define PHY_ST_REM_FLT (1<<4) /* Bit 4: Remote Fault Condition Occured */
|
||||
#define PHY_ST_REM_FLT (1<<4) /* Bit 4: Remote Fault Condition Occurred */
|
||||
#define PHY_ST_AN_CAP (1<<3) /* Bit 3: Auto-Negotiation Capability */
|
||||
#define PHY_ST_LSYNC (1<<2) /* Bit 2: Link Synchronized */
|
||||
#define PHY_ST_JAB_DET (1<<1) /* Bit 1: Jabber Detected */
|
||||
@ -1813,8 +1813,8 @@
|
||||
#define GM_GPSR_LINK_UP BIT_12 /* Link Up Status */
|
||||
#define GM_GPSR_PAUSE BIT_11 /* Pause State */
|
||||
#define GM_GPSR_TX_ACTIVE BIT_10 /* Tx in Progress */
|
||||
#define GM_GPSR_EXC_COL BIT_9 /* Excessive Collisions Occured */
|
||||
#define GM_GPSR_LAT_COL BIT_8 /* Late Collisions Occured */
|
||||
#define GM_GPSR_EXC_COL BIT_9 /* Excessive Collisions Occurred */
|
||||
#define GM_GPSR_LAT_COL BIT_8 /* Late Collisions Occurred */
|
||||
#define GM_GPSR_PHY_ST_CH BIT_5 /* PHY Status Change */
|
||||
#define GM_GPSR_GIG_SPEED BIT_4 /* Gigabit Speed (1 = 1000 Mbps) */
|
||||
#define GM_GPSR_PART_MODE BIT_3 /* Partition mode */
|
||||
@ -2175,13 +2175,8 @@
|
||||
#define MSK_ADDR_LO(x) ((uint64_t) (x) & 0xffffffffUL)
|
||||
#define MSK_ADDR_HI(x) ((uint64_t) (x) >> 32)
|
||||
|
||||
/*
|
||||
* At first I guessed 8 bytes, the size of a single descriptor, would be
|
||||
* required alignment constraints. But, it seems that Yukon II have 4096
|
||||
* bytes boundary alignment constraints.
|
||||
*/
|
||||
#define MSK_RING_ALIGN 4096
|
||||
#define MSK_STAT_ALIGN 4096
|
||||
#define MSK_RING_ALIGN 32768
|
||||
#define MSK_STAT_ALIGN 32768
|
||||
|
||||
/* Rx descriptor data structure */
|
||||
struct msk_rx_desc {
|
||||
|
@ -14,6 +14,7 @@ extern int random(void);
|
||||
uint32_t arc4random(void);
|
||||
|
||||
static __inline int imax(int a, int b) { return (a > b ? a : b); }
|
||||
static __inline int imin(int a, int b) { return (a < b ? a : b); }
|
||||
|
||||
extern int abs(int a);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user