broadcom440x: sync with FreeBSD 11.1.

This commit is contained in:
Jérôme Duval 2018-05-07 20:57:03 +02:00
parent 3f853fd3c2
commit 57ca9c743d
4 changed files with 22 additions and 28 deletions

View File

@ -2,7 +2,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers network broadcom440x dev bfe ;
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
UseHeaders [ FDirName $(SUBDIR) .. mii ] : 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 ;
@ -14,6 +14,6 @@ SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ]
KernelAddon broadcom440x :
if_bfe.c
glue.c
: libfreebsd_network.a broadcom440x_mii.a
: broadcom440x_mii.a libfreebsd11_network.a
;

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <net/bpf.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/ethernet.h>
#include <net/if_dl.h>
#include <net/if_media.h>
@ -363,12 +364,12 @@ bfe_dma_free(struct bfe_softc *sc)
/* Tx ring. */
if (sc->bfe_tx_tag != NULL) {
if (sc->bfe_tx_map != NULL)
if (sc->bfe_tx_dma != 0)
bus_dmamap_unload(sc->bfe_tx_tag, sc->bfe_tx_map);
if (sc->bfe_tx_map != NULL && sc->bfe_tx_list != NULL)
if (sc->bfe_tx_list != NULL)
bus_dmamem_free(sc->bfe_tx_tag, sc->bfe_tx_list,
sc->bfe_tx_map);
sc->bfe_tx_map = NULL;
sc->bfe_tx_dma = 0;
sc->bfe_tx_list = NULL;
bus_dma_tag_destroy(sc->bfe_tx_tag);
sc->bfe_tx_tag = NULL;
@ -376,12 +377,12 @@ bfe_dma_free(struct bfe_softc *sc)
/* Rx ring. */
if (sc->bfe_rx_tag != NULL) {
if (sc->bfe_rx_map != NULL)
if (sc->bfe_rx_dma != 0)
bus_dmamap_unload(sc->bfe_rx_tag, sc->bfe_rx_map);
if (sc->bfe_rx_map != NULL && sc->bfe_rx_list != NULL)
if (sc->bfe_rx_list != NULL)
bus_dmamem_free(sc->bfe_rx_tag, sc->bfe_rx_list,
sc->bfe_rx_map);
sc->bfe_rx_map = NULL;
sc->bfe_rx_dma = 0;
sc->bfe_rx_list = NULL;
bus_dma_tag_destroy(sc->bfe_rx_tag);
sc->bfe_rx_tag = NULL;
@ -489,7 +490,6 @@ bfe_attach(device_t dev)
ifp->if_ioctl = bfe_ioctl;
ifp->if_start = bfe_start;
ifp->if_init = bfe_init;
ifp->if_mtu = ETHERMTU;
IFQ_SET_MAXLEN(&ifp->if_snd, BFE_TX_QLEN);
ifp->if_snd.ifq_drv_maxlen = BFE_TX_QLEN;
IFQ_SET_READY(&ifp->if_snd);
@ -514,7 +514,7 @@ bfe_attach(device_t dev)
/*
* Tell the upper layer(s) we support long frames.
*/
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_capenable |= IFCAP_VLAN_MTU;
@ -1310,22 +1310,22 @@ bfe_stats_update(struct bfe_softc *sc)
stats->rx_control_frames += mib[MIB_RX_NPAUSE];
/* Update counters in ifnet. */
ifp->if_opackets += (u_long)mib[MIB_TX_GOOD_P];
ifp->if_collisions += (u_long)mib[MIB_TX_TCOLS];
ifp->if_oerrors += (u_long)mib[MIB_TX_URUNS] +
if_inc_counter(ifp, IFCOUNTER_OPACKETS, (u_long)mib[MIB_TX_GOOD_P]);
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (u_long)mib[MIB_TX_TCOLS]);
if_inc_counter(ifp, IFCOUNTER_OERRORS, (u_long)mib[MIB_TX_URUNS] +
(u_long)mib[MIB_TX_ECOLS] +
(u_long)mib[MIB_TX_DEFERED] +
(u_long)mib[MIB_TX_CLOST];
(u_long)mib[MIB_TX_CLOST]);
ifp->if_ipackets += (u_long)mib[MIB_RX_GOOD_P];
if_inc_counter(ifp, IFCOUNTER_IPACKETS, (u_long)mib[MIB_RX_GOOD_P]);
ifp->if_ierrors += mib[MIB_RX_JABBER] +
if_inc_counter(ifp, IFCOUNTER_IERRORS, mib[MIB_RX_JABBER] +
mib[MIB_RX_MISS] +
mib[MIB_RX_CRCA] +
mib[MIB_RX_USIZE] +
mib[MIB_RX_CRC] +
mib[MIB_RX_ALIGN] +
mib[MIB_RX_SYM];
mib[MIB_RX_SYM]);
}
static void
@ -1403,7 +1403,7 @@ bfe_rxeof(struct bfe_softc *sc)
* reuse mapped buffer from errored frame.
*/
if (bfe_list_newbuf(sc, cons) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
bfe_discard_buf(sc, cons);
continue;
}
@ -1818,7 +1818,7 @@ bfe_watchdog(struct bfe_softc *sc)
device_printf(sc->bfe_dev, "watchdog timeout -- resetting\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
bfe_init_locked(sc);

View File

@ -1,7 +1,7 @@
SubDir HAIKU_TOP src add-ons kernel drivers network broadcom440x 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 ;
@ -15,5 +15,5 @@ KernelStaticLibrary broadcom440x_mii.a
ObjectHdrs [ FGristFiles bmtphy$(SUFOBJ) ]
: [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) libs
compat freebsd_network ] ;
Includes [ FGristFiles bmtphy.c ] : <src!libs!compat!freebsd_network>miidevs.h ;
compat freebsd11_network ] ;
Includes [ FGristFiles bmtphy.c ] : <src!libs!compat!freebsd11_network>miidevs.h ;

View File

@ -163,12 +163,6 @@ bmtphy_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;