Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140757146
D15262.id42187.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15262.id42187.diff
View Options
Index: head/sys/net/iflib.c
===================================================================
--- head/sys/net/iflib.c
+++ head/sys/net/iflib.c
@@ -52,7 +52,6 @@
#include <sys/taskqueue.h>
#include <sys/limits.h>
-
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_types.h>
@@ -71,6 +70,7 @@
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/ip_var.h>
+#include <netinet/netdump/netdump.h>
#include <netinet6/ip6_var.h>
#include <machine/bus.h>
@@ -735,6 +735,8 @@
static struct mbuf * iflib_fixup_rx(struct mbuf *m);
#endif
+NETDUMP_DEFINE(iflib);
+
#ifdef DEV_NETMAP
#include <sys/selinfo.h>
#include <net/netmap.h>
@@ -3381,7 +3383,7 @@
ifsd_map = txq->ift_sds.ifsd_map;
do_prefetch = (txq->ift_ctx->ifc_flags & IFC_PREFETCH);
- while (n--) {
+ while (n-- > 0) {
if (do_prefetch) {
prefetch(ifsd_m[(cidx + 3) & mask]);
prefetch(ifsd_m[(cidx + 4) & mask]);
@@ -4438,6 +4440,8 @@
}
*ctxp = ctx;
+ NETDUMP_SET(ctx->ifc_ifp, iflib);
+
if_setgetcounterfn(ctx->ifc_ifp, iflib_if_get_counter);
iflib_add_device_sysctl_post(ctx);
ctx->ifc_flags |= IFC_INIT_DONE;
@@ -6015,3 +6019,88 @@
return (n);
}
#endif
+
+#ifdef NETDUMP
+static void
+iflib_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
+{
+ if_ctx_t ctx;
+
+ ctx = if_getsoftc(ifp);
+ CTX_LOCK(ctx);
+ *nrxr = NRXQSETS(ctx);
+ *ncl = ctx->ifc_rxqs[0].ifr_fl->ifl_size;
+ *clsize = ctx->ifc_rxqs[0].ifr_fl->ifl_buf_size;
+ CTX_UNLOCK(ctx);
+}
+
+static void
+iflib_netdump_event(struct ifnet *ifp, enum netdump_ev event)
+{
+ if_ctx_t ctx;
+ if_softc_ctx_t scctx;
+ iflib_fl_t fl;
+ iflib_rxq_t rxq;
+ int i, j;
+
+ ctx = if_getsoftc(ifp);
+ scctx = &ctx->ifc_softc_ctx;
+
+ switch (event) {
+ case NETDUMP_START:
+ for (i = 0; i < scctx->isc_nrxqsets; i++) {
+ rxq = &ctx->ifc_rxqs[i];
+ for (j = 0; j < rxq->ifr_nfl; j++) {
+ fl = rxq->ifr_fl;
+ fl->ifl_zone = m_getzone(fl->ifl_buf_size);
+ }
+ }
+ iflib_no_tx_batch = 1;
+ break;
+ default:
+ break;
+ }
+}
+
+static int
+iflib_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
+{
+ if_ctx_t ctx;
+ iflib_txq_t txq;
+ int error;
+
+ ctx = if_getsoftc(ifp);
+ if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING)
+ return (EBUSY);
+
+ txq = &ctx->ifc_txqs[0];
+ error = iflib_encap(txq, &m);
+ if (error == 0)
+ (void)iflib_txd_db_check(ctx, txq, true, txq->ift_in_use);
+ return (error);
+}
+
+static int
+iflib_netdump_poll(struct ifnet *ifp, int count)
+{
+ if_ctx_t ctx;
+ if_softc_ctx_t scctx;
+ iflib_txq_t txq;
+ int i;
+
+ ctx = if_getsoftc(ifp);
+ scctx = &ctx->ifc_softc_ctx;
+
+ if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING)
+ return (EBUSY);
+
+ txq = &ctx->ifc_txqs[0];
+ (void)iflib_completed_tx_reclaim(txq, RECLAIM_THRESH(ctx));
+
+ for (i = 0; i < scctx->isc_nrxqsets; i++)
+ (void)iflib_rxeof(&ctx->ifc_rxqs[i], 16 /* XXX */);
+ return (0);
+}
+#endif /* NETDUMP */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 28, 5:09 PM (5 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27338113
Default Alt Text
D15262.id42187.diff (2 KB)
Attached To
Mode
D15262: Add netdump hooks for iflib.
Attached
Detach File
Event Timeline
Log In to Comment