Commit 8a9a71381208b2364a2d12b0d257ae333917a1bc
1 parent
f9c4358edb
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
libfc, fcoe, bnx2fc: Always use fcoe_disc_init for discovery layer initialization
Currently libfcoe is doing some libfc discovery layer initialization outside of libfc. This patch moves this code into libfc and sets up a split in discovery (one time) initialization code and (re-configurable) settings that will come in the next patch. Signed-off-by: Robert Love <robert.w.love@intel.com> Tested-by: Jack Morgan <jack.morgan@intel.com> Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Showing 4 changed files with 11 additions and 9 deletions Side-by-side Diff
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
drivers/scsi/fcoe/fcoe_ctlr.c
... | ... | @@ -2826,6 +2826,8 @@ |
2826 | 2826 | int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip, |
2827 | 2827 | const struct libfc_function_template *tt, int init_fcp) |
2828 | 2828 | { |
2829 | + void *priv = lport; | |
2830 | + | |
2829 | 2831 | /* Set the function pointers set by the LLDD */ |
2830 | 2832 | memcpy(&lport->tt, tt, sizeof(*tt)); |
2831 | 2833 | if (init_fcp && fc_fcp_init(lport)) |
2832 | 2834 | |
... | ... | @@ -2842,12 +2844,11 @@ |
2842 | 2844 | lport->tt.disc_start = fcoe_ctlr_disc_start; |
2843 | 2845 | lport->tt.disc_stop = fcoe_ctlr_disc_stop; |
2844 | 2846 | lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final; |
2845 | - mutex_init(&lport->disc.disc_mutex); | |
2846 | - INIT_LIST_HEAD(&lport->disc.rports); | |
2847 | - lport->disc.priv = fip; | |
2848 | - } else { | |
2849 | - fc_disc_init(lport); | |
2847 | + priv = fip; | |
2850 | 2848 | } |
2849 | + | |
2850 | + fc_disc_init(lport, priv); | |
2851 | + | |
2851 | 2852 | return 0; |
2852 | 2853 | } |
2853 | 2854 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); |
drivers/scsi/libfc/fc_disc.c
... | ... | @@ -714,8 +714,9 @@ |
714 | 714 | /** |
715 | 715 | * fc_disc_init() - Initialize the discovery layer for a local port |
716 | 716 | * @lport: The local port that needs the discovery layer to be initialized |
717 | + * @priv: Private data structre for users of the discovery layer | |
717 | 718 | */ |
718 | -int fc_disc_init(struct fc_lport *lport) | |
719 | +int fc_disc_init(struct fc_lport *lport, void *priv) | |
719 | 720 | { |
720 | 721 | struct fc_disc *disc; |
721 | 722 | |
... | ... | @@ -736,7 +737,7 @@ |
736 | 737 | mutex_init(&disc->disc_mutex); |
737 | 738 | INIT_LIST_HEAD(&disc->rports); |
738 | 739 | |
739 | - disc->priv = lport; | |
740 | + disc->priv = priv; | |
740 | 741 | |
741 | 742 | return 0; |
742 | 743 | } |
include/scsi/libfc.h
... | ... | @@ -1074,7 +1074,7 @@ |
1074 | 1074 | /* |
1075 | 1075 | * DISCOVERY LAYER |
1076 | 1076 | *****************************/ |
1077 | -int fc_disc_init(struct fc_lport *); | |
1077 | +int fc_disc_init(struct fc_lport *, void *); | |
1078 | 1078 | |
1079 | 1079 | static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc) |
1080 | 1080 | { |