[haiku-commits] haiku: hrev51886 - in src/add-ons/kernel/drivers/network: ar81xx/dev/ale vt612x/dev/vge vt612x/dev/mii ar81xx/dev/mii

  • From: jerome.duval@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 21 Apr 2018 16:09:19 -0400 (EDT)

hrev51886 adds 2 changesets to branch 'master'
old head: dde876f9f8364706dc136166718e8647d51ad9cc
new head: 853a76f1f31d9ae4e267a21b29f6a621a06630dc
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=853a76f1f31d+%5Edde876f9f836

----------------------------------------------------------------------------

e68394b9787c: ar81xxx: sync with FreeBSD 11.1.

853a76f1f31d: vt612x: sync with FreeBSD 11.1.

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

----------------------------------------------------------------------------

10 files changed, 64 insertions(+), 100 deletions(-)
.../drivers/network/ar81xx/dev/ale/Jamfile       |  4 +-
.../drivers/network/ar81xx/dev/ale/if_ale.c      | 68 ++++++++------------
.../drivers/network/ar81xx/dev/ale/if_alereg.h   |  1 -
.../drivers/network/ar81xx/dev/mii/Jamfile       |  2 +-
.../drivers/network/ar81xx/dev/mii/ukphy.c       |  6 --
.../drivers/network/vt612x/dev/mii/Jamfile       |  6 +-
.../drivers/network/vt612x/dev/mii/ciphy.c       | 19 ++----
.../drivers/network/vt612x/dev/mii/ukphy.c       |  6 --
.../drivers/network/vt612x/dev/vge/Jamfile       |  6 +-
.../drivers/network/vt612x/dev/vge/if_vge.c      | 46 +++++++------

############################################################################

Commit:      e68394b9787c6724a940f444890124662eb7cab9
URL:         https://git.haiku-os.org/haiku/commit/?id=e68394b9787c
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Sat Apr 21 19:55:58 2018 UTC

ar81xxx: sync with FreeBSD 11.1.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/Jamfile 
b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/Jamfile
index ef6745815a..579282edd9 100644
--- a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/Jamfile
+++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/Jamfile
@@ -1,7 +1,7 @@
 SubDir HAIKU_TOP src add-ons kernel drivers network ar81xx dev ale ;
 
 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 ar81xx :
        if_ale.c
        glue.c
-       : libfreebsd_network.a ar81xx_mii.a
+       : ar81xx_mii.a libfreebsd11_network.a
        ;
diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c 
b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c
index 954a87f305..e7d030636c 100644
--- a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c
+++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/bpf.h>
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/if_arp.h>
 #include <net/ethernet.h>
 #include <net/if_dl.h>
@@ -342,7 +343,7 @@ ale_probe(device_t dev)
        vendor = pci_get_vendor(dev);
        devid = pci_get_device(dev);
        sp = ale_devs;
