Commit 9cb83c7529d929c00f37d821daed1942a1b20602

Authored by FUJITA Tomonori
Committed by Jens Axboe
1 parent c0dcffd71d

[SCSI] add use_sg_chaining option to scsi_host_template

This option is true if a low-level driver can support sg
chaining. This will be removed eventually when all the drivers are
converted to support sg chaining. q->max_phys_segments is set to
SCSI_MAX_SG_SEGMENTS if false.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 39 changed files with 58 additions and 3 deletions Side-by-side Diff

arch/ia64/hp/sim/simscsi.c
... ... @@ -360,6 +360,7 @@
360 360 .max_sectors = 1024,
361 361 .cmd_per_lun = SIMSCSI_REQ_QUEUE_LEN,
362 362 .use_clustering = DISABLE_CLUSTERING,
  363 + .use_sg_chaining = ENABLE_SG_CHAINING,
363 364 };
364 365  
365 366 static int __init
drivers/scsi/3w-9xxx.c
... ... @@ -1990,6 +1990,7 @@
1990 1990 .max_sectors = TW_MAX_SECTORS,
1991 1991 .cmd_per_lun = TW_MAX_CMDS_PER_LUN,
1992 1992 .use_clustering = ENABLE_CLUSTERING,
  1993 + .use_sg_chaining = ENABLE_SG_CHAINING,
1993 1994 .shost_attrs = twa_host_attrs,
1994 1995 .emulated = 1
1995 1996 };
drivers/scsi/3w-xxxx.c
... ... @@ -2261,6 +2261,7 @@
2261 2261 .max_sectors = TW_MAX_SECTORS,
2262 2262 .cmd_per_lun = TW_MAX_CMDS_PER_LUN,
2263 2263 .use_clustering = ENABLE_CLUSTERING,
  2264 + .use_sg_chaining = ENABLE_SG_CHAINING,
2264 2265 .shost_attrs = tw_host_attrs,
2265 2266 .emulated = 1
2266 2267 };
drivers/scsi/BusLogic.c
... ... @@ -3575,6 +3575,7 @@
3575 3575 .unchecked_isa_dma = 1,
3576 3576 .max_sectors = 128,
3577 3577 .use_clustering = ENABLE_CLUSTERING,
  3578 + .use_sg_chaining = ENABLE_SG_CHAINING,
3578 3579 };
3579 3580  
3580 3581 /*
drivers/scsi/NCR53c406a.c
... ... @@ -1066,7 +1066,8 @@
1066 1066 .sg_tablesize = 32 /*SG_ALL*/ /*SG_NONE*/,
1067 1067 .cmd_per_lun = 1 /* commands per lun */,
1068 1068 .unchecked_isa_dma = 1 /* unchecked_isa_dma */,
1069   - .use_clustering = ENABLE_CLUSTERING
  1069 + .use_clustering = ENABLE_CLUSTERING,
  1070 + .use_sg_chaining = ENABLE_SG_CHAINING,
1070 1071 };
1071 1072  
1072 1073 #include "scsi_module.c"
drivers/scsi/a100u2w.c
... ... @@ -1071,6 +1071,7 @@
1071 1071 .sg_tablesize = SG_ALL,
1072 1072 .cmd_per_lun = 1,
1073 1073 .use_clustering = ENABLE_CLUSTERING,
  1074 + .use_sg_chaining = ENABLE_SG_CHAINING,
1074 1075 };
1075 1076  
1076 1077 static int __devinit inia100_probe_one(struct pci_dev *pdev,
drivers/scsi/aacraid/linit.c
... ... @@ -944,6 +944,7 @@
944 944 .cmd_per_lun = AAC_NUM_IO_FIB,
945 945 #endif
946 946 .use_clustering = ENABLE_CLUSTERING,
  947 + .use_sg_chaining = ENABLE_SG_CHAINING,
947 948 .emulated = 1,
948 949 };
949 950  
drivers/scsi/aha1740.c
... ... @@ -563,6 +563,7 @@
563 563 .sg_tablesize = AHA1740_SCATTER,
564 564 .cmd_per_lun = AHA1740_CMDLUN,
565 565 .use_clustering = ENABLE_CLUSTERING,
  566 + .use_sg_chaining = ENABLE_SG_CHAINING,
