svn commit: r331677 - in user/markj/netdump: share/man/man4 sys/dev/bxe
Mark Johnston
markj at FreeBSD.org
Wed Mar 28 14:33:37 UTC 2018
Author: markj
Date: Wed Mar 28 14:33:35 2018
New Revision: 331677
URL: https://svnweb.freebsd.org/changeset/base/331677
Log:
Add netdump support to bxe(4).
Modified:
user/markj/netdump/share/man/man4/netdump.4
user/markj/netdump/sys/dev/bxe/bxe.c
user/markj/netdump/sys/dev/bxe/bxe.h
Modified: user/markj/netdump/share/man/man4/netdump.4
==============================================================================
--- user/markj/netdump/share/man/man4/netdump.4 Wed Mar 28 14:32:24 2018 (r331676)
+++ user/markj/netdump/share/man/man4/netdump.4 Wed Mar 28 14:33:35 2018 (r331677)
@@ -105,6 +105,7 @@ message to the server.
The following network drivers support netdump:
.Xr alc 4 ,
.Xr bge 4 ,
+.Xr bxe 4 ,
.Xr cxgb 4 ,
.Xr em 4 ,
.Xr igb 4 ,
Modified: user/markj/netdump/sys/dev/bxe/bxe.c
==============================================================================
--- user/markj/netdump/sys/dev/bxe/bxe.c Wed Mar 28 14:32:24 2018 (r331676)
+++ user/markj/netdump/sys/dev/bxe/bxe.c Wed Mar 28 14:33:35 2018 (r331677)
@@ -236,6 +236,8 @@ MODULE_DEPEND(bxe, pci, 1, 1, 1);
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
@@ -12767,6 +12769,9 @@ bxe_init_ifnet(struct bxe_softc *sc)
/* attach to the Ethernet interface list */
ether_ifattach(ifp, sc->link_params.mac_addr);
+ /* Attach driver netdump methods. */
+ NETDUMP_SET(ifp, bxe);
+
return (0);
}
@@ -19164,3 +19169,53 @@ bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data,
return (rval);
}
+
+#ifdef NETDUMP
+static void
+bxe_netdump_init(struct ifnet *ifp, int *nrxr)
+{
+ struct bxe_softc *sc;
+
+ sc = if_getsoftc(ifp);
+ *nrxr = sc->num_queues;
+}
+
+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 */
Modified: user/markj/netdump/sys/dev/bxe/bxe.h
==============================================================================
--- user/markj/netdump/sys/dev/bxe/bxe.h Wed Mar 28 14:32:24 2018 (r331676)
+++ user/markj/netdump/sys/dev/bxe/bxe.h Wed Mar 28 14:33:35 2018 (r331677)
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
#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>
More information about the svn-src-user
mailing list