Page MenuHomeFreeBSD

D15257.id42183.diff
No OneTemporary

D15257.id42183.diff

Index: head/sys/dev/bxe/bxe.h
===================================================================
--- head/sys/dev/bxe/bxe.h
+++ head/sys/dev/bxe/bxe.h
@@ -70,6 +70,7 @@
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
+#include <netinet/netdump/netdump.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
Index: head/sys/dev/bxe/bxe.c
===================================================================
--- head/sys/dev/bxe/bxe.c
+++ head/sys/dev/bxe/bxe.c
@@ -236,6 +236,8 @@
MODULE_DEPEND(bxe, ether, 1, 1, 1);
DRIVER_MODULE(bxe, pci, bxe_driver, bxe_devclass, 0, 0);
+NETDUMP_DEFINE(bxe);
+
/* resources needed for unloading a previously loaded device */
#define BXE_PREV_WAIT_NEEDED 1
@@ -12789,6 +12791,9 @@
/* attach to the Ethernet interface list */
ether_ifattach(ifp, sc->link_params.mac_addr);
+ /* Attach driver netdump methods. */
+ NETDUMP_SET(ifp, bxe);
+
return (0);
}
@@ -19186,3 +19191,57 @@
return (rval);
}
+
+#ifdef NETDUMP
+static void
+bxe_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
+{
+ struct bxe_softc *sc;
+
+ sc = if_getsoftc(ifp);
+ BXE_CORE_LOCK(sc);
+ *nrxr = sc->num_queues;
+ *ncl = NETDUMP_MAX_IN_FLIGHT;
+ *clsize = sc->fp[0].mbuf_alloc_size;
+ BXE_CORE_UNLOCK(sc);
+}
+
+static void
+bxe_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused)
+{
+}
+
+static int
+bxe_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
+{
+ struct bxe_softc *sc;
+ int error;
+
+ sc = if_getsoftc(ifp);
+ if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING || !sc->link_vars.link_up)
+ return (ENOENT);
+
+ error = bxe_tx_encap(&sc->fp[0], &m);
+ if (error != 0 && m != NULL)
+ m_freem(m);
+ return (error);
+}
+
+static int
+bxe_netdump_poll(struct ifnet *ifp, int count)
+{
+ struct bxe_softc *sc;
+ int i;
+
+ sc = if_getsoftc(ifp);
+ if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 ||
+ !sc->link_vars.link_up)
+ return (ENOENT);
+
+ for (i = 0; i < sc->num_queues; i++)
+ (void)bxe_rxeof(sc, &sc->fp[0]);
+ (void)bxe_txeof(sc, &sc->fp[0]);
+ return (0);
+}
+#endif /* NETDUMP */

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 8, 10:08 PM (16 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31095664
Default Alt Text
D15257.id42183.diff (2 KB)

Event Timeline