Commit 8359c79b3b89e97b7d4ef656915c1378069cfa93

Authored by John Soni Jose
Committed by James Bottomley
1 parent 72fb46a9d5

[SCSI] be2iscsi: Fix return value and typo.

Fix return value and typo in the message displayed.
Fix the goto label when wrb_hanlde allocation fails.
Fix the error message display in beiscsi_alloc_pdu

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

Showing 2 changed files with 60 additions and 20 deletions Side-by-side Diff

drivers/scsi/be2iscsi/be_iscsi.c
... ... @@ -531,9 +531,9 @@
531 531 break;
532 532 case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
533 533 if (!if_info.dhcp_state)
534   - len = sprintf(buf, "static");
  534 + len = sprintf(buf, "static\n");
535 535 else
536   - len = sprintf(buf, "dhcp");
  536 + len = sprintf(buf, "dhcp\n");
537 537 break;
538 538 case ISCSI_NET_PARAM_IPV4_SUBNET:
539 539 len = sprintf(buf, "%pI4\n", &if_info.ip_addr.subnet_mask);
... ... @@ -541,7 +541,7 @@
541 541 case ISCSI_NET_PARAM_VLAN_ENABLED:
542 542 len = sprintf(buf, "%s\n",
543 543 (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
544   - ? "Disabled" : "Enabled");
  544 + ? "Disabled\n" : "Enabled\n");
545 545 break;
546 546 case ISCSI_NET_PARAM_VLAN_ID:
547 547 if (if_info.vlan_priority == BEISCSI_VLAN_DISABLE)
... ... @@ -586,7 +586,7 @@
586 586 len = be2iscsi_get_if_param(phba, iface, param, buf);
587 587 break;
588 588 case ISCSI_NET_PARAM_IFACE_ENABLE:
589   - len = sprintf(buf, "enabled");
  589 + len = sprintf(buf, "enabled\n");
590 590 break;
591 591 case ISCSI_NET_PARAM_IPV4_GW:
592 592 memset(&gateway, 0, sizeof(gateway));
... ... @@ -731,7 +731,6 @@
731 731 * beiscsi_get_port_state - Get the Port State
732 732 * @shost : pointer to scsi_host structure
733 733 *
734   - * returns number of bytes
735 734 */
736 735 static void beiscsi_get_port_state(struct Scsi_Host *shost)
737 736 {
... ... @@ -1150,8 +1149,8 @@
1150 1149  
1151 1150 if (phba->state != BE_ADAPTER_UP) {
1152 1151 ret = -EBUSY;
1153   - beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1154   - "BS_%d : The Adapter state is Not UP\n");
  1152 + beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
  1153 + "BS_%d : The Adapter Port state is Down!!!\n");
1155 1154 return ERR_PTR(ret);
1156 1155 }
1157 1156  
drivers/scsi/be2iscsi/be_main.c
... ... @@ -4105,13 +4105,25 @@
4105 4105 spin_lock(&phba->io_sgl_lock);
4106 4106 io_task->psgl_handle = alloc_io_sgl_handle(phba);
4107 4107 spin_unlock(&phba->io_sgl_lock);
4108   - if (!io_task->psgl_handle)
  4108 + if (!io_task->psgl_handle) {
  4109 + beiscsi_log(phba, KERN_ERR,
  4110 + BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
  4111 + "BM_%d : Alloc of IO_SGL_ICD Failed"
  4112 + "for the CID : %d\n",
  4113 + beiscsi_conn->beiscsi_conn_cid);
4109 4114 goto free_hndls;
  4115 + }
4110 4116 io_task->pwrb_handle = alloc_wrb_handle(phba,
4111 4117 beiscsi_conn->beiscsi_conn_cid -
4112 4118 phba->fw_config.iscsi_cid_start);
4113   - if (!io_task->pwrb_handle)
  4119 + if (!io_task->pwrb_handle) {
  4120 + beiscsi_log(phba, KERN_ERR,
  4121 + BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
  4122 + "BM_%d : Alloc of WRB_HANDLE Failed"
  4123 + "for the CID : %d\n",
  4124 + beiscsi_conn->beiscsi_conn_cid);
4114 4125 goto free_io_hndls;
  4126 + }