-       for (i = 0; i < sizeof(ale_devs) / sizeof(ale_devs[0]); i++) {
+       for (i = 0; i < nitems(ale_devs); i++) {
                if (vendor == sp->ale_vendorid &&
                    devid == sp->ale_deviceid) {
                        device_set_desc(dev, sp->ale_name);
@@ -602,7 +603,7 @@ ale_attach(device_t dev)
        /* Create device sysctl node. */
        ale_sysctl_node(sc);
 
-       if ((error = ale_dma_alloc(sc) != 0))
+       if ((error = ale_dma_alloc(sc)) != 0)
                goto fail;
 
        /* Load station address. */
@@ -657,7 +658,7 @@ ale_attach(device_t dev)
        ifp->if_capenable &= ~IFCAP_RXCSUM;
 
        /* 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);
 
        /* Create local taskq. */
        sc->ale_tq = taskqueue_create_fast("ale_taskq", M_WAITOK,
@@ -945,8 +946,6 @@ ale_sysctl_node(struct ale_softc *sc)
            &stats->tx_late_colls, "Late collisions");
        ALE_SYSCTL_STAT_ADD32(ctx, child, "excess_colls",
            &stats->tx_excess_colls, "Excessive collisions");
-       ALE_SYSCTL_STAT_ADD32(ctx, child, "abort",
-           &stats->tx_abort, "Aborted frames due to Excessive collisions");
        ALE_SYSCTL_STAT_ADD32(ctx, child, "underruns",
            &stats->tx_underrun, "FIFO underruns");
        ALE_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns",
@@ -1329,34 +1328,32 @@ ale_dma_free(struct ale_softc *sc)
        }
        /* Tx descriptor ring. */
        if (sc->ale_cdata.ale_tx_ring_tag != NULL) {
-               if (sc->ale_cdata.ale_tx_ring_map != NULL)
+               if (sc->ale_cdata.ale_tx_ring_paddr != 0)
                        bus_dmamap_unload(sc->ale_cdata.ale_tx_ring_tag,
                            sc->ale_cdata.ale_tx_ring_map);
-               if (sc->ale_cdata.ale_tx_ring_map != NULL &&
-                   sc->ale_cdata.ale_tx_ring != NULL)
+               if (sc->ale_cdata.ale_tx_ring != NULL)
                        bus_dmamem_free(sc->ale_cdata.ale_tx_ring_tag,
                            sc->ale_cdata.ale_tx_ring,
                            sc->ale_cdata.ale_tx_ring_map);
+               sc->ale_cdata.ale_tx_ring_paddr = 0;
                sc->ale_cdata.ale_tx_ring = NULL;
-               sc->ale_cdata.ale_tx_ring_map = NULL;
                bus_dma_tag_destroy(sc->ale_cdata.ale_tx_ring_tag);
                sc->ale_cdata.ale_tx_ring_tag = NULL;
        }
        /* Rx page block. */
        for (i = 0; i < ALE_RX_PAGES; i++) {
                if (sc->ale_cdata.ale_rx_page[i].page_tag != NULL) {
-                       if (sc->ale_cdata.ale_rx_page[i].page_map != NULL)
+                       if (sc->ale_cdata.ale_rx_page[i].page_paddr != 0)
                                bus_dmamap_unload(
                                    sc->ale_cdata.ale_rx_page[i].page_tag,
                                    sc->ale_cdata.ale_rx_page[i].page_map);
-                       if (sc->ale_cdata.ale_rx_page[i].page_map != NULL &&
-                           sc->ale_cdata.ale_rx_page[i].page_addr != NULL)
+                       if (sc->ale_cdata.ale_rx_page[i].page_addr != NULL)
                                bus_dmamem_free(
                                    sc->ale_cdata.ale_rx_page[i].page_tag,
                                    sc->ale_cdata.ale_rx_page[i].page_addr,
                                    sc->ale_cdata.ale_rx_page[i].page_map);
+                       sc->ale_cdata.ale_rx_page[i].page_paddr = 0;
                        sc->ale_cdata.ale_rx_page[i].page_addr = NULL;
-                       sc->ale_cdata.ale_rx_page[i].page_map = NULL;
                        bus_dma_tag_destroy(
                            sc->ale_cdata.ale_rx_page[i].page_tag);
                        sc->ale_cdata.ale_rx_page[i].page_tag = NULL;
@@ -1365,18 +1362,17 @@ ale_dma_free(struct ale_softc *sc)
        /* Rx CMB. */
        for (i = 0; i < ALE_RX_PAGES; i++) {
                if (sc->ale_cdata.ale_rx_page[i].cmb_tag != NULL) {
-                       if (sc->ale_cdata.ale_rx_page[i].cmb_map != NULL)
+                       if (sc->ale_cdata.ale_rx_page[i].cmb_paddr != 0)
                                bus_dmamap_unload(
                                    sc->ale_cdata.ale_rx_page[i].cmb_tag,
                                    sc->ale_cdata.ale_rx_page[i].cmb_map);
-                       if (sc->ale_cdata.ale_rx_page[i].cmb_map != NULL &&
-                           sc->ale_cdata.ale_rx_page[i].cmb_addr != NULL)
+                       if (sc->ale_cdata.ale_rx_page[i].cmb_addr != NULL)
                                bus_dmamem_free(
                                    sc->ale_cdata.ale_rx_page[i].cmb_tag,
                                    sc->ale_cdata.ale_rx_page[i].cmb_addr,
                                    sc->ale_cdata.ale_rx_page[i].cmb_map);
+                       sc->ale_cdata.ale_rx_page[i].cmb_paddr = 0;
                        sc->ale_cdata.ale_rx_page[i].cmb_addr = NULL;
-                       sc->ale_cdata.ale_rx_page[i].cmb_map = NULL;
                        bus_dma_tag_destroy(
                            sc->ale_cdata.ale_rx_page[i].cmb_tag);
                        sc->ale_cdata.ale_rx_page[i].cmb_tag = NULL;
@@ -1384,16 +1380,15 @@ ale_dma_free(struct ale_softc *sc)
        }
        /* Tx CMB. */
        if (sc->ale_cdata.ale_tx_cmb_tag != NULL) {
-               if (sc->ale_cdata.ale_tx_cmb_map != NULL)
+               if (sc->ale_cdata.ale_tx_cmb_paddr != 0)
                        bus_dmamap_unload(sc->ale_cdata.ale_tx_cmb_tag,
                            sc->ale_cdata.ale_tx_cmb_map);
-               if (sc->ale_cdata.ale_tx_cmb_map != NULL &&
-                   sc->ale_cdata.ale_tx_cmb != NULL)
+               if (sc->ale_cdata.ale_tx_cmb != NULL)
                        bus_dmamem_free(sc->ale_cdata.ale_tx_cmb_tag,
                            sc->ale_cdata.ale_tx_cmb,
                            sc->ale_cdata.ale_tx_cmb_map);
+               sc->ale_cdata.ale_tx_cmb_paddr = 0;
                sc->ale_cdata.ale_tx_cmb = NULL;
-               sc->ale_cdata.ale_tx_cmb_map = NULL;
                bus_dma_tag_destroy(sc->ale_cdata.ale_tx_cmb_tag);
                sc->ale_cdata.ale_tx_cmb_tag = NULL;
        }
@@ -1956,13 +1951,13 @@ ale_watchdog(struct ale_softc *sc)
        ifp = sc->ale_ifp;
        if ((sc->ale_flags & ALE_FLAG_LINK) == 0) {
                if_printf(sc->ale_ifp, "watchdog timeout (lost link)\n");
-               ifp->if_oerrors++;
+               if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
                ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
                ale_init_locked(sc);
                return;
        }
        if_printf(sc->ale_ifp, "watchdog timeout -- resetting\n");
-       ifp->if_oerrors++;
+       if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
        ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
        ale_init_locked(sc);
        if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
@@ -2200,7 +2195,6 @@ ale_stats_update(struct ale_softc *sc)
        stat->tx_multi_colls += smb->tx_multi_colls;
        stat->tx_late_colls += smb->tx_late_colls;
        stat->tx_excess_colls += smb->tx_excess_colls;
-       stat->tx_abort += smb->tx_abort;
        stat->tx_underrun += smb->tx_underrun;
        stat->tx_desc_underrun += smb->tx_desc_underrun;
        stat->tx_lenerrs += smb->tx_lenerrs;
@@ -2209,28 +2203,22 @@ ale_stats_update(struct ale_softc *sc)
        stat->tx_mcast_bytes += smb->tx_mcast_bytes;
 
        /* Update counters in ifnet. */
-       ifp->if_opackets += smb->tx_frames;
+       if_inc_counter(ifp, IFCOUNTER_OPACKETS, smb->tx_frames);
 
-       ifp->if_collisions += smb->tx_single_colls +
+       if_inc_counter(ifp, IFCOUNTER_COLLISIONS, smb->tx_single_colls +
            smb->tx_multi_colls * 2 + smb->tx_late_colls +
-           smb->tx_abort * HDPX_CFG_RETRY_DEFAULT;
+           smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT);
 
-       /*
-        * XXX
-        * tx_pkts_truncated counter looks suspicious. It constantly
-        * increments with no sign of Tx errors. This may indicate
-        * the counter name is not correct one so I've removed the
-        * counter in output errors.
-        */
-       ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls +
-           smb->tx_underrun;
+       if_inc_counter(ifp, IFCOUNTER_OERRORS, smb->tx_late_colls +
+           smb->tx_excess_colls + smb->tx_underrun + smb->tx_pkts_truncated);
 
-       ifp->if_ipackets += smb->rx_frames;
+       if_inc_counter(ifp, IFCOUNTER_IPACKETS, smb->rx_frames);
 
-       ifp->if_ierrors += smb->rx_crcerrs + smb->rx_lenerrs +
+       if_inc_counter(ifp, IFCOUNTER_IERRORS,
+           smb->rx_crcerrs + smb->rx_lenerrs +
            smb->rx_runts + smb->rx_pkts_truncated +
            smb->rx_fifo_oflows + smb->rx_rrs_errs +
-           smb->rx_alignerrs;
+           smb->rx_alignerrs);
 }
 
 static int
@@ -2552,7 +2540,7 @@ ale_rxeof(struct ale_softc *sc, int count)
                m = m_devget((char *)(rs + 1), length - ETHER_CRC_LEN,
                    ETHER_ALIGN, ifp, NULL);
                if (m == NULL) {
-                       ifp->if_iqdrops++;
+                       if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
                        ale_rx_update_page(sc, &rx_page, length, &prod);
                        continue;
                }
diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alereg.h 
b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alereg.h
index 445af99daf..5804c53724 100644
--- a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alereg.h
+++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alereg.h
@@ -605,7 +605,6 @@ struct smb {
        uint32_t tx_multi_colls;
        uint32_t tx_late_colls;
        uint32_t tx_excess_colls;
-       uint32_t tx_abort;
        uint32_t tx_underrun;
        uint32_t tx_desc_underrun;
        uint32_t tx_lenerrs;
diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/Jamfile 
b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/Jamfile
index 896c8b79e7..c88c571d53 100644
--- a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/Jamfile
+++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/Jamfile
@@ -1,7 +1,7 @@
 SubDir HAIKU_TOP src add-ons kernel drivers network ar81xx 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 ;
diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c 
b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c
index 9d52eb580c..45addcbc75 100644
--- a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c
+++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c
@@ -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;
 

############################################################################

Revision:    hrev51886
Commit:      853a76f1f31d9ae4e267a21b29f6a621a06630dc
URL:         https://git.haiku-os.org/haiku/commit/?id=853a76f1f31d
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Sat Apr 21 20:07:48 2018 UTC

vt612x: sync with FreeBSD 11.1.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/Jamfile 
b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/Jamfile
index 394fa38ff7..dc9d237c64 100644
--- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/Jamfile
+++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/Jamfile
@@ -1,7 +1,7 @@
 SubDir HAIKU_TOP src add-ons kernel drivers network vt612x 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,6 +17,6 @@ KernelStaticLibrary vt612x_mii.a
 
 ObjectHdrs [ FGristFiles ciphy$(SUFOBJ) ukphy$(SUFOBJ) ]
        : [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) 
libs
-               compat freebsd_network ] ;
-Includes [ FGristFiles ciphy.c ukphy.c ] : 
<src!libs!compat!freebsd_network>miidevs.h ;
+               compat freebsd11_network ] ;
+Includes [ FGristFiles ciphy.c ukphy.c ] : 
<src!libs!compat!freebsd11_network>miidevs.h ;
 
diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c 
b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c
index 87d0d814e9..2d2816cddf 100644
--- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c
+++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c
@@ -91,8 +91,10 @@ static const struct mii_phydesc ciphys[] = {
        MII_PHY_DESC(xxCICADA, CS8201B),
        MII_PHY_DESC(xxCICADA, CS8204),
        MII_PHY_DESC(xxCICADA, VSC8211),
+       MII_PHY_DESC(xxCICADA, VSC8221),
        MII_PHY_DESC(xxCICADA, CS8244),
        MII_PHY_DESC(xxVITESSE, VSC8601),
+       MII_PHY_DESC(xxVITESSE, VSC8641),
        MII_PHY_END
 };
 
@@ -129,12 +131,6 @@ ciphy_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;
-
                ciphy_fixup(sc);        /* XXX hardware bug work-around */
 
                switch (IFM_SUBTYPE(ife->ifm_media)) {
@@ -184,12 +180,6 @@ setit:
                break;
 
        case MII_TICK:
-               /*
-                * Is the interface even up?
-                */
-               if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-                       return (0);
-
                /*
                 * Only used for autonegotiation.
                 */
@@ -313,8 +303,7 @@ ciphy_fixup(struct mii_softc *sc)
        status = PHY_READ(sc, CIPHY_MII_AUXCSR);
        speed = status & CIPHY_AUXCSR_SPEED;
 
-       if (strcmp(device_get_name(device_get_parent(sc->mii_dev)),
-           "nfe") == 0) {
+       if (mii_phy_mac_match(sc, "nfe")) {
                /* need to set for 2.5V RGMII for NVIDIA adapters */
                val = PHY_READ(sc, CIPHY_MII_ECTL1);
                val &= ~(CIPHY_ECTL1_IOVOL | CIPHY_ECTL1_INTSEL);
@@ -368,8 +357,10 @@ ciphy_fixup(struct mii_softc *sc)
 
                break;
        case MII_MODEL_xxCICADA_VSC8211:
+       case MII_MODEL_xxCICADA_VSC8221:
        case MII_MODEL_xxCICADA_CS8244:
        case MII_MODEL_xxVITESSE_VSC8601:
+       case MII_MODEL_xxVITESSE_VSC8641:
                break;
        default:
                device_printf(sc->mii_dev, "unknown CICADA PHY model %x\n",
diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c 
b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c
index 9d52eb580c..45addcbc75 100644
--- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c
+++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c
@@ -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;
 
diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile 
b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile
index 1d40cf74eb..86d01c98df 100644
--- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile
+++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/Jamfile
@@ -3,8 +3,8 @@ SubDir HAIKU_TOP src add-ons kernel drivers network vt612x dev 
vge ;
 SubDirCcFlags -Wall ;
 
 UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : 
true ;
+UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_network ] : 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 vt612x :
        if_vge.c
        glue.c
-       : libfreebsd_network.a vt612x_mii.a
+       : vt612x_mii.a libfreebsd11_network.a
        ;
 
diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c 
b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c
index f891cf2a2e..315f273eef 100644
--- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c
+++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c
@@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_arp.h>
 #include <net/ethernet.h>
 #include <net/if_dl.h>
+#include <net/if_var.h>
 #include <net/if_media.h>
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
@@ -911,31 +912,29 @@ vge_dma_free(struct vge_softc *sc)
 
        /* Tx ring. */
        if (sc->vge_cdata.vge_tx_ring_tag != NULL) {
-               if (sc->vge_cdata.vge_tx_ring_map)
+               if (sc->vge_rdata.vge_tx_ring_paddr)
                        bus_dmamap_unload(sc->vge_cdata.vge_tx_ring_tag,
                            sc->vge_cdata.vge_tx_ring_map);
-               if (sc->vge_cdata.vge_tx_ring_map &&
-                   sc->vge_rdata.vge_tx_ring)
+               if (sc->vge_rdata.vge_tx_ring)
                        bus_dmamem_free(sc->vge_cdata.vge_tx_ring_tag,
                            sc->vge_rdata.vge_tx_ring,
                            sc->vge_cdata.vge_tx_ring_map);
                sc->vge_rdata.vge_tx_ring = NULL;
-               sc->vge_cdata.vge_tx_ring_map = NULL;
+               sc->vge_rdata.vge_tx_ring_paddr = 0;
                bus_dma_tag_destroy(sc->vge_cdata.vge_tx_ring_tag);
                sc->vge_cdata.vge_tx_ring_tag = NULL;
        }
        /* Rx ring. */
        if (sc->vge_cdata.vge_rx_ring_tag != NULL) {
-               if (sc->vge_cdata.vge_rx_ring_map)
+               if (sc->vge_rdata.vge_rx_ring_paddr)
                        bus_dmamap_unload(sc->vge_cdata.vge_rx_ring_tag,
                            sc->vge_cdata.vge_rx_ring_map);
-               if (sc->vge_cdata.vge_rx_ring_map &&
-                   sc->vge_rdata.vge_rx_ring)
+               if (sc->vge_rdata.vge_rx_ring)
                        bus_dmamem_free(sc->vge_cdata.vge_rx_ring_tag,
                            sc->vge_rdata.vge_rx_ring,
                            sc->vge_cdata.vge_rx_ring_map);
                sc->vge_rdata.vge_rx_ring = NULL;
-               sc->vge_cdata.vge_rx_ring_map = NULL;
+               sc->vge_rdata.vge_rx_ring_paddr = 0;
                bus_dma_tag_destroy(sc->vge_cdata.vge_rx_ring_tag);
                sc->vge_cdata.vge_rx_ring_tag = NULL;
        }
@@ -1131,7 +1130,7 @@ vge_attach(device_t dev)
        ether_ifattach(ifp, eaddr);
 
        /* 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);
 
        /* Hook interrupt last to avoid having to lock softc */
        error = bus_setup_intr(dev, sc->vge_irq, INTR_TYPE_NET|INTR_MPSAFE,
@@ -1401,7 +1400,7 @@ vge_freebufs(struct vge_softc *sc)
                            txd->tx_dmamap);
                        m_freem(txd->tx_m);
                        txd->tx_m = NULL;
-                       ifp->if_oerrors++;
+                       if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
                }
        }
 }
@@ -1468,7 +1467,7 @@ vge_rxeof(struct vge_softc *sc, int count)
                 */
                if ((rxstat & VGE_RXPKT_SOF) != 0) {
                        if (vge_newbuf(sc, prod) != 0) {
-                               ifp->if_iqdrops++;
+                               if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
                                VGE_CHAIN_RESET(sc);
                                vge_discard_rxbuf(sc, prod);
                                continue;
@@ -1499,7 +1498,7 @@ vge_rxeof(struct vge_softc *sc, int count)
                if ((rxstat & VGE_RDSTS_RXOK) == 0 &&
                    (rxstat & (VGE_RDSTS_VIDM | VGE_RDSTS_RLERR |
                    VGE_RDSTS_CSUMERR)) == 0) {
-                       ifp->if_ierrors++;
+                       if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
                        /*
                         * If this is part of a multi-fragment packet,
                         * discard all the pieces.
@@ -1510,7 +1509,7 @@ vge_rxeof(struct vge_softc *sc, int count)
                }
 
                if (vge_newbuf(sc, prod) != 0) {
-                       ifp->if_iqdrops++;
+                       if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
                        VGE_CHAIN_RESET(sc);
                        vge_discard_rxbuf(sc, prod);
                        continue;
@@ -2022,11 +2021,9 @@ static void
 vge_init_locked(struct vge_softc *sc)
 {
        struct ifnet *ifp = sc->vge_ifp;
-       struct mii_data *mii;
        int error, i;
 
        VGE_LOCK_ASSERT(sc);
-       mii = device_get_softc(sc->vge_miibus);
 
        if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
                return;
@@ -2383,7 +2380,7 @@ vge_watchdog(void *arg)
 
        ifp = sc->vge_ifp;
        if_printf(ifp, "watchdog timeout\n");
-       ifp->if_oerrors++;
+       if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 
        vge_txeof(sc);
        vge_rxeof(sc, VGE_RX_DESC_CNT);
@@ -2709,24 +2706,25 @@ reset_idx:
        stats->tx_latecolls += mib[VGE_MIB_TX_LATECOLLS];
 
        /* Update counters in ifnet. */
-       ifp->if_opackets += mib[VGE_MIB_TX_GOOD_FRAMES];
+       if_inc_counter(ifp, IFCOUNTER_OPACKETS, mib[VGE_MIB_TX_GOOD_FRAMES]);
 
-       ifp->if_collisions += mib[VGE_MIB_TX_COLLS] +
-           mib[VGE_MIB_TX_LATECOLLS];
+       if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
+           mib[VGE_MIB_TX_COLLS] + mib[VGE_MIB_TX_LATECOLLS]);
 
-       ifp->if_oerrors += mib[VGE_MIB_TX_COLLS] +
-           mib[VGE_MIB_TX_LATECOLLS];
+       if_inc_counter(ifp, IFCOUNTER_OERRORS,
+           mib[VGE_MIB_TX_COLLS] + mib[VGE_MIB_TX_LATECOLLS]);
 
-       ifp->if_ipackets += mib[VGE_MIB_RX_GOOD_FRAMES];
+       if_inc_counter(ifp, IFCOUNTER_IPACKETS, mib[VGE_MIB_RX_GOOD_FRAMES]);
 
-       ifp->if_ierrors += mib[VGE_MIB_RX_FIFO_OVERRUNS] +
+       if_inc_counter(ifp, IFCOUNTER_IERRORS,
+           mib[VGE_MIB_RX_FIFO_OVERRUNS] +
            mib[VGE_MIB_RX_RUNTS] +
            mib[VGE_MIB_RX_RUNTS_ERRS] +
            mib[VGE_MIB_RX_CRCERRS] +
            mib[VGE_MIB_RX_ALIGNERRS] +
            mib[VGE_MIB_RX_NOBUFS] +
            mib[VGE_MIB_RX_SYMERRS] +
-           mib[VGE_MIB_RX_LENERRS];
+           mib[VGE_MIB_RX_LENERRS]);
 }
 
 static void


Other related posts:

  • » [haiku-commits] haiku: hrev51886 - in src/add-ons/kernel/drivers/network: ar81xx/dev/ale vt612x/dev/vge vt612x/dev/mii ar81xx/dev/mii - jerome . duval