aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2010-10-15 01:06:08 +0100
committerMichael Brown <mcb30@ipxe.org>2010-10-15 01:54:48 +0100
commit60b690141eaa8c736ab06500e6adfc9413c9b7f7 (patch)
treec17abac475867c7b34360f8c4786b059d9c3c63f /src
parenta9c799250faacd79e482be72f9f5bb0f8d4847d3 (diff)
downloadipxe-60b690141eaa8c736ab06500e6adfc9413c9b7f7.tar.gz
[fc] Use port WWN rather than node WWN as the primary Fibre Channel name
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/include/ipxe/fc.h8
-rw-r--r--src/net/fc.c62
-rw-r--r--src/net/fcels.c2
-rw-r--r--src/usr/fcmgmt.c11
4 files changed, 41 insertions, 42 deletions
diff --git a/src/include/ipxe/fc.h b/src/include/ipxe/fc.h
index a907c4cb7..8dbc19e7f 100644
--- a/src/include/ipxe/fc.h
+++ b/src/include/ipxe/fc.h
@@ -335,8 +335,8 @@ struct fc_peer {
/** List of all peers */
struct list_head list;
- /** Node name */
- struct fc_name node_wwn;
+ /** Port name */
+ struct fc_name port_wwn;
/** Link state monitor */
struct fc_link_state link;
@@ -377,7 +377,7 @@ fc_peer_put ( struct fc_peer *peer ) {
extern struct list_head fc_peers;
-extern struct fc_peer * fc_peer_get_wwn ( const struct fc_name *node_wwn );
+extern struct fc_peer * fc_peer_get_wwn ( const struct fc_name *port_wwn );
extern struct fc_peer *
fc_peer_get_port_id ( struct fc_port *port,
const struct fc_port_id *peer_port_id );
@@ -448,7 +448,7 @@ fc_ulp_put ( struct fc_ulp *ulp ) {
ref_put ( &ulp->refcnt );
}
-extern struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *node_wwn,
+extern struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *port_wwn,
unsigned int type );
extern struct fc_ulp *
fc_ulp_get_port_id_type ( struct fc_port *port,
diff --git a/src/net/fc.c b/src/net/fc.c
index e8e921592..7593b9593 100644
--- a/src/net/fc.c
+++ b/src/net/fc.c
@@ -1159,17 +1159,17 @@ struct fc_port * fc_port_find ( const char *name ) {
/**
* Find Fibre Channel port by link node name
*
- * @v link_node_wwn Link node name
+ * @v link_port_wwn Link node name
* @ret port Fibre Channel port, or NULL
*/
static struct fc_port *
-fc_port_find_link_wwn ( struct fc_name *link_node_wwn ) {
+fc_port_find_link_wwn ( struct fc_name *link_port_wwn ) {
struct fc_port *port;
list_for_each_entry ( port, &fc_ports, list ) {
if ( fc_link_ok ( &port->link ) &&
- ( memcmp ( &port->link_node_wwn, link_node_wwn,
- sizeof ( port->link_node_wwn ) ) == 0 ) ) {
+ ( memcmp ( &port->link_port_wwn, link_port_wwn,
+ sizeof ( port->link_port_wwn ) ) == 0 ) ) {
return port;
}
}
@@ -1192,7 +1192,7 @@ fc_port_find_link_wwn ( struct fc_name *link_node_wwn ) {
static void fc_peer_close ( struct fc_peer *peer, int rc ) {
DBGC ( peer, "FCPEER %s closed: %s\n",
- fc_ntoa ( &peer->node_wwn ) , strerror ( rc ) );
+ fc_ntoa ( &peer->port_wwn ) , strerror ( rc ) );
/* Sanity check */
assert ( list_empty ( &peer->ulps ) );
@@ -1263,7 +1263,7 @@ int fc_peer_login ( struct fc_peer *peer, struct fc_port *port,
peer->port = fc_port_get ( port );
memcpy ( &peer->port_id, port_id, sizeof ( peer->port_id ) );
DBGC ( peer, "FCPEER %s logged in via %s as %s\n",
- fc_ntoa ( &peer->node_wwn ), peer->port->name,
+ fc_ntoa ( &peer->port_wwn ), peer->port->name,
fc_id_ntoa ( &peer->port_id ) );
/* Add login reference */
@@ -1291,7 +1291,7 @@ void fc_peer_logout ( struct fc_peer *peer, int rc ) {
struct fc_ulp *tmp;
DBGC ( peer, "FCPEER %s logged out: %s\n",
- fc_ntoa ( &peer->node_wwn ), strerror ( rc ) );
+ fc_ntoa ( &peer->port_wwn ), strerror ( rc ) );
/* Drop login reference, if applicable */
if ( fc_link_ok ( &peer->link ) )
@@ -1349,16 +1349,16 @@ static void fc_peer_examine ( struct fc_link_state *link ) {
return;
DBGC ( peer, "FCPEER %s attempting login\n",
- fc_ntoa ( &peer->node_wwn ) );
+ fc_ntoa ( &peer->port_wwn ) );
/* Sanity check */
assert ( peer->port == NULL );
/* Look for a port with the peer attached via a point-to-point link */
- port = fc_port_find_link_wwn ( &peer->node_wwn );
+ port = fc_port_find_link_wwn ( &peer->port_wwn );
if ( ! port ) {
DBGC ( peer, "FCPEER %s could not find a point-to-point "
- "link\n", fc_ntoa ( &peer->node_wwn ) );
+ "link\n", fc_ntoa ( &peer->port_wwn ) );
fc_peer_logout ( peer, -ENOENT );
return;
}
@@ -1368,7 +1368,7 @@ static void fc_peer_examine ( struct fc_link_state *link ) {
intf_restart ( &peer->plogi, -ECANCELED );
if ( ( rc = fc_els_plogi ( &peer->plogi, port, peer_port_id ) ) != 0 ) {
DBGC ( peer, "FCPEER %s could not initiate PLOGI: %s\n",
- fc_ntoa ( &peer->node_wwn ), strerror ( rc ) );
+ fc_ntoa ( &peer->port_wwn ), strerror ( rc ) );
fc_peer_logout ( peer, rc );
return;
}
@@ -1386,10 +1386,10 @@ static struct interface_descriptor fc_peer_plogi_desc =
/**
* Create Fibre Channel peer
*
- * @v node_wwn Node name
+ * @v port_wwn Node name
* @ret peer Fibre Channel peer, or NULL
*/
-static struct fc_peer * fc_peer_create ( const struct fc_name *node_wwn ) {
+static struct fc_peer * fc_peer_create ( const struct fc_name *port_wwn ) {
struct fc_peer *peer;
/* Allocate and initialise structure */
@@ -1400,34 +1400,34 @@ static struct fc_peer * fc_peer_create ( const struct fc_name *node_wwn ) {
fc_link_init ( &peer->link, fc_peer_examine, &peer->refcnt );
intf_init ( &peer->plogi, &fc_peer_plogi_desc, &peer->refcnt );
list_add_tail ( &peer->list, &fc_peers );
- memcpy ( &peer->node_wwn, node_wwn, sizeof ( peer->node_wwn ) );
+ memcpy ( &peer->port_wwn, port_wwn, sizeof ( peer->port_wwn ) );
INIT_LIST_HEAD ( &peer->ulps );
/* Start link monitor */
fc_link_start ( &peer->link );
- DBGC ( peer, "FCPEER %s created\n", fc_ntoa ( &peer->node_wwn ) );
+ DBGC ( peer, "FCPEER %s created\n", fc_ntoa ( &peer->port_wwn ) );
return peer;
}
/**
* Get Fibre Channel peer by node name
*
- * @v node_wwn Node name
+ * @v port_wwn Node name
* @ret peer Fibre Channel peer, or NULL
*/
-struct fc_peer * fc_peer_get_wwn ( const struct fc_name *node_wwn ) {
+struct fc_peer * fc_peer_get_wwn ( const struct fc_name *port_wwn ) {
struct fc_peer *peer;
/* Look for an existing peer */
list_for_each_entry ( peer, &fc_peers, list ) {
- if ( memcmp ( &peer->node_wwn, node_wwn,
- sizeof ( peer->node_wwn ) ) == 0 )
+ if ( memcmp ( &peer->port_wwn, port_wwn,
+ sizeof ( peer->port_wwn ) ) == 0 )
return fc_peer_get ( peer );
}
/* Create a new peer */
- peer = fc_peer_create ( node_wwn );
+ peer = fc_peer_create ( port_wwn );
if ( ! peer )
return NULL;
@@ -1473,7 +1473,7 @@ struct fc_peer * fc_peer_get_port_id ( struct fc_port *port,
static void fc_ulp_close ( struct fc_ulp *ulp, int rc ) {
DBGC ( ulp, "FCULP %s/%02x closed: %s\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type, strerror ( rc ) );
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type, strerror ( rc ) );
/* Sanity check */
assert ( ulp->usage == 0 );
@@ -1555,13 +1555,13 @@ int fc_ulp_login ( struct fc_ulp *ulp, const void *param, size_t param_len,
if ( ! ulp->param ) {
DBGC ( ulp, "FCULP %s/%02x could not record "
"parameters\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
return -ENOMEM;
}
memcpy ( ulp->param, param, param_len );
ulp->param_len = param_len;
DBGC ( ulp, "FCULP %s/%02x logged in with parameters:\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
DBGC_HDA ( ulp, 0, ulp->param, ulp->param_len );
/* Add login reference */
@@ -1581,7 +1581,7 @@ int fc_ulp_login ( struct fc_ulp *ulp, const void *param, size_t param_len,
if ( ! ( ulp->flags & FC_ULP_ORIGINATED_LOGIN_OK ) ) {
DBGC ( ulp, "FCULP %s/%02x sending extra PRLI to work around "
"Linux bug\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
fc_link_start ( &ulp->link );
}
@@ -1597,7 +1597,7 @@ int fc_ulp_login ( struct fc_ulp *ulp, const void *param, size_t param_len,
void fc_ulp_logout ( struct fc_ulp *ulp, int rc ) {
DBGC ( ulp, "FCULP %s/%02x logged out: %s\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type, strerror ( rc ) );
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type, strerror ( rc ) );
/* Drop login reference, if applicable */
if ( fc_link_ok ( &ulp->link ) )
@@ -1652,14 +1652,14 @@ static void fc_ulp_examine ( struct fc_link_state *link ) {
return;
DBGC ( ulp, "FCULP %s/%02x attempting login\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
/* Try to create PRLI ELS */
intf_restart ( &ulp->prli, -ECANCELED );
if ( ( rc = fc_els_prli ( &ulp->prli, ulp->peer->port,
&ulp->peer->port_id, ulp->type ) ) != 0 ) {
DBGC ( ulp, "FCULP %s/%02x could not initiate PRLI: %s\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type,
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type,
strerror ( rc ) );
fc_ulp_logout ( ulp, rc );
return;
@@ -1701,7 +1701,7 @@ static struct fc_ulp * fc_ulp_create ( struct fc_peer *peer,
fc_link_start ( &ulp->link );
DBGC ( ulp, "FCULP %s/%02x created\n",
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
return ulp;
}
@@ -1733,17 +1733,17 @@ static struct fc_ulp * fc_ulp_get_type ( struct fc_peer *peer,
/**
* Get Fibre Channel upper-layer protocol by port name and type
*
- * @v node_wwn Port name
+ * @v port_wwn Port name
* @v type Type
* @ret ulp Fibre Channel upper-layer protocol, or NULL
*/
-struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *node_wwn,
+struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *port_wwn,
unsigned int type ) {
struct fc_ulp *ulp;
struct fc_peer *peer;
/* Get peer */
- peer = fc_peer_get_wwn ( node_wwn );
+ peer = fc_peer_get_wwn ( port_wwn );
if ( ! peer )
goto err_peer_get_wwn;
diff --git a/src/net/fcels.c b/src/net/fcels.c
index ef809ad86..150491646 100644
--- a/src/net/fcels.c
+++ b/src/net/fcels.c
@@ -677,7 +677,7 @@ static int fc_els_plogi_rx ( struct fc_els *els, const void *data,
fc_id_ntoa ( &els->peer_port_id ) );
/* Get peer */
- peer = fc_peer_get_wwn ( &plogi->node_wwn );
+ peer = fc_peer_get_wwn ( &plogi->port_wwn );
if ( ! peer ) {
DBGC ( els, FCELS_FMT " could not create peer\n",
FCELS_ARGS ( els ) );
diff --git a/src/usr/fcmgmt.c b/src/usr/fcmgmt.c
index 5a4d8117c..1af723d13 100644
--- a/src/usr/fcmgmt.c
+++ b/src/usr/fcmgmt.c
@@ -38,19 +38,18 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v port Fibre Channel port
*/
void fcportstat ( struct fc_port *port ) {
- printf ( "%s: %s", port->name, fc_ntoa ( &port->node_wwn ) );
- printf ( " port %s id %s\n [Link:", fc_ntoa ( &port->port_wwn ),
+ printf ( "%s: %s id %s", port->name, fc_ntoa ( &port->port_wwn ),
fc_id_ntoa ( &port->port_id ) );
+ printf ( " node %s\n [Link:", fc_ntoa ( &port->node_wwn ) );
if ( fc_link_ok ( &port->link ) ) {
- printf ( " up, %s", fc_ntoa ( &port->link_node_wwn ) );
- printf ( " port %s", fc_ntoa ( &port->link_port_wwn ) );
+ printf ( " up, %s", fc_ntoa ( &port->link_port_wwn ) );
if ( ( port->flags & FC_PORT_HAS_FABRIC ) ) {
printf ( " fabric" );
} else {
printf ( " id %s",
fc_id_ntoa ( &port->ptp_link_port_id ) );
}
- printf ( "]\n" );
+ printf ( " node %s]\n", fc_ntoa ( &port->link_node_wwn ) );
} else {
printf ( " down: %s]\n", strerror ( port->link.rc ) );
}
@@ -66,7 +65,7 @@ void fcpeerstat ( struct fc_peer *peer ) {
uint8_t *param;
unsigned int i;
- printf ( "%s:\n [Link:", fc_ntoa ( &peer->node_wwn ) );
+ printf ( "%s:\n [Link:", fc_ntoa ( &peer->port_wwn ) );
if ( fc_link_ok ( &peer->link ) ) {
printf ( " up, port %s id %s]\n", peer->port->name,
fc_id_ntoa ( &peer->port_id ) );