Rely on the statistics in XPT_GDEV_STATS instead of the versions still

retained in XPT_GDEV_TYPE for binary compatibility.  Mark the legacy
structure values for removal when we bump the major CAM revision.
This commit is contained in:
Justin T. Gibbs 1999-05-23 18:57:29 +00:00
parent 3caf668db7
commit 8281556234
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47434
3 changed files with 30 additions and 13 deletions

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cam_ccb.h,v 1.5 1999/05/06 20:15:57 ken Exp $
* $Id: cam_ccb.h,v 1.6 1999/05/22 21:58:45 gibbs Exp $
*/
#ifndef _CAM_CAM_CCB_H
@ -251,7 +251,7 @@ struct ccb_getdev {
/*
* GARBAGE COLLECT
* Moved to ccb_getdevstats but left here for binary compatibility.
* Remove in next rev of CAM version.
* Remove during next bump in CAM major version.
*/
int dev_openings; /* Space left for more work on device*/
int dev_active; /* Transactions running on the device */
@ -279,6 +279,11 @@ struct ccb_getdevstats {
* CCBs held by peripheral drivers
* for this device
*/
int maxtags; /*
* Boundary conditions for number of
* tagged operations
*/
int mintags;
struct timeval last_reset; /* Time of last bus reset/loop init */
};

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cam_periph.c,v 1.13 1999/05/09 01:25:04 ken Exp $
* $Id: cam_periph.c,v 1.14 1999/05/22 21:58:45 gibbs Exp $
*/
#include <sys/param.h>
@ -1463,23 +1463,25 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
case SCSI_STATUS_QUEUE_FULL:
{
/* no decrement */
struct ccb_getdev cgd;
struct ccb_getdevstats cgds;
/*
* First off, find out what the current
* transaction counts are.
*/
xpt_setup_ccb(&cgd.ccb_h,
xpt_setup_ccb(&cgds.ccb_h,
ccb->ccb_h.path,
/*priority*/1);
cgd.ccb_h.func_code = XPT_GDEV_TYPE;
xpt_action((union ccb *)&cgd);
cgds.ccb_h.func_code = XPT_GDEV_STATS;
xpt_action((union ccb *)&cgds);
/*
* If we were the only transaction active, treat
* the QUEUE FULL as if it were a BUSY condition.
*/
if (cgd.dev_active != 0) {
if (cgds.dev_active != 0) {
int total_openings;
/*
* Reduce the number of openings to
* be 1 less than the amount it took
@ -1487,10 +1489,12 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
* minimum allowed tag count for this
* device.
*/
openings = cgd.dev_active;
if (openings < cgd.mintags)
openings = cgd.mintags;
if (openings < cgd.dev_active+cgd.dev_openings)
total_openings =
cgds.dev_active+cgds.dev_openings;
openings = cgds.dev_active;
if (openings < cgds.mintags)
openings = cgds.mintags;
if (openings < total_openings)
relsim_flags = RELSIM_ADJUST_OPENINGS;
else {
/*

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cam_xpt.c,v 1.58 1999/05/18 00:41:05 gibbs Exp $
* $Id: cam_xpt.c,v 1.59 1999/05/22 21:58:47 gibbs Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
@ -2866,6 +2866,7 @@ xpt_action(union ccb *start_ccb)
tar = cgd->ccb_h.path->target;
cgd->inq_data = dev->inq_data;
cgd->pd_type = SID_TYPE(&dev->inq_data);
#ifndef GARBAGE_COLLECT
cgd->dev_openings = dev->ccbq.dev_openings;
cgd->dev_active = dev->ccbq.dev_active;
cgd->devq_openings = dev->ccbq.devq_openings;
@ -2873,6 +2874,7 @@ xpt_action(union ccb *start_ccb)
cgd->held = dev->ccbq.held;
cgd->maxtags = dev->quirk->maxtags;
cgd->mintags = dev->quirk->mintags;
#endif
cgd->ccb_h.status = CAM_REQ_CMP;
cgd->serial_num_len = dev->serial_num_len;
if ((dev->serial_num_len > 0)
@ -2906,6 +2908,8 @@ xpt_action(union ccb *start_ccb)
cgds->devq_queued = dev->ccbq.queue.entries;
cgds->held = dev->ccbq.held;
cgds->last_reset = tar->last_reset;
cgds->maxtags = dev->quirk->maxtags;
cgds->mintags = dev->quirk->mintags;
if (timevalcmp(&tar->last_reset, &bus->last_reset, <))
cgds->last_reset = bus->last_reset;
cgds->ccb_h.status = CAM_REQ_CMP;
@ -4544,6 +4548,10 @@ xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
callout_handle_init(&device->c_handle);
device->refcount = 1;
device->flags |= CAM_DEV_UNCONFIGURED;
/*
* Take the default quirk entry until we have inquiry
* data and can determine a better quirk to use.
*/
device->quirk = &xpt_quirk_table[xpt_quirk_table_size - 1];
cam_init_pinfo(&device->alloc_ccb_entry.pinfo);