diff options
author | James Smart <James.Smart@Emulex.Com> | 2009-07-19 10:01:26 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-08-22 18:51:58 -0400 |
commit | 1c6834a7e85715a4ac07c1cac25a1950040decb0 (patch) | |
tree | 66e859591d7bb25b26c10999ee861ac86701cfbc /drivers/scsi/lpfc/lpfc_mbox.c | |
parent | 32b9793fe6ff09a85f36b8bd7d6ff214653a7497 (diff) |
[SCSI] lpfc 8.3.4: NPIV vport fixes
NPIV vport fixes
- Fixed static vport creation on SLI4 HBAs
- Fixed vport create sending init_vpi before REG_VFI
- Fix unable to create vports on SLI4 HBA's Port2
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mbox.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 245945f2f3a0..a776f86bbcc3 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -52,30 +52,51 @@ | |||
52 | * This routine prepares the mailbox command for dumping list of static | 52 | * This routine prepares the mailbox command for dumping list of static |
53 | * vports to be created. | 53 | * vports to be created. |
54 | **/ | 54 | **/ |
55 | void | 55 | int |
56 | lpfc_dump_static_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, | 56 | lpfc_dump_static_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, |
57 | uint16_t offset) | 57 | uint16_t offset) |
58 | { | 58 | { |
59 | MAILBOX_t *mb; | 59 | MAILBOX_t *mb; |
60 | void *ctx; | 60 | struct lpfc_dmabuf *mp; |
61 | 61 | ||
62 | mb = &pmb->u.mb; | 62 | mb = &pmb->u.mb; |
63 | ctx = pmb->context2; | ||
64 | 63 | ||
65 | /* Setup to dump vport info region */ | 64 | /* Setup to dump vport info region */ |
66 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); | 65 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); |
67 | mb->mbxCommand = MBX_DUMP_MEMORY; | 66 | mb->mbxCommand = MBX_DUMP_MEMORY; |
68 | mb->un.varDmp.cv = 1; | ||
69 | mb->un.varDmp.type = DMP_NV_PARAMS; | 67 | mb->un.varDmp.type = DMP_NV_PARAMS; |
70 | mb->un.varDmp.entry_index = offset; | 68 | mb->un.varDmp.entry_index = offset; |
71 | mb->un.varDmp.region_id = DMP_REGION_VPORT; | 69 | mb->un.varDmp.region_id = DMP_REGION_VPORT; |
72 | mb->un.varDmp.word_cnt = DMP_RSP_SIZE/sizeof(uint32_t); | ||
73 | mb->un.varDmp.co = 0; | ||
74 | mb->un.varDmp.resp_offset = 0; | ||
75 | pmb->context2 = ctx; | ||
76 | mb->mbxOwner = OWN_HOST; | 70 | mb->mbxOwner = OWN_HOST; |
77 | 71 | ||
78 | return; | 72 | /* For SLI3 HBAs data is embedded in mailbox */ |
73 | if (phba->sli_rev != LPFC_SLI_REV4) { | ||
74 | mb->un.varDmp.cv = 1; | ||
75 | mb->un.varDmp.word_cnt = DMP_RSP_SIZE/sizeof(uint32_t); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | /* For SLI4 HBAs driver need to allocate memory */ | ||
80 | mp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL); | ||
81 | if (mp) | ||
82 | mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); | ||
83 | |||
84 | if (!mp || !mp->virt) { | ||
85 | kfree(mp); | ||
86 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | ||
87 | "2605 lpfc_dump_static_vport: memory" | ||
88 | " allocation failed\n"); | ||
89 | return 1; | ||
90 | } | ||
91 | memset(mp->virt, 0, LPFC_BPL_SIZE); | ||
92 | INIT_LIST_HEAD(&mp->list); | ||
93 | /* save address for completion */ | ||
94 | pmb->context2 = (uint8_t *) mp; | ||
95 | mb->un.varWords[3] = putPaddrLow(mp->phys); | ||
96 | mb->un.varWords[4] = putPaddrHigh(mp->phys); | ||
97 | mb->un.varDmp.sli4_length = sizeof(struct static_vport_info); | ||
98 | |||
99 | return 0; | ||
79 | } | 100 | } |
80 | 101 | ||
81 | /** | 102 | /** |
@@ -1805,6 +1826,7 @@ lpfc_reg_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport, dma_addr_t phys) | |||
1805 | 1826 | ||
1806 | /** | 1827 | /** |
1807 | * lpfc_init_vpi - Initialize the INIT_VPI mailbox command | 1828 | * lpfc_init_vpi - Initialize the INIT_VPI mailbox command |
1829 | * @phba: pointer to the hba structure to init the VPI for. | ||
1808 | * @mbox: pointer to lpfc mbox command to initialize. | 1830 | * @mbox: pointer to lpfc mbox command to initialize. |
1809 | * @vpi: VPI to be initialized. | 1831 | * @vpi: VPI to be initialized. |
1810 | * | 1832 | * |
@@ -1815,11 +1837,14 @@ lpfc_reg_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport, dma_addr_t phys) | |||
1815 | * successful virtual NPort login. | 1837 | * successful virtual NPort login. |
1816 | **/ | 1838 | **/ |
1817 | void | 1839 | void |
1818 | lpfc_init_vpi(struct lpfcMboxq *mbox, uint16_t vpi) | 1840 | lpfc_init_vpi(struct lpfc_hba *phba, struct lpfcMboxq *mbox, uint16_t vpi) |
1819 | { | 1841 | { |
1820 | memset(mbox, 0, sizeof(*mbox)); | 1842 | memset(mbox, 0, sizeof(*mbox)); |
1821 | bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VPI); | 1843 | bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VPI); |
1822 | bf_set(lpfc_init_vpi_vpi, &mbox->u.mqe.un.init_vpi, vpi); | 1844 | bf_set(lpfc_init_vpi_vpi, &mbox->u.mqe.un.init_vpi, |
1845 | vpi + phba->vpi_base); | ||
1846 | bf_set(lpfc_init_vpi_vfi, &mbox->u.mqe.un.init_vpi, | ||
1847 | phba->pport->vfi + phba->vfi_base); | ||
1823 | } | 1848 | } |
1824 | 1849 | ||
1825 | /** | 1850 | /** |