diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2019-10-17 16:23:03 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2019-10-17 16:23:03 +0000 |
commit | 7790c8c1996ad89a22b8bd194a230cf23ee67f4b (patch) | |
tree | 78e6de7914d8cdd8021ca4912f6223b1c30c0d32 /sys/dev/bge | |
parent | 756368b68b98ad0d95e6dc1754ab09b55e4d567f (diff) | |
download | src-7790c8c1996ad89a22b8bd194a230cf23ee67f4b.tar.gz src-7790c8c1996ad89a22b8bd194a230cf23ee67f4b.zip |
Split out a more generic debugnet(4) from netdump(4)
Debugnet is a simplistic and specialized panic- or debug-time reliable
datagram transport. It can drive a single connection at a time and is
currently unidirectional (debug/panic machine transmit to remote server
only).
It is mostly a verbatim code lift from netdump(4). Netdump(4) remains
the only consumer (until the rest of this patch series lands).
The INET-specific logic has been extracted somewhat more thoroughly than
previously in netdump(4), into debugnet_inet.c. UDP-layer logic and up, as
much as possible as is protocol-independent, remains in debugnet.c. The
separation is not perfect and future improvement is welcome. Supporting
INET6 is a long-term goal.
Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to
'debugnet_' or 'dn_' -- sorry. I thought keeping the netdump name on the
generic module would be more confusing than the refactoring.
The only functional change here is the mbuf allocation / tracking. Instead
of initiating solely on netdump-configured interface(s) at dumpon(8)
configuration time, we watch for any debugnet-enabled NIC for link
activation and query it for mbuf parameters at that time. If they exceed
the existing high-water mark allocation, we re-allocate and track the new
high-water mark. Otherwise, we leave the pre-panic mbuf allocation alone.
In a future patch in this series, this will allow initiating netdump from
panic ddb(4) without pre-panic configuration.
No other functional change intended.
Reviewed by: markj (earlier version)
Some discussion with: emaste, jhb
Objection from: marius
Differential Revision: https://reviews.freebsd.org/D21421
Notes
Notes:
svn path=/head/; revision=353685
Diffstat (limited to 'sys/dev/bge')
-rw-r--r-- | sys/dev/bge/if_bge.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index bae18acf96ae..30b8c9ac76b3 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #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$"); #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> @@ -519,7 +519,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 */ @@ -3983,8 +3983,8 @@ again: goto fail; } - /* Attach driver netdump methods. */ - NETDUMP_SET(ifp, bge); + /* Attach driver debugnet methods. */ + DEBUGNET_SET(ifp, bge); fail: if (error) @@ -6844,16 +6844,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))) @@ -6864,12 +6864,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; @@ -6888,7 +6888,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; @@ -6913,4 +6913,4 @@ bge_netdump_poll(if_t ifp, int count) bge_txeof(sc, tx_cons); return (0); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ |