aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi
diff options
context:
space:
mode:
authorJayamohan Kallickal <jayamohan.kallickal@emulex.com>2014-08-08 01:00:00 -0400
committerChristoph Hellwig <hch@lst.de>2014-09-16 12:09:46 -0400
commita3d313ea56fada1c73be022140b8d2b14ff1fc7b (patch)
treea2a4449c3589330dc34a7c9cfaa990977c349f48 /drivers/scsi/be2iscsi
parent65c5efa8166d146c088bef6e004f827c1070d826 (diff)
be2iscsi: Fix updating the boot enteries in sysfs
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>
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c38
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.h8
-rw-r--r--drivers/scsi/be2iscsi/be_main.c17
-rw-r--r--drivers/scsi/be2iscsi/be_main.h1
4 files changed, 62 insertions, 2 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index ea4477fe27ab..80d97f3d2ed9 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -275,6 +275,19 @@ bool is_link_state_evt(u32 trailer)
275 ASYNC_EVENT_CODE_LINK_STATE); 275 ASYNC_EVENT_CODE_LINK_STATE);
276} 276}
277 277
278static bool is_iscsi_evt(u32 trailer)
279{
280 return ((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) &
281 ASYNC_TRAILER_EVENT_CODE_MASK) ==
282 ASYNC_EVENT_CODE_ISCSI;
283}
284
285static int iscsi_evt_type(u32 trailer)
286{
287 return (trailer >> ASYNC_TRAILER_EVENT_TYPE_SHIFT) &
288 ASYNC_TRAILER_EVENT_TYPE_MASK;
289}
290
278static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl) 291static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
279{ 292{
280 if (compl->flags != 0) { 293 if (compl->flags != 0) {
@@ -438,7 +451,7 @@ void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
438 } else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) || 451 } else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) ||
439 ((evt->port_link_status & ASYNC_EVENT_LOGICAL) && 452 ((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
440 (evt->port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) { 453 (evt->port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) {
441 phba->state = BE_ADAPTER_LINK_UP; 454 phba->state = BE_ADAPTER_LINK_UP | BE_ADAPTER_CHECK_BOOT;
442 455
443 beiscsi_log(phba, KERN_ERR, 456 beiscsi_log(phba, KERN_ERR,
444 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT, 457 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
@@ -461,7 +474,28 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
461 /* Interpret compl as a async link evt */ 474 /* Interpret compl as a async link evt */
462 beiscsi_async_link_state_process(phba, 475 beiscsi_async_link_state_process(phba,
463 (struct be_async_event_link_state *) compl); 476 (struct be_async_event_link_state *) compl);
464 else 477 else if (is_iscsi_evt(compl->flags)) {
478 switch (iscsi_evt_type(compl->flags)) {
479 case ASYNC_EVENT_NEW_ISCSI_TGT_DISC:
480 case ASYNC_EVENT_NEW_ISCSI_CONN:
481 case ASYNC_EVENT_NEW_TCP_CONN:
482 phba->state |= BE_ADAPTER_CHECK_BOOT;
483 beiscsi_log(phba, KERN_ERR,
484 BEISCSI_LOG_CONFIG |
485 BEISCSI_LOG_MBOX,
486 "BC_%d : Async iscsi Event,"
487 " flags handled = 0x%08x\n",
488 compl->flags);
489 break;
490 default:
491 beiscsi_log(phba, KERN_ERR,
492 BEISCSI_LOG_CONFIG |
493 BEISCSI_LOG_MBOX,
494 "BC_%d : Unsupported Async"
495 " Event, flags = 0x%08x\n",
496 compl->flags);
497 }
498 } else
465 beiscsi_log(phba, KERN_ERR, 499 beiscsi_log(phba, KERN_ERR,
466 BEISCSI_LOG_CONFIG | 500 BEISCSI_LOG_CONFIG |
467 BEISCSI_LOG_MBOX, 501 BEISCSI_LOG_MBOX,
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index ccda0b6a7324..98897434bcb4 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -118,6 +118,14 @@ struct be_mcc_compl {
118#define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */ 118#define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
119#define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF 119#define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
120#define ASYNC_EVENT_CODE_LINK_STATE 0x1 120#define ASYNC_EVENT_CODE_LINK_STATE 0x1
121#define ASYNC_EVENT_CODE_ISCSI 0x4
122
123#define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16 /* bits 16 - 23 */
124#define ASYNC_TRAILER_EVENT_TYPE_MASK 0xF
125#define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4
126#define ASYNC_EVENT_NEW_ISCSI_CONN 0x5
127#define ASYNC_EVENT_NEW_TCP_CONN 0x7
128
121struct be_async_event_trailer { 129struct be_async_event_trailer {
122 u32 code; 130 u32 code;
123}; 131};
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 95634150d21c..0762b8e44f95 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4377,6 +4377,10 @@ static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
4377{ 4377{
4378 struct iscsi_boot_kobj *boot_kobj; 4378 struct iscsi_boot_kobj *boot_kobj;
4379 4379
4380 /* it has been created previously */
4381 if (phba->boot_kset)
4382 return 0;
4383
4380 /* get boot info using mgmt cmd */ 4384 /* get boot info using mgmt cmd */
4381 if (beiscsi_get_boot_info(phba)) 4385 if (beiscsi_get_boot_info(phba))
4382 /* Try to see if we can carry on without this */ 4386 /* Try to see if we can carry on without this */
@@ -5335,6 +5339,14 @@ static void be_eqd_update(struct beiscsi_hba *phba)
5335 } 5339 }
5336} 5340}
5337 5341
5342static void be_check_boot_session(struct beiscsi_hba *phba)
5343{
5344 if (beiscsi_setup_boot_info(phba))
5345 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
5346 "BM_%d : Could not set up "
5347 "iSCSI boot info on async event.\n");
5348}
5349
5338/* 5350/*
5339 * beiscsi_hw_health_check()- Check adapter health 5351 * beiscsi_hw_health_check()- Check adapter health
5340 * @work: work item to check HW health 5352 * @work: work item to check HW health
@@ -5350,6 +5362,11 @@ beiscsi_hw_health_check(struct work_struct *work)
5350 5362
5351 be_eqd_update(phba); 5363 be_eqd_update(phba);
5352 5364
5365 if (phba->state & BE_ADAPTER_CHECK_BOOT) {
5366 phba->state &= ~BE_ADAPTER_CHECK_BOOT;
5367 be_check_boot_session(phba);
5368 }
5369
5353 beiscsi_ue_detect(phba); 5370 beiscsi_ue_detect(phba);
5354 5371
5355 schedule_delayed_work(&phba->beiscsi_hw_check_task, 5372 schedule_delayed_work(&phba->beiscsi_hw_check_task,
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 0ca9d2d5397a..1e3428a4dbfb 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -104,6 +104,7 @@
104#define BE_ADAPTER_LINK_DOWN 0x002 104#define BE_ADAPTER_LINK_DOWN 0x002
105#define BE_ADAPTER_PCI_ERR 0x004 105#define BE_ADAPTER_PCI_ERR 0x004
106#define BE_ADAPTER_STATE_SHUTDOWN 0x008 106#define BE_ADAPTER_STATE_SHUTDOWN 0x008
107#define BE_ADAPTER_CHECK_BOOT 0x010
107 108
108 109
109#define BEISCSI_CLEAN_UNLOAD 0x01 110#define BEISCSI_CLEAN_UNLOAD 0x01