37#include <sys/eventhandler.h>
41#include <sys/socket.h>
42#include <sys/sockio.h>
45#include <net/ethernet.h>
47#include <net/if_clone.h>
48#include <net/if_types.h>
92static int tracer_ioctl(
struct ifnet *,
unsigned long, caddr_t);
111 if (strcmp(device_get_nameunit(
sc->
dev), mrr->
name) != 0)
114 KASSERT(mrr->
sc == NULL, (
"%s: multiple matches (%p, %p) for %s",
128 if (strncmp(
name,
"t4nex", 5) != 0 &&
129 strncmp(
name,
"t5nex", 5) != 0 &&
130 strncmp(
name,
"t6nex", 5) != 0)
144 const uint8_t lla[ETHER_ADDR_LEN] = {0, 0, 0, 0, 0, 0};
156 KASSERT(sc != NULL, (
"%s: name (%s) matched but softc is NULL",
162 if (sc->
ifp != NULL) {
173 rc = ifc_alloc_unit(ifc, &unit);
177 ifp = if_alloc(IFT_ETHER);
179 ifc_free_unit(ifc, unit);
185 strlcpy(
ifp->if_xname, name,
sizeof(
ifp->if_xname));
187 ifp->if_dunit = unit;
189 ifp->if_flags = IFF_SIMPLEX | IFF_DRV_RUNNING;
193 ifp->if_capabilities = IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU;
196 ifmedia_add(&sc->
media, IFM_ETHER | IFM_FDX | IFM_NONE, 0, NULL);
197 ifmedia_set(&sc->
media, IFM_ETHER | IFM_FDX | IFM_NONE);
198 ether_ifattach(
ifp, lla);
214 int unit =
ifp->if_dunit;
221 ifp->if_softc = NULL;
223 ifmedia_removeall(&sc->
media);
227 ifc_free_unit(ifc, unit);
264 if (sc->
ifp != NULL) {
266 sc->
ifp->if_softc = NULL;
270 ifmedia_removeall(&sc->
media);
314 else if (tp.
port < 8)
386 }
else if (t->
tp.
port < 8) {
425 KASSERT(m != NULL, (
"%s: no payload with opcode %02x", __func__,
432 m->m_pkthdr.rcvif =
ifp;
433 ETHER_BPF_MTAP(
ifp, m);
447 KASSERT(m != NULL, (
"%s: no payload with opcode %02x", __func__,
454 m->m_pkthdr.rcvif =
ifp;
455 ETHER_BPF_MTAP(
ifp, m);
476 struct ifreq *ifr = (
struct ifreq *)data;
493 rc = ifmedia_ioctl(
ifp, ifr, &sc->
media, cmd);
497 rc = ether_ioctl(
ifp, cmd, data);
529 ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *)
void t4_iterate(void(*)(struct adapter *, void *), void *)
static bool hw_off_limits(struct adapter *sc)
#define ASSERT_SYNCHRONIZED_OP(sc)
void end_synchronized_op(struct adapter *, int)
int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, int filter_index, int enable)
void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val)
void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, int filter_index, int *enabled)
uint8_t chan_map[MAX_NCHAN]
struct port_info * port[MAX_NPORTS]
uint32_t mask[T4_TRACE_LEN/4]
uint32_t data[T4_TRACE_LEN/4]
struct t4_trace_params tp
static void tracer_init(void *)
static struct sx t4_trace_lock
static void tracer_qflush(struct ifnet *)
int t4_trace_pkt(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
static int t4_cloner_match(struct if_clone *ifc, const char *name)
static struct if_clone * t4_cloner
static int t4_cloner_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
static const char * t4_cloner_name
static void match_name(struct adapter *sc, void *arg)
static int tracer_media_change(struct ifnet *)
static void tracer_media_status(struct ifnet *, struct ifmediareq *)
void t4_tracer_port_detach(struct adapter *sc)
int t4_set_tracer(struct adapter *sc, struct t4_tracer *t)
int t4_get_tracer(struct adapter *sc, struct t4_tracer *t)
int t5_trace_pkt(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
static int t4_cloner_destroy(struct if_clone *ifc, struct ifnet *ifp)
void t4_tracer_modunload()
static int tracer_ioctl(struct ifnet *, unsigned long, caddr_t)
static int tracer_transmit(struct ifnet *, struct mbuf *)