summaryrefslogtreecommitdiffstats
path: root/src/net/fcp.c
diff options
context:
space:
mode:
authorMichael Brown2011-06-25 00:16:17 +0200
committerMichael Brown2011-06-28 15:45:07 +0200
commit5f608a44a5574ec53c791e55894179dccb85f1c6 (patch)
treed57a92982f17ae989ba52a056f543991c0598921 /src/net/fcp.c
parent[fc] Maintain a list of Fibre Channel upper-layer protocol users (diff)
downloadipxe-5f608a44a5574ec53c791e55894179dccb85f1c6.tar.gz
ipxe-5f608a44a5574ec53c791e55894179dccb85f1c6.tar.xz
ipxe-5f608a44a5574ec53c791e55894179dccb85f1c6.zip
[fc] Send xfer_window_changed() when FCP link is established
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/fcp.c')
-rw-r--r--src/net/fcp.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/net/fcp.c b/src/net/fcp.c
index 28d2095d..419fea3e 100644
--- a/src/net/fcp.c
+++ b/src/net/fcp.c
@@ -921,6 +921,26 @@ static struct interface_descriptor fcpdev_scsi_desc =
INTF_DESC ( struct fcp_device, scsi, fcpdev_scsi_op );
/**
+ * Examine FCP ULP link state
+ *
+ * @v user Fibre Channel upper-layer protocol user
+ */
+static void fcpdev_examine ( struct fc_ulp_user *user ) {
+ struct fcp_device *fcpdev =
+ container_of ( user, struct fcp_device, user );
+
+ if ( fc_link_ok ( &fcpdev->user.ulp->link ) ) {
+ DBGC ( fcpdev, "FCP %p link is up\n", fcpdev );
+ } else {
+ DBGC ( fcpdev, "FCP %p link is down: %s\n",
+ fcpdev, strerror ( fcpdev->user.ulp->link.rc ) );
+ }
+
+ /* Notify SCSI layer of window change */
+ xfer_window_changed ( &fcpdev->scsi );
+}
+
+/**
* Open FCP device
*
* @v parent Parent interface
@@ -950,10 +970,13 @@ static int fcpdev_open ( struct interface *parent, struct fc_name *wwn,
ref_init ( &fcpdev->refcnt, NULL );
intf_init ( &fcpdev->scsi, &fcpdev_scsi_desc, &fcpdev->refcnt );
INIT_LIST_HEAD ( &fcpdev->fcpcmds );
- fc_ulp_attach ( ulp, &fcpdev->user );
+ fc_ulp_user_init ( &fcpdev->user, fcpdev_examine, &fcpdev->refcnt );
DBGC ( fcpdev, "FCP %p opened for %s\n", fcpdev, fc_ntoa ( wwn ) );
+ /* Attach to Fibre Channel ULP */
+ fc_ulp_attach ( ulp, &fcpdev->user );
+
/* Preserve parameters required for boot firmware table */
memcpy ( &fcpdev->wwn, wwn, sizeof ( fcpdev->wwn ) );
memcpy ( &fcpdev->lun, lun, sizeof ( fcpdev->lun ) );