566 567 .eh_abort_handler = aha1740_eh_abort_handler,
567 568 };
568 569  
drivers/scsi/aic7xxx/aic79xx_osm.c
... ... @@ -766,6 +766,7 @@
766 766 .max_sectors = 8192,
767 767 .cmd_per_lun = 2,
768 768 .use_clustering = ENABLE_CLUSTERING,
  769 + .use_sg_chaining = ENABLE_SG_CHAINING,
769 770 .slave_alloc = ahd_linux_slave_alloc,
770 771 .slave_configure = ahd_linux_slave_configure,
771 772 .target_alloc = ahd_linux_target_alloc,
drivers/scsi/aic7xxx/aic7xxx_osm.c
... ... @@ -747,6 +747,7 @@
747 747 .max_sectors = 8192,
748 748 .cmd_per_lun = 2,
749 749 .use_clustering = ENABLE_CLUSTERING,
  750 + .use_sg_chaining = ENABLE_SG_CHAINING,
750 751 .slave_alloc = ahc_linux_slave_alloc,
751 752 .slave_configure = ahc_linux_slave_configure,
752 753 .target_alloc = ahc_linux_target_alloc,
drivers/scsi/aic7xxx_old.c
... ... @@ -11142,6 +11142,7 @@
11142 11142 .max_sectors = 2048,
11143 11143 .cmd_per_lun = 3,
11144 11144 .use_clustering = ENABLE_CLUSTERING,
  11145 + .use_sg_chaining = ENABLE_SG_CHAINING,
11145 11146 };
11146 11147  
11147 11148 #include "scsi_module.c"
drivers/scsi/arcmsr/arcmsr_hba.c
... ... @@ -122,6 +122,7 @@
122 122 .max_sectors = ARCMSR_MAX_XFER_SECTORS,
123 123 .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN,
124 124 .use_clustering = ENABLE_CLUSTERING,
  125 + .use_sg_chaining = ENABLE_SG_CHAINING,
125 126 .shost_attrs = arcmsr_host_attrs,
126 127 };
127 128 #ifdef CONFIG_SCSI_ARCMSR_AER
drivers/scsi/dc395x.c
... ... @@ -4765,6 +4765,7 @@
4765 4765 .eh_bus_reset_handler = dc395x_eh_bus_reset,
4766 4766 .unchecked_isa_dma = 0,
4767 4767 .use_clustering = DISABLE_CLUSTERING,
  4768 + .use_sg_chaining = ENABLE_SG_CHAINING,
4768 4769 };
4769 4770  
4770 4771  
drivers/scsi/dpt_i2o.c
... ... @@ -3295,6 +3295,7 @@
3295 3295 .this_id = 7,
3296 3296 .cmd_per_lun = 1,
3297 3297 .use_clustering = ENABLE_CLUSTERING,
  3298 + .use_sg_chaining = ENABLE_SG_CHAINING,
3298 3299 };
3299 3300  
3300 3301 static s32 adpt_scsi_register(adpt_hba* pHba)
... ... @@ -523,7 +523,8 @@
523 523 .slave_configure = eata2x_slave_configure,
524 524 .this_id = 7,
525 525 .unchecked_isa_dma = 1,
526   - .use_clustering = ENABLE_CLUSTERING
  526 + .use_clustering = ENABLE_CLUSTERING,
  527 + .use_sg_chaining = ENABLE_SG_CHAINING,
527 528 };
528 529  
529 530 #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
drivers/scsi/hosts.c
... ... @@ -343,6 +343,7 @@
343 343 shost->use_clustering = sht->use_clustering;
344 344 shost->ordered_tag = sht->ordered_tag;
345 345 shost->active_mode = sht->supported_mode;
  346 + shost->use_sg_chaining = sht->use_sg_chaining;
