pcnet: Update with the 11.1 release of the le/pcn driver.
* switch compat layer. * tested on Qemu, model=pcnet.
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
SubDir HAIKU_TOP src add-ons kernel drivers network pcnet dev le ;
|
SubDir HAIKU_TOP src add-ons kernel drivers network pcnet dev le ;
|
||||||
|
|
||||||
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
||||||
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network ] : true ;
|
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_network ] : 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 ;
|
UsePrivateHeaders net system ;
|
||||||
UsePrivateKernelHeaders ;
|
UsePrivateKernelHeaders ;
|
||||||
@@ -15,5 +15,5 @@ KernelAddon pcnet :
|
|||||||
if_le_pci.c
|
if_le_pci.c
|
||||||
lance.c
|
lance.c
|
||||||
glue.c
|
glue.c
|
||||||
: libfreebsd_network.a pcnet_pcn.a pcnet_mii.a
|
: pcnet_pcn.a pcnet_mii.a libfreebsd11_network.a
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ am7990_rint(struct lance_softc *sc)
|
|||||||
bix = 0;
|
bix = 0;
|
||||||
|
|
||||||
if (m != NULL) {
|
if (m != NULL) {
|
||||||
ifp->if_ipackets++;
|
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||||
|
|
||||||
#ifdef LANCE_REVC_BUG
|
#ifdef LANCE_REVC_BUG
|
||||||
/*
|
/*
|
||||||
@@ -296,7 +296,7 @@ am7990_rint(struct lance_softc *sc)
|
|||||||
(*ifp->if_input)(ifp, m);
|
(*ifp->if_input)(ifp, m);
|
||||||
LE_LOCK(sc);
|
LE_LOCK(sc);
|
||||||
} else
|
} else
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc->sc_last_rd = bix;
|
sc->sc_last_rd = bix;
|
||||||
@@ -352,22 +352,22 @@ am7990_tint(struct lance_softc *sc)
|
|||||||
if_printf(ifp, "lost carrier\n");
|
if_printf(ifp, "lost carrier\n");
|
||||||
}
|
}
|
||||||
if (tmd.tmd3 & LE_T3_LCOL)
|
if (tmd.tmd3 & LE_T3_LCOL)
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
if (tmd.tmd3 & LE_T3_RTRY) {
|
if (tmd.tmd3 & LE_T3_RTRY) {
|
||||||
#ifdef LEDEBUG
|
#ifdef LEDEBUG
|
||||||
if_printf(ifp, "excessive collisions, tdr %d\n",
|
if_printf(ifp, "excessive collisions, tdr %d\n",
|
||||||
tmd.tmd3 & LE_T3_TDR_MASK);
|
tmd.tmd3 & LE_T3_TDR_MASK);
|
||||||
#endif
|
#endif
|
||||||
ifp->if_collisions += 16;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16);
|
||||||
}
|
}
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
} else {
|
} else {
|
||||||
if (tmd.tmd1_bits & LE_T1_ONE)
|
if (tmd.tmd1_bits & LE_T1_ONE)
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
else if (tmd.tmd1_bits & LE_T1_MORE)
|
else if (tmd.tmd1_bits & LE_T1_MORE)
|
||||||
/* Real number is unknown. */
|
/* Real number is unknown. */
|
||||||
ifp->if_collisions += 2;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 2);
|
||||||
ifp->if_opackets++;
|
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++bix == sc->sc_ntbuf)
|
if (++bix == sc->sc_ntbuf)
|
||||||
@@ -394,7 +394,7 @@ am7990_intr(void *arg)
|
|||||||
LE_LOCK(sc);
|
LE_LOCK(sc);
|
||||||
|
|
||||||
if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) {
|
if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) {
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
lance_init_locked(sc);
|
lance_init_locked(sc);
|
||||||
LE_UNLOCK(sc);
|
LE_UNLOCK(sc);
|
||||||
return;
|
return;
|
||||||
@@ -426,19 +426,19 @@ am7990_intr(void *arg)
|
|||||||
#ifdef LEDEBUG
|
#ifdef LEDEBUG
|
||||||
if_printf(ifp, "babble\n");
|
if_printf(ifp, "babble\n");
|
||||||
#endif
|
#endif
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if (isr & LE_C0_CERR) {
|
if (isr & LE_C0_CERR) {
|
||||||
if_printf(ifp, "collision error\n");
|
if_printf(ifp, "collision error\n");
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (isr & LE_C0_MISS) {
|
if (isr & LE_C0_MISS) {
|
||||||
#ifdef LEDEBUG
|
#ifdef LEDEBUG
|
||||||
if_printf(ifp, "missed packet\n");
|
if_printf(ifp, "missed packet\n");
|
||||||
#endif
|
#endif
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
}
|
}
|
||||||
if (isr & LE_C0_MERR) {
|
if (isr & LE_C0_MERR) {
|
||||||
if_printf(ifp, "memory error\n");
|
if_printf(ifp, "memory error\n");
|
||||||
@@ -450,14 +450,14 @@ am7990_intr(void *arg)
|
|||||||
|
|
||||||
if ((isr & LE_C0_RXON) == 0) {
|
if ((isr & LE_C0_RXON) == 0) {
|
||||||
if_printf(ifp, "receiver disabled\n");
|
if_printf(ifp, "receiver disabled\n");
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
lance_init_locked(sc);
|
lance_init_locked(sc);
|
||||||
LE_UNLOCK(sc);
|
LE_UNLOCK(sc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((isr & LE_C0_TXON) == 0) {
|
if ((isr & LE_C0_TXON) == 0) {
|
||||||
if_printf(ifp, "transmitter disabled\n");
|
if_printf(ifp, "transmitter disabled\n");
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
lance_init_locked(sc);
|
lance_init_locked(sc);
|
||||||
LE_UNLOCK(sc);
|
LE_UNLOCK(sc);
|
||||||
return;
|
return;
|
||||||
@@ -519,7 +519,7 @@ am7990_start_locked(struct lance_softc *sc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
|
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
|
||||||
if (m == 0)
|
if (m == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ am79900_rint(struct lance_softc *sc)
|
|||||||
bix = 0;
|
bix = 0;
|
||||||
|
|
||||||
if (m != NULL) {
|
if (m != NULL) {
|
||||||
ifp->if_ipackets++;
|
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||||
|
|
||||||
#if defined(__i386__) && !defined(PC98)
|
#if defined(__i386__) && !defined(PC98)
|
||||||
/*
|
/*
|
||||||
@@ -333,7 +333,7 @@ am79900_rint(struct lance_softc *sc)
|
|||||||
(*ifp->if_input)(ifp, m);
|
(*ifp->if_input)(ifp, m);
|
||||||
LE_LOCK(sc);
|
LE_LOCK(sc);
|
||||||
} else
|
} else
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc->sc_last_rd = bix;
|
sc->sc_last_rd = bix;
|
||||||
@@ -391,21 +391,21 @@ am79900_tint(struct lance_softc *sc)
|
|||||||
if_printf(ifp, "lost carrier\n");
|
if_printf(ifp, "lost carrier\n");
|
||||||
}
|
}
|
||||||
if (tmd2 & LE_T2_LCOL)
|
if (tmd2 & LE_T2_LCOL)
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
if (tmd2 & LE_T2_RTRY) {
|
if (tmd2 & LE_T2_RTRY) {
|
||||||
#ifdef LEDEBUG
|
#ifdef LEDEBUG
|
||||||
if_printf(ifp, "excessive collisions\n");
|
if_printf(ifp, "excessive collisions\n");
|
||||||
#endif
|
#endif
|
||||||
ifp->if_collisions += 16;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16);
|
||||||
}
|
}
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
} else {
|
} else {
|
||||||
if (tmd1 & LE_T1_ONE)
|
if (tmd1 & LE_T1_ONE)
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
else if (tmd1 & LE_T1_MORE)
|
else if (tmd1 & LE_T1_MORE)
|
||||||
/* Real number is unknown. */
|
/* Real number is unknown. */
|
||||||
ifp->if_collisions += 2;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 2);
|
||||||
ifp->if_opackets++;
|
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++bix == sc->sc_ntbuf)
|
if (++bix == sc->sc_ntbuf)
|
||||||
@@ -432,7 +432,7 @@ am79900_intr(void *arg)
|
|||||||
LE_LOCK(sc);
|
LE_LOCK(sc);
|
||||||
|
|
||||||
if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) {
|
if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) {
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
lance_init_locked(sc);
|
lance_init_locked(sc);
|
||||||
LE_UNLOCK(sc);
|
LE_UNLOCK(sc);
|
||||||
return;
|
return;
|
||||||
@@ -474,19 +474,19 @@ am79900_intr(void *arg)
|
|||||||
#ifdef LEDEBUG
|
#ifdef LEDEBUG
|
||||||
if_printf(ifp, "babble\n");
|
if_printf(ifp, "babble\n");
|
||||||
#endif
|
#endif
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if (isr & LE_C0_CERR) {
|
if (isr & LE_C0_CERR) {
|
||||||
if_printf(ifp, "collision error\n");
|
if_printf(ifp, "collision error\n");
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (isr & LE_C0_MISS) {
|
if (isr & LE_C0_MISS) {
|
||||||
#ifdef LEDEBUG
|
#ifdef LEDEBUG
|
||||||
if_printf(ifp, "missed packet\n");
|
if_printf(ifp, "missed packet\n");
|
||||||
#endif
|
#endif
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
}
|
}
|
||||||
if (isr & LE_C0_MERR) {
|
if (isr & LE_C0_MERR) {
|
||||||
if_printf(ifp, "memory error\n");
|
if_printf(ifp, "memory error\n");
|
||||||
@@ -498,14 +498,14 @@ am79900_intr(void *arg)
|
|||||||
|
|
||||||
if ((isr & LE_C0_RXON) == 0) {
|
if ((isr & LE_C0_RXON) == 0) {
|
||||||
if_printf(ifp, "receiver disabled\n");
|
if_printf(ifp, "receiver disabled\n");
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
lance_init_locked(sc);
|
lance_init_locked(sc);
|
||||||
LE_UNLOCK(sc);
|
LE_UNLOCK(sc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((isr & LE_C0_TXON) == 0) {
|
if ((isr & LE_C0_TXON) == 0) {
|
||||||
if_printf(ifp, "transmitter disabled\n");
|
if_printf(ifp, "transmitter disabled\n");
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
lance_init_locked(sc);
|
lance_init_locked(sc);
|
||||||
LE_UNLOCK(sc);
|
LE_UNLOCK(sc);
|
||||||
return;
|
return;
|
||||||
@@ -567,7 +567,7 @@ am79900_start_locked(struct lance_softc *sc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
|
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
|
||||||
if (m == 0)
|
if (m == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <net/ethernet.h>
|
#include <net/ethernet.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
#include <net/if_var.h>
|
||||||
#include <net/if_media.h>
|
#include <net/if_media.h>
|
||||||
|
|
||||||
#include <sparc64/sbus/lsi64854reg.h>
|
#include <sparc64/sbus/lsi64854reg.h>
|
||||||
@@ -387,7 +388,7 @@ le_dma_attach(device_t dev)
|
|||||||
sc->sc_mediachange = le_dma_supmediachange;
|
sc->sc_mediachange = le_dma_supmediachange;
|
||||||
sc->sc_mediastatus = le_dma_supmediastatus;
|
sc->sc_mediastatus = le_dma_supmediastatus;
|
||||||
sc->sc_supmedia = le_dma_supmedia;
|
sc->sc_supmedia = le_dma_supmedia;
|
||||||
sc->sc_nsupmedia = sizeof(le_dma_supmedia) / sizeof(le_dma_supmedia[0]);
|
sc->sc_nsupmedia = nitems(le_dma_supmedia);
|
||||||
sc->sc_defaultmedia = le_dma_supmedia[0];
|
sc->sc_defaultmedia = le_dma_supmedia[0];
|
||||||
|
|
||||||
OF_getetheraddr(dev, sc->sc_enaddr);
|
OF_getetheraddr(dev, sc->sc_enaddr);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
#include <sys/lock.h>
|
#include <sys/lock.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
|
#include <sys/malloc.h>
|
||||||
#include <sys/mbuf.h>
|
#include <sys/mbuf.h>
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@@ -79,6 +80,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <net/ethernet.h>
|
#include <net/ethernet.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
#include <net/if_var.h>
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
#include <net/if_dl.h>
|
#include <net/if_dl.h>
|
||||||
#include <net/if_media.h>
|
#include <net/if_media.h>
|
||||||
@@ -195,7 +197,7 @@ lance_attach(struct lance_softc *sc)
|
|||||||
ether_ifattach(ifp, sc->sc_enaddr);
|
ether_ifattach(ifp, sc->sc_enaddr);
|
||||||
|
|
||||||
/* Claim 802.1q capability. */
|
/* Claim 802.1q capability. */
|
||||||
ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
|
ifp->if_hdrlen = sizeof(struct ether_vlan_header);
|
||||||
ifp->if_capabilities |= IFCAP_VLAN_MTU;
|
ifp->if_capabilities |= IFCAP_VLAN_MTU;
|
||||||
ifp->if_capenable |= IFCAP_VLAN_MTU;
|
ifp->if_capenable |= IFCAP_VLAN_MTU;
|
||||||
}
|
}
|
||||||
@@ -397,8 +399,7 @@ lance_get(struct lance_softc *sc, int boff, int totlen)
|
|||||||
|
|
||||||
while (totlen > 0) {
|
while (totlen > 0) {
|
||||||
if (totlen >= MINCLSIZE) {
|
if (totlen >= MINCLSIZE) {
|
||||||
MCLGET(m, M_NOWAIT);
|
if (!(MCLGET(m, M_NOWAIT)))
|
||||||
if ((m->m_flags & M_EXT) == 0)
|
|
||||||
goto bad;
|
goto bad;
|
||||||
len = MCLBYTES;
|
len = MCLBYTES;
|
||||||
}
|
}
|
||||||
@@ -417,7 +418,7 @@ lance_get(struct lance_softc *sc, int boff, int totlen)
|
|||||||
totlen -= len;
|
totlen -= len;
|
||||||
if (totlen > 0) {
|
if (totlen > 0) {
|
||||||
MGET(newm, M_NOWAIT, MT_DATA);
|
MGET(newm, M_NOWAIT, MT_DATA);
|
||||||
if (newm == 0)
|
if (newm == NULL)
|
||||||
goto bad;
|
goto bad;
|
||||||
len = MLEN;
|
len = MLEN;
|
||||||
m = m->m_next = newm;
|
m = m->m_next = newm;
|
||||||
@@ -445,7 +446,7 @@ lance_watchdog(void *xsc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if_printf(ifp, "device timeout\n");
|
if_printf(ifp, "device timeout\n");
|
||||||
++ifp->if_oerrors;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
lance_init_locked(sc);
|
lance_init_locked(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src add-ons kernel drivers network pcnet dev mii ;
|
SubDir HAIKU_TOP src add-ons kernel drivers network pcnet dev mii ;
|
||||||
|
|
||||||
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
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 ;
|
UsePrivateHeaders net system ;
|
||||||
UsePrivateKernelHeaders ;
|
UsePrivateKernelHeaders ;
|
||||||
@@ -18,6 +18,6 @@ KernelStaticLibrary pcnet_mii.a
|
|||||||
|
|
||||||
ObjectHdrs [ FGristFiles nsphy$(SUFOBJ) nsphyter$(SUFOBJ) ]
|
ObjectHdrs [ FGristFiles nsphy$(SUFOBJ) nsphyter$(SUFOBJ) ]
|
||||||
: [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) libs
|
: [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) libs
|
||||||
compat freebsd_network ] ;
|
compat freebsd11_network ] ;
|
||||||
Includes [ FGristFiles nsphy.c nsphyter.c ]
|
Includes [ FGristFiles nsphy.c nsphyter.c ]
|
||||||
: <src!libs!compat!freebsd_network>miidevs.h ;
|
: <src!libs!compat!freebsd11_network>miidevs.h ;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/bus.h>
|
#include <sys/bus.h>
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
#include <net/if_var.h>
|
||||||
#include <net/if_media.h>
|
#include <net/if_media.h>
|
||||||
|
|
||||||
#include <dev/mii/mii.h>
|
#include <dev/mii/mii.h>
|
||||||
@@ -128,15 +129,13 @@ nsphy_probe(device_t dev)
|
|||||||
static int
|
static int
|
||||||
nsphy_attach(device_t dev)
|
nsphy_attach(device_t dev)
|
||||||
{
|
{
|
||||||
const char *nic;
|
|
||||||
u_int flags;
|
u_int flags;
|
||||||
|
|
||||||
nic = device_get_name(device_get_parent(device_get_parent(dev)));
|
|
||||||
flags = MIIF_NOMANPAUSE;
|
flags = MIIF_NOMANPAUSE;
|
||||||
/*
|
/*
|
||||||
* Am79C971 wedge when isolating all of their external PHYs.
|
* Am79C971 wedge when isolating all of their external PHYs.
|
||||||
*/
|
*/
|
||||||
if (strcmp(nic, "pcn") == 0)
|
if (mii_dev_mac_match(dev,"pcn"))
|
||||||
flags |= MIIF_NOISOLATE;
|
flags |= MIIF_NOISOLATE;
|
||||||
mii_phy_dev_attach(dev, flags, &nsphy_funcs, 1);
|
mii_phy_dev_attach(dev, flags, &nsphy_funcs, 1);
|
||||||
return (0);
|
return (0);
|
||||||
@@ -152,12 +151,6 @@ nsphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MII_MEDIACHG:
|
case MII_MEDIACHG:
|
||||||
/*
|
|
||||||
* If the interface is not up, don't do anything.
|
|
||||||
*/
|
|
||||||
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
reg = PHY_READ(sc, MII_NSPHY_PCR);
|
reg = PHY_READ(sc, MII_NSPHY_PCR);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -191,7 +184,7 @@ nsphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
|||||||
*/
|
*/
|
||||||
reg |= 0x0100 | 0x0400;
|
reg |= 0x0100 | 0x0400;
|
||||||
|
|
||||||
if (strcmp(mii->mii_ifp->if_dname, "fxp") == 0)
|
if (mii_phy_mac_match(sc, "fxp"))
|
||||||
PHY_WRITE(sc, MII_NSPHY_PCR, reg);
|
PHY_WRITE(sc, MII_NSPHY_PCR, reg);
|
||||||
|
|
||||||
mii_phy_setmedia(sc);
|
mii_phy_setmedia(sc);
|
||||||
|
|||||||
@@ -149,12 +149,6 @@ nsphyter_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MII_MEDIACHG:
|
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);
|
mii_phy_setmedia(sc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -140,12 +140,6 @@ ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MII_MEDIACHG:
|
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);
|
mii_phy_setmedia(sc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src add-ons kernel drivers network pcnet dev pcn ;
|
SubDir HAIKU_TOP src add-ons kernel drivers network pcnet dev pcn ;
|
||||||
|
|
||||||
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
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 ;
|
UsePrivateHeaders net system ;
|
||||||
UsePrivateKernelHeaders ;
|
UsePrivateKernelHeaders ;
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
#include <net/if_var.h>
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
#include <net/ethernet.h>
|
#include <net/ethernet.h>
|
||||||
#include <net/if_dl.h>
|
#include <net/if_dl.h>
|
||||||
@@ -802,8 +803,7 @@ pcn_newbuf(sc, idx, m)
|
|||||||
if (m_new == NULL)
|
if (m_new == NULL)
|
||||||
return(ENOBUFS);
|
return(ENOBUFS);
|
||||||
|
|
||||||
MCLGET(m_new, M_NOWAIT);
|
if (!(MCLGET(m_new, M_NOWAIT))) {
|
||||||
if (!(m_new->m_flags & M_EXT)) {
|
|
||||||
m_freem(m_new);
|
m_freem(m_new);
|
||||||
return(ENOBUFS);
|
return(ENOBUFS);
|
||||||
}
|
}
|
||||||
@@ -855,7 +855,7 @@ pcn_rxeof(sc)
|
|||||||
* comes up in the ring.
|
* comes up in the ring.
|
||||||
*/
|
*/
|
||||||
if (cur_rx->pcn_rxstat & PCN_RXSTAT_ERR) {
|
if (cur_rx->pcn_rxstat & PCN_RXSTAT_ERR) {
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
pcn_newbuf(sc, i, m);
|
pcn_newbuf(sc, i, m);
|
||||||
PCN_INC(i, PCN_RX_LIST_CNT);
|
PCN_INC(i, PCN_RX_LIST_CNT);
|
||||||
continue;
|
continue;
|
||||||
@@ -864,7 +864,7 @@ pcn_rxeof(sc)
|
|||||||
if (pcn_newbuf(sc, i, NULL)) {
|
if (pcn_newbuf(sc, i, NULL)) {
|
||||||
/* Ran out of mbufs; recycle this one. */
|
/* Ran out of mbufs; recycle this one. */
|
||||||
pcn_newbuf(sc, i, m);
|
pcn_newbuf(sc, i, m);
|
||||||
ifp->if_ierrors++;
|
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||||
PCN_INC(i, PCN_RX_LIST_CNT);
|
PCN_INC(i, PCN_RX_LIST_CNT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -872,7 +872,7 @@ pcn_rxeof(sc)
|
|||||||
PCN_INC(i, PCN_RX_LIST_CNT);
|
PCN_INC(i, PCN_RX_LIST_CNT);
|
||||||
|
|
||||||
/* No errors; receive the packet. */
|
/* No errors; receive the packet. */
|
||||||
ifp->if_ipackets++;
|
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||||
m->m_len = m->m_pkthdr.len =
|
m->m_len = m->m_pkthdr.len =
|
||||||
cur_rx->pcn_rxlen - ETHER_CRC_LEN;
|
cur_rx->pcn_rxlen - ETHER_CRC_LEN;
|
||||||
m->m_pkthdr.rcvif = ifp;
|
m->m_pkthdr.rcvif = ifp;
|
||||||
@@ -920,17 +920,17 @@ pcn_txeof(sc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cur_tx->pcn_txctl & PCN_TXCTL_ERR) {
|
if (cur_tx->pcn_txctl & PCN_TXCTL_ERR) {
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
if (cur_tx->pcn_txstat & PCN_TXSTAT_EXDEF)
|
if (cur_tx->pcn_txstat & PCN_TXSTAT_EXDEF)
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
if (cur_tx->pcn_txstat & PCN_TXSTAT_RTRY)
|
if (cur_tx->pcn_txstat & PCN_TXSTAT_RTRY)
|
||||||
ifp->if_collisions++;
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ifp->if_collisions +=
|
if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
|
||||||
cur_tx->pcn_txstat & PCN_TXSTAT_TRC;
|
cur_tx->pcn_txstat & PCN_TXSTAT_TRC);
|
||||||
|
|
||||||
ifp->if_opackets++;
|
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||||
if (sc->pcn_cdata.pcn_tx_chain[idx] != NULL) {
|
if (sc->pcn_cdata.pcn_tx_chain[idx] != NULL) {
|
||||||
m_freem(sc->pcn_cdata.pcn_tx_chain[idx]);
|
m_freem(sc->pcn_cdata.pcn_tx_chain[idx]);
|
||||||
sc->pcn_cdata.pcn_tx_chain[idx] = NULL;
|
sc->pcn_cdata.pcn_tx_chain[idx] = NULL;
|
||||||
@@ -966,7 +966,7 @@ pcn_tick(xsc)
|
|||||||
mii_tick(mii);
|
mii_tick(mii);
|
||||||
|
|
||||||
/* link just died */
|
/* link just died */
|
||||||
if (sc->pcn_link & !(mii->mii_media_status & IFM_ACTIVE))
|
if (sc->pcn_link && !(mii->mii_media_status & IFM_ACTIVE))
|
||||||
sc->pcn_link = 0;
|
sc->pcn_link = 0;
|
||||||
|
|
||||||
/* link just came up, restart */
|
/* link just came up, restart */
|
||||||
@@ -1435,7 +1435,7 @@ pcn_watchdog(struct pcn_softc *sc)
|
|||||||
PCN_LOCK_ASSERT(sc);
|
PCN_LOCK_ASSERT(sc);
|
||||||
ifp = sc->pcn_ifp;
|
ifp = sc->pcn_ifp;
|
||||||
|
|
||||||
ifp->if_oerrors++;
|
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||||
if_printf(ifp, "watchdog timeout\n");
|
if_printf(ifp, "watchdog timeout\n");
|
||||||
|
|
||||||
pcn_stop(sc);
|
pcn_stop(sc);
|
||||||
|
|||||||
Reference in New Issue
Block a user