Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jayamohan Kallickal and committed by
Christoph Hellwig
a3d313ea 65c5efa8

+62 -2
+36 -2
drivers/scsi/be2iscsi/be_cmds.c
··· 275 275 ASYNC_EVENT_CODE_LINK_STATE); 276 276 } 277 277 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 + 278 291 static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl) 279 292 { 280 293 if (compl->flags != 0) { ··· 451 438 } else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) || 452 439 ((evt->port_link_status & ASYNC_EVENT_LOGICAL) && 453 440 (evt->port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) { 454 - phba->state = BE_ADAPTER_LINK_UP; 441 + phba->state = BE_ADAPTER_LINK_UP | BE_ADAPTER_CHECK_BOOT; 455 442 456 443 beiscsi_log(phba, KERN_ERR, 457 444 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT, ··· 474 461 /* Interpret compl as a async link evt */ 475 462 beiscsi_async_link_state_process(phba, 476 463 (struct be_async_event_link_state *) compl); 477 - else 464 + else if (is_iscsi_evt(compl->flags)) { 465 + switch (iscsi_evt_type(compl->flags)) { 466 + case ASYNC_EVENT_NEW_ISCSI_TGT_DISC: 467 + case ASYNC_EVENT_NEW_ISCSI_CONN: 468 + case ASYNC_EVENT_NEW_TCP_CONN: 469 + phba->state |= BE_ADAPTER_CHECK_BOOT; 470 + beiscsi_log(phba, KERN_ERR, 471 + BEISCSI_LOG_CONFIG | 472 + BEISCSI_LOG_MBOX, 473 + "BC_%d : Async iscsi Event," 474 + " flags handled = 0x%08x\n", 475 + compl->flags); 476 + break; 477 + default: 478 + beiscsi_log(phba, KERN_ERR, 479 + BEISCSI_LOG_CONFIG | 480 + BEISCSI_LOG_MBOX, 481 + "BC_%d : Unsupported Async" 482 + " Event, flags = 0x%08x\n", 483 + compl->flags); 484 + } 485 + } else 478 486 beiscsi_log(phba, KERN_ERR, 479 487 BEISCSI_LOG_CONFIG | 480 488 BEISCSI_LOG_MBOX,
+8
drivers/scsi/be2iscsi/be_cmds.h
··· 118 118 #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */ 119 119 #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF 120 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 + 121 129 struct be_async_event_trailer { 122 130 u32 code; 123 131 };
+17
drivers/scsi/be2iscsi/be_main.c
··· 4377 4377 { 4378 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 4384 /* get boot info using mgmt cmd */ 4381 4385 if (beiscsi_get_boot_info(phba)) 4382 4386 /* Try to see if we can carry on without this */ ··· 5339 5335 } 5340 5336 } 5341 5337 5338 + static void be_check_boot_session(struct beiscsi_hba *phba) 5339 + { 5340 + if (beiscsi_setup_boot_info(phba)) 5341 + beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 5342 + "BM_%d : Could not set up " 5343 + "iSCSI boot info on async event.\n"); 5344 + } 5345 + 5342 5346 /* 5343 5347 * beiscsi_hw_health_check()- Check adapter health 5344 5348 * @work: work item to check HW health ··· 5361 5349 beiscsi_hw_check_task.work); 5362 5350 5363 5351 be_eqd_update(phba); 5352 + 5353 + if (phba->state & BE_ADAPTER_CHECK_BOOT) { 5354 + phba->state &= ~BE_ADAPTER_CHECK_BOOT; 5355 + be_check_boot_session(phba); 5356 + } 5364 5357 5365 5358 beiscsi_ue_detect(phba); 5366 5359
+1
drivers/scsi/be2iscsi/be_main.h
··· 104 104 #define BE_ADAPTER_LINK_DOWN 0x002 105 105 #define BE_ADAPTER_PCI_ERR 0x004 106 106 #define BE_ADAPTER_STATE_SHUTDOWN 0x008 107 + #define BE_ADAPTER_CHECK_BOOT 0x010 107 108 108 109 109 110 #define BEISCSI_CLEAN_UNLOAD 0x01