346 347  
347 348 if (sht->max_host_blocked)
348 349 shost->max_host_blocked = sht->max_host_blocked;
drivers/scsi/hptiop.c
... ... @@ -655,6 +655,7 @@
655 655 .unchecked_isa_dma = 0,
656 656 .emulated = 0,
657 657 .use_clustering = ENABLE_CLUSTERING,
  658 + .use_sg_chaining = ENABLE_SG_CHAINING,
658 659 .proc_name = driver_name,
659 660 .shost_attrs = hptiop_attrs,
660 661 .this_id = -1,
drivers/scsi/ibmmca.c
... ... @@ -1501,6 +1501,7 @@
1501 1501 .sg_tablesize = 16,
1502 1502 .cmd_per_lun = 1,
1503 1503 .use_clustering = ENABLE_CLUSTERING,
  1504 + .use_sg_chaining = ENABLE_SG_CHAINING,
1504 1505 };
1505 1506  
1506 1507 static int ibmmca_probe(struct device *dev)
drivers/scsi/ibmvscsi/ibmvscsi.c
... ... @@ -1548,6 +1548,7 @@
1548 1548 .this_id = -1,
1549 1549 .sg_tablesize = SG_ALL,
1550 1550 .use_clustering = ENABLE_CLUSTERING,
  1551 + .use_sg_chaining = ENABLE_SG_CHAINING,
1551 1552 .shost_attrs = ibmvscsi_attrs,
1552 1553 };
1553 1554  
drivers/scsi/initio.c
... ... @@ -2831,6 +2831,7 @@
2831 2831 .sg_tablesize = SG_ALL,
2832 2832 .cmd_per_lun = 1,
2833 2833 .use_clustering = ENABLE_CLUSTERING,
  2834 + .use_sg_chaining = ENABLE_SG_CHAINING,
2834 2835 };
2835 2836  
2836 2837 static int initio_probe_one(struct pci_dev *pdev,
drivers/scsi/lpfc/lpfc_scsi.c
... ... @@ -1438,6 +1438,7 @@
1438 1438 .scan_finished = lpfc_scan_finished,
1439 1439 .this_id = -1,
1440 1440 .sg_tablesize = LPFC_SG_SEG_CNT,
  1441 + .use_sg_chaining = ENABLE_SG_CHAINING,
1441 1442 .cmd_per_lun = LPFC_CMD_PER_LUN,
1442 1443 .use_clustering = ENABLE_CLUSTERING,
1443 1444 .shost_attrs = lpfc_hba_attrs,
... ... @@ -1460,6 +1461,7 @@
1460 1461 .sg_tablesize = LPFC_SG_SEG_CNT,
1461 1462 .cmd_per_lun = LPFC_CMD_PER_LUN,
1462 1463 .use_clustering = ENABLE_CLUSTERING,
  1464 + .use_sg_chaining = ENABLE_SG_CHAINING,
1463 1465 .shost_attrs = lpfc_vport_attrs,
1464 1466 .max_sectors = 0xFFFF,
1465 1467 };
drivers/scsi/mac53c94.c
... ... @@ -402,6 +402,7 @@
402 402 .sg_tablesize = SG_ALL,
403 403 .cmd_per_lun = 1,
404 404 .use_clustering = DISABLE_CLUSTERING,
  405 + .use_sg_chaining = ENABLE_SG_CHAINING,
405 406 };
406 407  
407 408 static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match)
drivers/scsi/megaraid.c
... ... @@ -4492,6 +4492,7 @@
4492 4492 .sg_tablesize = MAX_SGLIST,
4493 4493 .cmd_per_lun = DEF_CMD_PER_LUN,
4494 4494 .use_clustering = ENABLE_CLUSTERING,
  4495 + .use_sg_chaining = ENABLE_SG_CHAINING,
4495 4496 .eh_abort_handler = megaraid_abort,
4496 4497 .eh_device_reset_handler = megaraid_reset,
4497 4498 .eh_bus_reset_handler = megaraid_reset,
drivers/scsi/megaraid/megaraid_mbox.c
... ... @@ -361,6 +361,7 @@
361 361 .eh_host_reset_handler = megaraid_reset_handler,
362 362 .change_queue_depth = megaraid_change_queue_depth,
363 363 .use_clustering = ENABLE_CLUSTERING,
  364 + .use_sg_chaining = ENABLE_SG_CHAINING,
