aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_mbx.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-07-25 14:48:38 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-27 10:35:58 -0400
commitd00efe3fa87fdf1df3635ba57ef3f14d03bc3ac8 (patch)
tree7af8d1d78aafc96a14ef8f6a9c1f477c493c0497 /drivers/scsi/qla4xxx/ql4_mbx.c
parent56c155b5ca427c9a6312bb0e31865f1c8ab10b2b (diff)
[SCSI] qla4xxx: add support for set_net_config
Allows user space (iscsiadm) to send down network configuration parameters for LLD to set private network configuration on the iSCSI adapters. Based on patches from Vikas Chaudhary. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_mbx.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c119
1 files changed, 117 insertions, 2 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index fce8289e9752..559286dcc53c 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -303,7 +303,7 @@ qla4xxx_set_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
303 return QLA_SUCCESS; 303 return QLA_SUCCESS;
304} 304}
305 305
306static uint8_t 306uint8_t
307qla4xxx_get_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd, 307qla4xxx_get_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
308 uint32_t *mbox_sts, dma_addr_t init_fw_cb_dma) 308 uint32_t *mbox_sts, dma_addr_t init_fw_cb_dma)
309{ 309{
@@ -363,7 +363,7 @@ qla4xxx_update_local_ip(struct scsi_qla_host *ha,
363 } 363 }
364} 364}
365 365
366static uint8_t 366uint8_t
367qla4xxx_update_local_ifcb(struct scsi_qla_host *ha, 367qla4xxx_update_local_ifcb(struct scsi_qla_host *ha,
368 uint32_t *mbox_cmd, 368 uint32_t *mbox_cmd,
369 uint32_t *mbox_sts, 369 uint32_t *mbox_sts,
@@ -1207,3 +1207,118 @@ exit_send_tgts_no_free:
1207 return ret_val; 1207 return ret_val;
1208} 1208}
1209 1209
1210int qla4xxx_set_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
1211 uint32_t offset, uint32_t length, uint32_t options)
1212{
1213 uint32_t mbox_cmd[MBOX_REG_COUNT];
1214 uint32_t mbox_sts[MBOX_REG_COUNT];
1215 int status = QLA_SUCCESS;
1216
1217 memset(&mbox_cmd, 0, sizeof(mbox_cmd));
1218 memset(&mbox_sts, 0, sizeof(mbox_sts));
1219
1220 mbox_cmd[0] = MBOX_CMD_WRITE_FLASH;
1221 mbox_cmd[1] = LSDW(dma_addr);
1222 mbox_cmd[2] = MSDW(dma_addr);
1223 mbox_cmd[3] = offset;
1224 mbox_cmd[4] = length;
1225 mbox_cmd[5] = options;
1226
1227 status = qla4xxx_mailbox_command(ha, 6, 2, &mbox_cmd[0], &mbox_sts[0]);
1228 if (status != QLA_SUCCESS) {
1229 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: MBOX_CMD_WRITE_FLASH "
1230 "failed w/ status %04X, mbx1 %04X\n",
1231 __func__, mbox_sts[0], mbox_sts[1]));
1232 }
1233 return status;
1234}
1235
1236int qla4xxx_conn_close_sess_logout(struct scsi_qla_host *ha,
1237 uint16_t fw_ddb_index,
1238 uint16_t connection_id,
1239 uint16_t option)
1240{
1241 uint32_t mbox_cmd[MBOX_REG_COUNT];
1242 uint32_t mbox_sts[MBOX_REG_COUNT];
1243 int status = QLA_SUCCESS;
1244
1245 memset(&mbox_cmd, 0, sizeof(mbox_cmd));
1246 memset(&mbox_sts, 0, sizeof(mbox_sts));
1247
1248 mbox_cmd[0] = MBOX_CMD_CONN_CLOSE_SESS_LOGOUT;
1249 mbox_cmd[1] = fw_ddb_index;
1250 mbox_cmd[2] = connection_id;
1251 mbox_cmd[3] = option;
1252
1253 status = qla4xxx_mailbox_command(ha, 4, 2, &mbox_cmd[0], &mbox_sts[0]);
1254 if (status != QLA_SUCCESS) {
1255 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: MBOX_CMD_CONN_CLOSE "
1256 "option %04x failed w/ status %04X %04X\n",
1257 __func__, option, mbox_sts[0], mbox_sts[1]));
1258 }
1259 return status;
1260}
1261
1262int qla4xxx_disable_acb(struct scsi_qla_host *ha)
1263{
1264 uint32_t mbox_cmd[MBOX_REG_COUNT];
1265 uint32_t mbox_sts[MBOX_REG_COUNT];
1266 int status = QLA_SUCCESS;
1267
1268 memset(&mbox_cmd, 0, sizeof(mbox_cmd));
1269 memset(&mbox_sts, 0, sizeof(mbox_sts));
1270
1271 mbox_cmd[0] = MBOX_CMD_DISABLE_ACB;
1272
1273 status = qla4xxx_mailbox_command(ha, 8, 5, &mbox_cmd[0], &mbox_sts[0]);
1274 if (status != QLA_SUCCESS) {
1275 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: MBOX_CMD_DISABLE_ACB "
1276 "failed w/ status %04X %04X %04X", __func__,
1277 mbox_sts[0], mbox_sts[1], mbox_sts[2]));
1278 }
1279 return status;
1280}
1281
1282int qla4xxx_get_acb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
1283 uint32_t *mbox_sts, dma_addr_t acb_dma)
1284{
1285 int status = QLA_SUCCESS;
1286
1287 memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT);
1288 memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
1289 mbox_cmd[0] = MBOX_CMD_GET_ACB;
1290 mbox_cmd[1] = 0; /* Primary ACB */
1291 mbox_cmd[2] = LSDW(acb_dma);
1292 mbox_cmd[3] = MSDW(acb_dma);
1293 mbox_cmd[4] = sizeof(struct addr_ctrl_blk);
1294
1295 status = qla4xxx_mailbox_command(ha, 5, 5, &mbox_cmd[0], &mbox_sts[0]);
1296 if (status != QLA_SUCCESS) {
1297 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: MBOX_CMD_GET_ACB "
1298 "failed w/ status %04X\n", __func__,
1299 mbox_sts[0]));
1300 }
1301 return status;
1302}
1303
1304int qla4xxx_set_acb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
1305 uint32_t *mbox_sts, dma_addr_t acb_dma)
1306{
1307 int status = QLA_SUCCESS;
1308
1309 memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT);
1310 memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
1311 mbox_cmd[0] = MBOX_CMD_SET_ACB;
1312 mbox_cmd[1] = 0; /* Primary ACB */
1313 mbox_cmd[2] = LSDW(acb_dma);
1314 mbox_cmd[3] = MSDW(acb_dma);
1315 mbox_cmd[4] = sizeof(struct addr_ctrl_blk);
1316
1317 status = qla4xxx_mailbox_command(ha, 5, 5, &mbox_cmd[0], &mbox_sts[0]);
1318 if (status != QLA_SUCCESS) {
1319 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: MBOX_CMD_SET_ACB "
1320 "failed w/ status %04X\n", __func__,
1321 mbox_sts[0]));
1322 }
1323 return status;
1324}