diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2005-10-27 14:09:48 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-10-28 12:52:11 -0400 |
commit | 4fdfefe52944f5c4132a372ed5c208962a73c3f2 (patch) | |
tree | 23e4c9cb3f899d82e07fcfc55d75744b919415e5 /drivers/scsi/qla2xxx/qla_attr.c | |
parent | 0eedfcf0cdac30b14d1e6c99abc6604347ef0af8 (diff) |
[SCSI] qla2xxx: Add support to dynamically enable/disable ZIO.
ISP23xx and ISP24xx chips have support for an adaptive
method of posting SCSI command completions for multiple SCSI
commands during a single system interrupt.
SCSI commands are placed on the system response queue
without interrupting the host until 1) a delay timer
expires; or 2) a SCSI command completes with an error.
As long as the host software (qla2xxx) services the response
queue for completions (this polling is done during
queuecommand()) within the 'delay timer' period, the
firmware will not generate system interrupt.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index fc25cd834668..47c9ecfc1d8f 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -319,6 +319,83 @@ qla2x00_state_show(struct class_device *cdev, char *buf) | |||
319 | return len; | 319 | return len; |
320 | } | 320 | } |
321 | 321 | ||
322 | static ssize_t | ||
323 | qla2x00_zio_show(struct class_device *cdev, char *buf) | ||
324 | { | ||
325 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
326 | int len = 0; | ||
327 | |||
328 | switch (ha->zio_mode) { | ||
329 | case QLA_ZIO_MODE_5: | ||
330 | len += snprintf(buf + len, PAGE_SIZE-len, "Mode 5\n"); | ||
331 | break; | ||
332 | case QLA_ZIO_MODE_6: | ||
333 | len += snprintf(buf + len, PAGE_SIZE-len, "Mode 6\n"); | ||
334 | break; | ||
335 | case QLA_ZIO_DISABLED: | ||
336 | len += snprintf(buf + len, PAGE_SIZE-len, "Disabled\n"); | ||
337 | break; | ||
338 | } | ||
339 | return len; | ||
340 | } | ||
341 | |||
342 | static ssize_t | ||
343 | qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) | ||
344 | { | ||
345 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
346 | int val = 0; | ||
347 | uint16_t zio_mode; | ||
348 | |||
349 | if (sscanf(buf, "%d", &val) != 1) | ||
350 | return -EINVAL; | ||
351 | |||
352 | switch (val) { | ||
353 | case 1: | ||
354 | zio_mode = QLA_ZIO_MODE_5; | ||
355 | break; | ||
356 | case 2: | ||
357 | zio_mode = QLA_ZIO_MODE_6; | ||
358 | break; | ||
359 | default: | ||
360 | zio_mode = QLA_ZIO_DISABLED; | ||
361 | break; | ||
362 | } | ||
363 | |||
364 | /* Update per-hba values and queue a reset. */ | ||
365 | if (zio_mode != QLA_ZIO_DISABLED || ha->zio_mode != QLA_ZIO_DISABLED) { | ||
366 | ha->zio_mode = zio_mode; | ||
367 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | ||
368 | } | ||
369 | return strlen(buf); | ||
370 | } | ||
371 | |||
372 | static ssize_t | ||
373 | qla2x00_zio_timer_show(struct class_device *cdev, char *buf) | ||
374 | { | ||
375 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
376 | |||
377 | return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); | ||
378 | } | ||
379 | |||
380 | static ssize_t | ||
381 | qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | ||
382 | size_t count) | ||
383 | { | ||
384 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
385 | int val = 0; | ||
386 | uint16_t zio_timer; | ||
387 | |||
388 | if (sscanf(buf, "%d", &val) != 1) | ||
389 | return -EINVAL; | ||
390 | if (val > 25500 || val < 100) | ||
391 | return -ERANGE; | ||
392 | |||
393 | zio_timer = (uint16_t)(val / 100); | ||
394 | ha->zio_timer = zio_timer; | ||
395 | |||
396 | return strlen(buf); | ||
397 | } | ||
398 | |||
322 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, | 399 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, |
323 | NULL); | 400 | NULL); |
324 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); | 401 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); |
@@ -329,6 +406,10 @@ static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); | |||
329 | static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); | 406 | static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); |
330 | static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); | 407 | static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); |
331 | static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); | 408 | static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); |
409 | static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, | ||
410 | qla2x00_zio_store); | ||
411 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, | ||
412 | qla2x00_zio_timer_store); | ||
332 | 413 | ||
333 | struct class_device_attribute *qla2x00_host_attrs[] = { | 414 | struct class_device_attribute *qla2x00_host_attrs[] = { |
334 | &class_device_attr_driver_version, | 415 | &class_device_attr_driver_version, |
@@ -340,6 +421,8 @@ struct class_device_attribute *qla2x00_host_attrs[] = { | |||
340 | &class_device_attr_model_desc, | 421 | &class_device_attr_model_desc, |
341 | &class_device_attr_pci_info, | 422 | &class_device_attr_pci_info, |
342 | &class_device_attr_state, | 423 | &class_device_attr_state, |
424 | &class_device_attr_zio, | ||
425 | &class_device_attr_zio_timer, | ||
343 | NULL, | 426 | NULL, |
344 | }; | 427 | }; |
345 | 428 | ||