aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2013-03-25 14:00:28 -0400
committerRobert Love <robert.w.love@intel.com>2013-03-25 19:04:22 -0400
commit0db0e377ab5be5d507a2fca3d78215cd2e83b974 (patch)
treeb9b6916b3806d0daa61dcc060a884f8c5881e66e /drivers/scsi
parent0807619d3c64d935c257a377ac86982c777f969c (diff)
libfcoe: Fix fcoe_sysfs VN2VN mode
The libfc discovery layer is being initialized in the 'create' paths for both legacy libfcoe module parameters and fcoe_sysfs control interfaces. The problem is that for VN2VN mode the discovery layer is initialized as if it were in 'fabric' mode and it is not re-configured when the mode is changed to 'vn2vn'. This patch splits out code that needs to be initialized once and code that can, and should be, re-configured when the mode changes. Additionally this patch makes that change so that the discovery layer can be reconfigured to the libfcoe implementation when in 'vn2vn' mode. 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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/fcoe/fcoe_ctlr.c60
1 files changed, 45 insertions, 15 deletions
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 34ee56cf4bcc..a76247201be5 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -2815,6 +2815,47 @@ unlock:
2815} 2815}
2816 2816
2817/** 2817/**
2818 * fcoe_ctlr_mode_set() - Set or reset the ctlr's mode
2819 * @lport: The local port to be (re)configured
2820 * @fip: The FCoE controller whose mode is changing
2821 * @fip_mode: The new fip mode
2822 *
2823 * Note that the we shouldn't be changing the libfc discovery settings
2824 * (fc_disc_config) while an lport is going through the libfc state
2825 * machine. The mode can only be changed when a fcoe_ctlr device is
2826 * disabled, so that should ensure that this routine is only called
2827 * when nothing is happening.
2828 */
2829void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip,
2830 enum fip_state fip_mode)
2831{
2832 void *priv;
2833
2834 WARN_ON(lport->state != LPORT_ST_RESET &&
2835 lport->state != LPORT_ST_DISABLED);
2836
2837 if (fip_mode == FIP_MODE_VN2VN) {
2838 lport->rport_priv_size = sizeof(struct fcoe_rport);
2839 lport->point_to_multipoint = 1;
2840 lport->tt.disc_recv_req = fcoe_ctlr_disc_recv;
2841 lport->tt.disc_start = fcoe_ctlr_disc_start;
2842 lport->tt.disc_stop = fcoe_ctlr_disc_stop;
2843 lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final;
2844 priv = fip;
2845 } else {
2846 lport->rport_priv_size = 0;
2847 lport->point_to_multipoint = 0;
2848 lport->tt.disc_recv_req = NULL;
2849 lport->tt.disc_start = NULL;
2850 lport->tt.disc_stop = NULL;
2851 lport->tt.disc_stop_final = NULL;
2852 priv = lport;
2853 }
2854
2855 fc_disc_config(lport, priv);
2856}
2857
2858/**
2818 * fcoe_libfc_config() - Sets up libfc related properties for local port 2859 * fcoe_libfc_config() - Sets up libfc related properties for local port
2819 * @lport: The local port to configure libfc for 2860 * @lport: The local port to configure libfc for
2820 * @fip: The FCoE controller in use by the local port 2861 * @fip: The FCoE controller in use by the local port
@@ -2826,8 +2867,6 @@ unlock:
2826int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip, 2867int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip,
2827 const struct libfc_function_template *tt, int init_fcp) 2868 const struct libfc_function_template *tt, int init_fcp)
2828{ 2869{
2829 void *priv = lport;
2830
2831 /* Set the function pointers set by the LLDD */ 2870 /* Set the function pointers set by the LLDD */
2832 memcpy(&lport->tt, tt, sizeof(*tt)); 2871 memcpy(&lport->tt, tt, sizeof(*tt));
2833 if (init_fcp && fc_fcp_init(lport)) 2872 if (init_fcp && fc_fcp_init(lport))
@@ -2835,21 +2874,9 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip,
2835 fc_exch_init(lport); 2874 fc_exch_init(lport);
2836 fc_elsct_init(lport); 2875 fc_elsct_init(lport);
2837 fc_lport_init(lport); 2876 fc_lport_init(lport);
2838 if (fip->mode == FIP_MODE_VN2VN)
2839 lport->rport_priv_size = sizeof(struct fcoe_rport);
2840 fc_rport_init(lport); 2877 fc_rport_init(lport);
2841 if (fip->mode == FIP_MODE_VN2VN) {
2842 lport->point_to_multipoint = 1;
2843 lport->tt.disc_recv_req = fcoe_ctlr_disc_recv;
2844 lport->tt.disc_start = fcoe_ctlr_disc_start;
2845 lport->tt.disc_stop = fcoe_ctlr_disc_stop;
2846 lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final;
2847 priv = fip;
2848 }
2849
2850 fc_disc_init(lport); 2878 fc_disc_init(lport);
2851 fc_disc_config(lport, priv); 2879 fcoe_ctlr_mode_set(lport, fip, fip->mode);
2852
2853 return 0; 2880 return 0;
2854} 2881}
2855EXPORT_SYMBOL_GPL(fcoe_libfc_config); 2882EXPORT_SYMBOL_GPL(fcoe_libfc_config);
@@ -2877,6 +2904,7 @@ EXPORT_SYMBOL(fcoe_fcf_get_selected);
2877void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) 2904void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev)
2878{ 2905{
2879 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); 2906 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev);
2907 struct fc_lport *lport = ctlr->lp;
2880 2908
2881 mutex_lock(&ctlr->ctlr_mutex); 2909 mutex_lock(&ctlr->ctlr_mutex);
2882 switch (ctlr_dev->mode) { 2910 switch (ctlr_dev->mode) {
@@ -2890,5 +2918,7 @@ void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev)
2890 } 2918 }
2891 2919
2892 mutex_unlock(&ctlr->ctlr_mutex); 2920 mutex_unlock(&ctlr->ctlr_mutex);
2921
2922 fcoe_ctlr_mode_set(lport, ctlr, ctlr->mode);
2893} 2923}
2894EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); 2924EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode);