diff options
author | David S. Miller <davem@davemloft.net> | 2013-04-03 01:31:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-03 01:31:54 -0400 |
commit | d66248326410ed0d3e813ebe974b3e6638df0717 (patch) | |
tree | a1dbe86f5540596a70c6f3b9aab051d37f37daf5 /drivers/scsi | |
parent | 8facd5fb73c6e960555e5913743dfbb6c3d984a5 (diff) | |
parent | da241efcd9c3da2af6ba20055c7e158ec725005c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull net into net-next to get the synchronize_net() bug fix in
bonding.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 15 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe_ctlr.c | 60 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_disc.c | 26 |
4 files changed, 78 insertions, 29 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 2daf4b0da434..90bc7bd00966 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -940,6 +940,7 @@ static int bnx2fc_libfc_config(struct fc_lport *lport) | |||
940 | fc_exch_init(lport); | 940 | fc_exch_init(lport); |
941 | fc_rport_init(lport); | 941 | fc_rport_init(lport); |
942 | fc_disc_init(lport); | 942 | fc_disc_init(lport); |
943 | fc_disc_config(lport, lport); | ||
943 | return 0; | 944 | return 0; |
944 | } | 945 | } |
945 | 946 | ||
@@ -2133,6 +2134,7 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2133 | } | 2134 | } |
2134 | 2135 | ||
2135 | ctlr = bnx2fc_to_ctlr(interface); | 2136 | ctlr = bnx2fc_to_ctlr(interface); |
2137 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2136 | interface->vlan_id = vlan_id; | 2138 | interface->vlan_id = vlan_id; |
2137 | 2139 | ||
2138 | interface->timer_work_queue = | 2140 | interface->timer_work_queue = |
@@ -2143,7 +2145,7 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2143 | goto ifput_err; | 2145 | goto ifput_err; |
2144 | } | 2146 | } |
2145 | 2147 | ||
2146 | lport = bnx2fc_if_create(interface, &interface->hba->pcidev->dev, 0); | 2148 | lport = bnx2fc_if_create(interface, &cdev->dev, 0); |
2147 | if (!lport) { | 2149 | if (!lport) { |
2148 | printk(KERN_ERR PFX "Failed to create interface (%s)\n", | 2150 | printk(KERN_ERR PFX "Failed to create interface (%s)\n", |
2149 | netdev->name); | 2151 | netdev->name); |
@@ -2159,8 +2161,6 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2159 | /* Make this master N_port */ | 2161 | /* Make this master N_port */ |
2160 | ctlr->lp = lport; | 2162 | ctlr->lp = lport; |
2161 | 2163 | ||
2162 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2163 | |||
2164 | if (link_state == BNX2FC_CREATE_LINK_UP) | 2164 | if (link_state == BNX2FC_CREATE_LINK_UP) |
2165 | cdev->enabled = FCOE_CTLR_ENABLED; | 2165 | cdev->enabled = FCOE_CTLR_ENABLED; |
2166 | else | 2166 | else |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index b5d92fc93c70..9bfdc9a3f897 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -490,7 +490,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
490 | { | 490 | { |
491 | struct net_device *netdev = fcoe->netdev; | 491 | struct net_device *netdev = fcoe->netdev; |
492 | struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe); | 492 | struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe); |
493 | struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); | ||
494 | 493 | ||
495 | rtnl_lock(); | 494 | rtnl_lock(); |
496 | if (!fcoe->removed) | 495 | if (!fcoe->removed) |
@@ -501,7 +500,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
501 | /* tear-down the FCoE controller */ | 500 | /* tear-down the FCoE controller */ |
502 | fcoe_ctlr_destroy(fip); | 501 | fcoe_ctlr_destroy(fip); |
503 | scsi_host_put(fip->lp->host); | 502 | scsi_host_put(fip->lp->host); |
504 | fcoe_ctlr_device_delete(ctlr_dev); | ||
505 | dev_put(netdev); | 503 | dev_put(netdev); |
506 | module_put(THIS_MODULE); | 504 | module_put(THIS_MODULE); |
507 | } | 505 | } |
@@ -2194,6 +2192,8 @@ out_nodev: | |||
2194 | */ | 2192 | */ |
2195 | static void fcoe_destroy_work(struct work_struct *work) | 2193 | static void fcoe_destroy_work(struct work_struct *work) |
2196 | { | 2194 | { |
2195 | struct fcoe_ctlr_device *cdev; | ||
2196 | struct fcoe_ctlr *ctlr; | ||
2197 | struct fcoe_port *port; | 2197 | struct fcoe_port *port; |
2198 | struct fcoe_interface *fcoe; | 2198 | struct fcoe_interface *fcoe; |
2199 | struct Scsi_Host *shost; | 2199 | struct Scsi_Host *shost; |
@@ -2224,10 +2224,15 @@ static void fcoe_destroy_work(struct work_struct *work) | |||
2224 | mutex_lock(&fcoe_config_mutex); | 2224 | mutex_lock(&fcoe_config_mutex); |
2225 | 2225 | ||
2226 | fcoe = port->priv; | 2226 | fcoe = port->priv; |
2227 | ctlr = fcoe_to_ctlr(fcoe); | ||
2228 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2229 | |||
2227 | fcoe_if_destroy(port->lport); | 2230 | fcoe_if_destroy(port->lport); |
2228 | fcoe_interface_cleanup(fcoe); | 2231 | fcoe_interface_cleanup(fcoe); |
2229 | 2232 | ||
2230 | mutex_unlock(&fcoe_config_mutex); | 2233 | mutex_unlock(&fcoe_config_mutex); |
2234 | |||
2235 | fcoe_ctlr_device_delete(cdev); | ||
2231 | } | 2236 | } |
2232 | 2237 | ||
2233 | /** | 2238 | /** |
@@ -2335,7 +2340,9 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode, | |||
2335 | rc = -EIO; | 2340 | rc = -EIO; |
2336 | rtnl_unlock(); | 2341 | rtnl_unlock(); |
2337 | fcoe_interface_cleanup(fcoe); | 2342 | fcoe_interface_cleanup(fcoe); |
2338 | goto out_nortnl; | 2343 | mutex_unlock(&fcoe_config_mutex); |
2344 | fcoe_ctlr_device_delete(ctlr_dev); | ||
2345 | goto out; | ||
2339 | } | 2346 | } |
2340 | 2347 | ||
2341 | /* Make this the "master" N_Port */ | 2348 | /* Make this the "master" N_Port */ |
@@ -2375,8 +2382,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode, | |||
2375 | 2382 | ||
2376 | out_nodev: | 2383 | out_nodev: |
2377 | rtnl_unlock(); | 2384 | rtnl_unlock(); |
2378 | out_nortnl: | ||
2379 | mutex_unlock(&fcoe_config_mutex); | 2385 | mutex_unlock(&fcoe_config_mutex); |
2386 | out: | ||
2380 | return rc; | 2387 | return rc; |
2381 | } | 2388 | } |
2382 | 2389 | ||
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index 08c3bc398da2..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 | */ | ||
2829 | void 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 |
@@ -2833,21 +2874,9 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip, | |||
2833 | fc_exch_init(lport); | 2874 | fc_exch_init(lport); |
2834 | fc_elsct_init(lport); | 2875 | fc_elsct_init(lport); |
2835 | fc_lport_init(lport); | 2876 | fc_lport_init(lport); |
2836 | if (fip->mode == FIP_MODE_VN2VN) | ||
2837 | lport->rport_priv_size = sizeof(struct fcoe_rport); | ||
2838 | fc_rport_init(lport); | 2877 | fc_rport_init(lport); |
2839 | if (fip->mode == FIP_MODE_VN2VN) { | 2878 | fc_disc_init(lport); |
2840 | lport->point_to_multipoint = 1; | 2879 | fcoe_ctlr_mode_set(lport, fip, fip->mode); |
2841 | lport->tt.disc_recv_req = fcoe_ctlr_disc_recv; | ||
2842 | lport->tt.disc_start = fcoe_ctlr_disc_start; | ||
2843 | lport->tt.disc_stop = fcoe_ctlr_disc_stop; | ||
2844 | 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); | ||
2850 | } | ||
2851 | return 0; | 2880 | return 0; |
2852 | } | 2881 | } |
2853 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); | 2882 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); |
@@ -2875,6 +2904,7 @@ EXPORT_SYMBOL(fcoe_fcf_get_selected); | |||
2875 | void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) | 2904 | void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) |
2876 | { | 2905 | { |
2877 | 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; | ||
2878 | 2908 | ||
2879 | mutex_lock(&ctlr->ctlr_mutex); | 2909 | mutex_lock(&ctlr->ctlr_mutex); |
2880 | switch (ctlr_dev->mode) { | 2910 | switch (ctlr_dev->mode) { |
@@ -2888,5 +2918,7 @@ void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) | |||
2888 | } | 2918 | } |
2889 | 2919 | ||
2890 | mutex_unlock(&ctlr->ctlr_mutex); | 2920 | mutex_unlock(&ctlr->ctlr_mutex); |
2921 | |||
2922 | fcoe_ctlr_mode_set(lport, ctlr, ctlr->mode); | ||
2891 | } | 2923 | } |
2892 | EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); | 2924 | EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); |
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 8e561e6a557c..880a9068ca12 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -712,12 +712,13 @@ static void fc_disc_stop_final(struct fc_lport *lport) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | /** | 714 | /** |
715 | * fc_disc_init() - Initialize the discovery layer for a local port | 715 | * fc_disc_config() - Configure the discovery layer for a local port |
716 | * @lport: The local port that needs the discovery layer to be initialized | 716 | * @lport: The local port that needs the discovery layer to be configured |
717 | * @priv: Private data structre for users of the discovery layer | ||
717 | */ | 718 | */ |
718 | int fc_disc_init(struct fc_lport *lport) | 719 | void fc_disc_config(struct fc_lport *lport, void *priv) |
719 | { | 720 | { |
720 | struct fc_disc *disc; | 721 | struct fc_disc *disc = &lport->disc; |
721 | 722 | ||
722 | if (!lport->tt.disc_start) | 723 | if (!lport->tt.disc_start) |
723 | lport->tt.disc_start = fc_disc_start; | 724 | lport->tt.disc_start = fc_disc_start; |
@@ -732,12 +733,21 @@ int fc_disc_init(struct fc_lport *lport) | |||
732 | lport->tt.disc_recv_req = fc_disc_recv_req; | 733 | lport->tt.disc_recv_req = fc_disc_recv_req; |
733 | 734 | ||
734 | disc = &lport->disc; | 735 | disc = &lport->disc; |
736 | |||
737 | disc->priv = priv; | ||
738 | } | ||
739 | EXPORT_SYMBOL(fc_disc_config); | ||
740 | |||
741 | /** | ||
742 | * fc_disc_init() - Initialize the discovery layer for a local port | ||
743 | * @lport: The local port that needs the discovery layer to be initialized | ||
744 | */ | ||
745 | void fc_disc_init(struct fc_lport *lport) | ||
746 | { | ||
747 | struct fc_disc *disc = &lport->disc; | ||
748 | |||
735 | INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); | 749 | INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); |
736 | mutex_init(&disc->disc_mutex); | 750 | mutex_init(&disc->disc_mutex); |
737 | INIT_LIST_HEAD(&disc->rports); | 751 | INIT_LIST_HEAD(&disc->rports); |
738 | |||
739 | disc->priv = lport; | ||
740 | |||
741 | return 0; | ||
742 | } | 752 | } |
743 | EXPORT_SYMBOL(fc_disc_init); | 753 | EXPORT_SYMBOL(fc_disc_init); |