Skip to content

Commit a3d313e

Browse files
Jayamohan KallickalChristoph Hellwig
authored andcommitted
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>
1 parent 65c5efa commit a3d313e

4 files changed

Lines changed: 62 additions & 2 deletions

File tree

‎drivers/scsi/be2iscsi/be_cmds.c‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,19 @@ bool is_link_state_evt(u32 trailer)
275275
ASYNC_EVENT_CODE_LINK_STATE);
276276
}
277277

278+
static 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+
285+
static int iscsi_evt_type(u32 trailer)
286+
{
287+
return (trailer >> ASYNC_TRAILER_EVENT_TYPE_SHIFT) &
288+
ASYNC_TRAILER_EVENT_TYPE_MASK;
289+
}
290+
278291
static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
279292
{
280293
if (compl->flags != 0) {
@@ -438,7 +451,7 @@ void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
438451
} else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) ||
439452
((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
440453
(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;
442455

443456
beiscsi_log(phba, KERN_ERR,
444457
BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
@@ -461,7 +474,28 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
461474
/* Interpret compl as a async link evt */
462475
beiscsi_async_link_state_process(phba,
463476
(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
465499
beiscsi_log(phba, KERN_ERR,
466500
BEISCSI_LOG_CONFIG |
467501
BEISCSI_LOG_MBOX,

‎drivers/scsi/be2iscsi/be_cmds.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ struct be_mcc_compl {
118118
#define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
119119
#define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
120120
#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+
121129
struct be_async_event_trailer {
122130
u32 code;
123131
};

‎drivers/scsi/be2iscsi/be_main.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4377,6 +4377,10 @@ static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
43774377
{
43784378
struct iscsi_boot_kobj *boot_kobj;
43794379

4380+
/* it has been created previously */
4381+
if (phba->boot_kset)
4382+
return 0;
4383+
43804384
/* get boot info using mgmt cmd */
43814385
if (beiscsi_get_boot_info(phba))
43824386
/* Try to see if we can carry on without this */
@@ -5335,6 +5339,14 @@ static void be_eqd_update(struct beiscsi_hba *phba)
53355339
}
53365340
}
53375341

5342+
static 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+
53385350
/*
53395351
* beiscsi_hw_health_check()- Check adapter health
53405352
* @work: work item to check HW health
@@ -5350,6 +5362,11 @@ beiscsi_hw_health_check(struct work_struct *work)
53505362

53515363
be_eqd_update(phba);
53525364

5365+
if (phba->state & BE_ADAPTER_CHECK_BOOT) {
5366+
phba->state &= ~BE_ADAPTER_CHECK_BOOT;
5367+
be_check_boot_session(phba);
5368+
}
5369+
53535370
beiscsi_ue_detect(phba);
53545371

53555372
schedule_delayed_work(&phba->beiscsi_hw_check_task,

‎drivers/scsi/be2iscsi/be_main.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
#define BE_ADAPTER_LINK_DOWN 0x002
105105
#define BE_ADAPTER_PCI_ERR 0x004
106106
#define BE_ADAPTER_STATE_SHUTDOWN 0x008
107+
#define BE_ADAPTER_CHECK_BOOT 0x010
107108

108109

109110
#define BEISCSI_CLEAN_UNLOAD 0x01

0 commit comments

Comments
 (0)