|
@@ -146,8 +146,8 @@ struct fc_els_prli_descriptor fcp_prli_descriptor __fc_els_prli_descriptor = {
|
146
|
146
|
struct fcp_device {
|
147
|
147
|
/** Reference count */
|
148
|
148
|
struct refcnt refcnt;
|
149
|
|
- /** Fibre Channel upper-layer protocol */
|
150
|
|
- struct fc_ulp *ulp;
|
|
149
|
+ /** Fibre Channel upper-layer protocol user */
|
|
150
|
+ struct fc_ulp_user user;
|
151
|
151
|
/** SCSI command issuing interface */
|
152
|
152
|
struct interface scsi;
|
153
|
153
|
/** List of active commands */
|
|
@@ -734,13 +734,13 @@ static struct interface_descriptor fcpcmd_xchg_desc =
|
734
|
734
|
static int fcpdev_scsi_command ( struct fcp_device *fcpdev,
|
735
|
735
|
struct interface *parent,
|
736
|
736
|
struct scsi_cmd *command ) {
|
737
|
|
- struct fcp_prli_service_parameters *param = fcpdev->ulp->param;
|
|
737
|
+ struct fcp_prli_service_parameters *param = fcpdev->user.ulp->param;
|
738
|
738
|
struct fcp_command *fcpcmd;
|
739
|
739
|
int xchg_id;
|
740
|
740
|
int rc;
|
741
|
741
|
|
742
|
742
|
/* Check link */
|
743
|
|
- if ( ( rc = fcpdev->ulp->link.rc ) != 0 ) {
|
|
743
|
+ if ( ( rc = fcpdev->user.ulp->link.rc ) != 0 ) {
|
744
|
744
|
DBGC ( fcpdev, "FCP %p could not issue command while link is "
|
745
|
745
|
"down: %s\n", fcpdev, strerror ( rc ) );
|
746
|
746
|
goto err_link;
|
|
@@ -748,7 +748,7 @@ static int fcpdev_scsi_command ( struct fcp_device *fcpdev,
|
748
|
748
|
|
749
|
749
|
/* Check target capability */
|
750
|
750
|
assert ( param != NULL );
|
751
|
|
- assert ( fcpdev->ulp->param_len >= sizeof ( *param ) );
|
|
751
|
+ assert ( fcpdev->user.ulp->param_len >= sizeof ( *param ) );
|
752
|
752
|
if ( ! ( param->flags & htonl ( FCP_PRLI_TARGET ) ) ) {
|
753
|
753
|
DBGC ( fcpdev, "FCP %p could not issue command: not a target\n",
|
754
|
754
|
fcpdev );
|
|
@@ -772,8 +772,8 @@ static int fcpdev_scsi_command ( struct fcp_device *fcpdev,
|
772
|
772
|
|
773
|
773
|
/* Create new exchange */
|
774
|
774
|
if ( ( xchg_id = fc_xchg_originate ( &fcpcmd->xchg,
|
775
|
|
- fcpdev->ulp->peer->port,
|
776
|
|
- &fcpdev->ulp->peer->port_id,
|
|
775
|
+ fcpdev->user.ulp->peer->port,
|
|
776
|
+ &fcpdev->user.ulp->peer->port_id,
|
777
|
777
|
FC_TYPE_FCP ) ) < 0 ) {
|
778
|
778
|
rc = xchg_id;
|
779
|
779
|
DBGC ( fcpdev, "FCP %p could not create exchange: %s\n",
|
|
@@ -822,11 +822,7 @@ static void fcpdev_close ( struct fcp_device *fcpdev, int rc ) {
|
822
|
822
|
}
|
823
|
823
|
|
824
|
824
|
/* Drop reference to ULP */
|
825
|
|
- if ( fcpdev->ulp ) {
|
826
|
|
- fc_ulp_decrement ( fcpdev->ulp );
|
827
|
|
- fc_ulp_put ( fcpdev->ulp );
|
828
|
|
- fcpdev->ulp = NULL;
|
829
|
|
- }
|
|
825
|
+ fc_ulp_detach ( &fcpdev->user );
|
830
|
826
|
}
|
831
|
827
|
|
832
|
828
|
/**
|
|
@@ -836,7 +832,8 @@ static void fcpdev_close ( struct fcp_device *fcpdev, int rc ) {
|
836
|
832
|
* @ret len Length of window
|
837
|
833
|
*/
|
838
|
834
|
static size_t fcpdev_window ( struct fcp_device *fcpdev ) {
|
839
|
|
- return ( fc_link_ok ( &fcpdev->ulp->link ) ? ~( ( size_t ) 0 ) : 0 );
|
|
835
|
+ return ( fc_link_ok ( &fcpdev->user.ulp->link ) ?
|
|
836
|
+ ~( ( size_t ) 0 ) : 0 );
|
840
|
837
|
}
|
841
|
838
|
|
842
|
839
|
/**
|
|
@@ -897,15 +894,15 @@ static struct device * fcpdev_identify_device ( struct fcp_device *fcpdev ) {
|
897
|
894
|
/* We know the underlying device only if the link is up;
|
898
|
895
|
* otherwise we don't have a port to examine.
|
899
|
896
|
*/
|
900
|
|
- if ( ! fc_link_ok ( &fcpdev->ulp->link ) ) {
|
|
897
|
+ if ( ! fc_link_ok ( &fcpdev->user.ulp->link ) ) {
|
901
|
898
|
DBGC ( fcpdev, "FCP %p doesn't know underlying device "
|
902
|
899
|
"until link is up\n", fcpdev );
|
903
|
900
|
return NULL;
|
904
|
901
|
}
|
905
|
902
|
|
906
|
903
|
/* Hand off to port's transport interface */
|
907
|
|
- assert ( fcpdev->ulp->peer->port != NULL );
|
908
|
|
- return identify_device ( &fcpdev->ulp->peer->port->transport );
|
|
904
|
+ assert ( fcpdev->user.ulp->peer->port != NULL );
|
|
905
|
+ return identify_device ( &fcpdev->user.ulp->peer->port->transport );
|
909
|
906
|
}
|
910
|
907
|
|
911
|
908
|
/** FCP device SCSI interface operations */
|
|
@@ -953,8 +950,7 @@ static int fcpdev_open ( struct interface *parent, struct fc_name *wwn,
|
953
|
950
|
ref_init ( &fcpdev->refcnt, NULL );
|
954
|
951
|
intf_init ( &fcpdev->scsi, &fcpdev_scsi_desc, &fcpdev->refcnt );
|
955
|
952
|
INIT_LIST_HEAD ( &fcpdev->fcpcmds );
|
956
|
|
- fcpdev->ulp = fc_ulp_get ( ulp );
|
957
|
|
- fc_ulp_increment ( fcpdev->ulp );
|
|
953
|
+ fc_ulp_attach ( ulp, &fcpdev->user );
|
958
|
954
|
|
959
|
955
|
DBGC ( fcpdev, "FCP %p opened for %s\n", fcpdev, fc_ntoa ( wwn ) );
|
960
|
956
|
|