aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfad_im.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfad_im.c')
-rw-r--r--drivers/scsi/bfa/bfad_im.c54
1 files changed, 25 insertions, 29 deletions
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index f788c2a0ab07..78f42aa57369 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -19,6 +19,7 @@
19 * bfad_im.c Linux driver IM module. 19 * bfad_im.c Linux driver IM module.
20 */ 20 */
21 21
22#include <linux/slab.h>
22#include "bfad_drv.h" 23#include "bfad_drv.h"
23#include "bfad_im.h" 24#include "bfad_im.h"
24#include "bfad_trcmod.h" 25#include "bfad_trcmod.h"
@@ -43,11 +44,11 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio,
43 struct bfad_s *bfad = drv; 44 struct bfad_s *bfad = drv;
44 struct bfad_itnim_data_s *itnim_data; 45 struct bfad_itnim_data_s *itnim_data;
45 struct bfad_itnim_s *itnim; 46 struct bfad_itnim_s *itnim;
47 u8 host_status = DID_OK;
46 48
47 switch (io_status) { 49 switch (io_status) {
48 case BFI_IOIM_STS_OK: 50 case BFI_IOIM_STS_OK:
49 bfa_trc(bfad, scsi_status); 51 bfa_trc(bfad, scsi_status);
50 cmnd->result = ScsiResult(DID_OK, scsi_status);
51 scsi_set_resid(cmnd, 0); 52 scsi_set_resid(cmnd, 0);
52 53
53 if (sns_len > 0) { 54 if (sns_len > 0) {
@@ -56,8 +57,18 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio,
56 sns_len = SCSI_SENSE_BUFFERSIZE; 57 sns_len = SCSI_SENSE_BUFFERSIZE;
57 memcpy(cmnd->sense_buffer, sns_info, sns_len); 58 memcpy(cmnd->sense_buffer, sns_info, sns_len);
58 } 59 }
59 if (residue > 0) 60 if (residue > 0) {
61 bfa_trc(bfad, residue);
60 scsi_set_resid(cmnd, residue); 62 scsi_set_resid(cmnd, residue);
63 if (!sns_len && (scsi_status == SAM_STAT_GOOD) &&
64 (scsi_bufflen(cmnd) - residue) <
65 cmnd->underflow) {
66 bfa_trc(bfad, 0);
67 host_status = DID_ERROR;
68 }
69 }
70 cmnd->result = ScsiResult(host_status, scsi_status);
71
61 break; 72 break;
62 73
63 case BFI_IOIM_STS_ABORTED: 74 case BFI_IOIM_STS_ABORTED:
@@ -167,17 +178,15 @@ bfad_im_info(struct Scsi_Host *shost)
167 static char bfa_buf[256]; 178 static char bfa_buf[256];
168 struct bfad_im_port_s *im_port = 179 struct bfad_im_port_s *im_port =
169 (struct bfad_im_port_s *) shost->hostdata[0]; 180 (struct bfad_im_port_s *) shost->hostdata[0];
170 struct bfa_ioc_attr_s ioc_attr;
171 struct bfad_s *bfad = im_port->bfad; 181 struct bfad_s *bfad = im_port->bfad;
182 char model[BFA_ADAPTER_MODEL_NAME_LEN];
172 183
173 memset(&ioc_attr, 0, sizeof(ioc_attr)); 184 bfa_get_adapter_model(&bfad->bfa, model);
174 bfa_get_attr(&bfad->bfa, &ioc_attr);
175 185
176 memset(bfa_buf, 0, sizeof(bfa_buf)); 186 memset(bfa_buf, 0, sizeof(bfa_buf));
177 snprintf(bfa_buf, sizeof(bfa_buf), 187 snprintf(bfa_buf, sizeof(bfa_buf),
178 "Brocade FC/FCOE Adapter, " "model: %s hwpath: %s driver: %s", 188 "Brocade FC/FCOE Adapter, " "model: %s hwpath: %s driver: %s",
179 ioc_attr.adapter_attr.model, bfad->pci_name, 189 model, bfad->pci_name, BFAD_DRIVER_VERSION);
180 BFAD_DRIVER_VERSION);
181 return bfa_buf; 190 return bfa_buf;
182} 191}
183 192
@@ -501,16 +510,6 @@ void bfa_fcb_itnim_tov(struct bfad_itnim_s *itnim)
501} 510}
502 511
503/** 512/**
504 * Path TOV processing begin notification -- dummy for linux
505 */
506void
507bfa_fcb_itnim_tov_begin(struct bfad_itnim_s *itnim)
508{
509}
510
511
512
513/**
514 * Allocate a Scsi_Host for a port. 513 * Allocate a Scsi_Host for a port.
515 */ 514 */
516int 515int
@@ -931,10 +930,9 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port)
931 struct Scsi_Host *host = im_port->shost; 930 struct Scsi_Host *host = im_port->shost;
932 struct bfad_s *bfad = im_port->bfad; 931 struct bfad_s *bfad = im_port->bfad;
933 struct bfad_port_s *port = im_port->port; 932 struct bfad_port_s *port = im_port->port;
934 union attr { 933 struct bfa_pport_attr_s pattr;
935 struct bfa_pport_attr_s pattr; 934 char model[BFA_ADAPTER_MODEL_NAME_LEN];
936 struct bfa_ioc_attr_s ioc_attr; 935 char fw_ver[BFA_VERSION_LEN];
937 } attr;
938 936
939 fc_host_node_name(host) = 937 fc_host_node_name(host) =
940 bfa_os_htonll((bfa_fcs_port_get_nwwn(port->fcs_port))); 938 bfa_os_htonll((bfa_fcs_port_get_nwwn(port->fcs_port)));
@@ -954,20 +952,18 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port)
954 /* For fibre channel services type 0x20 */ 952 /* For fibre channel services type 0x20 */
955 fc_host_supported_fc4s(host)[7] = 1; 953 fc_host_supported_fc4s(host)[7] = 1;
956 954
957 memset(&attr.ioc_attr, 0, sizeof(attr.ioc_attr)); 955 bfa_get_adapter_model(&bfad->bfa, model);
958 bfa_get_attr(&bfad->bfa, &attr.ioc_attr); 956 bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver);
959 sprintf(fc_host_symbolic_name(host), "Brocade %s FV%s DV%s", 957 sprintf(fc_host_symbolic_name(host), "Brocade %s FV%s DV%s",
960 attr.ioc_attr.adapter_attr.model, 958 model, fw_ver, BFAD_DRIVER_VERSION);
961 attr.ioc_attr.adapter_attr.fw_ver, BFAD_DRIVER_VERSION);
962 959
963 fc_host_supported_speeds(host) = 0; 960 fc_host_supported_speeds(host) = 0;
964 fc_host_supported_speeds(host) |= 961 fc_host_supported_speeds(host) |=
965 FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT | 962 FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT |
966 FC_PORTSPEED_1GBIT; 963 FC_PORTSPEED_1GBIT;
967 964
968 memset(&attr.pattr, 0, sizeof(attr.pattr)); 965 bfa_fcport_get_attr(&bfad->bfa, &pattr);
969 bfa_pport_get_attr(&bfad->bfa, &attr.pattr); 966 fc_host_maxframe_size(host) = pattr.pport_cfg.maxfrsize;
970 fc_host_maxframe_size(host) = attr.pattr.pport_cfg.maxfrsize;
971} 967}
972 968
973static void 969static void