atheros813x: Upgrade to FreeBSD 12.
This commit is contained in:
parent
b240ae40df
commit
ca813faa3c
@ -1,4 +1,6 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -28,7 +30,7 @@
|
||||
/* Driver for Atheros AR813x/AR815x PCIe Ethernet. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
__FBSDID("$FreeBSD: releng/12.0/sys/dev/alc/if_alc.c 338948 2018-09-26 17:12:14Z imp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -62,6 +64,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/netdump/netdump.h>
|
||||
|
||||
#include <dev/mii/mii.h>
|
||||
#include <dev/mii/miivar.h>
|
||||
@ -197,6 +200,7 @@ static int alc_shutdown(device_t);
|
||||
static void alc_start(struct ifnet *);
|
||||
static void alc_start_locked(struct ifnet *);
|
||||
static void alc_start_queue(struct alc_softc *);
|
||||
static void alc_start_tx(struct alc_softc *);
|
||||
static void alc_stats_clear(struct alc_softc *);
|
||||
static void alc_stats_update(struct alc_softc *);
|
||||
static void alc_stop(struct alc_softc *);
|
||||
@ -211,6 +215,8 @@ static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int);
|
||||
static int sysctl_hw_alc_proc_limit(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_hw_alc_int_mod(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
NETDUMP_DEFINE(alc);
|
||||
|
||||
static device_method_t alc_methods[] = {
|
||||
/* Device interface. */
|
||||
DEVMETHOD(device_probe, alc_probe),
|
||||
@ -225,7 +231,7 @@ static device_method_t alc_methods[] = {
|
||||
DEVMETHOD(miibus_writereg, alc_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, alc_miibus_statchg),
|
||||
|
||||
{ NULL, NULL }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t alc_driver = {
|
||||
@ -237,6 +243,8 @@ static driver_t alc_driver = {
|
||||
static devclass_t alc_devclass;
|
||||
|
||||
DRIVER_MODULE(alc, pci, alc_driver, alc_devclass, 0, 0);
|
||||
MODULE_PNP_INFO("U16:vendor;U16:device", pci, alc, alc_ident_table,
|
||||
nitems(alc_ident_table) - 1);
|
||||
DRIVER_MODULE(miibus, alc, miibus_driver, miibus_devclass, 0, 0);
|
||||
|
||||
static struct resource_spec alc_res_spec_mem[] = {
|
||||
@ -1649,6 +1657,9 @@ alc_attach(device_t dev)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Attach driver netdump methods. */
|
||||
NETDUMP_SET(ifp, alc);
|
||||
|
||||
fail:
|
||||
if (error != 0)
|
||||
alc_detach(dev);
|
||||
@ -2972,22 +2983,28 @@ alc_start_locked(struct ifnet *ifp)
|
||||
ETHER_BPF_MTAP(ifp, m_head);
|
||||
}
|
||||
|
||||
if (enq > 0) {
|
||||
/* Sync descriptors. */
|
||||
bus_dmamap_sync(sc->alc_cdata.alc_tx_ring_tag,
|
||||
sc->alc_cdata.alc_tx_ring_map, BUS_DMASYNC_PREWRITE);
|
||||
/* Kick. Assume we're using normal Tx priority queue. */
|
||||
if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0)
|
||||
CSR_WRITE_2(sc, ALC_MBOX_TD_PRI0_PROD_IDX,
|
||||
(uint16_t)sc->alc_cdata.alc_tx_prod);
|
||||
else
|
||||
CSR_WRITE_4(sc, ALC_MBOX_TD_PROD_IDX,
|
||||
(sc->alc_cdata.alc_tx_prod <<
|
||||
MBOX_TD_PROD_LO_IDX_SHIFT) &
|
||||
MBOX_TD_PROD_LO_IDX_MASK);
|
||||
/* Set a timeout in case the chip goes out to lunch. */
|
||||
sc->alc_watchdog_timer = ALC_TX_TIMEOUT;
|
||||
}
|
||||
if (enq > 0)
|
||||
alc_start_tx(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
alc_start_tx(struct alc_softc *sc)
|
||||
{
|
||||
|
||||
/* Sync descriptors. */
|
||||
bus_dmamap_sync(sc->alc_cdata.alc_tx_ring_tag,
|
||||
sc->alc_cdata.alc_tx_ring_map, BUS_DMASYNC_PREWRITE);
|
||||
/* Kick. Assume we're using normal Tx priority queue. */
|
||||
if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0)
|
||||
CSR_WRITE_2(sc, ALC_MBOX_TD_PRI0_PROD_IDX,
|
||||
(uint16_t)sc->alc_cdata.alc_tx_prod);
|
||||
else
|
||||
CSR_WRITE_4(sc, ALC_MBOX_TD_PROD_IDX,
|
||||
(sc->alc_cdata.alc_tx_prod <<
|
||||
MBOX_TD_PROD_LO_IDX_SHIFT) &
|
||||
MBOX_TD_PROD_LO_IDX_MASK);
|
||||
/* Set a timeout in case the chip goes out to lunch. */
|
||||
sc->alc_watchdog_timer = ALC_TX_TIMEOUT;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4640,3 +4657,54 @@ sysctl_hw_alc_int_mod(SYSCTL_HANDLER_ARGS)
|
||||
return (sysctl_int_range(oidp, arg1, arg2, req,
|
||||
ALC_IM_TIMER_MIN, ALC_IM_TIMER_MAX));
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
static void
|
||||
alc_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
|
||||
{
|
||||
struct alc_softc *sc;
|
||||
|
||||
sc = if_getsoftc(ifp);
|
||||
KASSERT(sc->alc_buf_size <= MCLBYTES, ("incorrect cluster size"));
|
||||
|
||||
*nrxr = ALC_RX_RING_CNT;
|
||||
*ncl = NETDUMP_MAX_IN_FLIGHT;
|
||||
*clsize = MCLBYTES;
|
||||
}
|
||||
|
||||
static void
|
||||
alc_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
alc_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
{
|
||||
struct alc_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = if_getsoftc(ifp);
|
||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
|
||||
IFF_DRV_RUNNING)
|
||||
return (EBUSY);
|
||||
|
||||
error = alc_encap(sc, &m);
|
||||
if (error == 0)
|
||||
alc_start_tx(sc);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
alc_netdump_poll(struct ifnet *ifp, int count)
|
||||
{
|
||||
struct alc_softc *sc;
|
||||
|
||||
sc = if_getsoftc(ifp);
|
||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
|
||||
IFF_DRV_RUNNING)
|
||||
return (EBUSY);
|
||||
|
||||
alc_txeof(sc);
|
||||
return (alc_rxintr(sc, count));
|
||||
}
|
||||
#endif /* NETDUMP */
|
||||
|
@ -1,4 +1,6 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -24,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* $FreeBSD: releng/12.0/sys/dev/alc/if_alcreg.h 326255 2017-11-27 14:52:40Z pfg $
|
||||
*/
|
||||
|
||||
#ifndef _IF_ALCREG_H
|
||||
|
@ -1,4 +1,6 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -24,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* $FreeBSD: releng/12.0/sys/dev/alc/if_alcvar.h 326255 2017-11-27 14:52:40Z pfg $
|
||||
*/
|
||||
|
||||
#ifndef _IF_ALCVAR_H
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: ukphy.c,v 1.2 1999/04/23 04:24:32 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
|
||||
*
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -55,7 +57,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
__FBSDID("$FreeBSD: releng/12.0/sys/dev/mii/ukphy.c 326255 2017-11-27 14:52:40Z pfg $");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: ukphy_subr.c,v 1.2 1998/11/05 04:08:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
|
||||
*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -31,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
__FBSDID("$FreeBSD: releng/12.0/sys/dev/mii/ukphy_subr.c 326255 2017-11-27 14:52:40Z pfg $");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
|
Loading…
Reference in New Issue
Block a user