[Linux1394-cvslog] rev 638 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2002-10-22 05:12:27
|
Author: bencollins Date: 2002-10-22 01:12:22 -0400 (Tue, 22 Oct 2002) New Revision: 638 Modified: trunk/sbp2.c trunk/sbp2.h Log: Purge unused/uneeded options to sbp2. Later we'll reimplement some of this for per-node usage. Set better defaults for can_queue and cmds_per_lun. Translates to an equally better default for max command orbs to be allocated. Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c 2002-10-22 01:12:23.000000000 -0400 @@ -81,11 +81,9 @@ * * sbp2_max_speed - Force max speed allowed * (2 = 400mb, 1 = 200mb, 0 = 100mb. default = 2) - * sbp2_serialize_io - Serialize all I/O coming down from the scsi drivers + * sbp2_serialize_io - Serialize all I/O coming down from the scsi drivers * (0 = deserialized, 1 = serialized, default = 0) * sbp2_max_sectors, - Change max sectors per I/O supported (default = 255) - * sbp2_max_outstanding_cmds - Change max outstanding concurrent commands (default = 8) - * sbp2_max_cmds_per_lun - Change max concurrent commands per sbp2 device (default = 1) * sbp2_exclusive_login - Set to zero if you'd like to allow multiple hosts the ability * to log in at the same time. Sbp2 device must support this, * and you must know what you're doing (default = 1) @@ -396,26 +394,6 @@ static int sbp2_max_sectors = SBP2_MAX_SECTORS; /* - * Adjust sbp2_max_outstanding_cmds to tune performance if you have many - * sbp2 devices attached (or if you need to do some debugging). - */ -MODULE_PARM(sbp2_max_outstanding_cmds,"i"); -MODULE_PARM_DESC(sbp2_max_outstanding_cmds, "Change max outstanding concurrent commands (default = 8)"); -static int sbp2_max_outstanding_cmds = SBP2SCSI_MAX_OUTSTANDING_CMDS; - -/* - * Adjust sbp2_max_cmds_per_lun to tune performance. Enabling more than - * one concurrent/linked command per sbp2 device may allow some - * performance gains, but some older sbp2 devices have firmware bugs - * resulting in problems when linking commands... so, enable this with - * care. I can note that the Oxsemi OXFW911 sbp2 chipset works very well - * with large numbers of concurrent/linked commands. =) - */ -MODULE_PARM(sbp2_max_cmds_per_lun,"i"); -MODULE_PARM_DESC(sbp2_max_cmds_per_lun, "Change max concurrent commands per sbp2 device (default = 1)"); -static int sbp2_max_cmds_per_lun = SBP2SCSI_MAX_CMDS_PER_LUN; - -/* * Exclusive login to sbp2 device? In most cases, the sbp2 driver should * do an exclusive login, as it's generally unsafe to have two hosts * talking to a single sbp2 device at the same time (filesystem coherency, @@ -706,11 +684,13 @@ struct sbp2scsi_host_info *hi) { int i; - unsigned long flags; + unsigned long flags, orbs; struct sbp2_command_info *command; + + orbs = sbp2_serialize_io ? 2 : SBP2_MAX_COMMAND_ORBS; sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); - for (i = 0; i < scsi_id->sbp2_total_command_orbs; i++) { + for (i = 0; i < orbs; i++) { command = (struct sbp2_command_info *) kmalloc(sizeof(struct sbp2_command_info), GFP_KERNEL); if (!command) { @@ -1007,7 +987,7 @@ sbp2_set_busy_timeout(hi, scsi_id); /* Do a SBP-2 fetch agent reset. */ - sbp2_agent_reset(hi, scsi_id, 0); + sbp2_agent_reset(hi, scsi_id, 1); /* Get the max speed and packet size that we can use. */ sbp2_max_speed_and_size(hi, scsi_id); @@ -1223,12 +1203,6 @@ INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); scsi_id->sbp2_command_orb_lock = SPIN_LOCK_UNLOCKED; - /* Knock the total command orbs down if we are serializing I/O */ - if (sbp2_serialize_io) - scsi_id->sbp2_total_command_orbs = 2; - else - scsi_id->sbp2_total_command_orbs = SBP2_MAX_COMMAND_ORBS; - /* * Make sure that we've gotten ahold of the sbp2 management agent * address. Also figure out the command set being used (SCSI or @@ -1285,7 +1259,7 @@ /* * Do a SBP-2 fetch agent reset */ - sbp2_agent_reset(hi, scsi_id, 0); + sbp2_agent_reset(hi, scsi_id, 1); /* * Get the max speed and packet size that we can use @@ -1306,10 +1280,7 @@ /* Complete any pending commands with selection timeout */ sbp2scsi_complete_all_commands(hi, scsi_id, DID_NO_CONNECT); - /* Clean up any other structures */ - if (scsi_id->sbp2_total_command_orbs) { - sbp2util_remove_command_orb_pool(scsi_id, hi); - } + sbp2util_remove_command_orb_pool(scsi_id, hi); if (scsi_id->login_response) { pci_free_consistent(hi->host->pdev, @@ -1796,7 +1767,7 @@ * possible. */ if ((scsi_id->sbp2_firmware_revision & 0xffff00) == SBP2_128KB_BROKEN_FIRMWARE && - (sbp2_max_sectors * 512) > (128 * 1024)) { + (sbp2_max_sectors * 512) > (128*1024)) { SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB max transfer size.", NODE_BUS_ARGS(scsi_id->ne->nodeid)); SBP2_WARN("WARNING: Current sbp2_max_sectors setting is larger than 128KB (%d sectors)!", @@ -1847,6 +1818,8 @@ scsi_id->max_payload_size = min(sbp2_speedto_maxrec[scsi_id->speed_code], (u8)(((be32_to_cpu(hi->host->csr.rom[2]) >> 12) & 0xf) - 1)); + scsi_id->max_payload_size = sbp2_speedto_maxrec[SPEED_200]; + SBP2_ERR("Node[" NODE_BUS_FMT "]: Max speed [%s] - Max payload [%u]", NODE_BUS_ARGS(scsi_id->ne->nodeid), hpsb_speedto_str[scsi_id->speed_code], 1 << ((u32)scsi_id->max_payload_size + 2)); @@ -1857,7 +1830,7 @@ /* * This function is called in order to perform a SBP-2 agent reset. */ -static int sbp2_agent_reset(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, u32 flags) +static int sbp2_agent_reset(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, int wait) { struct hpsb_packet *packet; quadlet_t data; @@ -1884,7 +1857,7 @@ return(-EIO); } - if (!(flags & SBP2_SEND_NO_WAIT)) { + if (wait) { down(&packet->state_change); down(&packet->state_change); } @@ -2633,7 +2606,7 @@ * Initiate a fetch agent reset. */ SBP2_DEBUG("Dead bit set - initiating fetch agent reset"); - sbp2_agent_reset(hi, scsi_id, SBP2_SEND_NO_WAIT); + sbp2_agent_reset(hi, scsi_id, 0); } SBP2_ORB_DEBUG("completing command orb %p", &command->command_orb); @@ -2951,7 +2924,7 @@ /* * Initiate a fetch agent reset. */ - sbp2_agent_reset(hi, scsi_id, SBP2_SEND_NO_WAIT); + sbp2_agent_reset(hi, scsi_id, 0); sbp2scsi_complete_all_commands(hi, scsi_id, DID_BUS_BUSY); sbp2_spin_unlock(&hi->sbp2_command_lock, flags); } @@ -2971,7 +2944,7 @@ if (scsi_id) { SBP2_ERR("Generating sbp2 fetch agent reset"); - sbp2_agent_reset(hi, scsi_id, SBP2_SEND_NO_WAIT); + sbp2_agent_reset(hi, scsi_id, 0); } return(SUCCESS); @@ -3049,16 +3022,12 @@ "SBP-2 module load options:\n" "- Max speed supported: %s\n" "- Max sectors per I/O supported: %d\n" - "- Max outstanding commands supported: %d\n" - "- Max outstanding commands per lun supported: %d\n" "- Serialized I/O (debug): %s\n" "- Exclusive login: %s", hi->host->driver->name, version, hpsb_speedto_str[sbp2_max_speed], sbp2_max_sectors, - sbp2_max_outstanding_cmds, - sbp2_max_cmds_per_lun, sbp2_serialize_io ? "yes" : "no", sbp2_exclusive_login ? "yes" : "no"); @@ -3083,29 +3052,27 @@ .eh_host_reset_handler =sbp2scsi_reset, .bios_param = sbp2scsi_biosparam, .this_id = -1, - .sg_tablesize = SBP2_MAX_SG_ELEMENTS, - .use_clustering = SBP2_CLUSTERING, + .sg_tablesize = SG_ALL, + .use_clustering = ENABLE_CLUSTERING, + .cmd_per_lun = SBP2_MAX_CMDS_PER_LUN, + .can_queue = SBP2_MAX_SCSI_QUEUE, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) .use_new_eh_code = TRUE, #endif .emulated = 1, - .proc_name = SBP2_DEVICE_NAME, + .proc_name = SBP2_DEVICE_NAME, }; static int sbp2_module_init(void) { SBP2_DEBUG("sbp2_module_init"); - /* - * Module load debug option to force one command at a time (serializing I/O) - */ + /* Module load debug option to force one command at a time + * (serializing I/O) */ if (sbp2_serialize_io) { SBP2_ERR("Driver forced to serialize I/O (serialize_io = 1)"); scsi_driver_template.can_queue = 1; scsi_driver_template.cmd_per_lun = 1; - } else { - scsi_driver_template.can_queue = sbp2_max_outstanding_cmds; - scsi_driver_template.cmd_per_lun = sbp2_max_cmds_per_lun; } /* Modified: trunk/sbp2.h ============================================================================== --- trunk/sbp2.h (original) +++ trunk/sbp2.h 2002-10-22 01:12:23.000000000 -0400 @@ -32,33 +32,19 @@ #endif #define SBP2_DEVICE_NAME "sbp2" -#define SBP2_DEVICE_NAME_SIZE 4 /* * SBP2 specific structures and defines */ -#define ORB_FMT_CMD 0x0 -#define ORB_FMT_DUMMY 0x3 - #define ORB_DIRECTION_WRITE_TO_MEDIA 0x0 #define ORB_DIRECTION_READ_FROM_MEDIA 0x1 #define ORB_DIRECTION_NO_DATA_TRANSFER 0x2 #define ORB_SET_NULL_PTR(value) ((value & 0x1) << 31) #define ORB_SET_NOTIFY(value) ((value & 0x1) << 31) -#define ORB_SET_RQ_FMT(value) ((value & 0x3) << 29) +#define ORB_SET_RQ_FMT(value) ((value & 0x3) << 29) /* unused ? */ #define ORB_SET_NODE_ID(value) ((value & 0xffff) << 16) - -struct sbp2_dummy_orb { - volatile u32 next_ORB_hi; - volatile u32 next_ORB_lo; - u32 reserved1; - u32 reserved2; - u32 notify_rq_fmt; - u8 command_block[12]; -}; - #define ORB_SET_DATA_SIZE(value) (value & 0xffff) #define ORB_SET_PAGE_SIZE(value) ((value & 0x7) << 16) #define ORB_SET_PAGE_TABLE_PRESENT(value) ((value & 0x1) << 19) @@ -253,25 +239,15 @@ * Other misc defines */ #define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800 -#define SBP2_BROKEN_FIRMWARE_MAX_TRANSFER 0x20000 #define SBP2_DEVICE_TYPE_LUN_UNINITIALIZED 0xffffffff /* - * Flags for SBP-2 functions - */ -#define SBP2_SEND_NO_WAIT 0x00000001 - -/* * SCSI specific stuff */ -#define SBP2_MAX_SG_ELEMENTS SG_ALL -#define SBP2_CLUSTERING ENABLE_CLUSTERING #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 #define SBP2SCSI_MAX_SCSI_IDS 16 /* Max sbp2 device instances supported */ -#define SBP2SCSI_MAX_OUTSTANDING_CMDS 8 /* Max total outstanding sbp2 commands allowed at a time! */ -#define SBP2SCSI_MAX_CMDS_PER_LUN 1 /* Max outstanding sbp2 commands per device - tune as needed */ #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ #ifndef TYPE_SDAD @@ -314,14 +290,18 @@ DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN }; -#define SBP2_MAX_REQUEST_PACKETS (sbp2_max_outstanding_cmds * 2) -#define SBP2_MAX_COMMAND_ORBS (sbp2_max_cmds_per_lun * 2) - +/* This should be safe. If there's more than one LUN per node, we could + * saturate the tlabel's though. */ +#define SBP2_MAX_CMDS_PER_LUN 8 +#define SBP2_MAX_SCSI_QUEUE (SBP2_MAX_CMDS_PER_LUN * SBP2SCSI_MAX_SCSI_IDS) +#define SBP2_MAX_COMMAND_ORBS SBP2_MAX_SCSI_QUEUE /* This is the two dma types we use for cmd_dma below */ -#define CMD_DMA_NONE 0x0 -#define CMD_DMA_PAGE 0x1 -#define CMD_DMA_SINGLE 0x2 +enum cmd_dma_types { + CMD_DMA_NONE, + CMD_DMA_PAGE, + CMD_DMA_SINGLE +}; /* * Encapsulates all the info necessary for an outstanding command. @@ -335,11 +315,11 @@ void (*Current_done)(Scsi_Cmnd *); /* Also need s/g structure for each sbp2 command */ - struct sbp2_unrestricted_page_table scatter_gather_element[SBP2_MAX_SG_ELEMENTS] ____cacheline_aligned; + struct sbp2_unrestricted_page_table scatter_gather_element[SG_ALL] ____cacheline_aligned; dma_addr_t sge_dma ____cacheline_aligned; void *sge_buffer; dma_addr_t cmd_dma; - int dma_type; + enum cmd_dma_types dma_type; unsigned long dma_size; int dma_dir; @@ -400,7 +380,6 @@ spinlock_t sbp2_command_orb_lock; struct list_head sbp2_command_orb_inuse; struct list_head sbp2_command_orb_completed; - u32 sbp2_total_command_orbs; /* Node entry, as retrieved from NodeMgr entries */ struct node_entry *ne; @@ -488,7 +467,7 @@ static int sbp2_logout_device(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id); static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int destid, quadlet_t *data, u64 addr, unsigned int length, u16 flags); -static int sbp2_agent_reset(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, u32 flags); +static int sbp2_agent_reset(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, int wait); static int sbp2_create_command_orb(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, struct sbp2_command_info *command, |