mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 22:56:25 +08:00
Update to FreeBSD head 2018-06-01
Git mirror commit fb63610a69b0eb7f69a201ba05c4c1a7a2739cf9. Update #3472.
This commit is contained in:
@@ -141,6 +141,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <net/bpf.h>
|
||||
|
||||
#include <netinet/netdump/netdump.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/bus.h>
|
||||
@@ -281,6 +283,7 @@ static void re_tick (void *);
|
||||
static void re_int_task (void *, int);
|
||||
static void re_start (struct ifnet *);
|
||||
static void re_start_locked (struct ifnet *);
|
||||
static void re_start_tx (struct rl_softc *);
|
||||
static int re_ioctl (struct ifnet *, u_long, caddr_t);
|
||||
static void re_init (void *);
|
||||
static void re_init_locked (struct rl_softc *);
|
||||
@@ -309,6 +312,8 @@ 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);
|
||||
|
||||
#ifdef DEV_NETMAP /* see ixgbe.c for details */
|
||||
#include <dev/netmap/if_re_netmap.h>
|
||||
MODULE_DEPEND(re, netmap, 1, 1, 1);
|
||||
@@ -682,7 +687,7 @@ re_set_rxmode(struct rl_softc *sc)
|
||||
}
|
||||
|
||||
if_maddr_rlock(ifp);
|
||||
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
|
||||
CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
|
||||
@@ -1739,8 +1744,11 @@ re_attach(device_t dev)
|
||||
if (error) {
|
||||
device_printf(dev, "couldn't set up irq\n");
|
||||
ether_ifdetach(ifp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
NETDUMP_SET(ifp, re);
|
||||
|
||||
fail:
|
||||
if (error)
|
||||
re_detach(dev);
|
||||
@@ -2935,7 +2943,7 @@ re_start_locked(struct ifnet *ifp)
|
||||
#ifdef DEV_NETMAP
|
||||
/* XXX is this necessary ? */
|
||||
if (ifp->if_capenable & IFCAP_NETMAP) {
|
||||
struct netmap_kring *kring = &NA(ifp)->tx_rings[0];
|
||||
struct netmap_kring *kring = NA(ifp)->tx_rings[0];
|
||||
if (sc->rl_ldata.rl_tx_prodidx != kring->nr_hwcur) {
|
||||
/* kick the tx unit */
|
||||
CSR_WRITE_1(sc, sc->rl_txstart, RL_TXSTART_START);
|
||||
@@ -2983,8 +2991,14 @@ re_start_locked(struct ifnet *ifp)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Flush the TX descriptors */
|
||||
re_start_tx(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
re_start_tx(struct rl_softc *sc)
|
||||
{
|
||||
|
||||
/* Flush the TX descriptors */
|
||||
bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag,
|
||||
sc->rl_ldata.rl_tx_list_map,
|
||||
BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
|
||||
@@ -4080,3 +4094,59 @@ sysctl_hw_re_int_mod(SYSCTL_HANDLER_ARGS)
|
||||
return (sysctl_int_range(oidp, arg1, arg2, req, RL_TIMER_MIN,
|
||||
RL_TIMER_MAX));
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
static void
|
||||
re_netdump_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;
|
||||
*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)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
re_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
{
|
||||
struct rl_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = if_getsoftc(ifp);
|
||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
|
||||
IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0)
|
||||
return (EBUSY);
|
||||
|
||||
error = re_encap(sc, &m);
|
||||
if (error == 0)
|
||||
re_start_tx(sc);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
re_netdump_poll(struct ifnet *ifp, int count)
|
||||
{
|
||||
struct rl_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = if_getsoftc(ifp);
|
||||
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 ||
|
||||
(sc->rl_flags & RL_FLAG_LINK) == 0)
|
||||
return (EBUSY);
|
||||
|
||||
re_txeof(sc);
|
||||
error = re_rxeof(sc, NULL);
|
||||
if (error != 0 && error != EAGAIN)
|
||||
return (error);
|
||||
return (0);
|
||||
}
|
||||
#endif /* NETDUMP */
|
||||
|
Reference in New Issue
Block a user