Date: Mon, 24 Dec 2018 05:05:39 +0000 (UTC) From: Scott Long <scottl@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342386 - in head/sys/dev: mpr mps Message-ID: <201812240505.wBO55dPL015431@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: scottl Date: Mon Dec 24 05:05:38 2018 New Revision: 342386 URL: https://svnweb.freebsd.org/changeset/base/342386 Log: First step in refactoring and fixing the error recovery and task management code in the mpr and mps drivers. Eliminate duplicated code and fix some comments. Modified: head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_user.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_user.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Mon Dec 24 01:12:43 2018 (r342385) +++ head/sys/dev/mpr/mpr_sas.c Mon Dec 24 05:05:38 2018 (r342386) @@ -229,9 +229,12 @@ mprsas_startup_decrement(struct mprsas_softc *sassc) } } -/* The firmware requires us to stop sending commands when we're doing task - * management, so refcount the TMs and keep the simq frozen when any are in +/* + * The firmware requires us to stop sending commands when we're doing task + * management. * use. + * XXX The logic for serializing the device has been made lazy and moved to + * mprsas_prepare_for_tm(). */ struct mpr_command * mprsas_alloc_tm(struct mpr_softc *sc) @@ -467,8 +470,6 @@ mprsas_prepare_volume_remove(struct mprsas_softc *sass cm->cm_targ = targ; cm->cm_data = NULL; - cm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; cm->cm_complete = mprsas_remove_volume; cm->cm_complete_data = (void *)(uintptr_t)handle; @@ -531,8 +532,6 @@ mprsas_prepare_remove(struct mprsas_softc *sassc, uint cm->cm_targ = targ; cm->cm_data = NULL; - cm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; cm->cm_complete = mprsas_remove_device; cm->cm_complete_data = (void *)(uintptr_t)handle; @@ -1494,8 +1493,6 @@ mprsas_send_reset(struct mpr_softc *sc, struct mpr_com } tm->cm_data = NULL; - tm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; tm->cm_complete_data = (void *)tm; callout_reset(&tm->cm_callout, MPR_RESET_TIMEOUT * hz, @@ -1623,8 +1620,6 @@ mprsas_send_abort(struct mpr_softc *sc, struct mpr_com req->TaskMID = htole16(cm->cm_desc.Default.SMID); tm->cm_data = NULL; - tm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; tm->cm_complete = mprsas_abort_complete; tm->cm_complete_data = (void *)tm; tm->cm_targ = cm->cm_targ; @@ -3336,8 +3331,6 @@ mprsas_action_resetdev(struct mprsas_softc *sassc, uni req->MsgFlags = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET; tm->cm_data = NULL; - tm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; tm->cm_complete = mprsas_resetdev_complete; tm->cm_complete_data = ccb; @@ -3750,6 +3743,13 @@ mprsas_read_cap_done(struct cam_periph *periph, union #endif /* (__FreeBSD_version < 901503) || \ ((__FreeBSD_version >= 1000000) && (__FreeBSD_version < 1000006)) */ +/* + * Set the INRESET flag for this target so that no I/O will be sent to + * the target until the reset has completed. If an I/O request does + * happen, the devq will be frozen. The CCB holds the path which is + * used to release the devq. The devq is released and the CCB is freed + * when the TM completes. + */ void mprsas_prepare_for_tm(struct mpr_softc *sc, struct mpr_command *tm, struct mprsas_target *target, lun_id_t lun_id) @@ -3757,13 +3757,6 @@ mprsas_prepare_for_tm(struct mpr_softc *sc, struct mpr union ccb *ccb; path_id_t path_id; - /* - * Set the INRESET flag for this target so that no I/O will be sent to - * the target until the reset has completed. If an I/O request does - * happen, the devq will be frozen. The CCB holds the path which is - * used to release the devq. The devq is released and the CCB is freed - * when the TM completes. - */ ccb = xpt_alloc_ccb_nowait(); if (ccb) { path_id = cam_sim_path(sc->sassc->sim); Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Mon Dec 24 01:12:43 2018 (r342385) +++ head/sys/dev/mpr/mpr_user.c Mon Dec 24 05:05:38 2018 (r342386) @@ -835,8 +835,6 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru task->TaskMID = cm->cm_desc.Default.SMID; cm->cm_data = NULL; - cm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; cm->cm_complete = NULL; cm->cm_complete_data = NULL; Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Mon Dec 24 01:12:43 2018 (r342385) +++ head/sys/dev/mpr/mprvar.h Mon Dec 24 05:05:38 2018 (r342386) @@ -657,6 +657,8 @@ mpr_alloc_high_priority_command(struct mpr_softc *sc) TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); cm->cm_state = MPR_CM_STATE_BUSY; cm->cm_timeout_handler = NULL; + cm->cm_desc.HighPriority.RequestFlags = + MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; return (cm); } Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Mon Dec 24 01:12:43 2018 (r342385) +++ head/sys/dev/mps/mps_sas.c Mon Dec 24 05:05:38 2018 (r342386) @@ -227,9 +227,11 @@ mpssas_startup_decrement(struct mpssas_softc *sassc) } } -/* The firmware requires us to stop sending commands when we're doing task - * management, so refcount the TMs and keep the simq frozen when any are in - * use. +/* + * The firmware requires us to stop sending commands when we're doing task + * management. + * XXX The logic for serializing the device has been made lazy and moved to + * mpssas_prepare_for_tm(). */ struct mps_command * mpssas_alloc_tm(struct mps_softc *sc) @@ -472,8 +474,6 @@ mpssas_prepare_volume_remove(struct mpssas_softc *sass cm->cm_targ = targ; cm->cm_data = NULL; - cm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; cm->cm_complete = mpssas_remove_volume; cm->cm_complete_data = (void *)(uintptr_t)handle; @@ -536,7 +536,6 @@ mpssas_prepare_remove(struct mpssas_softc *sassc, uint cm->cm_targ = targ; cm->cm_data = NULL; - cm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; cm->cm_complete = mpssas_remove_device; cm->cm_complete_data = (void *)(uintptr_t)handle; @@ -1428,7 +1427,6 @@ mpssas_send_reset(struct mps_softc *sc, struct mps_com } tm->cm_data = NULL; - tm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; tm->cm_complete_data = (void *)tm; callout_reset(&tm->cm_callout, MPS_RESET_TIMEOUT * hz, @@ -1557,7 +1555,6 @@ mpssas_send_abort(struct mps_softc *sc, struct mps_com req->TaskMID = htole16(cm->cm_desc.Default.SMID); tm->cm_data = NULL; - tm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; tm->cm_complete = mpssas_abort_complete; tm->cm_complete_data = (void *)tm; tm->cm_targ = cm->cm_targ; @@ -3079,7 +3076,6 @@ mpssas_action_resetdev(struct mpssas_softc *sassc, uni req->MsgFlags = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET; tm->cm_data = NULL; - tm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; tm->cm_complete = mpssas_resetdev_complete; tm->cm_complete_data = ccb; tm->cm_targ = targ; @@ -3475,6 +3471,13 @@ mpssas_read_cap_done(struct cam_periph *periph, union #endif /* (__FreeBSD_version < 901503) || \ ((__FreeBSD_version >= 1000000) && (__FreeBSD_version < 1000006)) */ +/* + * Set the INRESET flag for this target so that no I/O will be sent to + * the target until the reset has completed. If an I/O request does + * happen, the devq will be frozen. The CCB holds the path which is + * used to release the devq. The devq is released and the CCB is freed + * when the TM completes. + */ void mpssas_prepare_for_tm(struct mps_softc *sc, struct mps_command *tm, struct mpssas_target *target, lun_id_t lun_id) @@ -3482,13 +3485,6 @@ mpssas_prepare_for_tm(struct mps_softc *sc, struct mps union ccb *ccb; path_id_t path_id; - /* - * Set the INRESET flag for this target so that no I/O will be sent to - * the target until the reset has completed. If an I/O request does - * happen, the devq will be frozen. The CCB holds the path which is - * used to release the devq. The devq is released and the CCB is freed - * when the TM completes. - */ ccb = xpt_alloc_ccb_nowait(); if (ccb) { path_id = cam_sim_path(sc->sassc->sim); Modified: head/sys/dev/mps/mps_user.c ============================================================================== --- head/sys/dev/mps/mps_user.c Mon Dec 24 01:12:43 2018 (r342385) +++ head/sys/dev/mps/mps_user.c Mon Dec 24 05:05:38 2018 (r342386) @@ -847,8 +847,6 @@ mps_user_pass_thru(struct mps_softc *sc, mps_pass_thru task->TaskMID = cm->cm_desc.Default.SMID; cm->cm_data = NULL; - cm->cm_desc.HighPriority.RequestFlags = - MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; cm->cm_complete = NULL; cm->cm_complete_data = NULL; Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Mon Dec 24 01:12:43 2018 (r342385) +++ head/sys/dev/mps/mpsvar.h Mon Dec 24 05:05:38 2018 (r342386) @@ -625,6 +625,8 @@ mps_alloc_high_priority_command(struct mps_softc *sc) TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); cm->cm_state = MPS_CM_STATE_BUSY; cm->cm_timeout_handler = NULL; + cm->cm_desc.HighPriority.RequestFlags = + MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; return (cm); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812240505.wBO55dPL015431>