@@ -389,7 +389,7 @@ zfcp_unit_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id,
389389 struct zfcp_unit * unit , * retval = NULL ;
390390
391391 list_for_each_entry (port , & adapter -> port_list_head , list ) {
392- if (id != port -> scsi_id )
392+ if (! port -> rport || ( id != port -> rport -> scsi_target_id ) )
393393 continue ;
394394 list_for_each_entry (unit , & port -> unit_list_head , list ) {
395395 if (lun == unit -> scsi_lun ) {
@@ -408,7 +408,7 @@ zfcp_port_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id)
408408 struct zfcp_port * port ;
409409
410410 list_for_each_entry (port , & adapter -> port_list_head , list ) {
411- if (id == port -> scsi_id )
411+ if (port -> rport && ( id == port -> rport -> scsi_target_id ) )
412412 return port ;
413413 }
414414 return (struct zfcp_port * ) NULL ;
@@ -634,7 +634,6 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
634634{
635635 int retval ;
636636 struct zfcp_unit * unit = (struct zfcp_unit * ) scpnt -> device -> hostdata ;
637- struct Scsi_Host * scsi_host = scpnt -> device -> host ;
638637
639638 if (!unit ) {
640639 ZFCP_LOG_NORMAL ("bug: Tried reset for nonexistent unit\n" );
@@ -729,7 +728,6 @@ zfcp_scsi_eh_bus_reset_handler(struct scsi_cmnd *scpnt)
729728{
730729 int retval = 0 ;
731730 struct zfcp_unit * unit ;
732- struct Scsi_Host * scsi_host = scpnt -> device -> host ;
733731
734732 unit = (struct zfcp_unit * ) scpnt -> device -> hostdata ;
735733 ZFCP_LOG_NORMAL ("bus reset because of problems with "
@@ -753,7 +751,6 @@ zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
753751{
754752 int retval = 0 ;
755753 struct zfcp_unit * unit ;
756- struct Scsi_Host * scsi_host = scpnt -> device -> host ;
757754
758755 unit = (struct zfcp_unit * ) scpnt -> device -> hostdata ;
759756 ZFCP_LOG_NORMAL ("host reset because of problems with "
@@ -833,6 +830,7 @@ zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
833830 shost = adapter -> scsi_host ;
834831 if (!shost )
835832 return ;
833+ fc_remove_host (shost );
836834 scsi_remove_host (shost );
837835 scsi_host_put (shost );
838836 adapter -> scsi_host = NULL ;
@@ -906,13 +904,30 @@ zfcp_get_node_name(struct scsi_target *starget)
906904 read_unlock_irqrestore (& zfcp_data .config_lock , flags );
907905}
908906
907+ void
908+ zfcp_set_fc_host_attrs (struct zfcp_adapter * adapter )
909+ {
910+ struct Scsi_Host * shost = adapter -> scsi_host ;
911+
912+ fc_host_node_name (shost ) = adapter -> wwnn ;
913+ fc_host_port_name (shost ) = adapter -> wwpn ;
914+ strncpy (fc_host_serial_number (shost ), adapter -> serial_number ,
915+ min (FC_SERIAL_NUMBER_SIZE , 32 ));
916+ fc_host_supported_classes (shost ) = FC_COS_CLASS2 | FC_COS_CLASS3 ;
917+ }
918+
909919struct fc_function_template zfcp_transport_functions = {
910920 .get_starget_port_id = zfcp_get_port_id ,
911921 .get_starget_port_name = zfcp_get_port_name ,
912922 .get_starget_node_name = zfcp_get_node_name ,
913923 .show_starget_port_id = 1 ,
914924 .show_starget_port_name = 1 ,
915925 .show_starget_node_name = 1 ,
926+ .show_rport_supported_classes = 1 ,
927+ .show_host_node_name = 1 ,
928+ .show_host_port_name = 1 ,
929+ .show_host_supported_classes = 1 ,
930+ .show_host_serial_number = 1 ,
916931};
917932
918933/**
0 commit comments