]> git.karo-electronics.de Git - linux-beck.git/commitdiff
be2iscsi: Fix updating the boot enteries in sysfs
authorJayamohan Kallickal <jayamohan.kallickal@emulex.com>
Fri, 8 Aug 2014 05:00:00 +0000 (01:00 -0400)
committerChristoph Hellwig <hch@lst.de>
Tue, 16 Sep 2014 16:09:46 +0000 (09:09 -0700)
 During port async event driver should check if there is any boot target
 configured on the adapter. Update sysfs enteries with the boot target
 parameters.

Signed-off-by: Minh Tran <minhduc.tran@emulex.com>
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/be2iscsi/be_cmds.c
drivers/scsi/be2iscsi/be_cmds.h
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/be2iscsi/be_main.h

index ea4477fe27abf3acb2f570922d8eecd4ab3de4eb..80d97f3d2ed9b36753f8beaac4448a361fd2b3c5 100644 (file)
@@ -275,6 +275,19 @@ bool is_link_state_evt(u32 trailer)
                  ASYNC_EVENT_CODE_LINK_STATE);
 }
 
+static bool is_iscsi_evt(u32 trailer)
+{
+       return ((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) &
+                 ASYNC_TRAILER_EVENT_CODE_MASK) ==
+                 ASYNC_EVENT_CODE_ISCSI;
+}
+
+static int iscsi_evt_type(u32 trailer)
+{
+       return (trailer >> ASYNC_TRAILER_EVENT_TYPE_SHIFT) &
+                ASYNC_TRAILER_EVENT_TYPE_MASK;
+}
+
 static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
 {
        if (compl->flags != 0) {
@@ -438,7 +451,7 @@ void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
        } else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) ||
                    ((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
                     (evt->port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) {
-               phba->state = BE_ADAPTER_LINK_UP;
+               phba->state = BE_ADAPTER_LINK_UP | BE_ADAPTER_CHECK_BOOT;
 
                beiscsi_log(phba, KERN_ERR,
                            BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
@@ -461,7 +474,28 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
                                /* Interpret compl as a async link evt */
                                beiscsi_async_link_state_process(phba,
                                   (struct be_async_event_link_state *) compl);
-                       else
+                       else if (is_iscsi_evt(compl->flags)) {
+                               switch (iscsi_evt_type(compl->flags)) {
+                               case ASYNC_EVENT_NEW_ISCSI_TGT_DISC:
+                               case ASYNC_EVENT_NEW_ISCSI_CONN:
+                               case ASYNC_EVENT_NEW_TCP_CONN:
+                                       phba->state |= BE_ADAPTER_CHECK_BOOT;
+                                       beiscsi_log(phba, KERN_ERR,
+                                                   BEISCSI_LOG_CONFIG |
+                                                   BEISCSI_LOG_MBOX,
+                                                   "BC_%d : Async iscsi Event,"
+                                                   " flags handled = 0x%08x\n",
+                                                   compl->flags);
+                                       break;
+                               default:
+                                       beiscsi_log(phba, KERN_ERR,
+                                                   BEISCSI_LOG_CONFIG |
+                                                   BEISCSI_LOG_MBOX,
+                                                   "BC_%d : Unsupported Async"
+                                                   " Event, flags = 0x%08x\n",
+                                                   compl->flags);
+                               }
+                       } else
                                beiscsi_log(phba, KERN_ERR,
                                            BEISCSI_LOG_CONFIG |
                                            BEISCSI_LOG_MBOX,
index ccda0b6a7324cf8d6700fb2d3fa00185fc16908e..98897434bcb4580c23e6939f35b6e8344002f7a3 100644 (file)
@@ -118,6 +118,14 @@ struct be_mcc_compl {
 #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8       /* bits 8 - 15 */
 #define ASYNC_TRAILER_EVENT_CODE_MASK  0xFF
 #define ASYNC_EVENT_CODE_LINK_STATE    0x1
+#define ASYNC_EVENT_CODE_ISCSI         0x4
+
+#define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16      /* bits 16 - 23 */
+#define ASYNC_TRAILER_EVENT_TYPE_MASK  0xF
+#define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4
+#define ASYNC_EVENT_NEW_ISCSI_CONN     0x5
+#define ASYNC_EVENT_NEW_TCP_CONN       0x7
+
 struct be_async_event_trailer {
        u32 code;
 };
index 95634150d21cf7be3a8a4a0d61d6607ed36a94cf..0762b8e44f95a7d88ddd0373d816c5e86746ea0e 100644 (file)
@@ -4377,6 +4377,10 @@ static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
 {
        struct iscsi_boot_kobj *boot_kobj;
 
+       /* it has been created previously */
+       if (phba->boot_kset)
+               return 0;
+
        /* get boot info using mgmt cmd */
        if (beiscsi_get_boot_info(phba))
                /* Try to see if we can carry on without this */
@@ -5335,6 +5339,14 @@ static void be_eqd_update(struct beiscsi_hba *phba)
        }
 }
 
+static void be_check_boot_session(struct beiscsi_hba *phba)
+{
+       if (beiscsi_setup_boot_info(phba))
+               beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
+                           "BM_%d : Could not set up "
+                           "iSCSI boot info on async event.\n");
+}
+
 /*
  * beiscsi_hw_health_check()- Check adapter health
  * @work: work item to check HW health
@@ -5350,6 +5362,11 @@ beiscsi_hw_health_check(struct work_struct *work)
 
        be_eqd_update(phba);
 
+       if (phba->state & BE_ADAPTER_CHECK_BOOT) {
+               phba->state &= ~BE_ADAPTER_CHECK_BOOT;
+               be_check_boot_session(phba);
+       }
+
        beiscsi_ue_detect(phba);
 
        schedule_delayed_work(&phba->beiscsi_hw_check_task,
index 0ca9d2d5397a3652e5d455f5e4aeec91642f9cae..1e3428a4dbfbceaaf1053ee4c38fc5da72f07d9f 100644 (file)
 #define BE_ADAPTER_LINK_DOWN   0x002
 #define BE_ADAPTER_PCI_ERR     0x004
 #define BE_ADAPTER_STATE_SHUTDOWN      0x008
+#define BE_ADAPTER_CHECK_BOOT  0x010
 
 
 #define BEISCSI_CLEAN_UNLOAD   0x01