4115 4127 } else {
4116 4128 io_task->scsi_cmnd = NULL;
4117 4129 if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) {
4118 4130  
... ... @@ -4120,8 +4132,16 @@
4120 4132 io_task->psgl_handle = (struct sgl_handle *)
4121 4133 alloc_mgmt_sgl_handle(phba);
4122 4134 spin_unlock(&phba->mgmt_sgl_lock);
4123   - if (!io_task->psgl_handle)
  4135 + if (!io_task->psgl_handle) {
  4136 + beiscsi_log(phba, KERN_ERR,
  4137 + BEISCSI_LOG_IO |
  4138 + BEISCSI_LOG_CONFIG,
  4139 + "BM_%d : Alloc of MGMT_SGL_ICD Failed"
  4140 + "for the CID : %d\n",
  4141 + beiscsi_conn->
  4142 + beiscsi_conn_cid);
4124 4143 goto free_hndls;
  4144 + }
4125 4145  
4126 4146 beiscsi_conn->login_in_progress = 1;
4127 4147 beiscsi_conn->plogin_sgl_handle =
... ... @@ -4130,8 +4150,16 @@
4130 4150 alloc_wrb_handle(phba,
4131 4151 beiscsi_conn->beiscsi_conn_cid -
4132 4152 phba->fw_config.iscsi_cid_start);
4133   - if (!io_task->pwrb_handle)
4134   - goto free_io_hndls;
  4153 + if (!io_task->pwrb_handle) {
  4154 + beiscsi_log(phba, KERN_ERR,
  4155 + BEISCSI_LOG_IO |
  4156 + BEISCSI_LOG_CONFIG,
  4157 + "BM_%d : Alloc of WRB_HANDLE Failed"
  4158 + "for the CID : %d\n",
  4159 + beiscsi_conn->
  4160 + beiscsi_conn_cid);
  4161 + goto free_mgmt_hndls;
  4162 + }
4135 4163 beiscsi_conn->plogin_wrb_handle =
4136 4164 io_task->pwrb_handle;
4137 4165  
4138 4166  
4139 4167  
4140 4168  
... ... @@ -4146,14 +4174,28 @@
4146 4174 spin_lock(&phba->mgmt_sgl_lock);
4147 4175 io_task->psgl_handle = alloc_mgmt_sgl_handle(phba);
4148 4176 spin_unlock(&phba->mgmt_sgl_lock);
4149   - if (!io_task->psgl_handle)
  4177 + if (!io_task->psgl_handle) {
  4178 + beiscsi_log(phba, KERN_ERR,
  4179 + BEISCSI_LOG_IO |
  4180 + BEISCSI_LOG_CONFIG,
  4181 + "BM_%d : Alloc of MGMT_SGL_ICD Failed"
  4182 + "for the CID : %d\n",
  4183 + beiscsi_conn->
  4184 + beiscsi_conn_cid);
4150 4185 goto free_hndls;
  4186 + }
4151 4187 io_task->pwrb_handle =
4152 4188 alloc_wrb_handle(phba,
4153 4189 beiscsi_conn->beiscsi_conn_cid -
4154 4190 phba->fw_config.iscsi_cid_start);
4155   - if (!io_task->pwrb_handle)
  4191 + if (!io_task->pwrb_handle) {
  4192 + beiscsi_log(phba, KERN_ERR,
  4193 + BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
  4194 + "BM_%d : Alloc of WRB_HANDLE Failed"
  4195 + "for the CID : %d\n",
  4196 + beiscsi_conn->beiscsi_conn_cid);
4156 4197 goto free_mgmt_hndls;
  4198 + }
4157 4199  
4158 4200 }
4159 4201 }
... ... @@ -4185,9 +4227,6 @@
4185 4227 pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
4186 4228 io_task->bhs_pa.u.a64.address);
4187 4229 io_task->cmd_bhs = NULL;
4188   - beiscsi_log(phba, KERN_ERR,
4189   - BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
4190   - "BM_%d : Alloc of SGL_ICD Failed\n");
4191 4230 return -ENOMEM;
4192 4231 }
4193 4232  
4194 4233  
... ... @@ -4387,13 +4426,13 @@
4387 4426 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4388 4427 "BM_%d : Failed to allocate memory for "
4389 4428 "beiscsi_bsg_request\n");
4390   - return -EIO;
  4429 + return -ENOMEM;
4391 4430 }
4392 4431 tag = mgmt_vendor_specific_fw_cmd(&phba->ctrl, phba, job,
4393 4432 &nonemb_cmd);
4394 4433 if (!tag) {
4395 4434 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4396   - "BM_%d : be_cmd_get_mac_addr Failed\n");
  4435 + "BM_%d : MBX Tag Allocation Failed\n");
4397 4436  
4398 4437 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4399 4438 nonemb_cmd.va, nonemb_cmd.dma);
4400 4439  
... ... @@ -4417,11 +4456,13 @@
4417 4456 nonemb_cmd.va, nonemb_cmd.dma);
4418 4457 if (status || extd_status) {
4419 4458 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4420   - "BM_%d : be_cmd_get_mac_addr Failed"
  4459 + "BM_%d : MBX Cmd Failed"
4421 4460 " status = %d extd_status = %d\n",
4422 4461 status, extd_status);
4423 4462  
4424 4463 return -EIO;
  4464 + } else {
  4465 + rc = 0;
4425 4466 }
4426 4467 break;
4427 4468