atheros813x, broadcom570x, rtl81xx: Upgrade to FreeBSD 13.
The changes for iflib reorganized some things that these drivers used, so here we upgrade them as well. One new chipset is supported in rtl81xx, the rest should all just be API changes.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
/* Driver for Atheros AR813x/AR815x PCIe Ethernet. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: releng/12.0/sys/dev/alc/if_alc.c 338948 2018-09-26 17:12:14Z imp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/alc/if_alc.c 338948 2018-09-26 17:12:14Z
|
||||
#include <sys/taskqueue.h>
|
||||
|
||||
#include <net/bpf.h>
|
||||
#include <net/debugnet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_arp.h>
|
||||
@@ -64,7 +65,6 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/alc/if_alc.c 338948 2018-09-26 17:12:14Z
|
||||
#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>
|
||||
@@ -215,7 +215,7 @@ 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);
|
||||
DEBUGNET_DEFINE(alc);
|
||||
|
||||
static device_method_t alc_methods[] = {
|
||||
/* Device interface. */
|
||||
@@ -1387,7 +1387,7 @@ alc_attach(device_t dev)
|
||||
mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
|
||||
MTX_DEF);
|
||||
callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0);
|
||||
TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc);
|
||||
NET_TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc);
|
||||
sc->alc_ident = alc_find_ident(dev);
|
||||
|
||||
/* Map the device. */
|
||||
@@ -1659,8 +1659,8 @@ alc_attach(device_t dev)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Attach driver netdump methods. */
|
||||
NETDUMP_SET(ifp, alc);
|
||||
/* Attach driver debugnet methods. */
|
||||
DEBUGNET_SET(ifp, alc);
|
||||
|
||||
fail:
|
||||
if (error != 0)
|
||||
@@ -1749,11 +1749,11 @@ alc_sysctl_node(struct alc_softc *sc)
|
||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->alc_dev));
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "int_rx_mod",
|
||||
CTLTYPE_INT | CTLFLAG_RW, &sc->alc_int_rx_mod, 0,
|
||||
sysctl_hw_alc_int_mod, "I", "alc Rx interrupt moderation");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &sc->alc_int_rx_mod,
|
||||
0, sysctl_hw_alc_int_mod, "I", "alc Rx interrupt moderation");
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "int_tx_mod",
|
||||
CTLTYPE_INT | CTLFLAG_RW, &sc->alc_int_tx_mod, 0,
|
||||
sysctl_hw_alc_int_mod, "I", "alc Tx interrupt moderation");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &sc->alc_int_tx_mod,
|
||||
0, sysctl_hw_alc_int_mod, "I", "alc Tx interrupt moderation");
|
||||
/* Pull in device tunables. */
|
||||
sc->alc_int_rx_mod = ALC_IM_RX_TIMER_DEFAULT;
|
||||
error = resource_int_value(device_get_name(sc->alc_dev),
|
||||
@@ -1780,8 +1780,8 @@ alc_sysctl_node(struct alc_softc *sc)
|
||||
}
|
||||
}
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "process_limit",
|
||||
CTLTYPE_INT | CTLFLAG_RW, &sc->alc_process_limit, 0,
|
||||
sysctl_hw_alc_proc_limit, "I",
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
|
||||
&sc->alc_process_limit, 0, sysctl_hw_alc_proc_limit, "I",
|
||||
"max number of Rx events to process");
|
||||
/* Pull in device tunables. */
|
||||
sc->alc_process_limit = ALC_PROC_DEFAULT;
|
||||
@@ -1798,13 +1798,13 @@ alc_sysctl_node(struct alc_softc *sc)
|
||||
}
|
||||
}
|
||||
|
||||
tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD,
|
||||
NULL, "ALC statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "ALC statistics");
|
||||
parent = SYSCTL_CHILDREN(tree);
|
||||
|
||||
/* Rx statistics. */
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD,
|
||||
NULL, "Rx MAC statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Rx MAC statistics");
|
||||
child = SYSCTL_CHILDREN(tree);
|
||||
ALC_SYSCTL_STAT_ADD32(ctx, child, "good_frames",
|
||||
&stats->rx_frames, "Good frames");
|
||||
@@ -1857,8 +1857,8 @@ alc_sysctl_node(struct alc_softc *sc)
|
||||
"Frames dropped due to address filtering");
|
||||
|
||||
/* Tx statistics. */
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD,
|
||||
NULL, "Tx MAC statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Tx MAC statistics");
|
||||
child = SYSCTL_CHILDREN(tree);
|
||||
ALC_SYSCTL_STAT_ADD32(ctx, child, "good_frames",
|
||||
&stats->tx_frames, "Good frames");
|
||||
@@ -4593,12 +4593,22 @@ alc_rxvlan(struct alc_softc *sc)
|
||||
CSR_WRITE_4(sc, ALC_MAC_CFG, reg);
|
||||
}
|
||||
|
||||
static u_int
|
||||
alc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
|
||||
{
|
||||
uint32_t *mchash = arg;
|
||||
uint32_t crc;
|
||||
|
||||
crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN);
|
||||
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
alc_rxfilter(struct alc_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
struct ifmultiaddr *ifma;
|
||||
uint32_t crc;
|
||||
uint32_t mchash[2];
|
||||
uint32_t rxcfg;
|
||||
|
||||
@@ -4621,15 +4631,7 @@ alc_rxfilter(struct alc_softc *sc)
|
||||
goto chipit;
|
||||
}
|
||||
|
||||
if_maddr_rlock(ifp);
|
||||
TAILQ_FOREACH(ifma, &sc->alc_ifp->if_multiaddrs, ifma_link) {
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
|
||||
ifma->ifma_addr), ETHER_ADDR_LEN);
|
||||
mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
|
||||
}
|
||||
if_maddr_runlock(ifp);
|
||||
if_foreach_llmaddr(ifp, alc_hash_maddr, mchash);
|
||||
|
||||
chipit:
|
||||
CSR_WRITE_4(sc, ALC_MAR0, mchash[0]);
|
||||
@@ -4670,9 +4672,9 @@ sysctl_hw_alc_int_mod(SYSCTL_HANDLER_ARGS)
|
||||
ALC_IM_TIMER_MIN, ALC_IM_TIMER_MAX));
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
#ifdef DEBUGNET
|
||||
static void
|
||||
alc_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
|
||||
alc_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
|
||||
{
|
||||
struct alc_softc *sc;
|
||||
|
||||
@@ -4680,17 +4682,17 @@ alc_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
|
||||
KASSERT(sc->alc_buf_size <= MCLBYTES, ("incorrect cluster size"));
|
||||
|
||||
*nrxr = ALC_RX_RING_CNT;
|
||||
*ncl = NETDUMP_MAX_IN_FLIGHT;
|
||||
*ncl = DEBUGNET_MAX_IN_FLIGHT;
|
||||
*clsize = MCLBYTES;
|
||||
}
|
||||
|
||||
static void
|
||||
alc_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused)
|
||||
alc_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
alc_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
alc_debugnet_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
{
|
||||
struct alc_softc *sc;
|
||||
int error;
|
||||
@@ -4707,7 +4709,7 @@ alc_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
}
|
||||
|
||||
static int
|
||||
alc_netdump_poll(struct ifnet *ifp, int count)
|
||||
alc_debugnet_poll(struct ifnet *ifp, int count)
|
||||
{
|
||||
struct alc_softc *sc;
|
||||
|
||||
@@ -4719,4 +4721,4 @@ alc_netdump_poll(struct ifnet *ifp, int count)
|
||||
alc_txeof(sc);
|
||||
return (alc_rxintr(sc, count));
|
||||
}
|
||||
#endif /* NETDUMP */
|
||||
#endif /* DEBUGNET */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: releng/12.0/sys/dev/alc/if_alcreg.h 326255 2017-11-27 14:52:40Z pfg $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _IF_ALCREG_H
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: releng/12.0/sys/dev/alc/if_alcvar.h 326255 2017-11-27 14:52:40Z pfg $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _IF_ALCVAR_H
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: releng/12.0/sys/dev/bge/if_bge.c 338948 2018-09-26 17:12:14Z imp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Broadcom BCM57xx(x)/BCM590x NetXtreme and NetLink family Ethernet driver
|
||||
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/bge/if_bge.c 338948 2018-09-26 17:12:14Z
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/taskqueue.h>
|
||||
|
||||
#include <net/debugnet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_arp.h>
|
||||
@@ -100,7 +101,6 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/bge/if_bge.c 338948 2018-09-26 17:12:14Z
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/netdump/netdump.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
@@ -112,13 +112,6 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/bge/if_bge.c 338948 2018-09-26 17:12:14Z
|
||||
#include "miidevs.h"
|
||||
#include <dev/mii/brgphyreg.h>
|
||||
|
||||
#ifdef __sparc64__
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/ver.h>
|
||||
#endif
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
@@ -246,8 +239,6 @@ static const struct bge_type {
|
||||
|
||||
{ FJTSU_VENDORID, FJTSU_DEVICEID_PW008GE4 },
|
||||
{ FJTSU_VENDORID, FJTSU_DEVICEID_PW008GE5 },
|
||||
{ FJTSU_VENDORID, FJTSU_DEVICEID_PP250450 },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
@@ -262,7 +253,6 @@ static const struct bge_vendor {
|
||||
{ SK_VENDORID, "SysKonnect" },
|
||||
{ TC_VENDORID, "3Com" },
|
||||
{ FJTSU_VENDORID, "Fujitsu" },
|
||||
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@@ -337,7 +327,6 @@ static const struct bge_revision {
|
||||
{ BGE_CHIPID_BCM57765_B0, "BCM57765 B0" },
|
||||
{ BGE_CHIPID_BCM57780_A0, "BCM57780 A0" },
|
||||
{ BGE_CHIPID_BCM57780_A1, "BCM57780 A1" },
|
||||
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@@ -370,7 +359,6 @@ static const struct bge_revision bge_majorrevs[] = {
|
||||
{ BGE_ASICREV_BCM5719, "unknown BCM5719" },
|
||||
{ BGE_ASICREV_BCM5720, "unknown BCM5720" },
|
||||
{ BGE_ASICREV_BCM5762, "unknown BCM5762" },
|
||||
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@@ -521,7 +509,7 @@ static void bge_add_sysctl_stats(struct bge_softc *, struct sysctl_ctx_list *,
|
||||
struct sysctl_oid_list *);
|
||||
static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
NETDUMP_DEFINE(bge);
|
||||
DEBUGNET_DEFINE(bge);
|
||||
|
||||
static device_method_t bge_methods[] = {
|
||||
/* Device interface */
|
||||
@@ -555,51 +543,14 @@ DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0);
|
||||
|
||||
static int bge_allow_asf = 1;
|
||||
|
||||
static SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters");
|
||||
static SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
|
||||
"BGE driver parameters");
|
||||
SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RDTUN, &bge_allow_asf, 0,
|
||||
"Allow ASF mode if available");
|
||||
|
||||
#define SPARC64_BLADE_1500_MODEL "SUNW,Sun-Blade-1500"
|
||||
#define SPARC64_BLADE_1500_PATH_BGE "/pci@1f,700000/network@2"
|
||||
#define SPARC64_BLADE_2500_MODEL "SUNW,Sun-Blade-2500"
|
||||
#define SPARC64_BLADE_2500_PATH_BGE "/pci@1c,600000/network@3"
|
||||
#define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id"
|
||||
|
||||
static int
|
||||
bge_has_eaddr(struct bge_softc *sc)
|
||||
{
|
||||
#ifdef __sparc64__
|
||||
char buf[sizeof(SPARC64_BLADE_1500_PATH_BGE)];
|
||||
device_t dev;
|
||||
uint32_t subvendor;
|
||||
|
||||
dev = sc->bge_dev;
|
||||
|
||||
/*
|
||||
* The on-board BGEs found in sun4u machines aren't fitted with
|
||||
* an EEPROM which means that we have to obtain the MAC address
|
||||
* via OFW and that some tests will always fail. We distinguish
|
||||
* such BGEs by the subvendor ID, which also has to be obtained
|
||||
* from OFW instead of the PCI configuration space as the latter
|
||||
* indicates Broadcom as the subvendor of the netboot interface.
|
||||
* For early Blade 1500 and 2500 we even have to check the OFW
|
||||
* device path as the subvendor ID always defaults to Broadcom
|
||||
* there.
|
||||
*/
|
||||
if (OF_getprop(ofw_bus_get_node(dev), SPARC64_OFW_SUBVENDOR,
|
||||
&subvendor, sizeof(subvendor)) == sizeof(subvendor) &&
|
||||
(subvendor == FJTSU_VENDORID || subvendor == SUN_VENDORID))
|
||||
return (0);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
if (OF_package_to_path(ofw_bus_get_node(dev), buf, sizeof(buf)) > 0) {
|
||||
if (strcmp(sparc64_model, SPARC64_BLADE_1500_MODEL) == 0 &&
|
||||
strcmp(buf, SPARC64_BLADE_1500_PATH_BGE) == 0)
|
||||
return (0);
|
||||
if (strcmp(sparc64_model, SPARC64_BLADE_2500_MODEL) == 0 &&
|
||||
strcmp(buf, SPARC64_BLADE_2500_PATH_BGE) == 0)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -1627,33 +1578,32 @@ bge_setpromisc(struct bge_softc *sc)
|
||||
BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_RX_PROMISC);
|
||||
}
|
||||
|
||||
static u_int
|
||||
bge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
|
||||
{
|
||||
uint32_t *hashes = arg;
|
||||
int h;
|
||||
|
||||
h = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0x7F;
|
||||
hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
bge_setmulti(struct bge_softc *sc)
|
||||
{
|
||||
if_t ifp;
|
||||
int mc_count = 0;
|
||||
uint32_t hashes[4] = { 0, 0, 0, 0 };
|
||||
int h, i, mcnt;
|
||||
unsigned char *mta;
|
||||
int i;
|
||||
|
||||
BGE_LOCK_ASSERT(sc);
|
||||
|
||||
ifp = sc->bge_ifp;
|
||||
|
||||
mc_count = if_multiaddr_count(ifp, -1);
|
||||
mta = malloc(sizeof(unsigned char) * ETHER_ADDR_LEN *
|
||||
mc_count, M_DEVBUF, M_NOWAIT);
|
||||
|
||||
if(mta == NULL) {
|
||||
device_printf(sc->bge_dev,
|
||||
"Failed to allocated temp mcast list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (if_getflags(ifp) & IFF_ALLMULTI || if_getflags(ifp) & IFF_PROMISC) {
|
||||
for (i = 0; i < 4; i++)
|
||||
CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0xFFFFFFFF);
|
||||
free(mta, M_DEVBUF);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1661,17 +1611,10 @@ bge_setmulti(struct bge_softc *sc)
|
||||
for (i = 0; i < 4; i++)
|
||||
CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0);
|
||||
|
||||
if_multiaddr_array(ifp, mta, &mcnt, mc_count);
|
||||
for(i = 0; i < mcnt; i++) {
|
||||
h = ether_crc32_le(mta + (i * ETHER_ADDR_LEN),
|
||||
ETHER_ADDR_LEN) & 0x7F;
|
||||
hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
|
||||
}
|
||||
if_foreach_llmaddr(ifp, bge_hash_maddr, hashes);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]);
|
||||
|
||||
free(mta, M_DEVBUF);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2933,10 +2876,14 @@ bge_dma_ring_alloc(struct bge_softc *sc, bus_size_t alignment,
|
||||
bus_addr_t *paddr, const char *msg)
|
||||
{
|
||||
struct bge_dmamap_arg ctx;
|
||||
bus_addr_t lowaddr;
|
||||
bus_size_t ring_end;
|
||||
int error;
|
||||
|
||||
lowaddr = BUS_SPACE_MAXADDR;
|
||||
again:
|
||||
error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag,
|
||||
alignment, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL,
|
||||
alignment, 0, lowaddr, BUS_SPACE_MAXADDR, NULL,
|
||||
NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag);
|
||||
if (error != 0) {
|
||||
device_printf(sc->bge_dev,
|
||||
@@ -2961,6 +2908,25 @@ bge_dma_ring_alloc(struct bge_softc *sc, bus_size_t alignment,
|
||||
return (ENOMEM);
|
||||
}
|
||||
*paddr = ctx.bge_busaddr;
|
||||
ring_end = *paddr + maxsize;
|
||||
if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0 &&
|
||||
BGE_ADDR_HI(*paddr) != BGE_ADDR_HI(ring_end)) {
|
||||
/*
|
||||
* 4GB boundary crossed. Limit maximum allowable DMA
|
||||
* address space to 32bit and try again.
|
||||
*/
|
||||
bus_dmamap_unload(*tag, *map);
|
||||
bus_dmamem_free(*tag, *ring, *map);
|
||||
bus_dma_tag_destroy(*tag);
|
||||
if (bootverbose)
|
||||
device_printf(sc->bge_dev, "4GB boundary crossed, "
|
||||
"limit DMA address space to 32bit for %s\n", msg);
|
||||
*ring = NULL;
|
||||
*tag = NULL;
|
||||
*map = NULL;
|
||||
lowaddr = BUS_SPACE_MAXADDR_32BIT;
|
||||
goto again;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -2968,7 +2934,7 @@ static int
|
||||
bge_dma_alloc(struct bge_softc *sc)
|
||||
{
|
||||
bus_addr_t lowaddr;
|
||||
bus_size_t rxmaxsegsz, sbsz, txsegsz, txmaxsegsz;
|
||||
bus_size_t boundary, sbsz, rxmaxsegsz, txsegsz, txmaxsegsz;
|
||||
int i, error;
|
||||
|
||||
lowaddr = BUS_SPACE_MAXADDR;
|
||||
@@ -3055,7 +3021,9 @@ bge_dma_alloc(struct bge_softc *sc)
|
||||
}
|
||||
|
||||
/* Create parent tag for buffers. */
|
||||
boundary = 0;
|
||||
if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0) {
|
||||
boundary = BGE_DMA_BNDRY;
|
||||
/*
|
||||
* XXX
|
||||
* watchdog timeout issue was observed on BCM5704 which
|
||||
@@ -3066,10 +3034,10 @@ bge_dma_alloc(struct bge_softc *sc)
|
||||
if (sc->bge_pcixcap != 0)
|
||||
lowaddr = BUS_SPACE_MAXADDR_32BIT;
|
||||
}
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), 1, 0, lowaddr,
|
||||
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0,
|
||||
BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL,
|
||||
&sc->bge_cdata.bge_buffer_tag);
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev),
|
||||
1, boundary, lowaddr, BUS_SPACE_MAXADDR, NULL,
|
||||
NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT,
|
||||
0, NULL, NULL, &sc->bge_cdata.bge_buffer_tag);
|
||||
if (error != 0) {
|
||||
device_printf(sc->bge_dev,
|
||||
"could not allocate buffer dma tag\n");
|
||||
@@ -3264,6 +3232,8 @@ bge_mbox_reorder(struct bge_softc *sc)
|
||||
bus = device_get_parent(dev);
|
||||
if (device_get_devclass(dev) != pcib)
|
||||
break;
|
||||
if (device_get_devclass(bus) != pci)
|
||||
break;
|
||||
for (i = 0; i < nitems(mbox_reorder_lists); i++) {
|
||||
if (pci_get_vendor(dev) ==
|
||||
mbox_reorder_lists[i].vendor &&
|
||||
@@ -3275,8 +3245,6 @@ bge_mbox_reorder(struct bge_softc *sc)
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
if (device_get_devclass(bus) != pci)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
@@ -3348,7 +3316,7 @@ bge_attach(device_t dev)
|
||||
sc->bge_dev = dev;
|
||||
|
||||
BGE_LOCK_INIT(sc, device_get_nameunit(dev));
|
||||
TASK_INIT(&sc->bge_intr_task, 0, bge_intr_task, sc);
|
||||
NET_TASK_INIT(&sc->bge_intr_task, 0, bge_intr_task, sc);
|
||||
callout_init_mtx(&sc->bge_stat_ch, &sc->bge_mtx, 0);
|
||||
|
||||
pci_enable_busmaster(dev);
|
||||
@@ -3972,8 +3940,8 @@ again:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Attach driver netdump methods. */
|
||||
NETDUMP_SET(ifp, bge);
|
||||
/* Attach driver debugnet methods. */
|
||||
DEBUGNET_SET(ifp, bge);
|
||||
|
||||
fail:
|
||||
if (error)
|
||||
@@ -6289,20 +6257,20 @@ bge_add_sysctls(struct bge_softc *sc)
|
||||
|
||||
#ifdef BGE_REGISTER_DEBUG
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "debug_info",
|
||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_debug_info, "I",
|
||||
"Debug Information");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
|
||||
bge_sysctl_debug_info, "I", "Debug Information");
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "reg_read",
|
||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_reg_read, "I",
|
||||
"MAC Register Read");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
|
||||
bge_sysctl_reg_read, "I", "MAC Register Read");
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "ape_read",
|
||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_ape_read, "I",
|
||||
"APE Register Read");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
|
||||
bge_sysctl_ape_read, "I", "APE Register Read");
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mem_read",
|
||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_mem_read, "I",
|
||||
"Memory Read");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
|
||||
bge_sysctl_mem_read, "I", "Memory Read");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6352,9 +6320,9 @@ bge_add_sysctls(struct bge_softc *sc)
|
||||
}
|
||||
|
||||
#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \
|
||||
SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \
|
||||
sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \
|
||||
desc)
|
||||
SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, \
|
||||
CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, \
|
||||
offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", desc)
|
||||
|
||||
static void
|
||||
bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx,
|
||||
@@ -6363,8 +6331,8 @@ bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx,
|
||||
struct sysctl_oid *tree;
|
||||
struct sysctl_oid_list *children, *schildren;
|
||||
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD,
|
||||
NULL, "BGE Statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE Statistics");
|
||||
schildren = children = SYSCTL_CHILDREN(tree);
|
||||
BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters",
|
||||
children, COSFramesDroppedDueToFilters,
|
||||
@@ -6398,8 +6366,8 @@ bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx,
|
||||
BGE_SYSCTL_STAT(sc, ctx, "NIC Send Threshold Hit",
|
||||
children, nicSendThresholdHit, "SendThresholdHit");
|
||||
|
||||
tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "rx", CTLFLAG_RD,
|
||||
NULL, "BGE RX Statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "rx",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE RX Statistics");
|
||||
children = SYSCTL_CHILDREN(tree);
|
||||
BGE_SYSCTL_STAT(sc, ctx, "Inbound Octets",
|
||||
children, rxstats.ifHCInOctets, "ifHCInOctets");
|
||||
@@ -6434,8 +6402,8 @@ bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx,
|
||||
BGE_SYSCTL_STAT(sc, ctx, "Outbound Range Length Errors",
|
||||
children, rxstats.outRangeLengthError, "outRangeLengthError");
|
||||
|
||||
tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "tx", CTLFLAG_RD,
|
||||
NULL, "BGE TX Statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "tx",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE TX Statistics");
|
||||
children = SYSCTL_CHILDREN(tree);
|
||||
BGE_SYSCTL_STAT(sc, ctx, "Outbound Octets",
|
||||
children, txstats.ifHCOutOctets, "ifHCOutOctets");
|
||||
@@ -6494,8 +6462,8 @@ bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx,
|
||||
struct bge_mac_stats *stats;
|
||||
|
||||
stats = &sc->bge_mac_stats;
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD,
|
||||
NULL, "BGE Statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE Statistics");
|
||||
schild = child = SYSCTL_CHILDREN(tree);
|
||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesDroppedDueToFilters",
|
||||
&stats->FramesDroppedDueToFilters, "Frames Dropped Due to Filters");
|
||||
@@ -6513,8 +6481,8 @@ bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx,
|
||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "RecvThresholdHit",
|
||||
&stats->RecvThresholdHit, "NIC Recv Threshold Hit");
|
||||
|
||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", CTLFLAG_RD,
|
||||
NULL, "BGE RX Statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE RX Statistics");
|
||||
child = SYSCTL_CHILDREN(tree);
|
||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCInOctets",
|
||||
&stats->ifHCInOctets, "Inbound Octets");
|
||||
@@ -6545,8 +6513,8 @@ bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx,
|
||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "UndersizePkts",
|
||||
&stats->etherStatsUndersizePkts, "Undersized Packets");
|
||||
|
||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", CTLFLAG_RD,
|
||||
NULL, "BGE TX Statistics");
|
||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx",
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE TX Statistics");
|
||||
child = SYSCTL_CHILDREN(tree);
|
||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCOutOctets",
|
||||
&stats->ifHCOutOctets, "Outbound Octets");
|
||||
@@ -6738,15 +6706,7 @@ bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS)
|
||||
static int
|
||||
bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[])
|
||||
{
|
||||
#ifdef __sparc64__
|
||||
if (sc->bge_flags & BGE_FLAG_EADDR)
|
||||
return (1);
|
||||
|
||||
OF_getetheraddr(sc->bge_dev, ether_addr);
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -6833,16 +6793,16 @@ bge_get_counter(if_t ifp, ift_counter cnt)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
#ifdef DEBUGNET
|
||||
static void
|
||||
bge_netdump_init(if_t ifp, int *nrxr, int *ncl, int *clsize)
|
||||
bge_debugnet_init(if_t ifp, int *nrxr, int *ncl, int *clsize)
|
||||
{
|
||||
struct bge_softc *sc;
|
||||
|
||||
sc = if_getsoftc(ifp);
|
||||
BGE_LOCK(sc);
|
||||
*nrxr = sc->bge_return_ring_cnt;
|
||||
*ncl = NETDUMP_MAX_IN_FLIGHT;
|
||||
*ncl = DEBUGNET_MAX_IN_FLIGHT;
|
||||
if ((sc->bge_flags & BGE_FLAG_JUMBO_STD) != 0 &&
|
||||
(if_getmtu(sc->bge_ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN +
|
||||
ETHER_VLAN_ENCAP_LEN > (MCLBYTES - ETHER_ALIGN)))
|
||||
@@ -6853,12 +6813,12 @@ bge_netdump_init(if_t ifp, int *nrxr, int *ncl, int *clsize)
|
||||
}
|
||||
|
||||
static void
|
||||
bge_netdump_event(if_t ifp __unused, enum netdump_ev event __unused)
|
||||
bge_debugnet_event(if_t ifp __unused, enum debugnet_ev event __unused)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
bge_netdump_transmit(if_t ifp, struct mbuf *m)
|
||||
bge_debugnet_transmit(if_t ifp, struct mbuf *m)
|
||||
{
|
||||
struct bge_softc *sc;
|
||||
uint32_t prodidx;
|
||||
@@ -6877,7 +6837,7 @@ bge_netdump_transmit(if_t ifp, struct mbuf *m)
|
||||
}
|
||||
|
||||
static int
|
||||
bge_netdump_poll(if_t ifp, int count)
|
||||
bge_debugnet_poll(if_t ifp, int count)
|
||||
{
|
||||
struct bge_softc *sc;
|
||||
uint32_t rx_prod, tx_cons;
|
||||
@@ -6902,4 +6862,4 @@ bge_netdump_poll(if_t ifp, int count)
|
||||
bge_txeof(sc, tx_cons);
|
||||
return (0);
|
||||
}
|
||||
#endif /* NETDUMP */
|
||||
#endif /* DEBUGNET */
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: releng/12.0/sys/dev/bge/if_bgereg.h 325966 2017-11-18 14:26:50Z pfg $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -145,7 +145,6 @@
|
||||
#define BGE_EXT_SSRAM 0x00020000
|
||||
#define BGE_EXT_SSRAM_END 0x000FFFFF
|
||||
|
||||
|
||||
/*
|
||||
* BCM570x register offsets. These are memory mapped registers
|
||||
* which can be accessed with the CSR_READ_4()/CSR_WRITE_4() macros.
|
||||
@@ -462,7 +461,6 @@
|
||||
#define BGE_PCICLOCKCTL_SYSPLL_DISABLE 0x00008000
|
||||
#define BGE_PCICLOCKCTL_BIST_ENABLE 0x00010000
|
||||
|
||||
|
||||
#ifndef PCIM_CMD_MWIEN
|
||||
#define PCIM_CMD_MWIEN 0x0010
|
||||
#endif
|
||||
@@ -902,7 +900,6 @@
|
||||
#define BGE_SGDIGSTS_PAUSE_CAP 0x00080000
|
||||
#define BGE_SGDIGSTS_ASYM_PAUSE 0x00100000
|
||||
|
||||
|
||||
/* MI communication register */
|
||||
#define BGE_MICOMM_DATA 0x0000FFFF
|
||||
#define BGE_MICOMM_REG 0x001F0000
|
||||
@@ -927,7 +924,6 @@
|
||||
#define BGE_MIMODE_500KHZ_CONST 0x00008000
|
||||
#define BGE_MIMODE_BASE 0x000C0000
|
||||
|
||||
|
||||
/*
|
||||
* Send data initiator control registers.
|
||||
*/
|
||||
@@ -1157,7 +1153,6 @@
|
||||
#define BGE_RXLP_LOCSTAT_IFIN_ERRORS 0x2254
|
||||
#define BGE_RXLP_LOCSTAT_RXTHRESH_HIT 0x2258
|
||||
|
||||
|
||||
/* Receive List Placement mode register */
|
||||
#define BGE_RXLPMODE_RESET 0x00000001
|
||||
#define BGE_RXLPMODE_ENABLE 0x00000002
|
||||
@@ -1208,7 +1203,6 @@
|
||||
#define BGE_RDBDI_RETURN_PROD15 0x24BC
|
||||
#define BGE_RDBDI_HWDIAG 0x24C0
|
||||
|
||||
|
||||
/* Receive Data and Receive BD Initiator Mode register */
|
||||
#define BGE_RDBDIMODE_RESET 0x00000001
|
||||
#define BGE_RDBDIMODE_ENABLE 0x00000002
|
||||
@@ -1221,7 +1215,6 @@
|
||||
#define BGE_RDBDISTAT_GIANT_ATTN 0x00000008
|
||||
#define BGE_RDBDISTAT_BADRINGSZ_ATTN 0x00000010
|
||||
|
||||
|
||||
/*
|
||||
* Receive Data Completion Control registers
|
||||
*/
|
||||
@@ -1410,7 +1403,6 @@
|
||||
#define BGE_HCC_TX_BD_CONS14 0x3CF8
|
||||
#define BGE_HCC_TX_BD_CONS15 0x3CFC
|
||||
|
||||
|
||||
/* Host coalescing mode register */
|
||||
#define BGE_HCCMODE_RESET 0x00000001
|
||||
#define BGE_HCCMODE_ENABLE 0x00000002
|
||||
@@ -1544,7 +1536,6 @@
|
||||
#define BGE_BMANSTAT_ERRO 0x00000004
|
||||
#define BGE_BMANSTAT_LOWMBUF_ERROR 0x00000010
|
||||
|
||||
|
||||
/*
|
||||
* Read DMA Control registers
|
||||
*/
|
||||
@@ -1652,7 +1643,6 @@
|
||||
#define BGE_WDMASTAT_PCI_FIFOOREAD_ATTN 0x00000100
|
||||
#define BGE_WDMASTAT_LOCREAD_TOOBIG 0x00000200
|
||||
|
||||
|
||||
/*
|
||||
* RX CPU registers
|
||||
*/
|
||||
@@ -1748,7 +1738,6 @@
|
||||
#define BGE_TXCPUSTAT_MA_REQ_FIFOOFLOW 0x40000000
|
||||
#define BGE_TXCPUSTAT_BLOCKING_READ 0x80000000
|
||||
|
||||
|
||||
/*
|
||||
* Low priority mailbox registers
|
||||
*/
|
||||
@@ -1924,7 +1913,6 @@
|
||||
#define BGE_MSISTAT_MSI_FIFOUFLOW_ATTN 0x00000020
|
||||
#define BGE_MSISTAT_MSI_FIFOOFLOW_ATTN 0x00000040
|
||||
|
||||
|
||||
/*
|
||||
* DMA Completion registers
|
||||
*/
|
||||
@@ -1934,7 +1922,6 @@
|
||||
#define BGE_DMACMODE_RESET 0x00000001
|
||||
#define BGE_DMACMODE_ENABLE 0x00000002
|
||||
|
||||
|
||||
/*
|
||||
* General control registers.
|
||||
*/
|
||||
@@ -2427,7 +2414,6 @@ struct bge_status_block {
|
||||
#define BGE_STATFLAG_LINKSTATE_CHANGED 0x00000002
|
||||
#define BGE_STATFLAG_ERROR 0x00000004
|
||||
|
||||
|
||||
/*
|
||||
* Broadcom Vendor ID
|
||||
* (Note: the BCM570x still defaults to the Alteon PCI vendor ID
|
||||
@@ -2565,18 +2551,12 @@ struct bge_status_block {
|
||||
#define APPLE_VENDORID 0x106b
|
||||
#define APPLE_DEVICE_BCM5701 0x1645
|
||||
|
||||
/*
|
||||
* Sun PCI vendor ID
|
||||
*/
|
||||
#define SUN_VENDORID 0x108e
|
||||
|
||||
/*
|
||||
* Fujitsu vendor/device IDs
|
||||
*/
|
||||
#define FJTSU_VENDORID 0x10cf
|
||||
#define FJTSU_DEVICEID_PW008GE5 0x11a1
|
||||
#define FJTSU_DEVICEID_PW008GE4 0x11a2
|
||||
#define FJTSU_DEVICEID_PP250450 0x11cc /* PRIMEPOWER250/450 LAN */
|
||||
|
||||
/*
|
||||
* Offset of MAC address inside EEPROM.
|
||||
@@ -2666,7 +2646,6 @@ struct bge_rx_mac_stats {
|
||||
bge_hostaddr etherStatsPkts8192Octetsto9022Octets;
|
||||
};
|
||||
|
||||
|
||||
/* Statistics maintained MAC Transmit block. */
|
||||
struct bge_tx_mac_stats {
|
||||
bge_hostaddr ifHCOutOctets;
|
||||
@@ -2866,6 +2845,12 @@ struct bge_gib {
|
||||
#define BGE_DMA_MAXADDR 0xFFFFFFFFFF
|
||||
#endif
|
||||
|
||||
#if (BUS_SPACE_MAXSIZE > 0xFFFFFFFF)
|
||||
#define BGE_DMA_BNDRY 0x100000000
|
||||
#else
|
||||
#define BGE_DMA_BNDRY 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ring structures. Most of these reside in host memory and we tell
|
||||
* the NIC where they are via the ring control blocks. The exceptions
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: releng/12.0/sys/dev/re/if_re.c 333813 2018-05-18 20:13:34Z mmacy $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
|
||||
@@ -128,6 +128,7 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/re/if_re.c 333813 2018-05-18 20:13:34Z m
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/taskqueue.h>
|
||||
|
||||
#include <net/debugnet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_arp.h>
|
||||
@@ -139,8 +140,6 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/re/if_re.c 333813 2018-05-18 20:13:34Z m
|
||||
|
||||
#include <net/bpf.h>
|
||||
|
||||
#include <netinet/netdump/netdump.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/bus.h>
|
||||
@@ -187,6 +186,8 @@ static const struct rl_type re_devs[] = {
|
||||
"RealTek 810xE PCIe 10/100baseTX" },
|
||||
{ RT_VENDORID, RT_DEVICEID_8168, 0,
|
||||
"RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet" },
|
||||
{ RT_VENDORID, RT_DEVICEID_8161, 0,
|
||||
"RealTek 8168 Gigabit Ethernet" },
|
||||
{ NCUBE_VENDORID, RT_DEVICEID_8168, 0,
|
||||
"TP-Link TG-3468 v2 (RTL8168) Gigabit Ethernet" },
|
||||
{ RT_VENDORID, RT_DEVICEID_8169, 0,
|
||||
@@ -310,7 +311,7 @@ static void re_setwol (struct rl_softc *);
|
||||
static void re_clrwol (struct rl_softc *);
|
||||
static void re_set_linkspeed (struct rl_softc *);
|
||||
|
||||
NETDUMP_DEFINE(re);
|
||||
DEBUGNET_DEFINE(re);
|
||||
|
||||
#ifdef DEV_NETMAP /* see ixgbe.c for details */
|
||||
#include <dev/netmap/if_re_netmap.h>
|
||||
@@ -650,6 +651,20 @@ re_miibus_statchg(device_t dev)
|
||||
*/
|
||||
}
|
||||
|
||||
static u_int
|
||||
re_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
|
||||
{
|
||||
uint32_t h, *hashes = arg;
|
||||
|
||||
h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26;
|
||||
if (h < 32)
|
||||
hashes[0] |= (1 << h);
|
||||
else
|
||||
hashes[1] |= (1 << (h - 32));
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the RX configuration and 64-bit multicast hash filter.
|
||||
*/
|
||||
@@ -657,9 +672,8 @@ static void
|
||||
re_set_rxmode(struct rl_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
struct ifmultiaddr *ifma;
|
||||
uint32_t hashes[2] = { 0, 0 };
|
||||
uint32_t h, rxfilt;
|
||||
uint32_t h, hashes[2] = { 0, 0 };
|
||||
uint32_t rxfilt;
|
||||
|
||||
RL_LOCK_ASSERT(sc);
|
||||
|
||||
@@ -684,18 +698,7 @@ re_set_rxmode(struct rl_softc *sc)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if_maddr_rlock(ifp);
|
||||
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
|
||||
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
|
||||
if (h < 32)
|
||||
hashes[0] |= (1 << h);
|
||||
else
|
||||
hashes[1] |= (1 << (h - 32));
|
||||
}
|
||||
if_maddr_runlock(ifp);
|
||||
if_foreach_llmaddr(ifp, re_hash_maddr, hashes);
|
||||
|
||||
if (hashes[0] != 0 || hashes[1] != 0) {
|
||||
/*
|
||||
@@ -1655,7 +1658,7 @@ re_attach(device_t dev)
|
||||
ifp->if_snd.ifq_drv_maxlen = RL_IFQ_MAXLEN;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
|
||||
TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc);
|
||||
NET_TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc);
|
||||
|
||||
#define RE_PHYAD_INTERNAL 0
|
||||
|
||||
@@ -1745,7 +1748,7 @@ re_attach(device_t dev)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
NETDUMP_SET(ifp, re);
|
||||
DEBUGNET_SET(ifp, re);
|
||||
|
||||
fail:
|
||||
if (error)
|
||||
@@ -3357,6 +3360,10 @@ re_init_locked(struct rl_softc *sc)
|
||||
|
||||
sc->rl_watchdog_timer = 0;
|
||||
callout_reset(&sc->rl_stat_callout, hz, re_tick, sc);
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
netmap_enable_all_rings(ifp);
|
||||
#endif /* DEV_NETMAP */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3605,6 +3612,10 @@ re_stop(struct rl_softc *sc)
|
||||
callout_stop(&sc->rl_stat_callout);
|
||||
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
netmap_disable_all_rings(ifp);
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
/*
|
||||
* Disable accepting frames to put RX MAC into idle state.
|
||||
* Otherwise it's possible to get frames while stop command
|
||||
@@ -3968,14 +3979,15 @@ re_add_sysctls(struct rl_softc *sc)
|
||||
children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->rl_dev));
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "stats",
|
||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, re_sysctl_stats, "I",
|
||||
"Statistics Information");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
|
||||
re_sysctl_stats, "I", "Statistics Information");
|
||||
if ((sc->rl_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0)
|
||||
return;
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "int_rx_mod",
|
||||
CTLTYPE_INT | CTLFLAG_RW, &sc->rl_int_rx_mod, 0,
|
||||
sysctl_hw_re_int_mod, "I", "re RX interrupt moderation");
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
|
||||
&sc->rl_int_rx_mod, 0, sysctl_hw_re_int_mod, "I",
|
||||
"re RX interrupt moderation");
|
||||
/* Pull in device tunables. */
|
||||
sc->rl_int_rx_mod = RL_TIMER_DEFAULT;
|
||||
error = resource_int_value(device_get_name(sc->rl_dev),
|
||||
@@ -4093,28 +4105,28 @@ sysctl_hw_re_int_mod(SYSCTL_HANDLER_ARGS)
|
||||
RL_TIMER_MAX));
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
#ifdef DEBUGNET
|
||||
static void
|
||||
re_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
|
||||
re_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
|
||||
{
|
||||
struct rl_softc *sc;
|
||||
|
||||
sc = if_getsoftc(ifp);
|
||||
RL_LOCK(sc);
|
||||
*nrxr = sc->rl_ldata.rl_rx_desc_cnt;
|
||||
*ncl = NETDUMP_MAX_IN_FLIGHT;
|
||||
*ncl = DEBUGNET_MAX_IN_FLIGHT;
|
||||
*clsize = (ifp->if_mtu > RL_MTU &&
|
||||
(sc->rl_flags & RL_FLAG_JUMBOV2) != 0) ? MJUM9BYTES : MCLBYTES;
|
||||
RL_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
re_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused)
|
||||
re_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
re_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
re_debugnet_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
{
|
||||
struct rl_softc *sc;
|
||||
int error;
|
||||
@@ -4131,7 +4143,7 @@ re_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
}
|
||||
|
||||
static int
|
||||
re_netdump_poll(struct ifnet *ifp, int count)
|
||||
re_debugnet_poll(struct ifnet *ifp, int count)
|
||||
{
|
||||
struct rl_softc *sc;
|
||||
int error;
|
||||
@@ -4147,4 +4159,4 @@ re_netdump_poll(struct ifnet *ifp, int count)
|
||||
return (error);
|
||||
return (0);
|
||||
}
|
||||
#endif /* NETDUMP */
|
||||
#endif /* DEBUGNET */
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: releng/12.0/sys/dev/rl/if_rlreg.h 306102 2016-09-21 14:15:15Z kevlo $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -999,6 +999,7 @@ struct rl_softc {
|
||||
#define RT_DEVICEID_8138 0x8138
|
||||
#define RT_DEVICEID_8139 0x8139
|
||||
#define RT_DEVICEID_8169SC 0x8167
|
||||
#define RT_DEVICEID_8161 0x8161
|
||||
#define RT_DEVICEID_8168 0x8168
|
||||
#define RT_DEVICEID_8169 0x8169
|
||||
#define RT_DEVICEID_8100 0x8100
|
||||
|
||||
Reference in New Issue
Block a user