diff options
Diffstat (limited to 'drivers/message/fusion/mptfc.c')
-rw-r--r-- | drivers/message/fusion/mptfc.c | 106 |
1 files changed, 39 insertions, 67 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index a8f2fa985455..85696f34c310 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -77,10 +77,6 @@ MODULE_DESCRIPTION(my_NAME); | |||
77 | MODULE_LICENSE("GPL"); | 77 | MODULE_LICENSE("GPL"); |
78 | 78 | ||
79 | /* Command line args */ | 79 | /* Command line args */ |
80 | static int mpt_pq_filter = 0; | ||
81 | module_param(mpt_pq_filter, int, 0); | ||
82 | MODULE_PARM_DESC(mpt_pq_filter, " Enable peripheral qualifier filter: enable=1 (default=0)"); | ||
83 | |||
84 | #define MPTFC_DEV_LOSS_TMO (60) | 80 | #define MPTFC_DEV_LOSS_TMO (60) |
85 | static int mptfc_dev_loss_tmo = MPTFC_DEV_LOSS_TMO; /* reasonable default */ | 81 | static int mptfc_dev_loss_tmo = MPTFC_DEV_LOSS_TMO; /* reasonable default */ |
86 | module_param(mptfc_dev_loss_tmo, int, 0); | 82 | module_param(mptfc_dev_loss_tmo, int, 0); |
@@ -513,8 +509,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
513 | 509 | ||
514 | if (vtarget->num_luns == 0) { | 510 | if (vtarget->num_luns == 0) { |
515 | vtarget->ioc_id = hd->ioc->id; | 511 | vtarget->ioc_id = hd->ioc->id; |
516 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES | | 512 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; |
517 | MPT_TARGET_FLAGS_VALID_INQUIRY; | ||
518 | hd->Targets[sdev->id] = vtarget; | 513 | hd->Targets[sdev->id] = vtarget; |
519 | } | 514 | } |
520 | 515 | ||
@@ -674,7 +669,10 @@ mptfc_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) | |||
674 | * if still doing discovery, | 669 | * if still doing discovery, |
675 | * hang loose a while until finished | 670 | * hang loose a while until finished |
676 | */ | 671 | */ |
677 | if (pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN) { | 672 | if ((pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN) || |
673 | (pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_ONLINE && | ||
674 | (pp0dest->Flags & MPI_FCPORTPAGE0_FLAGS_ATTACH_TYPE_MASK) | ||
675 | == MPI_FCPORTPAGE0_FLAGS_ATTACH_NO_INIT)) { | ||
678 | if (count-- > 0) { | 676 | if (count-- > 0) { |
679 | msleep(100); | 677 | msleep(100); |
680 | goto try_again; | 678 | goto try_again; |
@@ -900,59 +898,45 @@ mptfc_rescan_devices(void *arg) | |||
900 | { | 898 | { |
901 | MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; | 899 | MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; |
902 | int ii; | 900 | int ii; |
903 | int work_to_do; | ||
904 | u64 pn; | 901 | u64 pn; |
905 | unsigned long flags; | ||
906 | struct mptfc_rport_info *ri; | 902 | struct mptfc_rport_info *ri; |
907 | 903 | ||
908 | do { | 904 | /* start by tagging all ports as missing */ |
909 | /* start by tagging all ports as missing */ | 905 | list_for_each_entry(ri, &ioc->fc_rports, list) { |
910 | list_for_each_entry(ri, &ioc->fc_rports, list) { | 906 | if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { |
911 | if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { | 907 | ri->flags |= MPT_RPORT_INFO_FLAGS_MISSING; |
912 | ri->flags |= MPT_RPORT_INFO_FLAGS_MISSING; | ||
913 | } | ||
914 | } | 908 | } |
909 | } | ||
915 | 910 | ||
916 | /* | 911 | /* |
917 | * now rescan devices known to adapter, | 912 | * now rescan devices known to adapter, |
918 | * will reregister existing rports | 913 | * will reregister existing rports |
919 | */ | 914 | */ |
920 | for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { | 915 | for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { |
921 | (void) mptfc_GetFcPortPage0(ioc, ii); | 916 | (void) mptfc_GetFcPortPage0(ioc, ii); |
922 | mptfc_init_host_attr(ioc,ii); /* refresh */ | 917 | mptfc_init_host_attr(ioc, ii); /* refresh */ |
923 | mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev); | 918 | mptfc_GetFcDevPage0(ioc, ii, mptfc_register_dev); |
924 | } | 919 | } |
925 | 920 | ||
926 | /* delete devices still missing */ | 921 | /* delete devices still missing */ |
927 | list_for_each_entry(ri, &ioc->fc_rports, list) { | 922 | list_for_each_entry(ri, &ioc->fc_rports, list) { |
928 | /* if newly missing, delete it */ | 923 | /* if newly missing, delete it */ |
929 | if (ri->flags & MPT_RPORT_INFO_FLAGS_MISSING) { | 924 | if (ri->flags & MPT_RPORT_INFO_FLAGS_MISSING) { |
930 | 925 | ||
931 | ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| | 926 | ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| |
932 | MPT_RPORT_INFO_FLAGS_MISSING); | 927 | MPT_RPORT_INFO_FLAGS_MISSING); |
933 | fc_remote_port_delete(ri->rport); /* won't sleep */ | 928 | fc_remote_port_delete(ri->rport); /* won't sleep */ |
934 | ri->rport = NULL; | 929 | ri->rport = NULL; |
935 | 930 | ||
936 | pn = (u64)ri->pg0.WWPN.High << 32 | | 931 | pn = (u64)ri->pg0.WWPN.High << 32 | |
937 | (u64)ri->pg0.WWPN.Low; | 932 | (u64)ri->pg0.WWPN.Low; |
938 | dfcprintk ((MYIOC_s_INFO_FMT | 933 | dfcprintk ((MYIOC_s_INFO_FMT |
939 | "mptfc_rescan.%d: %llx deleted\n", | 934 | "mptfc_rescan.%d: %llx deleted\n", |
940 | ioc->name, | 935 | ioc->name, |
941 | ioc->sh->host_no, | 936 | ioc->sh->host_no, |
942 | (unsigned long long)pn)); | 937 | (unsigned long long)pn)); |
943 | } | ||
944 | } | 938 | } |
945 | 939 | } | |
946 | /* | ||
947 | * allow multiple passes as target state | ||
948 | * might have changed during scan | ||
949 | */ | ||
950 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | ||
951 | if (ioc->fc_rescan_work_count > 2) /* only need one more */ | ||
952 | ioc->fc_rescan_work_count = 2; | ||
953 | work_to_do = --ioc->fc_rescan_work_count; | ||
954 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | ||
955 | } while (work_to_do); | ||
956 | } | 940 | } |
957 | 941 | ||
958 | static int | 942 | static int |
@@ -1129,13 +1113,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1129 | hd->timer.data = (unsigned long) hd; | 1113 | hd->timer.data = (unsigned long) hd; |
1130 | hd->timer.function = mptscsih_timer_expired; | 1114 | hd->timer.function = mptscsih_timer_expired; |
1131 | 1115 | ||
1132 | hd->mpt_pq_filter = mpt_pq_filter; | ||
1133 | |||
1134 | ddvprintk((MYIOC_s_INFO_FMT | ||
1135 | "mpt_pq_filter %x\n", | ||
1136 | ioc->name, | ||
1137 | mpt_pq_filter)); | ||
1138 | |||
1139 | init_waitqueue_head(&hd->scandv_waitq); | 1116 | init_waitqueue_head(&hd->scandv_waitq); |
1140 | hd->scandv_wait_done = 0; | 1117 | hd->scandv_wait_done = 0; |
1141 | hd->last_queue_full = 0; | 1118 | hd->last_queue_full = 0; |
@@ -1171,7 +1148,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1171 | * by doing it via the workqueue, some locking is eliminated | 1148 | * by doing it via the workqueue, some locking is eliminated |
1172 | */ | 1149 | */ |
1173 | 1150 | ||
1174 | ioc->fc_rescan_work_count = 1; | ||
1175 | queue_work(ioc->fc_rescan_work_q, &ioc->fc_rescan_work); | 1151 | queue_work(ioc->fc_rescan_work_q, &ioc->fc_rescan_work); |
1176 | flush_workqueue(ioc->fc_rescan_work_q); | 1152 | flush_workqueue(ioc->fc_rescan_work_q); |
1177 | 1153 | ||
@@ -1214,10 +1190,8 @@ mptfc_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
1214 | case MPI_EVENT_RESCAN: | 1190 | case MPI_EVENT_RESCAN: |
1215 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | 1191 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); |
1216 | if (ioc->fc_rescan_work_q) { | 1192 | if (ioc->fc_rescan_work_q) { |
1217 | if (ioc->fc_rescan_work_count++ == 0) { | 1193 | queue_work(ioc->fc_rescan_work_q, |
1218 | queue_work(ioc->fc_rescan_work_q, | 1194 | &ioc->fc_rescan_work); |
1219 | &ioc->fc_rescan_work); | ||
1220 | } | ||
1221 | } | 1195 | } |
1222 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | 1196 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); |
1223 | break; | 1197 | break; |
@@ -1260,10 +1234,8 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
1260 | mptfc_SetFcPortPage1_defaults(ioc); | 1234 | mptfc_SetFcPortPage1_defaults(ioc); |
1261 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | 1235 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); |
1262 | if (ioc->fc_rescan_work_q) { | 1236 | if (ioc->fc_rescan_work_q) { |
1263 | if (ioc->fc_rescan_work_count++ == 0) { | 1237 | queue_work(ioc->fc_rescan_work_q, |
1264 | queue_work(ioc->fc_rescan_work_q, | 1238 | &ioc->fc_rescan_work); |
1265 | &ioc->fc_rescan_work); | ||
1266 | } | ||
1267 | } | 1239 | } |
1268 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | 1240 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); |
1269 | } | 1241 | } |