diff options
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_os.c')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index a47f99957ba8..4d231c12463e 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -2216,14 +2216,14 @@ static int qla4xxx_copy_to_fwddb_param(struct iscsi_bus_flash_session *sess, | |||
2216 | fw_ddb_entry->iscsi_def_time2retain = cpu_to_le16(sess->time2retain); | 2216 | fw_ddb_entry->iscsi_def_time2retain = cpu_to_le16(sess->time2retain); |
2217 | fw_ddb_entry->tgt_portal_grp = cpu_to_le16(sess->tpgt); | 2217 | fw_ddb_entry->tgt_portal_grp = cpu_to_le16(sess->tpgt); |
2218 | fw_ddb_entry->mss = cpu_to_le16(conn->max_segment_size); | 2218 | fw_ddb_entry->mss = cpu_to_le16(conn->max_segment_size); |
2219 | fw_ddb_entry->tcp_xmt_wsf = cpu_to_le16(conn->tcp_xmit_wsf); | 2219 | fw_ddb_entry->tcp_xmt_wsf = (uint8_t) cpu_to_le32(conn->tcp_xmit_wsf); |
2220 | fw_ddb_entry->tcp_rcv_wsf = cpu_to_le16(conn->tcp_recv_wsf); | 2220 | fw_ddb_entry->tcp_rcv_wsf = (uint8_t) cpu_to_le32(conn->tcp_recv_wsf); |
2221 | fw_ddb_entry->ipv4_tos = conn->ipv4_tos; | 2221 | fw_ddb_entry->ipv4_tos = conn->ipv4_tos; |
2222 | fw_ddb_entry->ipv6_flow_lbl = cpu_to_le16(conn->ipv6_flow_label); | 2222 | fw_ddb_entry->ipv6_flow_lbl = cpu_to_le16(conn->ipv6_flow_label); |
2223 | fw_ddb_entry->ka_timeout = cpu_to_le16(conn->keepalive_timeout); | 2223 | fw_ddb_entry->ka_timeout = cpu_to_le16(conn->keepalive_timeout); |
2224 | fw_ddb_entry->lcl_port = cpu_to_le16(conn->local_port); | 2224 | fw_ddb_entry->lcl_port = cpu_to_le16(conn->local_port); |
2225 | fw_ddb_entry->stat_sn = cpu_to_le16(conn->statsn); | 2225 | fw_ddb_entry->stat_sn = cpu_to_le32(conn->statsn); |
2226 | fw_ddb_entry->exp_stat_sn = cpu_to_le16(conn->exp_statsn); | 2226 | fw_ddb_entry->exp_stat_sn = cpu_to_le32(conn->exp_statsn); |
2227 | fw_ddb_entry->ddb_link = cpu_to_le16(sess->discovery_parent_type); | 2227 | fw_ddb_entry->ddb_link = cpu_to_le16(sess->discovery_parent_type); |
2228 | fw_ddb_entry->chap_tbl_idx = cpu_to_le16(sess->chap_out_idx); | 2228 | fw_ddb_entry->chap_tbl_idx = cpu_to_le16(sess->chap_out_idx); |
2229 | fw_ddb_entry->tsid = cpu_to_le16(sess->tsid); | 2229 | fw_ddb_entry->tsid = cpu_to_le16(sess->tsid); |
@@ -5504,9 +5504,9 @@ static int qla4xxx_sysfs_ddb_is_non_persistent(struct device *dev, void *data) | |||
5504 | * If this is invoked as a result of a userspace call then the entry is marked | 5504 | * If this is invoked as a result of a userspace call then the entry is marked |
5505 | * as nonpersistent using flash_state field. | 5505 | * as nonpersistent using flash_state field. |
5506 | **/ | 5506 | **/ |
5507 | int qla4xxx_sysfs_ddb_tgt_create(struct scsi_qla_host *ha, | 5507 | static int qla4xxx_sysfs_ddb_tgt_create(struct scsi_qla_host *ha, |
5508 | struct dev_db_entry *fw_ddb_entry, | 5508 | struct dev_db_entry *fw_ddb_entry, |
5509 | uint16_t *idx, int user) | 5509 | uint16_t *idx, int user) |
5510 | { | 5510 | { |
5511 | struct iscsi_bus_flash_session *fnode_sess = NULL; | 5511 | struct iscsi_bus_flash_session *fnode_sess = NULL; |
5512 | struct iscsi_bus_flash_conn *fnode_conn = NULL; | 5512 | struct iscsi_bus_flash_conn *fnode_conn = NULL; |
@@ -5605,6 +5605,7 @@ static int qla4xxx_sysfs_ddb_add(struct Scsi_Host *shost, const char *buf, | |||
5605 | ql4_printk(KERN_ERR, ha, | 5605 | ql4_printk(KERN_ERR, ha, |
5606 | "%s: A non-persistent entry %s found\n", | 5606 | "%s: A non-persistent entry %s found\n", |
5607 | __func__, dev->kobj.name); | 5607 | __func__, dev->kobj.name); |
5608 | put_device(dev); | ||
5608 | goto exit_ddb_add; | 5609 | goto exit_ddb_add; |
5609 | } | 5610 | } |
5610 | 5611 | ||
@@ -6112,8 +6113,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess, | |||
6112 | int parent_type, parent_index = 0xffff; | 6113 | int parent_type, parent_index = 0xffff; |
6113 | int rc = 0; | 6114 | int rc = 0; |
6114 | 6115 | ||
6115 | dev = iscsi_find_flashnode_conn(fnode_sess, NULL, | 6116 | dev = iscsi_find_flashnode_conn(fnode_sess); |
6116 | iscsi_is_flashnode_conn_dev); | ||
6117 | if (!dev) | 6117 | if (!dev) |
6118 | return -EIO; | 6118 | return -EIO; |
6119 | 6119 | ||
@@ -6276,8 +6276,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess, | |||
6276 | rc = sprintf(buf, "\n"); | 6276 | rc = sprintf(buf, "\n"); |
6277 | break; | 6277 | break; |
6278 | case ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX: | 6278 | case ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX: |
6279 | if ((fnode_sess->discovery_parent_idx) >= 0 && | 6279 | if (fnode_sess->discovery_parent_idx < MAX_DDB_ENTRIES) |
6280 | (fnode_sess->discovery_parent_idx < MAX_DDB_ENTRIES)) | ||
6281 | parent_index = fnode_sess->discovery_parent_idx; | 6280 | parent_index = fnode_sess->discovery_parent_idx; |
6282 | 6281 | ||
6283 | rc = sprintf(buf, "%u\n", parent_index); | 6282 | rc = sprintf(buf, "%u\n", parent_index); |
@@ -6287,8 +6286,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess, | |||
6287 | parent_type = ISCSI_DISC_PARENT_ISNS; | 6286 | parent_type = ISCSI_DISC_PARENT_ISNS; |
6288 | else if (fnode_sess->discovery_parent_type == DDB_NO_LINK) | 6287 | else if (fnode_sess->discovery_parent_type == DDB_NO_LINK) |
6289 | parent_type = ISCSI_DISC_PARENT_UNKNOWN; | 6288 | parent_type = ISCSI_DISC_PARENT_UNKNOWN; |
6290 | else if (fnode_sess->discovery_parent_type >= 0 && | 6289 | else if (fnode_sess->discovery_parent_type < MAX_DDB_ENTRIES) |
6291 | fnode_sess->discovery_parent_type < MAX_DDB_ENTRIES) | ||
6292 | parent_type = ISCSI_DISC_PARENT_SENDTGT; | 6290 | parent_type = ISCSI_DISC_PARENT_SENDTGT; |
6293 | else | 6291 | else |
6294 | parent_type = ISCSI_DISC_PARENT_UNKNOWN; | 6292 | parent_type = ISCSI_DISC_PARENT_UNKNOWN; |
@@ -6349,6 +6347,8 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess, | |||
6349 | rc = -ENOSYS; | 6347 | rc = -ENOSYS; |
6350 | break; | 6348 | break; |
6351 | } | 6349 | } |
6350 | |||
6351 | put_device(dev); | ||
6352 | return rc; | 6352 | return rc; |
6353 | } | 6353 | } |
6354 | 6354 | ||
@@ -6368,20 +6368,11 @@ qla4xxx_sysfs_ddb_set_param(struct iscsi_bus_flash_session *fnode_sess, | |||
6368 | { | 6368 | { |
6369 | struct Scsi_Host *shost = iscsi_flash_session_to_shost(fnode_sess); | 6369 | struct Scsi_Host *shost = iscsi_flash_session_to_shost(fnode_sess); |
6370 | struct scsi_qla_host *ha = to_qla_host(shost); | 6370 | struct scsi_qla_host *ha = to_qla_host(shost); |
6371 | struct dev_db_entry *fw_ddb_entry = NULL; | ||
6372 | struct iscsi_flashnode_param_info *fnode_param; | 6371 | struct iscsi_flashnode_param_info *fnode_param; |
6373 | struct nlattr *attr; | 6372 | struct nlattr *attr; |
6374 | int rc = QLA_ERROR; | 6373 | int rc = QLA_ERROR; |
6375 | uint32_t rem = len; | 6374 | uint32_t rem = len; |
6376 | 6375 | ||
6377 | fw_ddb_entry = kzalloc(sizeof(*fw_ddb_entry), GFP_KERNEL); | ||
6378 | if (!fw_ddb_entry) { | ||
6379 | DEBUG2(ql4_printk(KERN_ERR, ha, | ||
6380 | "%s: Unable to allocate ddb buffer\n", | ||
6381 | __func__)); | ||
6382 | return -ENOMEM; | ||
6383 | } | ||
6384 | |||
6385 | nla_for_each_attr(attr, data, len, rem) { | 6376 | nla_for_each_attr(attr, data, len, rem) { |
6386 | fnode_param = nla_data(attr); | 6377 | fnode_param = nla_data(attr); |
6387 | 6378 | ||
@@ -6590,16 +6581,11 @@ static int qla4xxx_sysfs_ddb_delete(struct iscsi_bus_flash_session *fnode_sess) | |||
6590 | struct dev_db_entry *fw_ddb_entry = NULL; | 6581 | struct dev_db_entry *fw_ddb_entry = NULL; |
6591 | dma_addr_t fw_ddb_entry_dma; | 6582 | dma_addr_t fw_ddb_entry_dma; |
6592 | uint16_t *ddb_cookie = NULL; | 6583 | uint16_t *ddb_cookie = NULL; |
6593 | size_t ddb_size; | 6584 | size_t ddb_size = 0; |
6594 | void *pddb = NULL; | 6585 | void *pddb = NULL; |
6595 | int target_id; | 6586 | int target_id; |
6596 | int rc = 0; | 6587 | int rc = 0; |
6597 | 6588 | ||
6598 | if (!fnode_sess) { | ||
6599 | rc = -EINVAL; | ||
6600 | goto exit_ddb_del; | ||
6601 | } | ||
6602 | |||
6603 | if (fnode_sess->is_boot_target) { | 6589 | if (fnode_sess->is_boot_target) { |
6604 | rc = -EPERM; | 6590 | rc = -EPERM; |
6605 | DEBUG2(ql4_printk(KERN_ERR, ha, | 6591 | DEBUG2(ql4_printk(KERN_ERR, ha, |
@@ -6631,8 +6617,7 @@ static int qla4xxx_sysfs_ddb_delete(struct iscsi_bus_flash_session *fnode_sess) | |||
6631 | 6617 | ||
6632 | dev_db_start_offset += (fnode_sess->target_id * | 6618 | dev_db_start_offset += (fnode_sess->target_id * |
6633 | sizeof(*fw_ddb_entry)); | 6619 | sizeof(*fw_ddb_entry)); |
6634 | dev_db_start_offset += (void *)&(fw_ddb_entry->cookie) - | 6620 | dev_db_start_offset += offsetof(struct dev_db_entry, cookie); |
6635 | (void *)fw_ddb_entry; | ||
6636 | 6621 | ||
6637 | ddb_size = sizeof(*ddb_cookie); | 6622 | ddb_size = sizeof(*ddb_cookie); |
6638 | } | 6623 | } |