aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPrakash, Sathya <sathya.prakash@lsi.com>2007-08-14 06:49:32 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:40:50 -0400
commiteb5329f40c13923e84a847204b5c5d62954eaf05 (patch)
tree4a6c7ce6c5636d414a4e78c92d743dc45ed0604c /drivers
parent56af97ae477cf8c2983edf86db2559d6394ca860 (diff)
[SCSI] mpt fusion: Link speed change display support
When there is state change in FC links, a message is displayed with old and new link speed. signed-off-by: Sathya Prakash <sathya.prakash@lsi.com> Acked-by: Eric Moore <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/message/fusion/mptbase.h2
-rw-r--r--drivers/message/fusion/mptfc.c66
2 files changed, 68 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 04ef0a37a764..1197eba45bf5 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -698,6 +698,8 @@ typedef struct _MPT_ADAPTER
698 698
699 struct work_struct fc_setup_reset_work; 699 struct work_struct fc_setup_reset_work;
700 struct list_head fc_rports; 700 struct list_head fc_rports;
701 struct work_struct fc_lsc_work;
702 u8 fc_link_speed[2];
701 spinlock_t fc_rescan_work_lock; 703 spinlock_t fc_rescan_work_lock;
702 struct work_struct fc_rescan_work; 704 struct work_struct fc_rescan_work;
703 char fc_rescan_work_q_name[KOBJ_NAME_LEN]; 705 char fc_rescan_work_q_name[KOBJ_NAME_LEN];
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 2b3e27a58035..aadb0711cb61 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -675,6 +675,50 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
675} 675}
676 676
677/* 677/*
678 * mptfc_display_port_link_speed - displaying link speed
679 * @ioc: Pointer to MPT_ADAPTER structure
680 * @portnum: IOC Port number
681 * @pp0dest: port page0 data payload
682 *
683 */
684static void
685mptfc_display_port_link_speed(MPT_ADAPTER *ioc, int portnum, FCPortPage0_t *pp0dest)
686{
687 u8 old_speed, new_speed, state;
688 char *old, *new;
689
690 if (portnum >= 2)
691 return;
692
693 old_speed = ioc->fc_link_speed[portnum];
694 new_speed = pp0dest->CurrentSpeed;
695 state = pp0dest->PortState;
696
697 if (state != MPI_FCPORTPAGE0_PORTSTATE_OFFLINE &&
698 new_speed != MPI_FCPORTPAGE0_CURRENT_SPEED_UKNOWN) {
699
700 old = old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT ? "1 Gbps" :
701 old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT ? "2 Gbps" :
702 old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_4GBIT ? "4 Gbps" :
703 "Unknown";
704 new = new_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT ? "1 Gbps" :
705 new_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT ? "2 Gbps" :
706 new_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_4GBIT ? "4 Gbps" :
707 "Unknown";
708 if (old_speed == 0)
709 printk(MYIOC_s_NOTE_FMT
710 "FC Link Established, Speed = %s\n",
711 ioc->name, new);
712 else if (old_speed != new_speed)
713 printk(MYIOC_s_WARN_FMT
714 "FC Link Speed Change, Old Speed = %s, New Speed = %s\n",
715 ioc->name, old, new);
716
717 ioc->fc_link_speed[portnum] = new_speed;
718 }
719}
720
721/*
678 * mptfc_GetFcPortPage0 - Fetch FCPort config Page0. 722 * mptfc_GetFcPortPage0 - Fetch FCPort config Page0.
679 * @ioc: Pointer to MPT_ADAPTER structure 723 * @ioc: Pointer to MPT_ADAPTER structure
680 * @portnum: IOC Port number 724 * @portnum: IOC Port number
@@ -773,6 +817,7 @@ mptfc_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
773 " complete.\n", 817 " complete.\n",
774 ioc->name); 818 ioc->name);
775 } 819 }
820 mptfc_display_port_link_speed(ioc, portnum, pp0dest);
776 } 821 }
777 822
778 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma); 823 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma);
@@ -1023,6 +1068,18 @@ mptfc_init_host_attr(MPT_ADAPTER *ioc,int portnum)
1023} 1068}
1024 1069
1025static void 1070static void
1071mptfc_link_status_change(struct work_struct *work)
1072{
1073 MPT_ADAPTER *ioc =
1074 container_of(work, MPT_ADAPTER, fc_rescan_work);
1075 int ii;
1076
1077 for (ii=0; ii < ioc->facts.NumberOfPorts; ii++)
1078 (void) mptfc_GetFcPortPage0(ioc, ii);
1079
1080}
1081
1082static void
1026mptfc_setup_reset(struct work_struct *work) 1083mptfc_setup_reset(struct work_struct *work)
1027{ 1084{
1028 MPT_ADAPTER *ioc = 1085 MPT_ADAPTER *ioc =
@@ -1163,6 +1220,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1163 spin_lock_init(&ioc->fc_rescan_work_lock); 1220 spin_lock_init(&ioc->fc_rescan_work_lock);
1164 INIT_WORK(&ioc->fc_rescan_work, mptfc_rescan_devices); 1221 INIT_WORK(&ioc->fc_rescan_work, mptfc_rescan_devices);
1165 INIT_WORK(&ioc->fc_setup_reset_work, mptfc_setup_reset); 1222 INIT_WORK(&ioc->fc_setup_reset_work, mptfc_setup_reset);
1223 INIT_WORK(&ioc->fc_lsc_work, mptfc_link_status_change);
1166 1224
1167 spin_lock_irqsave(&ioc->FreeQlock, flags); 1225 spin_lock_irqsave(&ioc->FreeQlock, flags);
1168 1226
@@ -1337,6 +1395,14 @@ mptfc_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
1337 } 1395 }
1338 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); 1396 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
1339 break; 1397 break;
1398 case MPI_EVENT_LINK_STATUS_CHANGE:
1399 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
1400 if (ioc->fc_rescan_work_q) {
1401 queue_work(ioc->fc_rescan_work_q,
1402 &ioc->fc_lsc_work);
1403 }
1404 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
1405 break;
1340 default: 1406 default:
1341 rc = mptscsih_event_process(ioc,pEvReply); 1407 rc = mptscsih_event_process(ioc,pEvReply);
1342 break; 1408 break;