summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_rlreg.h
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2010-11-05 19:28:00 +0000
committeryongari <yongari@FreeBSD.org>2010-11-05 19:28:00 +0000
commit3f7fdc49477b1af5af349aa052cb0711a96f8542 (patch)
treee60c0c509fe8161b56ab14cda21272f5ad5addbb /sys/pci/if_rlreg.h
parent6a88b24ee2d7ca5016b91d9d019359d50e6924df (diff)
downloadFreeBSD-src-3f7fdc49477b1af5af349aa052cb0711a96f8542.zip
FreeBSD-src-3f7fdc49477b1af5af349aa052cb0711a96f8542.tar.gz
Add simple MAC statistics counter reading support. Unfortunately
useful counters like rl_missed_pkts is 16 bits quantity which is too small to hold meaningful information happened in a second. This means driver should frequently read these counters in order not to lose accuracy and that approach is too inefficient in driver's view. Moreover it seems there is no way to trigger an interrupt to detect counter near-full or wraparound event as well as lacking clearing the MAC counters. Another limitation of reading the counters from RealTek controllers is lack of interrupt firing at the end of DMA cycle of MAC counter read request such that driver have to poll the end of the DMA which is a time consuming process as well as inefficient. The more severe issue of the MAC counter read request is it takes too long to complete the DMA. All these limitation made maintaining MAC counters in driver impractical. For now, just provide simple sysctl interface to trigger reading the MAC counters. These counters could be used to track down driver issues. Users can read MAC counters maintained in controller with the following command. #sysctl dev.re.0.stats=1 While I'm here add check for validity of dma map and allocated memory before unloading/freeing them. Tested by: rmacklem
Diffstat (limited to 'sys/pci/if_rlreg.h')
-rw-r--r--sys/pci/if_rlreg.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/pci/if_rlreg.h b/sys/pci/if_rlreg.h
index 7d2c7e4..0b29474 100644
--- a/sys/pci/if_rlreg.h
+++ b/sys/pci/if_rlreg.h
@@ -723,19 +723,16 @@ struct rl_desc {
* Statistics counter structure (8139C+ and 8169 only)
*/
struct rl_stats {
- uint32_t rl_tx_pkts_lo;
- uint32_t rl_tx_pkts_hi;
- uint32_t rl_tx_errs_lo;
- uint32_t rl_tx_errs_hi;
- uint32_t rl_tx_errs;
+ uint64_t rl_tx_pkts;
+ uint64_t rl_rx_pkts;
+ uint64_t rl_tx_errs;
+ uint32_t rl_rx_errs;
uint16_t rl_missed_pkts;
uint16_t rl_rx_framealign_errs;
uint32_t rl_tx_onecoll;
uint32_t rl_tx_multicolls;
- uint32_t rl_rx_ucasts_hi;
- uint32_t rl_rx_ucasts_lo;
- uint32_t rl_rx_bcasts_lo;
- uint32_t rl_rx_bcasts_hi;
+ uint64_t rl_rx_ucasts;
+ uint64_t rl_rx_bcasts;
uint32_t rl_rx_mcasts;
uint16_t rl_tx_aborts;
uint16_t rl_rx_underruns;
@@ -769,6 +766,7 @@ struct rl_stats {
#define RL_NTXSEGS 32
#define RL_RING_ALIGN 256
+#define RL_DUMP_ALIGN 64
#define RL_IFQ_MAXLEN 512
#define RL_TX_DESC_NXT(sc,x) ((x + 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1))
#define RL_TX_DESC_PRV(sc,x) ((x - 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1))
OpenPOWER on IntegriCloud