Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152862070
D1157.id2393.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
22 KB
Referenced Files
None
Subscribers
None
D1157.id2393.diff
View Options
Index: sys/cam/cam_xpt.c
===================================================================
--- sys/cam/cam_xpt.c
+++ sys/cam/cam_xpt.c
@@ -2893,8 +2893,7 @@
start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE;
}
- callout_reset(&dev->callout,
- (crs->release_timeout * hz) / 1000,
+ callout_reset_msec(&dev->callout, crs->release_timeout,
xpt_release_devq_timeout, dev);
dev->flags |= CAM_DEV_REL_TIMEOUT_PENDING;
@@ -4944,7 +4943,7 @@
periphdriver_init(1);
xpt_hold_boot();
callout_init(&xsoftc.boot_callout, 1);
- callout_reset(&xsoftc.boot_callout, hz * xsoftc.boot_delay / 1000,
+ callout_reset_msec(&xsoftc.boot_callout, xsoftc.boot_delay,
xpt_boot_delay, NULL);
/* Fire up rescan thread. */
if (kproc_kthread_add(xpt_scanner_thread, NULL, &cam_proc, NULL, 0, 0,
Index: sys/dev/advansys/advansys.c
===================================================================
--- sys/dev/advansys/advansys.c
+++ sys/dev/advansys/advansys.c
@@ -168,9 +168,9 @@
ccb_h = LIST_FIRST(&adv->pending_ccbs);
while (ccb_h != NULL) {
cinfo = ccb_h->ccb_cinfo_ptr;
- callout_reset(&cinfo->timer,
- ccb_h->timeout * hz / 1000, adv_timeout,
- ccb_h);
+ callout_reset_msec(&cinfo->timer,
+ ccb_h->timeout,
+ adv_timeout, ccb_h);
ccb_h = LIST_NEXT(ccb_h, sim_links.le);
}
adv->state &= ~ADV_IN_TIMEOUT;
@@ -569,7 +569,7 @@
ccb_h->status |= CAM_SIM_QUEUED;
LIST_INSERT_HEAD(&adv->pending_ccbs, ccb_h, sim_links.le);
/* Schedule our timeout */
- callout_reset(&cinfo->timer, ccb_h->timeout * hz /1000, adv_timeout,
+ callout_reset_msec(&cinfo->timer, ccb_h->timeout, adv_timeout,
csio);
}
Index: sys/dev/advansys/adwcam.c
===================================================================
--- sys/dev/advansys/adwcam.c
+++ sys/dev/advansys/adwcam.c
@@ -322,8 +322,7 @@
acb->state |= ACB_ACTIVE;
ccb->ccb_h.status |= CAM_SIM_QUEUED;
LIST_INSERT_HEAD(&adw->pending_ccbs, &ccb->ccb_h, sim_links.le);
- callout_reset(&acb->timer, (ccb->ccb_h.timeout * hz) / 1000,
- adwtimeout, acb);
+ callout_reset_msec(&acb->timer, ccb->ccb_h.timeout, adwtimeout, acb);
adw_send_acb(adw, acb, acbvtob(adw, acb));
}
Index: sys/dev/aha/aha.c
===================================================================
--- sys/dev/aha/aha.c
+++ sys/dev/aha/aha.c
@@ -1047,8 +1047,7 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
LIST_INSERT_HEAD(&aha->pending_ccbs, &ccb->ccb_h, sim_links.le);
- callout_reset(&accb->timer, (ccb->ccb_h.timeout * hz) / 1000,
- ahatimeout, accb);
+ callout_reset_msec(&accb->timer, ccb->ccb_h.timeout, ahatimeout, accb);
/* Tell the adapter about this command */
if (aha->cur_outbox->action_code != AMBO_FREE) {
@@ -1181,9 +1180,8 @@
ccb_h = LIST_NEXT(ccb_h, sim_links.le);
ahadone(aha, pending_accb, AMBI_ERROR);
} else {
- callout_reset(&pending_accb->timer,
- (ccb_h->timeout * hz) / 1000,
- ahatimeout, pending_accb);
+ callout_reset_msec(&pending_accb->timer,
+ ccb_h->timeout, ahatimeout, pending_accb);
ccb_h = LIST_NEXT(ccb_h, sim_links.le);
}
}
Index: sys/dev/ahb/ahb.c
===================================================================
--- sys/dev/ahb/ahb.c
+++ sys/dev/ahb/ahb.c
@@ -616,9 +616,8 @@
xpt_done(ccb);
} else if (ahb->immed_ecb != NULL) {
/* Re-instate timeout */
- callout_reset(&pending_ecb->timer,
- (ccb->ccb_h.timeout * hz) / 1000,
- ahbtimeout, pending_ecb);
+ callout_reset_msec(&pending_ecb->timer,
+ ccb->ccb_h.timeout, ahbtimeout, pending_ecb);
}
}
@@ -985,7 +984,7 @@
/* Tell the adapter about this command */
ahbqueuembox(ahb, ecb_paddr, ATTN_STARTECB|ccb->ccb_h.target_id);
- callout_reset(&ecb->timer, (ccb->ccb_h.timeout * hz) / 1000, ahbtimeout,
+ callout_reset_msec(&ecb->timer, ccb->ccb_h.timeout, ahbtimeout,
ecb);
}
Index: sys/dev/ahci/ahci.c
===================================================================
--- sys/dev/ahci/ahci.c
+++ sys/dev/ahci/ahci.c
@@ -1582,7 +1582,8 @@
return;
}
/* Start command execution timeout */
- callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 2000,
+ callout_reset(&slot->timeout,
+ MSECS_TO_TICKS_FACTOR(ccb->ccb_h.timeout, 2),
(timeout_t*)ahci_timeout, slot);
return;
}
@@ -1619,7 +1620,7 @@
if ((ch->toslots & (1 << i)) == 0)
continue;
callout_reset(&slot->timeout,
- (int)slot->ccb->ccb_h.timeout * hz / 2000,
+ MSECS_TO_TICKS_FACTOR(slot->ccb->ccb_h.timeout, 2),
(timeout_t*)ahci_timeout, slot);
}
}
@@ -1653,7 +1654,7 @@
}
callout_reset(&slot->timeout,
- (int)slot->ccb->ccb_h.timeout * hz / 2000,
+ MSECS_TO_TICKS_FACTOR(slot->ccb->ccb_h.timeout, 2),
(timeout_t*)ahci_timeout, slot);
return;
}
Index: sys/dev/aic/aic.c
===================================================================
--- sys/dev/aic/aic.c
+++ sys/dev/aic/aic.c
@@ -319,8 +319,7 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
TAILQ_INSERT_TAIL(&aic->pending_ccbs, &ccb->ccb_h, sim_links.tqe);
- callout_reset(&scb->timer, (ccb->ccb_h.timeout * hz) / 1000,
- aic_timeout, scb);
+ callout_reset_msec(&scb->timer, ccb->ccb_h.timeout, aic_timeout, scb);
aic_start(aic);
}
@@ -1075,9 +1074,8 @@
&pending_scb->ccb->ccb_h, sim_links.tqe);
aic_done(aic, pending_scb);
} else {
- callout_reset(&pending_scb->timer,
- (ccb_h->timeout * hz) / 1000, aic_timeout,
- pending_scb);
+ callout_reset_msec(&pending_scb->timer,
+ ccb_h->timeout, aic_timeout, pending_scb);
ccb_h = TAILQ_NEXT(ccb_h, sim_links.tqe);
}
}
@@ -1094,9 +1092,8 @@
&nexus_scb->ccb->ccb_h, sim_links.tqe);
aic_done(aic, nexus_scb);
} else {
- callout_reset(&nexus_scb->timer,
- (ccb_h->timeout * hz) / 1000, aic_timeout,
- nexus_scb);
+ callout_reset_msec(&nexus_scb->timer,
+ ccb_h->timeout, aic_timeout, nexus_scb);
ccb_h = TAILQ_NEXT(ccb_h, sim_links.tqe);
}
}
Index: sys/dev/arcmsr/arcmsr.c
===================================================================
--- sys/dev/arcmsr/arcmsr.c
+++ sys/dev/arcmsr/arcmsr.c
@@ -2705,7 +2705,8 @@
if (pccb->ccb_h.timeout != CAM_TIME_INFINITY)
{
arcmsr_callout_init(&srb->ccb_callout);
- callout_reset(&srb->ccb_callout, ((pccb->ccb_h.timeout + (ARCMSR_TIMEOUT_DELAY * 1000)) * hz) / 1000, arcmsr_srb_timeout, srb);
+ callout_reset_msec(&srb->ccb_callout, pccb->ccb_h.timeout +
+ (ARCMSR_TIMEOUT_DELAY * 1000), arcmsr_srb_timeout, srb);
srb->srb_flags |= SRB_FLAG_TIMER_START;
}
}
Index: sys/dev/asr/asr.c
===================================================================
--- sys/dev/asr/asr.c
+++ sys/dev/asr/asr.c
@@ -813,7 +813,7 @@
ccb->ccb_h.timeout = 6 * 60 * 1000;
}
set_ccb_timeout_ch(ccb, timeout(asr_timeout, (caddr_t)ccb,
- (ccb->ccb_h.timeout * hz) / 1000));
+ MSECS_TO_TICKS(ccb->ccb_h.timeout));
}
splx(s);
} /* ASR_ccbAdd */
@@ -1338,8 +1338,8 @@
if (ASR_reset (sc) == ENXIO) {
/* Try again later */
set_ccb_timeout_ch(ccb, timeout(asr_timeout,
- (caddr_t)ccb,
- (ccb->ccb_h.timeout * hz) / 1000));
+ (caddr_t)ccb,
+ MSECS_TO_TICKS(ccb->ccb_h.timeout));
}
return;
}
@@ -1354,8 +1354,8 @@
debug_asr_printf (" AGAIN\nreinitializing adapter\n");
if (ASR_reset (sc) == ENXIO) {
set_ccb_timeout_ch(ccb, timeout(asr_timeout,
- (caddr_t)ccb,
- (ccb->ccb_h.timeout * hz) / 1000));
+ (caddr_t)ccb,
+ MSECS_TO_TICKS(ccb->ccb_h.timeout));
}
splx(s);
return;
@@ -1365,7 +1365,7 @@
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
ccb->ccb_h.status |= CAM_CMD_TIMEOUT;
set_ccb_timeout_ch(ccb, timeout(asr_timeout, (caddr_t)ccb,
- (ccb->ccb_h.timeout * hz) / 1000));
+ MSECS_TO_TICKS(ccb->ccb_h.timeout));
ASR_resetBus (sc, cam_sim_bus(xpt_path_sim(ccb->ccb_h.path)));
xpt_async (AC_BUS_RESET, ccb->ccb_h.path, NULL);
splx(s);
Index: sys/dev/buslogic/bt.c
===================================================================
--- sys/dev/buslogic/bt.c
+++ sys/dev/buslogic/bt.c
@@ -1465,8 +1465,7 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
LIST_INSERT_HEAD(&bt->pending_ccbs, &ccb->ccb_h, sim_links.le);
- callout_reset(&bccb->timer, (ccb->ccb_h.timeout * hz) / 1000,
- bttimeout, bccb);
+ callout_reset_msec(&bccb->timer, ccb->ccb_h.timeout, bttimeout, bccb);
/* Tell the adapter about this command */
bt->cur_outbox->ccb_addr = btccbvtop(bt, bccb);
@@ -1600,9 +1599,8 @@
ccb_h = LIST_NEXT(ccb_h, sim_links.le);
btdone(bt, pending_bccb, BMBI_ERROR);
} else {
- callout_reset(&pending_bccb->timer,
- (ccb_h->timeout * hz) / 1000,
- bttimeout, pending_bccb);
+ callout_reset_msec(&pending_bccb->timer,
+ ccb_h->timeout, bttimeout, pending_bccb);
ccb_h = LIST_NEXT(ccb_h, sim_links.le);
}
}
Index: sys/dev/ciss/ciss.c
===================================================================
--- sys/dev/ciss/ciss.c
+++ sys/dev/ciss/ciss.c
@@ -147,9 +147,9 @@
static void ciss_perf_msi_intr(void *arg);
static void ciss_complete(struct ciss_softc *sc, cr_qhead_t *qh);
static int _ciss_report_request(struct ciss_request *cr, int *command_status, int *scsi_status, const char *func);
-static int ciss_synch_request(struct ciss_request *cr, int timeout);
-static int ciss_poll_request(struct ciss_request *cr, int timeout);
-static int ciss_wait_request(struct ciss_request *cr, int timeout);
+static int ciss_synch_request(struct ciss_request *cr, u_int32_t timeout);
+static int ciss_poll_request(struct ciss_request *cr, u_int32_t timeout);
+static int ciss_wait_request(struct ciss_request *cr, u_int32_t timeout);
#if 0
static int ciss_abort_request(struct ciss_request *cr);
#endif
@@ -2354,7 +2354,7 @@
* completion.
*/
static int
-ciss_synch_request(struct ciss_request *cr, int timeout)
+ciss_synch_request(struct ciss_request *cr, u_int32_t timeout)
{
if (cr->cr_sc->ciss_flags & CISS_FLAG_RUNNING) {
return(ciss_wait_request(cr, timeout));
@@ -2369,7 +2369,7 @@
* Timeout in milliseconds.
*/
static int
-ciss_poll_request(struct ciss_request *cr, int timeout)
+ciss_poll_request(struct ciss_request *cr, u_int32_t timeout)
{
cr_qhead_t qh;
struct ciss_softc *sc;
@@ -2403,7 +2403,7 @@
* the timeout.
*/
static int
-ciss_wait_request(struct ciss_request *cr, int timeout)
+ciss_wait_request(struct ciss_request *cr, u_int32_t timeout)
{
int error;
@@ -2414,7 +2414,8 @@
return(error);
while ((cr->cr_flags & CISS_REQ_SLEEP) && (error != EWOULDBLOCK)) {
- error = msleep(cr, &cr->cr_sc->ciss_mtx, PRIBIO, "cissREQ", (timeout * hz) / 1000);
+ error = msleep(cr, &cr->cr_sc->ciss_mtx, PRIBIO, "cissREQ",
+ MSECS_TO_TICKS(timeout));
}
return(error);
}
Index: sys/dev/dpt/dpt_scsi.c
===================================================================
--- sys/dev/dpt/dpt_scsi.c
+++ sys/dev/dpt/dpt_scsi.c
@@ -793,8 +793,7 @@
dccb->state |= DCCB_ACTIVE;
ccb->ccb_h.status |= CAM_SIM_QUEUED;
LIST_INSERT_HEAD(&dpt->pending_ccb_list, &ccb->ccb_h, sim_links.le);
- callout_reset(&dccb->timer, (ccb->ccb_h.timeout * hz) / 1000,
- dpttimeout, dccb);
+ callout_reset_msec(&dccb->timer, ccb->ccb_h.timeout, dpttimeout, dccb);
if (dpt_send_eata_command(dpt, &dccb->eata_ccb,
dccb->eata_ccb.cp_busaddr,
EATA_CMD_DMA_SEND_CP, 0, 0, 0, 0) != 0) {
Index: sys/dev/firewire/sbp.c
===================================================================
--- sys/dev/firewire/sbp.c
+++ sys/dev/firewire/sbp.c
@@ -1028,8 +1028,8 @@
sbp_scan_dev(struct sbp_dev *sdev)
{
sdev->status = SBP_DEV_PROBE;
- callout_reset(&sdev->target->scan_callout, scan_delay * hz / 1000,
- sbp_cam_scan_target, (void *)sdev->target);
+ callout_reset_msec(&sdev->target->scan_callout, scan_delay,
+ sbp_cam_scan_target, (void *)sdev->target);
}
static void
@@ -2699,9 +2699,10 @@
prev2 = prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb);
STAILQ_INSERT_TAIL(&sdev->ocbs, ocb, ocb);
- if (ocb->ccb != NULL)
- callout_reset(&ocb->timer, (ocb->ccb->ccb_h.timeout * hz) / 1000,
+ if (ocb->ccb != NULL) {
+ callout_reset_msec(&ocb->timer, ocb->ccb->ccb_h.timeout,
sbp_timeout, ocb);
+ }
if (use_doorbell && prev == NULL)
prev2 = sdev->last_ocb;
Index: sys/dev/glxiic/glxiic.c
===================================================================
--- sys/dev/glxiic/glxiic.c
+++ sys/dev/glxiic/glxiic.c
@@ -559,8 +559,7 @@
GLXIIC_ASSERT_LOCKED(sc);
- callout_reset(&sc->callout, sc->timeout * 1000 / hz, glxiic_timeout,
- sc);
+ callout_reset_msec(&sc->callout, sc->timeout, glxiic_timeout, sc);
}
static void
Index: sys/dev/hpt27xx/hpt27xx_os_bsd.c
===================================================================
--- sys/dev/hpt27xx/hpt27xx_os_bsd.c
+++ sys/dev/hpt27xx/hpt27xx_os_bsd.c
@@ -240,7 +240,7 @@
HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS);
- callout_reset(&vbus_ext->timer, interval * hz / 1000000,
+ callout_reset(&vbus_ext->timer, MSECS_TO_TICKS_FACTOR(interval, 1000),
os_timer_for_ldm, vbus_ext);
}
Index: sys/dev/hptnr/hptnr_os_bsd.c
===================================================================
--- sys/dev/hptnr/hptnr_os_bsd.c
+++ sys/dev/hptnr/hptnr_os_bsd.c
@@ -235,7 +235,7 @@
HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS);
- callout_reset(&vbus_ext->timer, interval * hz / 1000000,
+ callout_reset(&vbus_ext->timer, MSECS_TO_TICKS_FACTOR(interval, 1000),
os_timer_for_ldm, vbus_ext);
}
Index: sys/dev/hptrr/hptrr_os_bsd.c
===================================================================
--- sys/dev/hptrr/hptrr_os_bsd.c
+++ sys/dev/hptrr/hptrr_os_bsd.c
@@ -221,7 +221,7 @@
HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS);
- callout_reset(&vbus_ext->timer, interval * hz / 1000000,
+ callout_reset(&vbus_ext->timer, MSECS_TO_TICKS_FACTOR(interval, 1000),
os_timer_for_ldm, vbus_ext);
}
Index: sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
===================================================================
--- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -983,9 +983,8 @@
mtx_unlock(&sc->hs_lock);
reqp->retries++;
- callout_reset(&reqp->callout,
- (ccb->ccb_h.timeout * hz) / 1000,
- storvsc_timeout, reqp);
+ callout_reset_msec(&reqp->callout, ccb->ccb_h.timeout,
+ storvsc_timeout, reqp);
#if HVS_TIMEOUT_TEST
storvsc_timeout_test(reqp, SEND_DIAGNOSTIC, 0);
#endif
@@ -1158,9 +1157,8 @@
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
callout_init(&reqp->callout, CALLOUT_MPSAFE);
- callout_reset(&reqp->callout,
- (ccb->ccb_h.timeout * hz) / 1000,
- storvsc_timeout, reqp);
+ callout_reset_msec(&reqp->callout, ccb->ccb_h.timeout,
+ storvsc_timeout, reqp);
#if HVS_TIMEOUT_TEST
cv_init(&reqp->event.cv, "storvsc timeout cv");
mtx_init(&reqp->event.mtx, "storvsc timeout mutex",
Index: sys/dev/iir/iir.c
===================================================================
--- sys/dev/iir/iir.c
+++ sys/dev/iir/iir.c
@@ -1240,9 +1240,8 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
/* timeout handling */
- gccb->gc_timeout_ch =
- timeout(iir_timeout, (caddr_t)gccb,
- (ccb->ccb_h.timeout * hz) / 1000);
+ gccb->gc_timeout_ch = timeout(iir_timeout, (caddr_t)gccb,
+ MSECS_TO_TICKS(ccb->ccb_h.timeout));
gdt->sc_copy_cmd(gdt, gccb);
splx(lock);
Index: sys/dev/isci/isci_timer.c
===================================================================
--- sys/dev/isci/isci_timer.c
+++ sys/dev/isci/isci_timer.c
@@ -79,7 +79,7 @@
isci_timer->is_started = TRUE;
isci_log_message(3, "TIMER", "start %p %d\n", timer, milliseconds);
- callout_reset(&isci_timer->callout, (milliseconds * hz)/1000,
+ callout_reset_msec(&isci_timer->callout, milliseconds,
isci_timer_timeout, timer);
}
Index: sys/dev/mpr/mpr_sas.c
===================================================================
--- sys/dev/mpr/mpr_sas.c
+++ sys/dev/mpr/mpr_sas.c
@@ -1903,7 +1903,7 @@
cm->cm_desc.SCSIIO.DevHandle = htole16(targ->handle);
}
- callout_reset(&cm->cm_callout, (ccb->ccb_h.timeout * hz) / 1000,
+ callout_reset_msec(&cm->cm_callout, ccb->ccb_h.timeout,
mprsas_scsiio_timeout, cm);
targ->issued++;
Index: sys/dev/mps/mps_sas.c
===================================================================
--- sys/dev/mps/mps_sas.c
+++ sys/dev/mps/mps_sas.c
@@ -1839,7 +1839,7 @@
}
}
- callout_reset(&cm->cm_callout, (ccb->ccb_h.timeout * hz) / 1000,
+ callout_reset_msec(&cm->cm_callout, ccb->ccb_h.timeout,
mpssas_scsiio_timeout, cm);
targ->issued++;
Index: sys/dev/mpt/mpt.c
===================================================================
--- sys/dev/mpt/mpt.c
+++ sys/dev/mpt/mpt.c
@@ -1330,7 +1330,7 @@
* our sleep mode.
*/
if (sleep_ok != 0) {
- timeout = (time_ms * hz) / 1000;
+ timeout = MSECS_TO_TICKS(time_ms);
} else {
timeout = time_ms * 2;
}
Index: sys/dev/mpt/mpt_cam.c
===================================================================
--- sys/dev/mpt/mpt_cam.c
+++ sys/dev/mpt/mpt_cam.c
@@ -1630,7 +1630,7 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
- mpt_req_timeout(req, (ccb->ccb_h.timeout * hz) / 1000,
+ mpt_req_timeout(req, MSECS_TO_TICKS(ccb->ccb_h.timeout),
mpt_timeout, ccb);
}
if (mpt->verbose > MPT_PRT_DEBUG) {
@@ -2016,7 +2016,7 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
- mpt_req_timeout(req, (ccb->ccb_h.timeout * hz) / 1000,
+ mpt_req_timeout(req, MSECS_TO_TICKS(ccb->ccb_h.timeout),
mpt_timeout, ccb);
}
if (mpt->verbose > MPT_PRT_DEBUG) {
Index: sys/dev/mrsas/mrsas_cam.c
===================================================================
--- sys/dev/mrsas/mrsas_cam.c
+++ sys/dev/mrsas/mrsas_cam.c
@@ -378,8 +378,7 @@
* on OCR enable/disable property of Controller from ocr_thread
* context.
*/
- callout_reset(&cmd->cm_callout, (600000 * hz) / 1000,
- mrsas_scsiio_timeout, cmd);
+ callout_reset_msec(&cmd->cm_callout, 600000, mrsas_scsiio_timeout, cmd);
sc->do_timedout_reset = 1;
if (sc->ocr_thread_active)
wakeup(&sc->ocr_chan);
@@ -530,7 +529,7 @@
/*
* Start timer for IO timeout. Default timeout value is 90 second.
*/
- callout_reset(&cmd->cm_callout, (sc->mrsas_io_timeout * hz) / 1000,
+ callout_reset_msec(&cmd->cm_callout, sc->mrsas_io_timeout,
mrsas_scsiio_timeout, cmd);
mrsas_atomic_inc(&sc->fw_outstanding);
Index: sys/dev/mvs/mvs.c
===================================================================
--- sys/dev/mvs/mvs.c
+++ sys/dev/mvs/mvs.c
@@ -1415,7 +1415,7 @@
}
}
/* Start command execution timeout */
- callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 1000,
+ callout_reset_msec(&slot->timeout, ccb->ccb_h.timeout,
(timeout_t*)mvs_timeout, slot);
}
@@ -1529,7 +1529,7 @@
ATA_OUTL(ch->r_mem, EDMA_REQQIP,
ch->dma.workrq_bus + MVS_CRQB_OFFSET + (MVS_CRQB_SIZE * ch->out_idx));
/* Start command execution timeout */
- callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 1000,
+ callout_reset_msec(&slot->timeout, ccb->ccb_h.timeout,
(timeout_t*)mvs_timeout, slot);
return;
}
@@ -1568,7 +1568,7 @@
if ((ch->toslots & (1 << i)) == 0)
continue;
callout_reset(&slot->timeout,
- (int)slot->ccb->ccb_h.timeout * hz / 2000,
+ MSECS_TO_TICKS_FACTOR(slot->ccb->ccb_h.timeout, 2),
(timeout_t*)mvs_timeout, slot);
}
}
Index: sys/dev/siis/siis.c
===================================================================
--- sys/dev/siis/siis.c
+++ sys/dev/siis/siis.c
@@ -1120,7 +1120,7 @@
ATA_OUTL(ch->r_mem, SIIS_P_CACTL(slot->slot), prb_bus);
ATA_OUTL(ch->r_mem, SIIS_P_CACTH(slot->slot), prb_bus >> 32);
/* Start command execution timeout */
- callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 1000,
+ callout_reset_msec(&slot->timeout, ccb->ccb_h.timeout,
(timeout_t*)siis_timeout, slot);
return;
}
@@ -1162,8 +1162,7 @@
continue;
if ((ch->toslots & (1 << i)) == 0)
continue;
- callout_reset(&slot->timeout,
- (int)slot->ccb->ccb_h.timeout * hz / 1000,
+ callout_reset_msec(&slot->timeout, slot->ccb->ccb_h.timeout,
(timeout_t*)siis_timeout, slot);
}
}
Index: sys/dev/sym/sym_hipd.c
===================================================================
--- sys/dev/sym/sym_hipd.c
+++ sys/dev/sym/sym_hipd.c
@@ -2329,8 +2329,8 @@
assert(!(ccb->ccb_h.status & CAM_SIM_QUEUED));
ccb->ccb_h.status = CAM_REQ_INPROG;
- callout_reset(&cp->ch, ccb->ccb_h.timeout * hz / 1000, sym_callout,
- (caddr_t) ccb);
+ callout_reset_msec(&cp->ch, ccb->ccb_h.timeout, sym_callout,
+ (caddr_t)ccb);
ccb->ccb_h.status |= CAM_SIM_QUEUED;
ccb->ccb_h.sym_hcb_ptr = np;
Index: sys/dev/trm/trm.c
===================================================================
--- sys/dev/trm/trm.c
+++ sys/dev/trm/trm.c
@@ -475,7 +475,8 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
#if 0
/* XXX Need a timeout handler */
- ccb->ccb_h.timeout_ch = timeout(trmtimeout, (caddr_t)srb, (ccb->ccb_h.timeout * hz) / 1000);
+ ccb->ccb_h.timeout_ch = timeout(trmtimeout, (caddr_t)srb,
+ MSECS_TO_TICKS(ccb->ccb_h.timeout));
#endif
trm_SendSRB(pACB, pSRB);
splx(flags);
Index: sys/dev/tws/tws_cam.c
===================================================================
--- sys/dev/tws/tws_cam.c
+++ sys/dev/tws/tws_cam.c
@@ -747,7 +747,7 @@
* and submit the I/O.
*/
sc->stats.scsi_ios++;
- callout_reset(&req->timeout, (ccb_h->timeout * hz) / 1000, tws_timeout, req);
+ callout_reset_msec(&req->timeout, ccb->ccb_h.timeout, tws_timeout, req);
error = tws_map_request(sc, req);
return(error);
}
Index: sys/dev/virtio/scsi/virtio_scsi.c
===================================================================
--- sys/dev/virtio/scsi/virtio_scsi.c
+++ sys/dev/virtio/scsi/virtio_scsi.c
@@ -1087,7 +1087,7 @@
if (ccbh->timeout != CAM_TIME_INFINITY) {
req->vsr_flags |= VTSCSI_REQ_FLAG_TIMEOUT_SET;
- callout_reset(&req->vsr_callout, ccbh->timeout * hz / 1000,
+ callout_reset_msec(&req->vsr_callout, ccbh->timeout,
vtscsi_timedout_scsi_cmd, req);
}
Index: sys/sys/callout.h
===================================================================
--- sys/sys/callout.h
+++ sys/sys/callout.h
@@ -39,6 +39,7 @@
#define _SYS_CALLOUT_H_
#include <sys/_callout.h>
+#include <sys/time.h>
#define CALLOUT_LOCAL_ALLOC 0x0001 /* was allocated from callfree */
#define CALLOUT_ACTIVE 0x0002 /* callout is currently active */
@@ -62,6 +63,11 @@
struct callout *callout;
};
+#define MSECS_TO_TICKS_FACTOR(ms, f) \
+ (int)((u_int64_t)(ms) * (u_int32_t)hz / (1000 * f))
+#define MSECS_TO_TICKS(ms) \
+ MSECS_TO_TICKS_FACTOR(ms, 1)
+
#ifdef _KERNEL
#define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE)
#define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE)
@@ -89,6 +95,8 @@
(cpu), C_HARDCLOCK)
#define callout_reset(c, on_tick, fn, arg) \
callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu)
+#define callout_reset_msec(c, ms, fn, arg) \
+ callout_reset(c, MSECS_TO_TICKS(ms), fn, arg)
#define callout_reset_curcpu(c, on_tick, fn, arg) \
callout_reset_on((c), (on_tick), (fn), (arg), PCPU_GET(cpuid))
int callout_schedule(struct callout *, int);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 18, 2:05 PM (10 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31723116
Default Alt Text
D1157.id2393.diff (22 KB)
Attached To
Mode
D1157: Prevent overflow issues in timeout processing
Attached
Detach File
Event Timeline
Log In to Comment