Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157003825
D15255.id42042.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D15255.id42042.diff
View Options
Index: sys/dev/alc/if_alc.c
===================================================================
--- sys/dev/alc/if_alc.c
+++ sys/dev/alc/if_alc.c
@@ -64,6 +64,7 @@
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
+#include <netinet/netdump/netdump.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
@@ -199,6 +200,7 @@
static void alc_start(struct ifnet *);
static void alc_start_locked(struct ifnet *);
static void alc_start_queue(struct alc_softc *);
+static void alc_start_tx(struct alc_softc *);
static void alc_stats_clear(struct alc_softc *);
static void alc_stats_update(struct alc_softc *);
static void alc_stop(struct alc_softc *);
@@ -213,6 +215,8 @@
static int sysctl_hw_alc_proc_limit(SYSCTL_HANDLER_ARGS);
static int sysctl_hw_alc_int_mod(SYSCTL_HANDLER_ARGS);
+NETDUMP_DEFINE(alc);
+
static device_method_t alc_methods[] = {
/* Device interface. */
DEVMETHOD(device_probe, alc_probe),
@@ -227,7 +231,7 @@
DEVMETHOD(miibus_writereg, alc_miibus_writereg),
DEVMETHOD(miibus_statchg, alc_miibus_statchg),
- { NULL, NULL }
+ DEVMETHOD_END
};
static driver_t alc_driver = {
@@ -1651,6 +1655,9 @@
goto fail;
}
+ /* Attach driver netdump methods. */
+ NETDUMP_SET(ifp, alc);
+
fail:
if (error != 0)
alc_detach(dev);
@@ -2974,22 +2981,28 @@
ETHER_BPF_MTAP(ifp, m_head);
}
- if (enq > 0) {
- /* Sync descriptors. */
- bus_dmamap_sync(sc->alc_cdata.alc_tx_ring_tag,
- sc->alc_cdata.alc_tx_ring_map, BUS_DMASYNC_PREWRITE);
- /* Kick. Assume we're using normal Tx priority queue. */
- if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0)
- CSR_WRITE_2(sc, ALC_MBOX_TD_PRI0_PROD_IDX,
- (uint16_t)sc->alc_cdata.alc_tx_prod);
- else
- CSR_WRITE_4(sc, ALC_MBOX_TD_PROD_IDX,
- (sc->alc_cdata.alc_tx_prod <<
- MBOX_TD_PROD_LO_IDX_SHIFT) &
- MBOX_TD_PROD_LO_IDX_MASK);
- /* Set a timeout in case the chip goes out to lunch. */
- sc->alc_watchdog_timer = ALC_TX_TIMEOUT;
- }
+ if (enq > 0)
+ alc_start_tx(sc);
+}
+
+static void
+alc_start_tx(struct alc_softc *sc)
+{
+
+ /* Sync descriptors. */
+ bus_dmamap_sync(sc->alc_cdata.alc_tx_ring_tag,
+ sc->alc_cdata.alc_tx_ring_map, BUS_DMASYNC_PREWRITE);
+ /* Kick. Assume we're using normal Tx priority queue. */
+ if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0)
+ CSR_WRITE_2(sc, ALC_MBOX_TD_PRI0_PROD_IDX,
+ (uint16_t)sc->alc_cdata.alc_tx_prod);
+ else
+ CSR_WRITE_4(sc, ALC_MBOX_TD_PROD_IDX,
+ (sc->alc_cdata.alc_tx_prod <<
+ MBOX_TD_PROD_LO_IDX_SHIFT) &
+ MBOX_TD_PROD_LO_IDX_MASK);
+ /* Set a timeout in case the chip goes out to lunch. */
+ sc->alc_watchdog_timer = ALC_TX_TIMEOUT;
}
static void
@@ -4642,3 +4655,54 @@
return (sysctl_int_range(oidp, arg1, arg2, req,
ALC_IM_TIMER_MIN, ALC_IM_TIMER_MAX));
}
+
+#ifdef NETDUMP
+static void
+alc_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
+{
+ struct alc_softc *sc;
+
+ sc = if_getsoftc(ifp);
+ KASSERT(sc->alc_buf_size <= MCLBYTES, ("incorrect cluster size"));
+
+ *nrxr = ALC_RX_RING_CNT;
+ *ncl = NETDUMP_MAX_IN_FLIGHT;
+ *clsize = MCLBYTES;
+}
+
+static void
+alc_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused)
+{
+}
+
+static int
+alc_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
+{
+ struct alc_softc *sc;
+ int error;
+
+ sc = if_getsoftc(ifp);
+ if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING)
+ return (EBUSY);
+
+ error = alc_encap(sc, &m);
+ if (error == 0)
+ alc_start_tx(sc);
+ return (error);
+}
+
+static int
+alc_netdump_poll(struct ifnet *ifp, int count)
+{
+ struct alc_softc *sc;
+
+ sc = if_getsoftc(ifp);
+ if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING)
+ return (EBUSY);
+
+ alc_txeof(sc);
+ return (alc_rxintr(sc, count));
+}
+#endif /* NETDUMP */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 10:01 PM (12 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33271071
Default Alt Text
D15255.id42042.diff (3 KB)
Attached To
Mode
D15255: Add netdump hooks for alc(4).
Attached
Detach File
Event Timeline
Log In to Comment