|
@@ -1159,17 +1159,17 @@ struct fc_port * fc_port_find ( const char *name ) {
|
1159
|
1159
|
/**
|
1160
|
1160
|
* Find Fibre Channel port by link node name
|
1161
|
1161
|
*
|
1162
|
|
- * @v link_node_wwn Link node name
|
|
1162
|
+ * @v link_port_wwn Link node name
|
1163
|
1163
|
* @ret port Fibre Channel port, or NULL
|
1164
|
1164
|
*/
|
1165
|
1165
|
static struct fc_port *
|
1166
|
|
-fc_port_find_link_wwn ( struct fc_name *link_node_wwn ) {
|
|
1166
|
+fc_port_find_link_wwn ( struct fc_name *link_port_wwn ) {
|
1167
|
1167
|
struct fc_port *port;
|
1168
|
1168
|
|
1169
|
1169
|
list_for_each_entry ( port, &fc_ports, list ) {
|
1170
|
1170
|
if ( fc_link_ok ( &port->link ) &&
|
1171
|
|
- ( memcmp ( &port->link_node_wwn, link_node_wwn,
|
1172
|
|
- sizeof ( port->link_node_wwn ) ) == 0 ) ) {
|
|
1171
|
+ ( memcmp ( &port->link_port_wwn, link_port_wwn,
|
|
1172
|
+ sizeof ( port->link_port_wwn ) ) == 0 ) ) {
|
1173
|
1173
|
return port;
|
1174
|
1174
|
}
|
1175
|
1175
|
}
|
|
@@ -1192,7 +1192,7 @@ fc_port_find_link_wwn ( struct fc_name *link_node_wwn ) {
|
1192
|
1192
|
static void fc_peer_close ( struct fc_peer *peer, int rc ) {
|
1193
|
1193
|
|
1194
|
1194
|
DBGC ( peer, "FCPEER %s closed: %s\n",
|
1195
|
|
- fc_ntoa ( &peer->node_wwn ) , strerror ( rc ) );
|
|
1195
|
+ fc_ntoa ( &peer->port_wwn ) , strerror ( rc ) );
|
1196
|
1196
|
|
1197
|
1197
|
/* Sanity check */
|
1198
|
1198
|
assert ( list_empty ( &peer->ulps ) );
|
|
@@ -1263,7 +1263,7 @@ int fc_peer_login ( struct fc_peer *peer, struct fc_port *port,
|
1263
|
1263
|
peer->port = fc_port_get ( port );
|
1264
|
1264
|
memcpy ( &peer->port_id, port_id, sizeof ( peer->port_id ) );
|
1265
|
1265
|
DBGC ( peer, "FCPEER %s logged in via %s as %s\n",
|
1266
|
|
- fc_ntoa ( &peer->node_wwn ), peer->port->name,
|
|
1266
|
+ fc_ntoa ( &peer->port_wwn ), peer->port->name,
|
1267
|
1267
|
fc_id_ntoa ( &peer->port_id ) );
|
1268
|
1268
|
|
1269
|
1269
|
/* Add login reference */
|
|
@@ -1291,7 +1291,7 @@ void fc_peer_logout ( struct fc_peer *peer, int rc ) {
|
1291
|
1291
|
struct fc_ulp *tmp;
|
1292
|
1292
|
|
1293
|
1293
|
DBGC ( peer, "FCPEER %s logged out: %s\n",
|
1294
|
|
- fc_ntoa ( &peer->node_wwn ), strerror ( rc ) );
|
|
1294
|
+ fc_ntoa ( &peer->port_wwn ), strerror ( rc ) );
|
1295
|
1295
|
|
1296
|
1296
|
/* Drop login reference, if applicable */
|
1297
|
1297
|
if ( fc_link_ok ( &peer->link ) )
|
|
@@ -1349,16 +1349,16 @@ static void fc_peer_examine ( struct fc_link_state *link ) {
|
1349
|
1349
|
return;
|
1350
|
1350
|
|
1351
|
1351
|
DBGC ( peer, "FCPEER %s attempting login\n",
|
1352
|
|
- fc_ntoa ( &peer->node_wwn ) );
|
|
1352
|
+ fc_ntoa ( &peer->port_wwn ) );
|
1353
|
1353
|
|
1354
|
1354
|
/* Sanity check */
|
1355
|
1355
|
assert ( peer->port == NULL );
|
1356
|
1356
|
|
1357
|
1357
|
/* Look for a port with the peer attached via a point-to-point link */
|
1358
|
|
- port = fc_port_find_link_wwn ( &peer->node_wwn );
|
|
1358
|
+ port = fc_port_find_link_wwn ( &peer->port_wwn );
|
1359
|
1359
|
if ( ! port ) {
|
1360
|
1360
|
DBGC ( peer, "FCPEER %s could not find a point-to-point "
|
1361
|
|
- "link\n", fc_ntoa ( &peer->node_wwn ) );
|
|
1361
|
+ "link\n", fc_ntoa ( &peer->port_wwn ) );
|
1362
|
1362
|
fc_peer_logout ( peer, -ENOENT );
|
1363
|
1363
|
return;
|
1364
|
1364
|
}
|
|
@@ -1368,7 +1368,7 @@ static void fc_peer_examine ( struct fc_link_state *link ) {
|
1368
|
1368
|
intf_restart ( &peer->plogi, -ECANCELED );
|
1369
|
1369
|
if ( ( rc = fc_els_plogi ( &peer->plogi, port, peer_port_id ) ) != 0 ) {
|
1370
|
1370
|
DBGC ( peer, "FCPEER %s could not initiate PLOGI: %s\n",
|
1371
|
|
- fc_ntoa ( &peer->node_wwn ), strerror ( rc ) );
|
|
1371
|
+ fc_ntoa ( &peer->port_wwn ), strerror ( rc ) );
|
1372
|
1372
|
fc_peer_logout ( peer, rc );
|
1373
|
1373
|
return;
|
1374
|
1374
|
}
|
|
@@ -1386,10 +1386,10 @@ static struct interface_descriptor fc_peer_plogi_desc =
|
1386
|
1386
|
/**
|
1387
|
1387
|
* Create Fibre Channel peer
|
1388
|
1388
|
*
|
1389
|
|
- * @v node_wwn Node name
|
|
1389
|
+ * @v port_wwn Node name
|
1390
|
1390
|
* @ret peer Fibre Channel peer, or NULL
|
1391
|
1391
|
*/
|
1392
|
|
-static struct fc_peer * fc_peer_create ( const struct fc_name *node_wwn ) {
|
|
1392
|
+static struct fc_peer * fc_peer_create ( const struct fc_name *port_wwn ) {
|
1393
|
1393
|
struct fc_peer *peer;
|
1394
|
1394
|
|
1395
|
1395
|
/* Allocate and initialise structure */
|
|
@@ -1400,34 +1400,34 @@ static struct fc_peer * fc_peer_create ( const struct fc_name *node_wwn ) {
|
1400
|
1400
|
fc_link_init ( &peer->link, fc_peer_examine, &peer->refcnt );
|
1401
|
1401
|
intf_init ( &peer->plogi, &fc_peer_plogi_desc, &peer->refcnt );
|
1402
|
1402
|
list_add_tail ( &peer->list, &fc_peers );
|
1403
|
|
- memcpy ( &peer->node_wwn, node_wwn, sizeof ( peer->node_wwn ) );
|
|
1403
|
+ memcpy ( &peer->port_wwn, port_wwn, sizeof ( peer->port_wwn ) );
|
1404
|
1404
|
INIT_LIST_HEAD ( &peer->ulps );
|
1405
|
1405
|
|
1406
|
1406
|
/* Start link monitor */
|
1407
|
1407
|
fc_link_start ( &peer->link );
|
1408
|
1408
|
|
1409
|
|
- DBGC ( peer, "FCPEER %s created\n", fc_ntoa ( &peer->node_wwn ) );
|
|
1409
|
+ DBGC ( peer, "FCPEER %s created\n", fc_ntoa ( &peer->port_wwn ) );
|
1410
|
1410
|
return peer;
|
1411
|
1411
|
}
|
1412
|
1412
|
|
1413
|
1413
|
/**
|
1414
|
1414
|
* Get Fibre Channel peer by node name
|
1415
|
1415
|
*
|
1416
|
|
- * @v node_wwn Node name
|
|
1416
|
+ * @v port_wwn Node name
|
1417
|
1417
|
* @ret peer Fibre Channel peer, or NULL
|
1418
|
1418
|
*/
|
1419
|
|
-struct fc_peer * fc_peer_get_wwn ( const struct fc_name *node_wwn ) {
|
|
1419
|
+struct fc_peer * fc_peer_get_wwn ( const struct fc_name *port_wwn ) {
|
1420
|
1420
|
struct fc_peer *peer;
|
1421
|
1421
|
|
1422
|
1422
|
/* Look for an existing peer */
|
1423
|
1423
|
list_for_each_entry ( peer, &fc_peers, list ) {
|
1424
|
|
- if ( memcmp ( &peer->node_wwn, node_wwn,
|
1425
|
|
- sizeof ( peer->node_wwn ) ) == 0 )
|
|
1424
|
+ if ( memcmp ( &peer->port_wwn, port_wwn,
|
|
1425
|
+ sizeof ( peer->port_wwn ) ) == 0 )
|
1426
|
1426
|
return fc_peer_get ( peer );
|
1427
|
1427
|
}
|
1428
|
1428
|
|
1429
|
1429
|
/* Create a new peer */
|
1430
|
|
- peer = fc_peer_create ( node_wwn );
|
|
1430
|
+ peer = fc_peer_create ( port_wwn );
|
1431
|
1431
|
if ( ! peer )
|
1432
|
1432
|
return NULL;
|
1433
|
1433
|
|
|
@@ -1473,7 +1473,7 @@ struct fc_peer * fc_peer_get_port_id ( struct fc_port *port,
|
1473
|
1473
|
static void fc_ulp_close ( struct fc_ulp *ulp, int rc ) {
|
1474
|
1474
|
|
1475
|
1475
|
DBGC ( ulp, "FCULP %s/%02x closed: %s\n",
|
1476
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type, strerror ( rc ) );
|
|
1476
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type, strerror ( rc ) );
|
1477
|
1477
|
|
1478
|
1478
|
/* Sanity check */
|
1479
|
1479
|
assert ( ulp->usage == 0 );
|
|
@@ -1555,13 +1555,13 @@ int fc_ulp_login ( struct fc_ulp *ulp, const void *param, size_t param_len,
|
1555
|
1555
|
if ( ! ulp->param ) {
|
1556
|
1556
|
DBGC ( ulp, "FCULP %s/%02x could not record "
|
1557
|
1557
|
"parameters\n",
|
1558
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
|
|
1558
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
|
1559
|
1559
|
return -ENOMEM;
|
1560
|
1560
|
}
|
1561
|
1561
|
memcpy ( ulp->param, param, param_len );
|
1562
|
1562
|
ulp->param_len = param_len;
|
1563
|
1563
|
DBGC ( ulp, "FCULP %s/%02x logged in with parameters:\n",
|
1564
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
|
|
1564
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
|
1565
|
1565
|
DBGC_HDA ( ulp, 0, ulp->param, ulp->param_len );
|
1566
|
1566
|
|
1567
|
1567
|
/* Add login reference */
|
|
@@ -1581,7 +1581,7 @@ int fc_ulp_login ( struct fc_ulp *ulp, const void *param, size_t param_len,
|
1581
|
1581
|
if ( ! ( ulp->flags & FC_ULP_ORIGINATED_LOGIN_OK ) ) {
|
1582
|
1582
|
DBGC ( ulp, "FCULP %s/%02x sending extra PRLI to work around "
|
1583
|
1583
|
"Linux bug\n",
|
1584
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
|
|
1584
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
|
1585
|
1585
|
fc_link_start ( &ulp->link );
|
1586
|
1586
|
}
|
1587
|
1587
|
|
|
@@ -1597,7 +1597,7 @@ int fc_ulp_login ( struct fc_ulp *ulp, const void *param, size_t param_len,
|
1597
|
1597
|
void fc_ulp_logout ( struct fc_ulp *ulp, int rc ) {
|
1598
|
1598
|
|
1599
|
1599
|
DBGC ( ulp, "FCULP %s/%02x logged out: %s\n",
|
1600
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type, strerror ( rc ) );
|
|
1600
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type, strerror ( rc ) );
|
1601
|
1601
|
|
1602
|
1602
|
/* Drop login reference, if applicable */
|
1603
|
1603
|
if ( fc_link_ok ( &ulp->link ) )
|
|
@@ -1652,14 +1652,14 @@ static void fc_ulp_examine ( struct fc_link_state *link ) {
|
1652
|
1652
|
return;
|
1653
|
1653
|
|
1654
|
1654
|
DBGC ( ulp, "FCULP %s/%02x attempting login\n",
|
1655
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
|
|
1655
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
|
1656
|
1656
|
|
1657
|
1657
|
/* Try to create PRLI ELS */
|
1658
|
1658
|
intf_restart ( &ulp->prli, -ECANCELED );
|
1659
|
1659
|
if ( ( rc = fc_els_prli ( &ulp->prli, ulp->peer->port,
|
1660
|
1660
|
&ulp->peer->port_id, ulp->type ) ) != 0 ) {
|
1661
|
1661
|
DBGC ( ulp, "FCULP %s/%02x could not initiate PRLI: %s\n",
|
1662
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type,
|
|
1662
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type,
|
1663
|
1663
|
strerror ( rc ) );
|
1664
|
1664
|
fc_ulp_logout ( ulp, rc );
|
1665
|
1665
|
return;
|
|
@@ -1701,7 +1701,7 @@ static struct fc_ulp * fc_ulp_create ( struct fc_peer *peer,
|
1701
|
1701
|
fc_link_start ( &ulp->link );
|
1702
|
1702
|
|
1703
|
1703
|
DBGC ( ulp, "FCULP %s/%02x created\n",
|
1704
|
|
- fc_ntoa ( &ulp->peer->node_wwn ), ulp->type );
|
|
1704
|
+ fc_ntoa ( &ulp->peer->port_wwn ), ulp->type );
|
1705
|
1705
|
return ulp;
|
1706
|
1706
|
}
|
1707
|
1707
|
|
|
@@ -1733,17 +1733,17 @@ static struct fc_ulp * fc_ulp_get_type ( struct fc_peer *peer,
|
1733
|
1733
|
/**
|
1734
|
1734
|
* Get Fibre Channel upper-layer protocol by port name and type
|
1735
|
1735
|
*
|
1736
|
|
- * @v node_wwn Port name
|
|
1736
|
+ * @v port_wwn Port name
|
1737
|
1737
|
* @v type Type
|
1738
|
1738
|
* @ret ulp Fibre Channel upper-layer protocol, or NULL
|
1739
|
1739
|
*/
|
1740
|
|
-struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *node_wwn,
|
|
1740
|
+struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *port_wwn,
|
1741
|
1741
|
unsigned int type ) {
|
1742
|
1742
|
struct fc_ulp *ulp;
|
1743
|
1743
|
struct fc_peer *peer;
|
1744
|
1744
|
|
1745
|
1745
|
/* Get peer */
|
1746
|
|
- peer = fc_peer_get_wwn ( node_wwn );
|
|
1746
|
+ peer = fc_peer_get_wwn ( port_wwn );
|
1747
|
1747
|
if ( ! peer )
|
1748
|
1748
|
goto err_peer_get_wwn;
|
1749
|
1749
|
|