attansic_l1: sync with FreeBSD 11.1.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel drivers network attansic_l1 dev age ;
|
||||
|
||||
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 attansic_l1 :
|
||||
if_age.c
|
||||
glue.c
|
||||
: libfreebsd_network.a atl1_mii.a
|
||||
: atl1_mii.a libfreebsd11_network.a
|
||||
;
|
||||
|
||||
@@ -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>
|
||||
@@ -322,8 +323,7 @@ age_probe(device_t dev)
|
||||
vendor = pci_get_vendor(dev);
|
||||
devid = pci_get_device(dev);
|
||||
sp = age_devs;
|
||||
for (i = 0; i < sizeof(age_devs) / sizeof(age_devs[0]);
|
||||
i++, sp++) {
|
||||
for (i = 0; i < nitems(age_devs); i++, sp++) {
|
||||
if (vendor == sp->age_vendorid &&
|
||||
devid == sp->age_deviceid) {
|
||||
device_set_desc(dev, sp->age_name);
|
||||
@@ -587,7 +587,7 @@ age_attach(device_t dev)
|
||||
/* Create device sysctl node. */
|
||||
age_sysctl_node(sc);
|
||||
|
||||
if ((error = age_dma_alloc(sc) != 0))
|
||||
if ((error = age_dma_alloc(sc)) != 0)
|
||||
goto fail;
|
||||
|
||||
/* Load station address. */
|
||||
@@ -634,7 +634,7 @@ age_attach(device_t dev)
|
||||
ifp->if_capenable = ifp->if_capabilities;
|
||||
|
||||
/* 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->age_tq = taskqueue_create_fast("age_taskq", M_WAITOK,
|
||||
@@ -1228,76 +1228,71 @@ age_dma_free(struct age_softc *sc)
|
||||
}
|
||||
/* Tx ring. */
|
||||
if (sc->age_cdata.age_tx_ring_tag != NULL) {
|
||||
if (sc->age_cdata.age_tx_ring_map != NULL)
|
||||
if (sc->age_rdata.age_tx_ring_paddr != 0)
|
||||
bus_dmamap_unload(sc->age_cdata.age_tx_ring_tag,
|
||||
sc->age_cdata.age_tx_ring_map);
|
||||
if (sc->age_cdata.age_tx_ring_map != NULL &&
|
||||
sc->age_rdata.age_tx_ring != NULL)
|
||||
if (sc->age_rdata.age_tx_ring != NULL)
|
||||
bus_dmamem_free(sc->age_cdata.age_tx_ring_tag,
|
||||
sc->age_rdata.age_tx_ring,
|
||||
sc->age_cdata.age_tx_ring_map);
|
||||
sc->age_rdata.age_tx_ring_paddr = 0;
|
||||
sc->age_rdata.age_tx_ring = NULL;
|
||||
sc->age_cdata.age_tx_ring_map = NULL;
|
||||
bus_dma_tag_destroy(sc->age_cdata.age_tx_ring_tag);
|
||||
sc->age_cdata.age_tx_ring_tag = NULL;
|
||||
}
|
||||
/* Rx ring. */
|
||||
if (sc->age_cdata.age_rx_ring_tag != NULL) {
|
||||
if (sc->age_cdata.age_rx_ring_map != NULL)
|
||||
if (sc->age_rdata.age_rx_ring_paddr != 0)
|
||||
bus_dmamap_unload(sc->age_cdata.age_rx_ring_tag,
|
||||
sc->age_cdata.age_rx_ring_map);
|
||||
if (sc->age_cdata.age_rx_ring_map != NULL &&
|
||||
sc->age_rdata.age_rx_ring != NULL)
|
||||
if (sc->age_rdata.age_rx_ring != NULL)
|
||||
bus_dmamem_free(sc->age_cdata.age_rx_ring_tag,
|
||||
sc->age_rdata.age_rx_ring,
|
||||
sc->age_cdata.age_rx_ring_map);
|
||||
sc->age_rdata.age_rx_ring_paddr = 0;
|
||||
sc->age_rdata.age_rx_ring = NULL;
|
||||
sc->age_cdata.age_rx_ring_map = NULL;
|
||||
bus_dma_tag_destroy(sc->age_cdata.age_rx_ring_tag);
|
||||
sc->age_cdata.age_rx_ring_tag = NULL;
|
||||
}
|
||||
/* Rx return ring. */
|
||||
if (sc->age_cdata.age_rr_ring_tag != NULL) {
|
||||
if (sc->age_cdata.age_rr_ring_map != NULL)
|
||||
if (sc->age_rdata.age_rr_ring_paddr != 0)
|
||||
bus_dmamap_unload(sc->age_cdata.age_rr_ring_tag,
|
||||
sc->age_cdata.age_rr_ring_map);
|
||||
if (sc->age_cdata.age_rr_ring_map != NULL &&
|
||||
sc->age_rdata.age_rr_ring != NULL)
|
||||
if (sc->age_rdata.age_rr_ring != NULL)
|
||||
bus_dmamem_free(sc->age_cdata.age_rr_ring_tag,
|
||||
sc->age_rdata.age_rr_ring,
|
||||
sc->age_cdata.age_rr_ring_map);
|
||||
sc->age_rdata.age_rr_ring_paddr = 0;
|
||||
sc->age_rdata.age_rr_ring = NULL;
|
||||
sc->age_cdata.age_rr_ring_map = NULL;
|
||||
bus_dma_tag_destroy(sc->age_cdata.age_rr_ring_tag);
|
||||
sc->age_cdata.age_rr_ring_tag = NULL;
|
||||
}
|
||||
/* CMB block */
|
||||
if (sc->age_cdata.age_cmb_block_tag != NULL) {
|
||||
if (sc->age_cdata.age_cmb_block_map != NULL)
|
||||
if (sc->age_rdata.age_cmb_block_paddr != 0)
|
||||
bus_dmamap_unload(sc->age_cdata.age_cmb_block_tag,
|
||||
sc->age_cdata.age_cmb_block_map);
|
||||
if (sc->age_cdata.age_cmb_block_map != NULL &&
|
||||
sc->age_rdata.age_cmb_block != NULL)
|
||||
if (sc->age_rdata.age_cmb_block != NULL)
|
||||
bus_dmamem_free(sc->age_cdata.age_cmb_block_tag,
|
||||
sc->age_rdata.age_cmb_block,
|
||||
sc->age_cdata.age_cmb_block_map);
|
||||
sc->age_rdata.age_cmb_block_paddr = 0;
|
||||
sc->age_rdata.age_cmb_block = NULL;
|
||||
sc->age_cdata.age_cmb_block_map = NULL;
|
||||
bus_dma_tag_destroy(sc->age_cdata.age_cmb_block_tag);
|
||||
sc->age_cdata.age_cmb_block_tag = NULL;
|
||||
}
|
||||
/* SMB block */
|
||||
if (sc->age_cdata.age_smb_block_tag != NULL) {
|
||||
if (sc->age_cdata.age_smb_block_map != NULL)
|
||||
if (sc->age_rdata.age_smb_block_paddr != 0)
|
||||
bus_dmamap_unload(sc->age_cdata.age_smb_block_tag,
|
||||
sc->age_cdata.age_smb_block_map);
|
||||
if (sc->age_cdata.age_smb_block_map != NULL &&
|
||||
sc->age_rdata.age_smb_block != NULL)
|
||||
if (sc->age_rdata.age_smb_block != NULL)
|
||||
bus_dmamem_free(sc->age_cdata.age_smb_block_tag,
|
||||
sc->age_rdata.age_smb_block,
|
||||
sc->age_cdata.age_smb_block_map);
|
||||
sc->age_rdata.age_smb_block_paddr = 0;
|
||||
sc->age_rdata.age_smb_block = NULL;
|
||||
sc->age_cdata.age_smb_block_map = NULL;
|
||||
bus_dma_tag_destroy(sc->age_cdata.age_smb_block_tag);
|
||||
sc->age_cdata.age_smb_block_tag = NULL;
|
||||
}
|
||||
@@ -1800,7 +1795,7 @@ age_watchdog(struct age_softc *sc)
|
||||
ifp = sc->age_ifp;
|
||||
if ((sc->age_flags & AGE_FLAG_LINK) == 0) {
|
||||
if_printf(sc->age_ifp, "watchdog timeout (missed link)\n");
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
age_init_locked(sc);
|
||||
return;
|
||||
@@ -1813,7 +1808,7 @@ age_watchdog(struct age_softc *sc)
|
||||
return;
|
||||
}
|
||||
if_printf(sc->age_ifp, "watchdog timeout\n");
|
||||
ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
age_init_locked(sc);
|
||||
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
|
||||
@@ -2095,22 +2090,22 @@ age_stats_update(struct age_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 + smb->tx_late_colls +
|
||||
smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT;
|
||||
smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT);
|
||||
|
||||
ifp->if_oerrors += smb->tx_excess_colls +
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, smb->tx_excess_colls +
|
||||
smb->tx_late_colls + smb->tx_underrun +
|
||||
smb->tx_pkts_truncated;
|
||||
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 +
|
||||
smb->rx_runts + smb->rx_pkts_truncated +
|
||||
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_desc_oflows +
|
||||
smb->rx_alignerrs;
|
||||
smb->rx_alignerrs);
|
||||
|
||||
/* Update done, clear. */
|
||||
smb->updated = 0;
|
||||
@@ -2299,7 +2294,7 @@ age_fixup_rx(struct ifnet *ifp, struct mbuf *m)
|
||||
*/
|
||||
MGETHDR(n, M_NOWAIT, MT_DATA);
|
||||
if (n == NULL) {
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
m_freem(m);
|
||||
return (NULL);
|
||||
}
|
||||
@@ -2355,7 +2350,7 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
mp = rxd->rx_m;
|
||||
/* Add a new receive buffer to the ring. */
|
||||
if (age_newbuf(sc, rxd) != 0) {
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
/* Reuse Rx buffers. */
|
||||
if (sc->age_cdata.age_rxhead != NULL)
|
||||
m_freem(sc->age_cdata.age_rxhead);
|
||||
@@ -2495,7 +2490,7 @@ age_rxintr(struct age_softc *sc, int rr_prod, int count)
|
||||
* I'm not sure whether this check is really needed.
|
||||
*/
|
||||
pktlen = AGE_RX_BYTES(le32toh(rxrd->len));
|
||||
if (nsegs != (pktlen + (AGE_RX_BUF_SIZE - 1)) / AGE_RX_BUF_SIZE)
|
||||
if (nsegs != howmany(pktlen, AGE_RX_BUF_SIZE))
|
||||
break;
|
||||
|
||||
/* Received a frame. */
|
||||
|
||||
@@ -80,6 +80,7 @@ static int atphy_setmedia(struct mii_softc *, int);
|
||||
static const struct mii_phydesc atphys[] = {
|
||||
MII_PHY_DESC(xxATHEROS, F1),
|
||||
MII_PHY_DESC(xxATHEROS, F1_7),
|
||||
MII_PHY_DESC(xxATHEROS, AR8021),
|
||||
MII_PHY_DESC(xxATHEROS, F2),
|
||||
MII_PHY_END
|
||||
};
|
||||
@@ -116,12 +117,6 @@ atphy_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 ||
|
||||
IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) {
|
||||
atphy_setmedia(sc, ife->ifm_media);
|
||||
@@ -174,12 +169,6 @@ 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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user