Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/re/if_re.c
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | |||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#include <net/if_dl.h> | #include <net/if_dl.h> | ||||
#include <net/if_media.h> | #include <net/if_media.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#include <net/if_vlan_var.h> | #include <net/if_vlan_var.h> | ||||
#include <net/bpf.h> | #include <net/bpf.h> | ||||
#include <netinet/netdump/netdump.h> | #include <net/panicnet.h> | ||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <machine/resource.h> | #include <machine/resource.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <dev/mii/mii.h> | #include <dev/mii/mii.h> | ||||
#include <dev/mii/miivar.h> | #include <dev/mii/miivar.h> | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | |||||
static void re_set_jumbo (struct rl_softc *, int); | static void re_set_jumbo (struct rl_softc *, int); | ||||
static void re_set_rxmode (struct rl_softc *); | static void re_set_rxmode (struct rl_softc *); | ||||
static void re_reset (struct rl_softc *); | static void re_reset (struct rl_softc *); | ||||
static void re_setwol (struct rl_softc *); | static void re_setwol (struct rl_softc *); | ||||
static void re_clrwol (struct rl_softc *); | static void re_clrwol (struct rl_softc *); | ||||
static void re_set_linkspeed (struct rl_softc *); | static void re_set_linkspeed (struct rl_softc *); | ||||
NETDUMP_DEFINE(re); | PANICNET_DEFINE(re); | ||||
#ifdef DEV_NETMAP /* see ixgbe.c for details */ | #ifdef DEV_NETMAP /* see ixgbe.c for details */ | ||||
#include <dev/netmap/if_re_netmap.h> | #include <dev/netmap/if_re_netmap.h> | ||||
MODULE_DEPEND(re, netmap, 1, 1, 1); | MODULE_DEPEND(re, netmap, 1, 1, 1); | ||||
#endif /* !DEV_NETMAP */ | #endif /* !DEV_NETMAP */ | ||||
#ifdef RE_DIAG | #ifdef RE_DIAG | ||||
static int re_diag (struct rl_softc *); | static int re_diag (struct rl_softc *); | ||||
▲ Show 20 Lines • Show All 1,418 Lines • ▼ Show 20 Lines | error = bus_setup_intr(dev, sc->rl_irq[0], | ||||
&sc->rl_intrhand[0]); | &sc->rl_intrhand[0]); | ||||
} | } | ||||
if (error) { | if (error) { | ||||
device_printf(dev, "couldn't set up irq\n"); | device_printf(dev, "couldn't set up irq\n"); | ||||
ether_ifdetach(ifp); | ether_ifdetach(ifp); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
NETDUMP_SET(ifp, re); | PANICNET_SET(ifp, re); | ||||
fail: | fail: | ||||
if (error) | if (error) | ||||
re_detach(dev); | re_detach(dev); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,331 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
sysctl_hw_re_int_mod(SYSCTL_HANDLER_ARGS) | sysctl_hw_re_int_mod(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
return (sysctl_int_range(oidp, arg1, arg2, req, RL_TIMER_MIN, | return (sysctl_int_range(oidp, arg1, arg2, req, RL_TIMER_MIN, | ||||
RL_TIMER_MAX)); | RL_TIMER_MAX)); | ||||
} | } | ||||
#ifdef NETDUMP | #ifdef PANICNET | ||||
static void | static void | ||||
re_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) | re_panicnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) | ||||
{ | { | ||||
struct rl_softc *sc; | struct rl_softc *sc; | ||||
sc = if_getsoftc(ifp); | sc = if_getsoftc(ifp); | ||||
RL_LOCK(sc); | RL_LOCK(sc); | ||||
*nrxr = sc->rl_ldata.rl_rx_desc_cnt; | *nrxr = sc->rl_ldata.rl_rx_desc_cnt; | ||||
*ncl = NETDUMP_MAX_IN_FLIGHT; | *ncl = PANICNET_MAX_IN_FLIGHT; | ||||
*clsize = (ifp->if_mtu > RL_MTU && | *clsize = (ifp->if_mtu > RL_MTU && | ||||
(sc->rl_flags & RL_FLAG_JUMBOV2) != 0) ? MJUM9BYTES : MCLBYTES; | (sc->rl_flags & RL_FLAG_JUMBOV2) != 0) ? MJUM9BYTES : MCLBYTES; | ||||
RL_UNLOCK(sc); | RL_UNLOCK(sc); | ||||
} | } | ||||
static void | static void | ||||
re_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused) | re_panicnet_event(struct ifnet *ifp __unused, enum panicnet_ev event __unused) | ||||
{ | { | ||||
} | } | ||||
static int | static int | ||||
re_netdump_transmit(struct ifnet *ifp, struct mbuf *m) | re_panicnet_transmit(struct ifnet *ifp, struct mbuf *m) | ||||
{ | { | ||||
struct rl_softc *sc; | struct rl_softc *sc; | ||||
int error; | int error; | ||||
sc = if_getsoftc(ifp); | sc = if_getsoftc(ifp); | ||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != | if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != | ||||
IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0) | IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0) | ||||
return (EBUSY); | return (EBUSY); | ||||
error = re_encap(sc, &m); | error = re_encap(sc, &m); | ||||
if (error == 0) | if (error == 0) | ||||
re_start_tx(sc); | re_start_tx(sc); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
re_netdump_poll(struct ifnet *ifp, int count) | re_panicnet_poll(struct ifnet *ifp, int count) | ||||
{ | { | ||||
struct rl_softc *sc; | struct rl_softc *sc; | ||||
int error; | int error; | ||||
sc = if_getsoftc(ifp); | sc = if_getsoftc(ifp); | ||||
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || | if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || | ||||
(sc->rl_flags & RL_FLAG_LINK) == 0) | (sc->rl_flags & RL_FLAG_LINK) == 0) | ||||
return (EBUSY); | return (EBUSY); | ||||
re_txeof(sc); | re_txeof(sc); | ||||
error = re_rxeof(sc, NULL); | error = re_rxeof(sc, NULL); | ||||
if (error != 0 && error != EAGAIN) | if (error != 0 && error != EAGAIN) | ||||
return (error); | return (error); | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif /* NETDUMP */ | #endif /* PANICNET */ |