diff options
author | Robert Love <robert.w.love@intel.com> | 2012-02-10 20:18:46 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-19 10:25:41 -0500 |
commit | 1a8ef414d97bf3f293e286f02002f8db768f9867 (patch) | |
tree | 2df0c754ecedb356bd1fc574eed71b6490c4b8f0 /drivers/scsi/fcoe | |
parent | ccefd23ed2d683ad3c0282280e6e6d0b163ad041 (diff) |
[SCSI] fcoe: Remove reference counting on 'stuct fcoe_interface'
The reference counting was necessary on these instances
because it was possible for NPIV ports to be destroyed
after the N_Port. A previous patch ensures that all NPIV
ports are destroyed before the N_Port making the need to
track references on the interface unnecessary.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/fcoe')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 48 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe.h | 3 |
2 files changed, 5 insertions, 46 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 5126685ab982..278958157e24 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -384,7 +384,6 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev, | |||
384 | } | 384 | } |
385 | 385 | ||
386 | dev_hold(netdev); | 386 | dev_hold(netdev); |
387 | kref_init(&fcoe->kref); | ||
388 | 387 | ||
389 | /* | 388 | /* |
390 | * Initialize FIP. | 389 | * Initialize FIP. |
@@ -412,42 +411,6 @@ out: | |||
412 | } | 411 | } |
413 | 412 | ||
414 | /** | 413 | /** |
415 | * fcoe_interface_release() - fcoe_port kref release function | ||
416 | * @kref: Embedded reference count in an fcoe_interface struct | ||
417 | */ | ||
418 | static void fcoe_interface_release(struct kref *kref) | ||
419 | { | ||
420 | struct fcoe_interface *fcoe; | ||
421 | struct net_device *netdev; | ||
422 | |||
423 | fcoe = container_of(kref, struct fcoe_interface, kref); | ||
424 | netdev = fcoe->netdev; | ||
425 | /* tear-down the FCoE controller */ | ||
426 | fcoe_ctlr_destroy(&fcoe->ctlr); | ||
427 | kfree(fcoe); | ||
428 | dev_put(netdev); | ||
429 | module_put(THIS_MODULE); | ||
430 | } | ||
431 | |||
432 | /** | ||
433 | * fcoe_interface_get() - Get a reference to a FCoE interface | ||
434 | * @fcoe: The FCoE interface to be held | ||
435 | */ | ||
436 | static inline void fcoe_interface_get(struct fcoe_interface *fcoe) | ||
437 | { | ||
438 | kref_get(&fcoe->kref); | ||
439 | } | ||
440 | |||
441 | /** | ||
442 | * fcoe_interface_put() - Put a reference to a FCoE interface | ||
443 | * @fcoe: The FCoE interface to be released | ||
444 | */ | ||
445 | static inline void fcoe_interface_put(struct fcoe_interface *fcoe) | ||
446 | { | ||
447 | kref_put(&fcoe->kref, fcoe_interface_release); | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * fcoe_interface_cleanup() - Clean up a FCoE interface | 414 | * fcoe_interface_cleanup() - Clean up a FCoE interface |
452 | * @fcoe: The FCoE interface to be cleaned up | 415 | * @fcoe: The FCoE interface to be cleaned up |
453 | * | 416 | * |
@@ -494,7 +457,11 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
494 | rtnl_unlock(); | 457 | rtnl_unlock(); |
495 | 458 | ||
496 | /* Release the self-reference taken during fcoe_interface_create() */ | 459 | /* Release the self-reference taken during fcoe_interface_create() */ |
497 | fcoe_interface_put(fcoe); | 460 | /* tear-down the FCoE controller */ |
461 | fcoe_ctlr_destroy(fip); | ||
462 | kfree(fcoe); | ||
463 | dev_put(netdev); | ||
464 | module_put(THIS_MODULE); | ||
498 | } | 465 | } |
499 | 466 | ||
500 | /** | 467 | /** |
@@ -976,9 +943,6 @@ static void fcoe_if_destroy(struct fc_lport *lport) | |||
976 | dev_uc_del(netdev, port->data_src_addr); | 943 | dev_uc_del(netdev, port->data_src_addr); |
977 | rtnl_unlock(); | 944 | rtnl_unlock(); |
978 | 945 | ||
979 | /* Release reference held in fcoe_if_create() */ | ||
980 | fcoe_interface_put(fcoe); | ||
981 | |||
982 | /* Free queued packets for the per-CPU receive threads */ | 946 | /* Free queued packets for the per-CPU receive threads */ |
983 | fcoe_percpu_clean(lport); | 947 | fcoe_percpu_clean(lport); |
984 | 948 | ||
@@ -1168,7 +1132,6 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe, | |||
1168 | goto out_lp_destroy; | 1132 | goto out_lp_destroy; |
1169 | } | 1133 | } |
1170 | 1134 | ||
1171 | fcoe_interface_get(fcoe); | ||
1172 | return lport; | 1135 | return lport; |
1173 | 1136 | ||
1174 | out_lp_destroy: | 1137 | out_lp_destroy: |
@@ -2113,7 +2076,6 @@ static void fcoe_destroy_work(struct work_struct *work) | |||
2113 | 2076 | ||
2114 | fcoe = port->priv; | 2077 | fcoe = port->priv; |
2115 | fcoe_if_destroy(port->lport); | 2078 | fcoe_if_destroy(port->lport); |
2116 | |||
2117 | fcoe_interface_cleanup(fcoe); | 2079 | fcoe_interface_cleanup(fcoe); |
2118 | 2080 | ||
2119 | mutex_unlock(&fcoe_config_mutex); | 2081 | mutex_unlock(&fcoe_config_mutex); |
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h index bcc89e639495..3c2733a12aa1 100644 --- a/drivers/scsi/fcoe/fcoe.h +++ b/drivers/scsi/fcoe/fcoe.h | |||
@@ -71,8 +71,6 @@ do { \ | |||
71 | * @ctlr: The FCoE controller (for FIP) | 71 | * @ctlr: The FCoE controller (for FIP) |
72 | * @oem: The offload exchange manager for all local port | 72 | * @oem: The offload exchange manager for all local port |
73 | * instances associated with this port | 73 | * instances associated with this port |
74 | * @kref: The kernel reference | ||
75 | * | ||
76 | * This structure is 1:1 with a net devive. | 74 | * This structure is 1:1 with a net devive. |
77 | */ | 75 | */ |
78 | struct fcoe_interface { | 76 | struct fcoe_interface { |
@@ -83,7 +81,6 @@ struct fcoe_interface { | |||
83 | struct packet_type fip_packet_type; | 81 | struct packet_type fip_packet_type; |
84 | struct fcoe_ctlr ctlr; | 82 | struct fcoe_ctlr ctlr; |
85 | struct fc_exch_mgr *oem; | 83 | struct fc_exch_mgr *oem; |
86 | struct kref kref; | ||
87 | }; | 84 | }; |
88 | 85 | ||
89 | #define fcoe_from_ctlr(fip) container_of(fip, struct fcoe_interface, ctlr) | 86 | #define fcoe_from_ctlr(fip) container_of(fip, struct fcoe_interface, ctlr) |