|
@@ -1476,6 +1476,18 @@ struct fc_peer * fc_peer_get_port_id ( struct fc_port *port,
|
1476
|
1476
|
******************************************************************************
|
1477
|
1477
|
*/
|
1478
|
1478
|
|
|
1479
|
+/**
|
|
1480
|
+ * Free Fibre Channel upper-layer protocol
|
|
1481
|
+ *
|
|
1482
|
+ * @v refcnt Reference count
|
|
1483
|
+ */
|
|
1484
|
+static void fc_ulp_free ( struct refcnt *refcnt ) {
|
|
1485
|
+ struct fc_ulp *ulp = container_of ( refcnt, struct fc_ulp, refcnt );
|
|
1486
|
+
|
|
1487
|
+ fc_peer_put ( ulp->peer );
|
|
1488
|
+ free ( ulp );
|
|
1489
|
+}
|
|
1490
|
+
|
1479
|
1491
|
/**
|
1480
|
1492
|
* Close Fibre Channel upper-layer protocol
|
1481
|
1493
|
*
|
|
@@ -1499,10 +1511,6 @@ static void fc_ulp_close ( struct fc_ulp *ulp, int rc ) {
|
1499
|
1511
|
/* Remove from list of ULPs */
|
1500
|
1512
|
list_del ( &ulp->list );
|
1501
|
1513
|
INIT_LIST_HEAD ( &ulp->list );
|
1502
|
|
-
|
1503
|
|
- /* Drop peer reference */
|
1504
|
|
- fc_peer_put ( ulp->peer );
|
1505
|
|
- ulp->peer = NULL;
|
1506
|
1514
|
}
|
1507
|
1515
|
|
1508
|
1516
|
/**
|
|
@@ -1525,7 +1533,6 @@ void fc_ulp_increment ( struct fc_ulp *ulp ) {
|
1525
|
1533
|
* @v ulp Fibre Channel ulp
|
1526
|
1534
|
*/
|
1527
|
1535
|
void fc_ulp_decrement ( struct fc_ulp *ulp ) {
|
1528
|
|
- struct fc_peer *peer = ulp->peer;
|
1529
|
1536
|
|
1530
|
1537
|
/* Sanity check */
|
1531
|
1538
|
assert ( ulp->usage > 0 );
|
|
@@ -1535,7 +1542,7 @@ void fc_ulp_decrement ( struct fc_ulp *ulp ) {
|
1535
|
1542
|
fc_ulp_logout ( ulp, 0 );
|
1536
|
1543
|
|
1537
|
1544
|
/* Decrement our peer's usage count */
|
1538
|
|
- fc_peer_decrement ( peer );
|
|
1545
|
+ fc_peer_decrement ( ulp->peer );
|
1539
|
1546
|
}
|
1540
|
1547
|
|
1541
|
1548
|
/**
|
|
@@ -1702,7 +1709,7 @@ static struct fc_ulp * fc_ulp_create ( struct fc_peer *peer,
|
1702
|
1709
|
ulp = zalloc ( sizeof ( *ulp ) );
|
1703
|
1710
|
if ( ! ulp )
|
1704
|
1711
|
return NULL;
|
1705
|
|
- ref_init ( &ulp->refcnt, NULL );
|
|
1712
|
+ ref_init ( &ulp->refcnt, fc_ulp_free );
|
1706
|
1713
|
fc_link_init ( &ulp->link, fc_ulp_examine, &ulp->refcnt );
|
1707
|
1714
|
intf_init ( &ulp->prli, &fc_ulp_prli_desc, &ulp->refcnt );
|
1708
|
1715
|
ulp->peer = fc_peer_get ( peer );
|