Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgb/cxgb_main.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <net/bpf.h> | #include <net/bpf.h> | ||||
#include <net/debugnet.h> | |||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/if_arp.h> | #include <net/if_arp.h> | ||||
#include <net/if_dl.h> | #include <net/if_dl.h> | ||||
#include <net/if_media.h> | #include <net/if_media.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#include <net/if_vlan_var.h> | #include <net/if_vlan_var.h> | ||||
#include <netinet/in_systm.h> | #include <netinet/in_systm.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/if_ether.h> | #include <netinet/if_ether.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | ||||
#include <netinet/udp.h> | #include <netinet/udp.h> | ||||
#include <netinet/netdump/netdump.h> | |||||
#include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <dev/pci/pci_private.h> | #include <dev/pci/pci_private.h> | ||||
#include <cxgb_include.h> | #include <cxgb_include.h> | ||||
#ifdef PRIV_SUPPORTED | #ifdef PRIV_SUPPORTED | ||||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | static struct cdevsw cxgb_cdevsw = { | ||||
.d_ioctl = cxgb_extension_ioctl, | .d_ioctl = cxgb_extension_ioctl, | ||||
.d_name = "cxgb", | .d_name = "cxgb", | ||||
}; | }; | ||||
static devclass_t cxgb_port_devclass; | static devclass_t cxgb_port_devclass; | ||||
DRIVER_MODULE(cxgb, cxgbc, cxgb_port_driver, cxgb_port_devclass, 0, 0); | DRIVER_MODULE(cxgb, cxgbc, cxgb_port_driver, cxgb_port_devclass, 0, 0); | ||||
MODULE_VERSION(cxgb, 1); | MODULE_VERSION(cxgb, 1); | ||||
NETDUMP_DEFINE(cxgb); | DEBUGNET_DEFINE(cxgb); | ||||
static struct mtx t3_list_lock; | static struct mtx t3_list_lock; | ||||
static SLIST_HEAD(, adapter) t3_list; | static SLIST_HEAD(, adapter) t3_list; | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
static struct mtx t3_uld_list_lock; | static struct mtx t3_uld_list_lock; | ||||
static SLIST_HEAD(, uld_info) t3_uld_list; | static SLIST_HEAD(, uld_info) t3_uld_list; | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 818 Lines • ▼ Show 20 Lines | #endif | ||||
if (sc->params.nports > 2) { | if (sc->params.nports > 2) { | ||||
ifp->if_capabilities &= ~(IFCAP_TSO | IFCAP_VLAN_HWTSO); | ifp->if_capabilities &= ~(IFCAP_TSO | IFCAP_VLAN_HWTSO); | ||||
ifp->if_capenable &= ~(IFCAP_TSO | IFCAP_VLAN_HWTSO); | ifp->if_capenable &= ~(IFCAP_TSO | IFCAP_VLAN_HWTSO); | ||||
ifp->if_hwassist &= ~CSUM_TSO; | ifp->if_hwassist &= ~CSUM_TSO; | ||||
} | } | ||||
ether_ifattach(ifp, p->hw_addr); | ether_ifattach(ifp, p->hw_addr); | ||||
/* Attach driver netdump methods. */ | /* Attach driver debugnet methods. */ | ||||
NETDUMP_SET(ifp, cxgb); | DEBUGNET_SET(ifp, cxgb); | ||||
#ifdef DEFAULT_JUMBO | #ifdef DEFAULT_JUMBO | ||||
if (sc->params.nports <= 2) | if (sc->params.nports <= 2) | ||||
ifp->if_mtu = ETHERMTU_JUMBO; | ifp->if_mtu = ETHERMTU_JUMBO; | ||||
#endif | #endif | ||||
if ((err = cxgb_makedev(p)) != 0) { | if ((err = cxgb_makedev(p)) != 0) { | ||||
printf("makedev failed %d\n", err); | printf("makedev failed %d\n", err); | ||||
return (err); | return (err); | ||||
▲ Show 20 Lines • Show All 2,519 Lines • ▼ Show 20 Lines | #endif | ||||
mtx_unlock(&t3_list_lock); | mtx_unlock(&t3_list_lock); | ||||
mtx_destroy(&t3_list_lock); | mtx_destroy(&t3_list_lock); | ||||
break; | break; | ||||
} | } | ||||
return (rc); | return (rc); | ||||
} | } | ||||
#ifdef NETDUMP | #ifdef DEBUGNET | ||||
static void | static void | ||||
cxgb_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) | cxgb_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) | ||||
{ | { | ||||
struct port_info *pi; | struct port_info *pi; | ||||
adapter_t *adap; | adapter_t *adap; | ||||
pi = if_getsoftc(ifp); | pi = if_getsoftc(ifp); | ||||
adap = pi->adapter; | adap = pi->adapter; | ||||
ADAPTER_LOCK(adap); | ADAPTER_LOCK(adap); | ||||
*nrxr = adap->nqsets; | *nrxr = adap->nqsets; | ||||
*ncl = adap->sge.qs[0].fl[1].size; | *ncl = adap->sge.qs[0].fl[1].size; | ||||
*clsize = adap->sge.qs[0].fl[1].buf_size; | *clsize = adap->sge.qs[0].fl[1].buf_size; | ||||
ADAPTER_UNLOCK(adap); | ADAPTER_UNLOCK(adap); | ||||
} | } | ||||
static void | static void | ||||
cxgb_netdump_event(struct ifnet *ifp, enum netdump_ev event) | cxgb_debugnet_event(struct ifnet *ifp, enum debugnet_ev event) | ||||
{ | { | ||||
struct port_info *pi; | struct port_info *pi; | ||||
struct sge_qset *qs; | struct sge_qset *qs; | ||||
int i; | int i; | ||||
pi = if_getsoftc(ifp); | pi = if_getsoftc(ifp); | ||||
if (event == NETDUMP_START) | if (event == DEBUGNET_START) | ||||
for (i = 0; i < pi->adapter->nqsets; i++) { | for (i = 0; i < pi->adapter->nqsets; i++) { | ||||
qs = &pi->adapter->sge.qs[i]; | qs = &pi->adapter->sge.qs[i]; | ||||
/* Need to reinit after netdump_mbuf_dump(). */ | /* Need to reinit after debugnet_mbuf_start(). */ | ||||
qs->fl[0].zone = zone_pack; | qs->fl[0].zone = zone_pack; | ||||
qs->fl[1].zone = zone_clust; | qs->fl[1].zone = zone_clust; | ||||
qs->lro.enabled = 0; | qs->lro.enabled = 0; | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
cxgb_netdump_transmit(struct ifnet *ifp, struct mbuf *m) | cxgb_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) | ||||
{ | { | ||||
struct port_info *pi; | struct port_info *pi; | ||||
struct sge_qset *qs; | struct sge_qset *qs; | ||||
pi = if_getsoftc(ifp); | pi = if_getsoftc(ifp); | ||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != | if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != | ||||
IFF_DRV_RUNNING) | IFF_DRV_RUNNING) | ||||
return (ENOENT); | return (ENOENT); | ||||
qs = &pi->adapter->sge.qs[pi->first_qset]; | qs = &pi->adapter->sge.qs[pi->first_qset]; | ||||
return (cxgb_netdump_encap(qs, &m)); | return (cxgb_debugnet_encap(qs, &m)); | ||||
} | } | ||||
static int | static int | ||||
cxgb_netdump_poll(struct ifnet *ifp, int count) | cxgb_debugnet_poll(struct ifnet *ifp, int count) | ||||
{ | { | ||||
struct port_info *pi; | struct port_info *pi; | ||||
adapter_t *adap; | adapter_t *adap; | ||||
int i; | int i; | ||||
pi = if_getsoftc(ifp); | pi = if_getsoftc(ifp); | ||||
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) | if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) | ||||
return (ENOENT); | return (ENOENT); | ||||
adap = pi->adapter; | adap = pi->adapter; | ||||
for (i = 0; i < adap->nqsets; i++) | for (i = 0; i < adap->nqsets; i++) | ||||
(void)cxgb_netdump_poll_rx(adap, &adap->sge.qs[i]); | (void)cxgb_debugnet_poll_rx(adap, &adap->sge.qs[i]); | ||||
(void)cxgb_netdump_poll_tx(&adap->sge.qs[pi->first_qset]); | (void)cxgb_debugnet_poll_tx(&adap->sge.qs[pi->first_qset]); | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif /* NETDUMP */ | #endif /* DEBUGNET */ |