Explorar el Código

[fc] Use port WWN rather than node WWN as the primary Fibre Channel name

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown hace 14 años
padre
commit
60b690141e
Se han modificado 4 ficheros con 41 adiciones y 42 borrados
  1. 4
    4
      src/include/ipxe/fc.h
  2. 31
    31
      src/net/fc.c
  3. 1
    1
      src/net/fcels.c
  4. 5
    6
      src/usr/fcmgmt.c

+ 4
- 4
src/include/ipxe/fc.h Ver fichero

@@ -335,8 +335,8 @@ struct fc_peer {
335 335
 	/** List of all peers */
336 336
 	struct list_head list;
337 337
 
338
-	/** Node name */
339
-	struct fc_name node_wwn;
338
+	/** Port name */
339
+	struct fc_name port_wwn;
340 340
 
341 341
 	/** Link state monitor */
342 342
 	struct fc_link_state link;
@@ -377,7 +377,7 @@ fc_peer_put ( struct fc_peer *peer ) {
377 377
 
378 378
 extern struct list_head fc_peers;
379 379
 
380
-extern struct fc_peer * fc_peer_get_wwn ( const struct fc_name *node_wwn );
380
+extern struct fc_peer * fc_peer_get_wwn ( const struct fc_name *port_wwn );
381 381
 extern struct fc_peer *
382 382
 fc_peer_get_port_id ( struct fc_port *port,
383 383
 		      const struct fc_port_id *peer_port_id );
@@ -448,7 +448,7 @@ fc_ulp_put ( struct fc_ulp *ulp ) {
448 448
 	ref_put ( &ulp->refcnt );
449 449
 }
450 450
 
451
-extern struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *node_wwn,
451
+extern struct fc_ulp * fc_ulp_get_wwn_type ( const struct fc_name *port_wwn,
452 452
 					     unsigned int type );
453 453
 extern struct fc_ulp *
454 454
 fc_ulp_get_port_id_type ( struct fc_port *port,

+ 31
- 31
src/net/fc.c Ver fichero

@@ -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
 

+ 1
- 1
src/net/fcels.c Ver fichero

@@ -677,7 +677,7 @@ static int fc_els_plogi_rx ( struct fc_els *els, const void *data,
677 677
 	       fc_id_ntoa ( &els->peer_port_id ) );
678 678
 
679 679
 	/* Get peer */
680
-	peer = fc_peer_get_wwn ( &plogi->node_wwn );
680
+	peer = fc_peer_get_wwn ( &plogi->port_wwn );
681 681
 	if ( ! peer ) {
682 682
 		DBGC ( els, FCELS_FMT " could not create peer\n",
683 683
 		       FCELS_ARGS ( els ) );

+ 5
- 6
src/usr/fcmgmt.c Ver fichero

@@ -38,19 +38,18 @@ FILE_LICENCE ( GPL2_OR_LATER );
38 38
  * @v port		Fibre Channel port
39 39
  */
40 40
 void fcportstat ( struct fc_port *port ) {
41
-	printf ( "%s: %s", port->name, fc_ntoa ( &port->node_wwn ) );
42
-	printf ( " port %s id %s\n  [Link:", fc_ntoa ( &port->port_wwn ),
41
+	printf ( "%s: %s id %s", port->name, fc_ntoa ( &port->port_wwn ),
43 42
 		 fc_id_ntoa ( &port->port_id ) );
43
+	printf ( " node %s\n  [Link:", fc_ntoa ( &port->node_wwn ) );
44 44
 	if ( fc_link_ok ( &port->link ) ) {
45
-		printf ( " up, %s", fc_ntoa ( &port->link_node_wwn ) );
46
-		printf ( " port %s", fc_ntoa ( &port->link_port_wwn ) );
45
+		printf ( " up, %s", fc_ntoa ( &port->link_port_wwn ) );
47 46
 		if ( ( port->flags & FC_PORT_HAS_FABRIC ) ) {
48 47
 			printf ( " fabric" );
49 48
 		} else {
50 49
 			printf ( " id %s",
51 50
 				 fc_id_ntoa ( &port->ptp_link_port_id ) );
52 51
 		}
53
-		printf ( "]\n" );
52
+		printf ( " node %s]\n", fc_ntoa ( &port->link_node_wwn ) );
54 53
 	} else {
55 54
 		printf ( " down: %s]\n", strerror ( port->link.rc ) );
56 55
 	}
@@ -66,7 +65,7 @@ void fcpeerstat ( struct fc_peer *peer ) {
66 65
 	uint8_t *param;
67 66
 	unsigned int i;
68 67
 
69
-	printf ( "%s:\n  [Link:", fc_ntoa ( &peer->node_wwn ) );
68
+	printf ( "%s:\n  [Link:", fc_ntoa ( &peer->port_wwn ) );
70 69
 	if ( fc_link_ok ( &peer->link ) ) {
71 70
 		printf ( " up, port %s id %s]\n", peer->port->name,
72 71
 			 fc_id_ntoa ( &peer->port_id ) );

Loading…
Cancelar
Guardar