Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bge/if_bge.c
Show All 12 Lines | |||||
DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0); | DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0); | ||||
MODULE_PNP_INFO("U16:vendor;U16:device", pci, bge, bge_devs, | MODULE_PNP_INFO("U16:vendor;U16:device", pci, bge, bge_devs, | ||||
nitems(bge_devs) - 1); | nitems(bge_devs) - 1); | ||||
DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0); | DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0); | ||||
static int bge_allow_asf = 1; | static int bge_allow_asf = 1; | ||||
static SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters"); | static SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"BGE driver parameters"); | |||||
SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RDTUN, &bge_allow_asf, 0, | SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RDTUN, &bge_allow_asf, 0, | ||||
"Allow ASF mode if available"); | "Allow ASF mode if available"); | ||||
static int | static int | ||||
bge_has_eaddr(struct bge_softc *sc) | bge_has_eaddr(struct bge_softc *sc) | ||||
{ | { | ||||
return (1); | return (1); | ||||
} | } | ||||
Show All 24 Lines | |||||
struct sysctl_oid_list *children; | struct sysctl_oid_list *children; | ||||
int unit; | int unit; | ||||
ctx = device_get_sysctl_ctx(sc->bge_dev); | ctx = device_get_sysctl_ctx(sc->bge_dev); | ||||
children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bge_dev)); | children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bge_dev)); | ||||
#ifdef BGE_REGISTER_DEBUG | #ifdef BGE_REGISTER_DEBUG | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "debug_info", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "debug_info", | ||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_debug_info, "I", | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | ||||
"Debug Information"); | bge_sysctl_debug_info, "I", "Debug Information"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "reg_read", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "reg_read", | ||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_reg_read, "I", | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | ||||
"MAC Register Read"); | bge_sysctl_reg_read, "I", "MAC Register Read"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "ape_read", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "ape_read", | ||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_ape_read, "I", | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | ||||
"APE Register Read"); | bge_sysctl_ape_read, "I", "APE Register Read"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mem_read", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mem_read", | ||||
CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_mem_read, "I", | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | ||||
"Memory Read"); | bge_sysctl_mem_read, "I", "Memory Read"); | ||||
#endif | #endif | ||||
unit = device_get_unit(sc->bge_dev); | unit = device_get_unit(sc->bge_dev); | ||||
/* | /* | ||||
* A common design characteristic for many Broadcom client controllers | * A common design characteristic for many Broadcom client controllers | ||||
* is that they only support a single outstanding DMA read operation | * is that they only support a single outstanding DMA read operation | ||||
* on the PCIe bus. This means that it will take twice as long to fetch | * on the PCIe bus. This means that it will take twice as long to fetch | ||||
Show All 24 Lines | |||||
if (BGE_IS_5705_PLUS(sc)) | if (BGE_IS_5705_PLUS(sc)) | ||||
bge_add_sysctl_stats_regs(sc, ctx, children); | bge_add_sysctl_stats_regs(sc, ctx, children); | ||||
else | else | ||||
bge_add_sysctl_stats(sc, ctx, children); | bge_add_sysctl_stats(sc, ctx, children); | ||||
} | } | ||||
#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ | #define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ | ||||
SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \ | SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, \ | ||||
sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \ | CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, \ | ||||
desc) | offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", desc) | ||||
static void | static void | ||||
bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx, | bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx, | ||||
struct sysctl_oid_list *parent) | struct sysctl_oid_list *parent) | ||||
{ | { | ||||
struct sysctl_oid *tree; | struct sysctl_oid *tree; | ||||
struct sysctl_oid_list *children, *schildren; | struct sysctl_oid_list *children, *schildren; | ||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", | ||||
NULL, "BGE Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE Statistics"); | ||||
schildren = children = SYSCTL_CHILDREN(tree); | schildren = children = SYSCTL_CHILDREN(tree); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters", | BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters", | ||||
children, COSFramesDroppedDueToFilters, | children, COSFramesDroppedDueToFilters, | ||||
"FramesDroppedDueToFilters"); | "FramesDroppedDueToFilters"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "NIC DMA Write Queue Full", | BGE_SYSCTL_STAT(sc, ctx, "NIC DMA Write Queue Full", | ||||
children, nicDmaWriteQueueFull, "DmaWriteQueueFull"); | children, nicDmaWriteQueueFull, "DmaWriteQueueFull"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "NIC DMA Write High Priority Queue Full", | BGE_SYSCTL_STAT(sc, ctx, "NIC DMA Write High Priority Queue Full", | ||||
children, nicDmaWriteHighPriQueueFull, "DmaWriteHighPriQueueFull"); | children, nicDmaWriteHighPriQueueFull, "DmaWriteHighPriQueueFull"); | ||||
Show All 17 Lines | |||||
children, nicRingStatusUpdate, "RingStatusUpdate"); | children, nicRingStatusUpdate, "RingStatusUpdate"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "NIC Interrupts", | BGE_SYSCTL_STAT(sc, ctx, "NIC Interrupts", | ||||
children, nicInterrupts, "Interrupts"); | children, nicInterrupts, "Interrupts"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "NIC Avoided Interrupts", | BGE_SYSCTL_STAT(sc, ctx, "NIC Avoided Interrupts", | ||||
children, nicAvoidedInterrupts, "AvoidedInterrupts"); | children, nicAvoidedInterrupts, "AvoidedInterrupts"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "NIC Send Threshold Hit", | BGE_SYSCTL_STAT(sc, ctx, "NIC Send Threshold Hit", | ||||
children, nicSendThresholdHit, "SendThresholdHit"); | children, nicSendThresholdHit, "SendThresholdHit"); | ||||
tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "rx", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "rx", | ||||
NULL, "BGE RX Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE RX Statistics"); | ||||
children = SYSCTL_CHILDREN(tree); | children = SYSCTL_CHILDREN(tree); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Inbound Octets", | BGE_SYSCTL_STAT(sc, ctx, "Inbound Octets", | ||||
children, rxstats.ifHCInOctets, "ifHCInOctets"); | children, rxstats.ifHCInOctets, "ifHCInOctets"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Fragments", | BGE_SYSCTL_STAT(sc, ctx, "Fragments", | ||||
children, rxstats.etherStatsFragments, "Fragments"); | children, rxstats.etherStatsFragments, "Fragments"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Inbound Unicast Packets", | BGE_SYSCTL_STAT(sc, ctx, "Inbound Unicast Packets", | ||||
children, rxstats.ifHCInUcastPkts, "UnicastPkts"); | children, rxstats.ifHCInUcastPkts, "UnicastPkts"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Inbound Multicast Packets", | BGE_SYSCTL_STAT(sc, ctx, "Inbound Multicast Packets", | ||||
Show All 18 Lines | |||||
children, rxstats.etherStatsJabbers, "Jabbers"); | children, rxstats.etherStatsJabbers, "Jabbers"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Undersized Packets", | BGE_SYSCTL_STAT(sc, ctx, "Undersized Packets", | ||||
children, rxstats.etherStatsUndersizePkts, "UndersizePkts"); | children, rxstats.etherStatsUndersizePkts, "UndersizePkts"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Inbound Range Length Errors", | BGE_SYSCTL_STAT(sc, ctx, "Inbound Range Length Errors", | ||||
children, rxstats.inRangeLengthError, "inRangeLengthError"); | children, rxstats.inRangeLengthError, "inRangeLengthError"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Outbound Range Length Errors", | BGE_SYSCTL_STAT(sc, ctx, "Outbound Range Length Errors", | ||||
children, rxstats.outRangeLengthError, "outRangeLengthError"); | children, rxstats.outRangeLengthError, "outRangeLengthError"); | ||||
tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "tx", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, schildren, OID_AUTO, "tx", | ||||
NULL, "BGE TX Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE TX Statistics"); | ||||
children = SYSCTL_CHILDREN(tree); | children = SYSCTL_CHILDREN(tree); | ||||
BGE_SYSCTL_STAT(sc, ctx, "Outbound Octets", | BGE_SYSCTL_STAT(sc, ctx, "Outbound Octets", | ||||
children, txstats.ifHCOutOctets, "ifHCOutOctets"); | children, txstats.ifHCOutOctets, "ifHCOutOctets"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "TX Collisions", | BGE_SYSCTL_STAT(sc, ctx, "TX Collisions", | ||||
children, txstats.etherStatsCollisions, "Collisions"); | children, txstats.etherStatsCollisions, "Collisions"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "XON Sent", | BGE_SYSCTL_STAT(sc, ctx, "XON Sent", | ||||
children, txstats.outXonSent, "XonSent"); | children, txstats.outXonSent, "XonSent"); | ||||
BGE_SYSCTL_STAT(sc, ctx, "XOFF Sent", | BGE_SYSCTL_STAT(sc, ctx, "XOFF Sent", | ||||
Show All 24 Lines | |||||
bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx, | bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx, | ||||
struct sysctl_oid_list *parent) | struct sysctl_oid_list *parent) | ||||
{ | { | ||||
struct sysctl_oid *tree; | struct sysctl_oid *tree; | ||||
struct sysctl_oid_list *child, *schild; | struct sysctl_oid_list *child, *schild; | ||||
struct bge_mac_stats *stats; | struct bge_mac_stats *stats; | ||||
stats = &sc->bge_mac_stats; | stats = &sc->bge_mac_stats; | ||||
tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", | ||||
NULL, "BGE Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE Statistics"); | ||||
schild = child = SYSCTL_CHILDREN(tree); | schild = child = SYSCTL_CHILDREN(tree); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesDroppedDueToFilters", | BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesDroppedDueToFilters", | ||||
&stats->FramesDroppedDueToFilters, "Frames Dropped Due to Filters"); | &stats->FramesDroppedDueToFilters, "Frames Dropped Due to Filters"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteQueueFull", | BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteQueueFull", | ||||
&stats->DmaWriteQueueFull, "NIC DMA Write Queue Full"); | &stats->DmaWriteQueueFull, "NIC DMA Write Queue Full"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteHighPriQueueFull", | BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteHighPriQueueFull", | ||||
&stats->DmaWriteHighPriQueueFull, | &stats->DmaWriteHighPriQueueFull, | ||||
"NIC DMA Write High Priority Queue Full"); | "NIC DMA Write High Priority Queue Full"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "NoMoreRxBDs", | BGE_SYSCTL_STAT_ADD64(ctx, child, "NoMoreRxBDs", | ||||
&stats->NoMoreRxBDs, "NIC No More RX Buffer Descriptors"); | &stats->NoMoreRxBDs, "NIC No More RX Buffer Descriptors"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "InputDiscards", | BGE_SYSCTL_STAT_ADD64(ctx, child, "InputDiscards", | ||||
&stats->InputDiscards, "Discarded Input Frames"); | &stats->InputDiscards, "Discarded Input Frames"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "InputErrors", | BGE_SYSCTL_STAT_ADD64(ctx, child, "InputErrors", | ||||
&stats->InputErrors, "Input Errors"); | &stats->InputErrors, "Input Errors"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "RecvThresholdHit", | BGE_SYSCTL_STAT_ADD64(ctx, child, "RecvThresholdHit", | ||||
&stats->RecvThresholdHit, "NIC Recv Threshold Hit"); | &stats->RecvThresholdHit, "NIC Recv Threshold Hit"); | ||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", | ||||
NULL, "BGE RX Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE RX Statistics"); | ||||
child = SYSCTL_CHILDREN(tree); | child = SYSCTL_CHILDREN(tree); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCInOctets", | BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCInOctets", | ||||
&stats->ifHCInOctets, "Inbound Octets"); | &stats->ifHCInOctets, "Inbound Octets"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "Fragments", | BGE_SYSCTL_STAT_ADD64(ctx, child, "Fragments", | ||||
&stats->etherStatsFragments, "Fragments"); | &stats->etherStatsFragments, "Fragments"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "UnicastPkts", | BGE_SYSCTL_STAT_ADD64(ctx, child, "UnicastPkts", | ||||
&stats->ifHCInUcastPkts, "Inbound Unicast Packets"); | &stats->ifHCInUcastPkts, "Inbound Unicast Packets"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "MulticastPkts", | BGE_SYSCTL_STAT_ADD64(ctx, child, "MulticastPkts", | ||||
Show All 14 Lines | |||||
&stats->xoffStateEntered, "XOFF State Entered"); | &stats->xoffStateEntered, "XOFF State Entered"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesTooLong", | BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesTooLong", | ||||
&stats->dot3StatsFramesTooLong, "Frames Too Long"); | &stats->dot3StatsFramesTooLong, "Frames Too Long"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "Jabbers", | BGE_SYSCTL_STAT_ADD64(ctx, child, "Jabbers", | ||||
&stats->etherStatsJabbers, "Jabbers"); | &stats->etherStatsJabbers, "Jabbers"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "UndersizePkts", | BGE_SYSCTL_STAT_ADD64(ctx, child, "UndersizePkts", | ||||
&stats->etherStatsUndersizePkts, "Undersized Packets"); | &stats->etherStatsUndersizePkts, "Undersized Packets"); | ||||
tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", CTLFLAG_RD, | tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", | ||||
NULL, "BGE TX Statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "BGE TX Statistics"); | ||||
child = SYSCTL_CHILDREN(tree); | child = SYSCTL_CHILDREN(tree); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCOutOctets", | BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCOutOctets", | ||||
&stats->ifHCOutOctets, "Outbound Octets"); | &stats->ifHCOutOctets, "Outbound Octets"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "Collisions", | BGE_SYSCTL_STAT_ADD64(ctx, child, "Collisions", | ||||
&stats->etherStatsCollisions, "TX Collisions"); | &stats->etherStatsCollisions, "TX Collisions"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "XonSent", | BGE_SYSCTL_STAT_ADD64(ctx, child, "XonSent", | ||||
&stats->outXonSent, "XON Sent"); | &stats->outXonSent, "XON Sent"); | ||||
BGE_SYSCTL_STAT_ADD64(ctx, child, "XoffSent", | BGE_SYSCTL_STAT_ADD64(ctx, child, "XoffSent", | ||||
Show All 12 Lines |