Add netdump support to cxgb(4).
Tested with a T320 adapter. Reviewed by: np MFC after: 1 month Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D15258
This commit is contained in:
parent
7b25e48395
commit
f97c308eb9
@ -576,4 +576,11 @@ int cxgb_transmit(struct ifnet *ifp, struct mbuf *m);
|
||||
void cxgb_qflush(struct ifnet *ifp);
|
||||
void t3_iterate(void (*)(struct adapter *, void *), void *);
|
||||
void cxgb_refresh_stats(struct port_info *);
|
||||
|
||||
#ifdef NETDUMP
|
||||
int cxgb_netdump_encap(struct sge_qset *qs, struct mbuf **m);
|
||||
int cxgb_netdump_poll_rx(adapter_t *adap, struct sge_qset *qs);
|
||||
int cxgb_netdump_poll_tx(struct sge_qset *qs);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/netdump/netdump.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
@ -191,6 +192,8 @@ static devclass_t cxgb_port_devclass;
|
||||
DRIVER_MODULE(cxgb, cxgbc, cxgb_port_driver, cxgb_port_devclass, 0, 0);
|
||||
MODULE_VERSION(cxgb, 1);
|
||||
|
||||
NETDUMP_DEFINE(cxgb);
|
||||
|
||||
static struct mtx t3_list_lock;
|
||||
static SLIST_HEAD(, adapter) t3_list;
|
||||
#ifdef TCP_OFFLOAD
|
||||
@ -1045,6 +1048,9 @@ cxgb_port_attach(device_t dev)
|
||||
|
||||
ether_ifattach(ifp, p->hw_addr);
|
||||
|
||||
/* Attach driver netdump methods. */
|
||||
NETDUMP_SET(ifp, cxgb);
|
||||
|
||||
#ifdef DEFAULT_JUMBO
|
||||
if (sc->params.nports <= 2)
|
||||
ifp->if_mtu = ETHERMTU_JUMBO;
|
||||
@ -3578,3 +3584,72 @@ cxgbc_mod_event(module_t mod, int cmd, void *arg)
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
static void
|
||||
cxgb_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
|
||||
{
|
||||
struct port_info *pi;
|
||||
adapter_t *adap;
|
||||
|
||||
pi = if_getsoftc(ifp);
|
||||
adap = pi->adapter;
|
||||
ADAPTER_LOCK(adap);
|
||||
*nrxr = SGE_QSETS;
|
||||
*ncl = adap->sge.qs[0].fl[1].size;
|
||||
*clsize = adap->sge.qs[0].fl[1].buf_size;
|
||||
ADAPTER_UNLOCK(adap);
|
||||
}
|
||||
|
||||
static void
|
||||
cxgb_netdump_event(struct ifnet *ifp, enum netdump_ev event)
|
||||
{
|
||||
struct port_info *pi;
|
||||
struct sge_qset *qs;
|
||||
int i;
|
||||
|
||||
pi = if_getsoftc(ifp);
|
||||
if (event == NETDUMP_START)
|
||||
for (i = 0; i < SGE_QSETS; i++) {
|
||||
qs = &pi->adapter->sge.qs[i];
|
||||
|
||||
/* Need to reinit after netdump_mbuf_dump(). */
|
||||
qs->fl[0].zone = zone_pack;
|
||||
qs->fl[1].zone = zone_clust;
|
||||
qs->lro.enabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
cxgb_netdump_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
{
|
||||
struct port_info *pi;
|
||||
struct sge_qset *qs;
|
||||
|
||||
pi = if_getsoftc(ifp);
|
||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
|
||||
IFF_DRV_RUNNING)
|
||||
return (ENOENT);
|
||||
|
||||
qs = &pi->adapter->sge.qs[pi->first_qset];
|
||||
return (cxgb_netdump_encap(qs, &m));
|
||||
}
|
||||
|
||||
static int
|
||||
cxgb_netdump_poll(struct ifnet *ifp, int count)
|
||||
{
|
||||
struct port_info *pi;
|
||||
adapter_t *adap;
|
||||
int i;
|
||||
|
||||
pi = if_getsoftc(ifp);
|
||||
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
|
||||
return (ENOENT);
|
||||
|
||||
adap = pi->adapter;
|
||||
for (i = 0; i < SGE_QSETS; i++)
|
||||
(void)cxgb_netdump_poll_rx(adap, &adap->sge.qs[i]);
|
||||
(void)cxgb_netdump_poll_tx(&adap->sge.qs[pi->first_qset]);
|
||||
return (0);
|
||||
}
|
||||
#endif /* NETDUMP */
|
||||
|
@ -390,6 +390,15 @@ reclaim_completed_tx(struct sge_qset *qs, int reclaim_min, int queue)
|
||||
return (reclaim);
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
int
|
||||
cxgb_netdump_poll_tx(struct sge_qset *qs)
|
||||
{
|
||||
|
||||
return (reclaim_completed_tx(qs, TX_RECLAIM_MAX, TXQ_ETH));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* should_restart_tx - are there enough resources to restart a Tx queue?
|
||||
* @q: the Tx queue
|
||||
@ -1586,6 +1595,23 @@ t3_encap(struct sge_qset *qs, struct mbuf **m)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
int
|
||||
cxgb_netdump_encap(struct sge_qset *qs, struct mbuf **m)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = t3_encap(qs, m);
|
||||
if (error == 0)
|
||||
check_ring_tx_db(qs->port->adapter, &qs->txq[TXQ_ETH], 1);
|
||||
else if (*m != NULL) {
|
||||
m_freem(*m);
|
||||
*m = NULL;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
cxgb_tx_watchdog(void *arg)
|
||||
{
|
||||
@ -3014,6 +3040,14 @@ process_responses_gts(adapter_t *adap, struct sge_rspq *rq)
|
||||
return (work);
|
||||
}
|
||||
|
||||
#ifdef NETDUMP
|
||||
int
|
||||
cxgb_netdump_poll_rx(adapter_t *adap, struct sge_qset *qs)
|
||||
{
|
||||
|
||||
return (process_responses_gts(adap, &qs->rspq));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interrupt handler for legacy INTx interrupts for T3B-based cards.
|
||||
|
Loading…
x
Reference in New Issue
Block a user