diff options
author | Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> | 2013-09-17 13:54:47 +0200 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-10-25 10:58:01 +0200 |
commit | b1d0b63f99300c0bd8b3fa9c8058fcd9529e294f (patch) | |
tree | f370d12d1f75bc2dbd06b835753aa47c894cadb3 /drivers/scsi/qla4xxx | |
parent | [SCSI] qla4xxx: Populate local CHAP credentials for flash target sessions (diff) | |
download | linux-b1d0b63f99300c0bd8b3fa9c8058fcd9529e294f.tar.xz linux-b1d0b63f99300c0bd8b3fa9c8058fcd9529e294f.zip |
[SCSI] qla4xxx: Use offset based on adapter type to set CHAP entry in flash
To write a CHAP entry in adapter's flash calculate the offset based
on the type of adapter.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index 5eef7d1aaa86..121be4298d4c 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c @@ -1537,6 +1537,7 @@ static int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username, int rval = QLA_ERROR; uint32_t offset = 0; struct ql4_chap_table *chap_table; + uint32_t chap_size = 0; dma_addr_t chap_dma; chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); @@ -1554,7 +1555,20 @@ static int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username, strncpy(chap_table->secret, password, MAX_CHAP_SECRET_LEN); strncpy(chap_table->name, username, MAX_CHAP_NAME_LEN); chap_table->cookie = __constant_cpu_to_le16(CHAP_VALID_COOKIE); - offset = FLASH_CHAP_OFFSET | (idx * sizeof(struct ql4_chap_table)); + + if (is_qla40XX(ha)) { + chap_size = MAX_CHAP_ENTRIES_40XX * sizeof(*chap_table); + offset = FLASH_CHAP_OFFSET; + } else { /* Single region contains CHAP info for both ports which is + * divided into half for each port. + */ + chap_size = ha->hw.flt_chap_size / 2; + offset = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_region_chap << 2); + if (ha->port_num == 1) + offset += chap_size; + } + + offset += (idx * sizeof(struct ql4_chap_table)); rval = qla4xxx_set_flash(ha, chap_dma, offset, sizeof(struct ql4_chap_table), FLASH_OPT_RMW_COMMIT); |