364 365 .sdev_attrs = megaraid_sdev_attrs,
365 366 .shost_attrs = megaraid_shost_attrs,
366 367 };
drivers/scsi/megaraid/megaraid_sas.c
... ... @@ -1110,6 +1110,7 @@
1110 1110 .eh_timed_out = megasas_reset_timer,
1111 1111 .bios_param = megasas_bios_param,
1112 1112 .use_clustering = ENABLE_CLUSTERING,
  1113 + .use_sg_chaining = ENABLE_SG_CHAINING,
1113 1114 };
1114 1115  
1115 1116 /**
... ... @@ -1843,6 +1843,7 @@
1843 1843 .sg_tablesize = SG_ALL,
1844 1844 .cmd_per_lun = 2,
1845 1845 .use_clustering = DISABLE_CLUSTERING,
  1846 + .use_sg_chaining = ENABLE_SG_CHAINING,
1846 1847 };
1847 1848  
1848 1849 static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
drivers/scsi/nsp32.c
... ... @@ -281,6 +281,7 @@
281 281 .cmd_per_lun = 1,
282 282 .this_id = NSP32_HOST_SCSIID,
283 283 .use_clustering = DISABLE_CLUSTERING,
  284 + .use_sg_chaining = ENABLE_SG_CHAINING,
284 285 .eh_abort_handler = nsp32_eh_abort,
285 286 .eh_bus_reset_handler = nsp32_eh_bus_reset,
286 287 .eh_host_reset_handler = nsp32_eh_host_reset,
drivers/scsi/pcmcia/sym53c500_cs.c
... ... @@ -694,6 +694,7 @@
694 694 .sg_tablesize = 32,
695 695 .cmd_per_lun = 1,
696 696 .use_clustering = ENABLE_CLUSTERING,
  697 + .use_sg_chaining = ENABLE_SG_CHAINING,
697 698 .shost_attrs = SYM53C500_shost_attrs
698 699 };
699 700  
drivers/scsi/qla2xxx/qla_os.c
... ... @@ -132,6 +132,7 @@
132 132 .this_id = -1,
133 133 .cmd_per_lun = 3,
134 134 .use_clustering = ENABLE_CLUSTERING,
  135 + .use_sg_chaining = ENABLE_SG_CHAINING,
135 136 .sg_tablesize = SG_ALL,
136 137  
137 138 /*
... ... @@ -163,6 +164,7 @@
163 164 .this_id = -1,
164 165 .cmd_per_lun = 3,
165 166 .use_clustering = ENABLE_CLUSTERING,
  167 + .use_sg_chaining = ENABLE_SG_CHAINING,
166 168 .sg_tablesize = SG_ALL,
167 169  
168 170 .max_sectors = 0xFFFF,
drivers/scsi/qla4xxx/ql4_os.c
... ... @@ -94,6 +94,7 @@
94 94 .this_id = -1,
95 95 .cmd_per_lun = 3,
96 96 .use_clustering = ENABLE_CLUSTERING,
  97 + .use_sg_chaining = ENABLE_SG_CHAINING,
97 98 .sg_tablesize = SG_ALL,
98 99  
99 100 .max_sectors = 0xFFFF,
drivers/scsi/qlogicfas.c
... ... @@ -197,6 +197,7 @@
197 197 .sg_tablesize = SG_ALL,
198 198 .cmd_per_lun = 1,
199 199 .use_clustering = DISABLE_CLUSTERING,
  200 + .use_sg_chaining = ENABLE_SG_CHAINING,
200 201 };
201 202  
202 203 static __init int qlogicfas_init(void)
drivers/scsi/scsi_lib.c
... ... @@ -1645,7 +1645,10 @@
1645 1645 * converted, so better keep it safe.
1646 1646 */
1647 1647 #ifdef ARCH_HAS_SG_CHAIN
1648   - blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS);
  1648 + if (shost->use_sg_chaining)
  1649 + blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS);
  1650 + else
  1651 + blk_queue_max_phys_segments(q, SCSI_MAX_SG_SEGMENTS);
