Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/msk/if_msk.c
Show All 12 Lines | |||||
device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n", | device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n", | ||||
sc->msk_hw_id, sc->msk_hw_rev); | sc->msk_hw_id, sc->msk_hw_rev); | ||||
mtx_destroy(&sc->msk_mtx); | mtx_destroy(&sc->msk_mtx); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), | SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), | ||||
OID_AUTO, "process_limit", CTLTYPE_INT | CTLFLAG_RW, | OID_AUTO, "process_limit", | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
&sc->msk_process_limit, 0, sysctl_hw_msk_proc_limit, "I", | &sc->msk_process_limit, 0, sysctl_hw_msk_proc_limit, "I", | ||||
"max number of Rx events to process"); | "max number of Rx events to process"); | ||||
sc->msk_process_limit = MSK_PROC_DEFAULT; | sc->msk_process_limit = MSK_PROC_DEFAULT; | ||||
error = resource_int_value(device_get_name(dev), device_get_unit(dev), | error = resource_int_value(device_get_name(dev), device_get_unit(dev), | ||||
"process_limit", &sc->msk_process_limit); | "process_limit", &sc->msk_process_limit); | ||||
if (error == 0) { | if (error == 0) { | ||||
if (sc->msk_process_limit < MSK_PROC_MIN || | if (sc->msk_process_limit < MSK_PROC_MIN || | ||||
Show All 24 Lines | |||||
return (sysctl_handle_64(oidp, &result, 0, req)); | return (sysctl_handle_64(oidp, &result, 0, req)); | ||||
} | } | ||||
#undef MSK_READ_MIB32 | #undef MSK_READ_MIB32 | ||||
#undef MSK_READ_MIB64 | #undef MSK_READ_MIB64 | ||||
#define MSK_SYSCTL_STAT32(sc, c, o, p, n, d) \ | #define MSK_SYSCTL_STAT32(sc, c, o, p, n, d) \ | ||||
SYSCTL_ADD_PROC(c, p, OID_AUTO, o, CTLTYPE_UINT | CTLFLAG_RD, \ | SYSCTL_ADD_PROC(c, p, OID_AUTO, o, \ | ||||
CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, \ | |||||
sc, offsetof(struct msk_hw_stats, n), msk_sysctl_stat32, \ | sc, offsetof(struct msk_hw_stats, n), msk_sysctl_stat32, \ | ||||
"IU", d) | "IU", d) | ||||
#define MSK_SYSCTL_STAT64(sc, c, o, p, n, d) \ | #define MSK_SYSCTL_STAT64(sc, c, o, p, n, d) \ | ||||
SYSCTL_ADD_PROC(c, p, OID_AUTO, o, CTLTYPE_U64 | CTLFLAG_RD, \ | SYSCTL_ADD_PROC(c, p, OID_AUTO, o, \ | ||||
CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_NEEDGIANT, \ | |||||
sc, offsetof(struct msk_hw_stats, n), msk_sysctl_stat64, \ | sc, offsetof(struct msk_hw_stats, n), msk_sysctl_stat64, \ | ||||
"QU", d) | "QU", d) | ||||
static void | static void | ||||
msk_sysctl_node(struct msk_if_softc *sc_if) | msk_sysctl_node(struct msk_if_softc *sc_if) | ||||
{ | { | ||||
struct sysctl_ctx_list *ctx; | struct sysctl_ctx_list *ctx; | ||||
struct sysctl_oid_list *child, *schild; | struct sysctl_oid_list *child, *schild; | ||||
struct sysctl_oid *tree; | struct sysctl_oid *tree; | ||||
ctx = device_get_sysctl_ctx(sc_if->msk_if_dev); | ctx = device_get_sysctl_ctx(sc_if->msk_if_dev); | ||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc_if->msk_if_dev)); | child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc_if->msk_if_dev)); | ||||
tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", | ||||
NULL, "MSK Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "MSK Statistics"); | ||||
schild = SYSCTL_CHILDREN(tree); | schild = SYSCTL_CHILDREN(tree); | ||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", | ||||
NULL, "MSK RX Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "MSK RX Statistics"); | ||||
child = SYSCTL_CHILDREN(tree); | child = SYSCTL_CHILDREN(tree); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "ucast_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "ucast_frames", | ||||
child, rx_ucast_frames, "Good unicast frames"); | child, rx_ucast_frames, "Good unicast frames"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "bcast_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "bcast_frames", | ||||
child, rx_bcast_frames, "Good broadcast frames"); | child, rx_bcast_frames, "Good broadcast frames"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "pause_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "pause_frames", | ||||
child, rx_pause_frames, "Pause frames"); | child, rx_pause_frames, "Pause frames"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "mcast_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "mcast_frames", | ||||
Show All 20 Lines | |||||
child, rx_pkts_1519_max, "1519 to max frames"); | child, rx_pkts_1519_max, "1519 to max frames"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "frames_too_long", | MSK_SYSCTL_STAT32(sc_if, ctx, "frames_too_long", | ||||
child, rx_pkts_too_long, "frames too long"); | child, rx_pkts_too_long, "frames too long"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "jabbers", | MSK_SYSCTL_STAT32(sc_if, ctx, "jabbers", | ||||
child, rx_pkts_jabbers, "Jabber errors"); | child, rx_pkts_jabbers, "Jabber errors"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "overflows", | MSK_SYSCTL_STAT32(sc_if, ctx, "overflows", | ||||
child, rx_fifo_oflows, "FIFO overflows"); | child, rx_fifo_oflows, "FIFO overflows"); | ||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", | ||||
NULL, "MSK TX Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "MSK TX Statistics"); | ||||
child = SYSCTL_CHILDREN(tree); | child = SYSCTL_CHILDREN(tree); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "ucast_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "ucast_frames", | ||||
child, tx_ucast_frames, "Unicast frames"); | child, tx_ucast_frames, "Unicast frames"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "bcast_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "bcast_frames", | ||||
child, tx_bcast_frames, "Broadcast frames"); | child, tx_bcast_frames, "Broadcast frames"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "pause_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "pause_frames", | ||||
child, tx_pause_frames, "Pause frames"); | child, tx_pause_frames, "Pause frames"); | ||||
MSK_SYSCTL_STAT32(sc_if, ctx, "mcast_frames", | MSK_SYSCTL_STAT32(sc_if, ctx, "mcast_frames", | ||||
Show All 12 Lines |