summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef 'Jeff' Sipek <josef.sipek@nexenta.com>2014-05-07 01:23:12 -0400
committerRichard Lowe <richlowe@richlowe.net>2014-05-14 19:36:59 -0400
commit0529d5c654f682ce87e4f74affd1c83c429c50e1 (patch)
tree1ecfc75ae9990330c9690032480b23aea6a5e698
parente1d3217b9afde782c4d3e946fda0e6ef36a61306 (diff)
downloadillumos-joyent-0529d5c654f682ce87e4f74affd1c83c429c50e1.tar.gz
4778 iprb shouldn't abuse ddi_get_time(9f)
Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/uts/common/io/iprb/iprb.c20
-rw-r--r--usr/src/uts/common/io/iprb/iprb.h17
2 files changed, 19 insertions, 18 deletions
diff --git a/usr/src/uts/common/io/iprb/iprb.c b/usr/src/uts/common/io/iprb/iprb.c
index 14952254b9..0dfcce6e12 100644
--- a/usr/src/uts/common/io/iprb/iprb.c
+++ b/usr/src/uts/common/io/iprb/iprb.c
@@ -298,8 +298,8 @@ iprb_attach(dev_info_t *dip)
/*
* Precalculate watchdog times.
*/
- ip->tx_timeout = drv_usectohz(TX_WATCHDOG * 1000000);
- ip->rx_timeout = drv_usectohz(RX_WATCHDOG * 1000000);
+ ip->tx_timeout = TX_WATCHDOG;
+ ip->rx_timeout = RX_WATCHDOG;
iprb_identify(ip);
@@ -703,7 +703,7 @@ iprb_cmd_reclaim(iprb_t *ip)
if (ip->cmd_count == 0) {
ip->tx_wdog = 0;
} else {
- ip->tx_wdog = ddi_get_time();
+ ip->tx_wdog = gethrtime();
}
}
}
@@ -775,7 +775,7 @@ iprb_cmd_submit(iprb_t *ip, uint16_t cmd)
PUT8(ip, CSR_CMD, CUC_RESUME);
(void) GET8(ip, CSR_CMD); /* flush CSR */
- ip->tx_wdog = ddi_get_time();
+ ip->tx_wdog = gethrtime();
ip->cmd_last = ip->cmd_head;
ip->cmd_head++;
ip->cmd_head %= NUM_TX;
@@ -1010,15 +1010,15 @@ void
iprb_update_stats(iprb_t *ip)
{
iprb_dma_t *sp = &ip->stats;
- time_t tstamp;
+ hrtime_t tstamp;
int i;
ASSERT(mutex_owned(&ip->culock));
/* Collect the hardware stats, but don't keep redoing it */
- if ((tstamp = ddi_get_time()) == ip->stats_time) {
+ tstamp = gethrtime();
+ if (tstamp / NANOSEC == ip->stats_time / NANOSEC)
return;
- }
PUTSTAT(sp, STATS_DONE_OFFSET, 0);
SYNCSTATS(sp, 0, 0, DDI_DMA_SYNC_FORDEV);
@@ -1174,7 +1174,7 @@ iprb_rx(iprb_t *ip)
break;
}
- ip->rx_wdog = ddi_get_time();
+ ip->rx_wdog = gethrtime();
SYNCRFD(rfd, 0, 0, DDI_DMA_SYNC_FORKERNEL);
cnt = GETRFD16(rfd, RFD_CNT_OFFSET);
@@ -1663,7 +1663,7 @@ iprb_periodic(void *arg)
*/
if (ip->rxhangbug &&
((ip->miih == NULL) || (mii_get_speed(ip->miih) == 10000000)) &&
- ((ddi_get_time() - ip->rx_wdog) > ip->rx_timeout)) {
+ ((gethrtime() - ip->rx_wdog) > ip->rx_timeout)) {
cmn_err(CE_CONT, "?Possible RU hang, resetting.\n");
reset = B_TRUE;
}
@@ -1671,7 +1671,7 @@ iprb_periodic(void *arg)
/* update the statistics */
mutex_enter(&ip->culock);
- if (ip->tx_wdog && ((ddi_get_time() - ip->tx_wdog) > ip->tx_timeout)) {
+ if (ip->tx_wdog && ((gethrtime() - ip->tx_wdog) > ip->tx_timeout)) {
/* transmit/CU hang? */
cmn_err(CE_CONT, "?CU stalled, resetting.\n");
reset = B_TRUE;
diff --git a/usr/src/uts/common/io/iprb/iprb.h b/usr/src/uts/common/io/iprb/iprb.h
index 572502955e..8d31e3a4d6 100644
--- a/usr/src/uts/common/io/iprb/iprb.h
+++ b/usr/src/uts/common/io/iprb/iprb.h
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _IPRB_H
@@ -26,8 +26,9 @@
#define NUM_TX 128 /* outstanding tx queue */
#define NUM_RX 128 /* outstanding rx queue */
-#define RX_WATCHDOG 15 /* timeout for rx watchdog (sec) */
-#define TX_WATCHDOG 15 /* timeout for tx watchdog (sec) */
+/* timeouts for the rx and tx watchdogs (nsec) */
+#define RX_WATCHDOG (15 * NANOSEC)
+#define TX_WATCHDOG (15 * NANOSEC)
/*
* Driver structures.
@@ -72,7 +73,7 @@ typedef struct iprb {
iprb_dma_t cmds[NUM_TX];
iprb_dma_t rxb[NUM_RX];
iprb_dma_t stats;
- time_t stats_time;
+ hrtime_t stats_time;
uint16_t cmd_head;
uint16_t cmd_last;
@@ -81,10 +82,10 @@ typedef struct iprb {
uint16_t rx_index;
uint16_t rx_last;
- time_t rx_wdog;
- time_t rx_timeout;
- time_t tx_wdog;
- time_t tx_timeout;
+ hrtime_t rx_wdog;
+ hrtime_t rx_timeout;
+ hrtime_t tx_wdog;
+ hrtime_t tx_timeout;
uint16_t eeprom_bits;