]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] another TCQ update
authorDoug Ledford <dledford@redhat.com>
Tue, 15 Oct 2002 11:51:27 +0000 (04:51 -0700)
committerDoug Ledford <dledford@redhat.com>
Tue, 15 Oct 2002 11:51:27 +0000 (04:51 -0700)
More scsi TCQ updates, tweak to ServeRAID, tweak scsi_scan, make BusLogic
use new method

drivers/scsi/BusLogic.c
drivers/scsi/BusLogic.h
drivers/scsi/ips.c
drivers/scsi/scsi_scan.c

index d32420b99220218b89a62ed7d39dd84ccf552e6d..b4ee7032b7d710acedabe90c83b9ae157d2fa411 100644 (file)
@@ -2604,21 +2604,21 @@ static boolean BusLogic_TargetDeviceInquiry(BusLogic_HostAdapter_T
   through Host Adapter.
 */
 
-static void BusLogic_ReportTargetDeviceInfo(BusLogic_HostAdapter_T
+/*static void BusLogic_ReportTargetDeviceInfo(BusLogic_HostAdapter_T
                                            *HostAdapter)
 {
   int TargetID;
-  /*
+*/  /*
     Inhibit the Target Device Inquiry and Reporting if requested.
   */
-  if (BusLogic_MultiMasterHostAdapterP(HostAdapter) &&
+/*  if (BusLogic_MultiMasterHostAdapterP(HostAdapter) &&
       HostAdapter->DriverOptions != NULL &&
       HostAdapter->DriverOptions->LocalOptions.InhibitTargetInquiry)
     return;
-  /*
+*/  /*
     Report on the Target Devices found.
   */
-  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
+/*  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
     {
       BusLogic_TargetFlags_T *TargetFlags = &HostAdapter->TargetFlags[TargetID];
       if (TargetFlags->TargetExists && !TargetFlags->TargetInfoReported)
@@ -2674,7 +2674,7 @@ static void BusLogic_ReportTargetDeviceInfo(BusLogic_HostAdapter_T
        }
     }
 }
-
+*/
 
 /*
   BusLogic_InitializeHostStructure initializes the fields in the SCSI Host
@@ -2700,6 +2700,49 @@ static void BusLogic_InitializeHostStructure(BusLogic_HostAdapter_T
   Host->cmd_per_lun = HostAdapter->UntaggedQueueDepth;
 }
 
+/*
+  BusLogic_SlaveAttach will actually set the queue depth on individual
+  scsi devices as they are permanently added to the device chain.  We
+  shamelessly rip off the SelectQueueDepths code to make this work mostly
+  like it used to.  Since we don't get called once at the end of the scan
+  but instead get called for each device, we have to do things a bit
+  differently.
+*/
+int BusLogic_SlaveAttach(SCSI_Device_T *Device)
+{
+  BusLogic_HostAdapter_T *HostAdapter =
+    (BusLogic_HostAdapter_T *) Device->host->hostdata;
+  int TargetID = Device->id;
+  int QueueDepth = HostAdapter->QueueDepth[TargetID];
+
+  if (HostAdapter->TargetFlags[TargetID].TaggedQueuingSupported &&
+      (HostAdapter->TaggedQueuingPermitted & (1 << TargetID)))
+    {
+      if (QueueDepth == 0)
+       QueueDepth = BusLogic_MaxAutomaticTaggedQueueDepth;
+      HostAdapter->QueueDepth[TargetID] = QueueDepth;
+      scsi_adjust_queue_depth(Device, MSG_SIMPLE_TAG, QueueDepth);
+    }
+  else
+    {
+      HostAdapter->TaggedQueuingPermitted &= ~(1 << TargetID);
+      QueueDepth = HostAdapter->UntaggedQueueDepth;
+      HostAdapter->QueueDepth[TargetID] = QueueDepth;
+      scsi_adjust_queue_depth(Device, 0, QueueDepth);
+    }
+  QueueDepth = 0;
+  for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++)
+    if (HostAdapter->TargetFlags[TargetID].TargetExists)
+      {
+       QueueDepth += HostAdapter->QueueDepth[TargetID];
+      }
+  if (QueueDepth > HostAdapter->AllocatedCCBs)
+    BusLogic_CreateAdditionalCCBs(HostAdapter,
+                                 QueueDepth
+                                 - HostAdapter->AllocatedCCBs,
+                                 false);
+  return 0;
+}
 
 /*
   BusLogic_SelectQueueDepths selects Queue Depths for each Target Device based
@@ -2709,7 +2752,7 @@ static void BusLogic_InitializeHostStructure(BusLogic_HostAdapter_T
   since all the Target Devices have now been probed.
 */
 
-static void BusLogic_SelectQueueDepths(SCSI_Host_T *Host,
+/* static void BusLogic_SelectQueueDepths(SCSI_Host_T *Host,
                                       SCSI_Device_T *DeviceList)
 {
   BusLogic_HostAdapter_T *HostAdapter =
@@ -2764,8 +2807,8 @@ static void BusLogic_SelectQueueDepths(SCSI_Host_T *Host,
   for (Device = DeviceList; Device != NULL; Device = Device->next)
     if (Device->host == Host)
       Device->queue_depth = HostAdapter->QueueDepth[Device->id];
-  /* Allocate an extra CCB for each Target Device for a Bus Device Reset. */
-  AllocatedQueueDepth += HostAdapter->TargetDeviceCount;
+*/  /* Allocate an extra CCB for each Target Device for a Bus Device Reset. */
+/*  AllocatedQueueDepth += HostAdapter->TargetDeviceCount;
   if (AllocatedQueueDepth > HostAdapter->DriverQueueDepth)
     AllocatedQueueDepth = HostAdapter->DriverQueueDepth;
   BusLogic_CreateAdditionalCCBs(HostAdapter,
@@ -2778,7 +2821,7 @@ static void BusLogic_SelectQueueDepths(SCSI_Host_T *Host,
         HostAdapter = HostAdapter->Next)
       BusLogic_ReportTargetDeviceInfo(HostAdapter);
 }
-
+*/
 
 /*
   BusLogic_DetectHostAdapter probes for BusLogic Host Adapters at the standard
@@ -2881,7 +2924,10 @@ int BusLogic_DetectHostAdapter(SCSI_Host_Template_T *HostTemplate)
       memcpy(HostAdapter, PrototypeHostAdapter, sizeof(BusLogic_HostAdapter_T));
       HostAdapter->SCSI_Host = Host;
       HostAdapter->HostNumber = Host->host_no;
+      /*
+       * This function is deprecated
       Host->select_queue_depths = BusLogic_SelectQueueDepths;
+       */
       /*
        Add Host Adapter to the end of the list of registered BusLogic
        Host Adapters.
index 00fb8207a3a855dbb81a5ec7e355ff9eb189641a..4f064b12903ebd22e74cfe0dcffb2412018ac6d5 100644 (file)
@@ -60,6 +60,7 @@ extern int BusLogic_ResetCommand(SCSI_Command_T *, unsigned int);
 extern int BusLogic_BIOSDiskParameters(SCSI_Disk_T *, struct block_device *,
                                       int *);
 extern int BusLogic_ProcDirectoryInfo(char *, char **, off_t, int, int, int);
+extern int BusLogic_SlaveAttach(SCSI_Device_T *);
 
 
 /*
@@ -76,6 +77,7 @@ extern int BusLogic_ProcDirectoryInfo(char *, char **, off_t, int, int, int);
     queuecommand:   BusLogic_QueueCommand,       /* Queue Command Function */ \
     abort:          BusLogic_AbortCommand,       /* Abort Command Function */ \
     reset:          BusLogic_ResetCommand,       /* Reset Command Function */ \
+    slave_attach:   BusLogic_SlaveAttach,        /* Configure a SCSI_Device*/ \
     bios_param:     BusLogic_BIOSDiskParameters,  /* BIOS Disk Parameters   */ \
     unchecked_isa_dma: 1,                        /* Default Initial Value  */ \
     max_sectors:    128,                         /* I/O queue len limit    */ \
index 6963127669cecb319e9cef4fc4a064002beef4cf..fa060c14118c8b076edf2bdf7c62153bae37b235 100644 (file)
@@ -1879,10 +1879,12 @@ ips_slave_attach(Scsi_Device *SDptr)
    int          min;
 
    ha = IPS_HA(SDptr->host);
-   min = ha->max_cmds / 4;
-   if (min < 8)
-      min = ha->max_cmds - 1;
-   scsi_adjust_queue_depth(SDptr, MSG_ORDERED_TAG, min);
+   if (SDptr->tagged_supported) {
+      min = ha->max_cmds / 2;
+      if (min <= 16)
+         min = ha->max_cmds - 1;
+      scsi_adjust_queue_depth(SDptr, MSG_ORDERED_TAG, min);
+   }
    return 0;
 }
 
index 0f52ed55b2102ca8a5c7db7b2c3770e556b34084..fd2eadc20f1e603b51ecea1486d9cdf5edb452de 100644 (file)
@@ -1482,6 +1482,13 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
                        printk(KERN_INFO "%s: scsi_add_lun: failed low level driver attach, setting device offline", devname);
                        sdev->online = FALSE;
                }
+               /*
+                * For untagged devices, did the lldd set the untagged queue
+                * depth?
+                */
+               if(sdev->tagged_supported == 0 &&
+                       sdev->new_queue_depth != sdev->host->cmd_per_lun)
+                       scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
        } else if(sdev->host->cmd_per_lun) {
                scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
        }