summaryrefslogtreecommitdiff
path: root/drivers/scsi/qla4xxx
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-10-06 03:56:59 -0500
committerJames Bottomley <JBottomley@Parallels.com>2011-10-20 10:12:44 -0500
commit00c31889f7513e9ffa6b2b4de8ad6d7f59a61c80 (patch)
tree6ba665724a1aed89f962598c323af9be18ce5688 /drivers/scsi/qla4xxx
parent88f4f5170fe74ae28443f304fcd226ddcf84f592 (diff)
downloadlinux-3.10-00c31889f7513e9ffa6b2b4de8ad6d7f59a61c80.tar.gz
linux-3.10-00c31889f7513e9ffa6b2b4de8ad6d7f59a61c80.tar.bz2
linux-3.10-00c31889f7513e9ffa6b2b4de8ad6d7f59a61c80.zip
[SCSI] qla4xxx: fix data alignment and use nl helpers
This has the driver use helpers for a common operation and fixes a issue where if multiple iscsi params are sent they could be sent at offsets that cause unaligned accesses. The nla helpers account for the padding needed to align properly for the driver. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index d39205c816d..ce20dab7536 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -78,8 +78,8 @@ static int qla4xxx_conn_get_param(struct iscsi_cls_conn *conn,
enum iscsi_param param, char *buf);
static int qla4xxx_host_get_param(struct Scsi_Host *shost,
enum iscsi_host_param param, char *buf);
-static int qla4xxx_iface_set_param(struct Scsi_Host *shost, char *data,
- int count);
+static int qla4xxx_iface_set_param(struct Scsi_Host *shost, void *data,
+ uint32_t len);
static int qla4xxx_get_iface_param(struct iscsi_iface *iface,
enum iscsi_param_type param_type,
int param, char *buf);
@@ -842,7 +842,7 @@ qla4xxx_initcb_to_acb(struct addr_ctrl_blk *init_fw_cb)
}
static int
-qla4xxx_iface_set_param(struct Scsi_Host *shost, char *data, int count)
+qla4xxx_iface_set_param(struct Scsi_Host *shost, void *data, uint32_t len)
{
struct scsi_qla_host *ha = to_qla_host(shost);
int rval = 0;
@@ -851,8 +851,8 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, char *data, int count)
dma_addr_t init_fw_cb_dma;
uint32_t mbox_cmd[MBOX_REG_COUNT];
uint32_t mbox_sts[MBOX_REG_COUNT];
- uint32_t total_param_count;
- uint32_t length;
+ uint32_t rem = len;
+ struct nlattr *attr;
init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
sizeof(struct addr_ctrl_blk),
@@ -873,11 +873,8 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, char *data, int count)
goto exit_init_fw_cb;
}
- total_param_count = count;
- iface_param = (struct iscsi_iface_param_info *)data;
-
- for ( ; total_param_count != 0; total_param_count--) {
- length = iface_param->len;
+ nla_for_each_attr(attr, data, len, rem) {
+ iface_param = nla_data(attr);
if (iface_param->param_type != ISCSI_NET_PARAM)
continue;
@@ -914,10 +911,6 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, char *data, int count)
ql4_printk(KERN_ERR, ha, "Invalid iface type\n");
break;
}
-
- iface_param = (struct iscsi_iface_param_info *)
- ((uint8_t *)iface_param +
- sizeof(struct iscsi_iface_param_info) + length);
}
init_fw_cb->cookie = cpu_to_le32(0x11BEAD5A);