Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ioat/ioat.c
Show All 12 Lines | |||||
#define ioat_log_message(v, ...) do { \ | #define ioat_log_message(v, ...) do { \ | ||||
if ((v) <= g_ioat_debug_level) { \ | if ((v) <= g_ioat_debug_level) { \ | ||||
device_printf(ioat->device, __VA_ARGS__); \ | device_printf(ioat->device, __VA_ARGS__); \ | ||||
} \ | } \ | ||||
} while (0) | } while (0) | ||||
MALLOC_DEFINE(M_IOAT, "ioat", "ioat driver memory allocations"); | MALLOC_DEFINE(M_IOAT, "ioat", "ioat driver memory allocations"); | ||||
SYSCTL_NODE(_hw, OID_AUTO, ioat, CTLFLAG_RD, 0, "ioat node"); | SYSCTL_NODE(_hw, OID_AUTO, ioat, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"ioat node"); | |||||
static int g_force_legacy_interrupts; | static int g_force_legacy_interrupts; | ||||
SYSCTL_INT(_hw_ioat, OID_AUTO, force_legacy_interrupts, CTLFLAG_RDTUN, | SYSCTL_INT(_hw_ioat, OID_AUTO, force_legacy_interrupts, CTLFLAG_RDTUN, | ||||
&g_force_legacy_interrupts, 0, "Set to non-zero to force MSI-X disabled"); | &g_force_legacy_interrupts, 0, "Set to non-zero to force MSI-X disabled"); | ||||
int g_ioat_debug_level = 0; | int g_ioat_debug_level = 0; | ||||
SYSCTL_INT(_hw_ioat, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_ioat_debug_level, | SYSCTL_INT(_hw_ioat, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_ioat_debug_level, | ||||
0, "Set log level (0-3) for ioat(4). Higher is more verbose."); | 0, "Set log level (0-3) for ioat(4). Higher is more verbose."); | ||||
Show All 24 Lines | |||||
SYSCTL_ADD_UINT(ctx, par, OID_AUTO, "max_xfer_size", CTLFLAG_RD, | SYSCTL_ADD_UINT(ctx, par, OID_AUTO, "max_xfer_size", CTLFLAG_RD, | ||||
&ioat->max_xfer_size, 0, "HW maximum transfer size"); | &ioat->max_xfer_size, 0, "HW maximum transfer size"); | ||||
SYSCTL_ADD_INT(ctx, par, OID_AUTO, "intrdelay_supported", CTLFLAG_RD, | SYSCTL_ADD_INT(ctx, par, OID_AUTO, "intrdelay_supported", CTLFLAG_RD, | ||||
&ioat->intrdelay_supported, 0, "Is INTRDELAY supported"); | &ioat->intrdelay_supported, 0, "Is INTRDELAY supported"); | ||||
SYSCTL_ADD_U16(ctx, par, OID_AUTO, "intrdelay_max", CTLFLAG_RD, | SYSCTL_ADD_U16(ctx, par, OID_AUTO, "intrdelay_max", CTLFLAG_RD, | ||||
&ioat->intrdelay_max, 0, | &ioat->intrdelay_max, 0, | ||||
"Maximum configurable INTRDELAY on this channel (microseconds)"); | "Maximum configurable INTRDELAY on this channel (microseconds)"); | ||||
tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "state", CTLFLAG_RD, NULL, | tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "state", | ||||
"IOAT channel internal state"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "IOAT channel internal state"); | ||||
state = SYSCTL_CHILDREN(tmp); | state = SYSCTL_CHILDREN(tmp); | ||||
SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "ring_size_order", CTLFLAG_RD, | SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "ring_size_order", CTLFLAG_RD, | ||||
&ioat->ring_size_order, 0, "SW descriptor ring size order"); | &ioat->ring_size_order, 0, "SW descriptor ring size order"); | ||||
SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "head", CTLFLAG_RD, &ioat->head, | SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "head", CTLFLAG_RD, &ioat->head, | ||||
0, "SW descriptor head pointer index"); | 0, "SW descriptor head pointer index"); | ||||
SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "tail", CTLFLAG_RD, &ioat->tail, | SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "tail", CTLFLAG_RD, &ioat->tail, | ||||
0, "SW descriptor tail pointer index"); | 0, "SW descriptor tail pointer index"); | ||||
SYSCTL_ADD_UQUAD(ctx, state, OID_AUTO, "last_completion", CTLFLAG_RD, | SYSCTL_ADD_UQUAD(ctx, state, OID_AUTO, "last_completion", CTLFLAG_RD, | ||||
ioat->comp_update, "HW addr of last completion"); | ioat->comp_update, "HW addr of last completion"); | ||||
SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_submitter_processing", | SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_submitter_processing", | ||||
CTLFLAG_RD, &ioat->is_submitter_processing, 0, | CTLFLAG_RD, &ioat->is_submitter_processing, 0, | ||||
"submitter processing"); | "submitter processing"); | ||||
SYSCTL_ADD_PROC(ctx, state, OID_AUTO, "chansts", | SYSCTL_ADD_PROC(ctx, state, OID_AUTO, "chansts", | ||||
CTLTYPE_STRING | CTLFLAG_RD, ioat, 0, sysctl_handle_chansts, "A", | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, ioat, 0, | ||||
"String of the channel status"); | sysctl_handle_chansts, "A", "String of the channel status"); | ||||
SYSCTL_ADD_U16(ctx, state, OID_AUTO, "intrdelay", CTLFLAG_RD, | SYSCTL_ADD_U16(ctx, state, OID_AUTO, "intrdelay", CTLFLAG_RD, | ||||
&ioat->cached_intrdelay, 0, | &ioat->cached_intrdelay, 0, | ||||
"Current INTRDELAY on this channel (cached, microseconds)"); | "Current INTRDELAY on this channel (cached, microseconds)"); | ||||
tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "hammer", CTLFLAG_RD, NULL, | tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "hammer", | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, | |||||
"Big hammers (mostly for testing)"); | "Big hammers (mostly for testing)"); | ||||
hammer = SYSCTL_CHILDREN(tmp); | hammer = SYSCTL_CHILDREN(tmp); | ||||
SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_reset", | SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_reset", | ||||
CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_reset, "I", | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, ioat, 0, | ||||
"Set to non-zero to reset the hardware"); | sysctl_handle_reset, "I", "Set to non-zero to reset the hardware"); | ||||
tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "stats", CTLFLAG_RD, NULL, | tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "stats", | ||||
"IOAT channel statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "IOAT channel statistics"); | ||||
statpar = SYSCTL_CHILDREN(tmp); | statpar = SYSCTL_CHILDREN(tmp); | ||||
SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "interrupts", | SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "interrupts", | ||||
CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.interrupts, | CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.interrupts, | ||||
"Number of interrupts processed on this channel"); | "Number of interrupts processed on this channel"); | ||||
SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "descriptors", | SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "descriptors", | ||||
CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.descriptors_processed, | CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.descriptors_processed, | ||||
"Number of descriptors processed on this channel"); | "Number of descriptors processed on this channel"); | ||||
SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "submitted", | SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "submitted", | ||||
CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.descriptors_submitted, | CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.descriptors_submitted, | ||||
"Number of descriptors submitted to this channel"); | "Number of descriptors submitted to this channel"); | ||||
SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "errored", | SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "errored", | ||||
CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.descriptors_error, | CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.descriptors_error, | ||||
"Number of descriptors failed by channel errors"); | "Number of descriptors failed by channel errors"); | ||||
SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "halts", | SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "halts", | ||||
CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.channel_halts, 0, | CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.channel_halts, 0, | ||||
"Number of times the channel has halted"); | "Number of times the channel has halted"); | ||||
SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "last_halt_chanerr", | SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "last_halt_chanerr", | ||||
CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.last_halt_chanerr, 0, | CTLFLAG_RW | CTLFLAG_STATS, &ioat->stats.last_halt_chanerr, 0, | ||||
"The raw CHANERR when the channel was last halted"); | "The raw CHANERR when the channel was last halted"); | ||||
SYSCTL_ADD_PROC(ctx, statpar, OID_AUTO, "desc_per_interrupt", | SYSCTL_ADD_PROC(ctx, statpar, OID_AUTO, "desc_per_interrupt", | ||||
CTLTYPE_STRING | CTLFLAG_RD, ioat, 0, sysctl_handle_dpi, "A", | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, ioat, 0, | ||||
"Descriptors per interrupt"); | sysctl_handle_dpi, "A", "Descriptors per interrupt"); | ||||
} | } | ||||
static void | static void | ||||
ioat_get(struct ioat_softc *ioat) | ioat_get(struct ioat_softc *ioat) | ||||
{ | { | ||||
mtx_assert(&ioat->submit_lock, MA_OWNED); | mtx_assert(&ioat->submit_lock, MA_OWNED); | ||||
KASSERT(ioat->refcnt < UINT32_MAX, ("refcnt overflow")); | KASSERT(ioat->refcnt < UINT32_MAX, ("refcnt overflow")); | ||||
Show All 12 Lines |