1649 1652 #else
1650 1653 blk_queue_max_phys_segments(q, SCSI_MAX_SG_SEGMENTS);
1651 1654 #endif
... ... @@ -1123,6 +1123,7 @@
1123 1123 .this_id = -1,
1124 1124 .sg_tablesize = ST_MAX_SG,
1125 1125 .cmd_per_lun = ST_CMD_PER_LUN,
  1126 + .use_sg_chaining = ENABLE_SG_CHAINING,
1126 1127 };
1127 1128  
1128 1129 static int stex_set_dma_mask(struct pci_dev * pdev)
drivers/scsi/sym53c416.c
... ... @@ -854,6 +854,7 @@
854 854 .cmd_per_lun = 1,
855 855 .unchecked_isa_dma = 1,
856 856 .use_clustering = ENABLE_CLUSTERING,
  857 + .use_sg_chaining = ENABLE_SG_CHAINING,
857 858 };
858 859 #include "scsi_module.c"
drivers/scsi/sym53c8xx_2/sym_glue.c
... ... @@ -1808,6 +1808,7 @@
1808 1808 .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler,
1809 1809 .this_id = 7,
1810 1810 .use_clustering = ENABLE_CLUSTERING,
  1811 + .use_sg_chaining = ENABLE_SG_CHAINING,
1811 1812 .max_sectors = 0xFFFF,
1812 1813 #ifdef SYM_LINUX_PROC_INFO_SUPPORT
1813 1814 .proc_info = sym53c8xx_proc_info,
drivers/scsi/u14-34f.c
... ... @@ -451,6 +451,7 @@
451 451 .this_id = 7,
452 452 .unchecked_isa_dma = 1,
453 453 .use_clustering = ENABLE_CLUSTERING
  454 + .use_sg_chaining = ENABLE_SG_CHAINING,
454 455 };
455 456  
456 457 #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
drivers/scsi/ultrastor.c
... ... @@ -1197,6 +1197,7 @@
1197 1197 .cmd_per_lun = ULTRASTOR_MAX_CMDS_PER_LUN,
1198 1198 .unchecked_isa_dma = 1,
1199 1199 .use_clustering = ENABLE_CLUSTERING,
  1200 + .use_sg_chaining = ENABLE_SG_CHAINING,
1200 1201 };
1201 1202 #include "scsi_module.c"
drivers/scsi/wd7000.c
... ... @@ -1671,6 +1671,7 @@
1671 1671 .cmd_per_lun = 1,
1672 1672 .unchecked_isa_dma = 1,
1673 1673 .use_clustering = ENABLE_CLUSTERING,
  1674 + .use_sg_chaining = ENABLE_SG_CHAINING,
1674 1675 };
1675 1676  
1676 1677 #include "scsi_module.c"
include/scsi/scsi_host.h
... ... @@ -39,6 +39,9 @@
39 39 #define DISABLE_CLUSTERING 0
40 40 #define ENABLE_CLUSTERING 1
41 41  
  42 +#define DISABLE_SG_CHAINING 0
  43 +#define ENABLE_SG_CHAINING 1
  44 +
42 45 enum scsi_eh_timer_return {
43 46 EH_NOT_HANDLED,
44 47 EH_HANDLED,
... ... @@ -443,6 +446,15 @@
443 446 unsigned ordered_tag:1;
444 447  
445 448 /*
  449 + * true if the low-level driver can support sg chaining. this
  450 + * will be removed eventually when all the drivers are
  451 + * converted to support sg chaining.
  452 + *
  453 + * Status: OBSOLETE
  454 + */
  455 + unsigned use_sg_chaining:1;
  456 +
  457 + /*
446 458 * Countdown for host blocking with no commands outstanding
447 459 */
448 460 unsigned int max_host_blocked;
... ... @@ -586,6 +598,7 @@
586 598 unsigned unchecked_isa_dma:1;
587 599 unsigned use_clustering:1;
588 600 unsigned use_blk_tcq:1;
  601 + unsigned use_sg_chaining:1;
589 602  
590 603 /*
591 604 * Host has requested that no further requests come through for the