aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2013-07-13 00:22:56 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-07-13 00:22:56 -0400
commit622f9a8e7b8043a5ea2c7d047d65ecad01fe0f97 (patch)
treeac8513cb52c074b43daba22407eb61de520afef9
parent655ee63cf3714ac0a7ebee4a7dd00fdc54b006fc (diff)
parent7a5ed75a782a1f2de7fc773981ecd88bfa7595b1 (diff)
Merge tag 'fcoe' into for-linus
A short series of fixes to libfc, libfcoe and fcoe. Most patches fix formatting problems, one changes the behavior of which discovered ports can/will be logged into and another fixes a memory leak.
-rw-r--r--drivers/scsi/fcoe/fcoe.c26
-rw-r--r--drivers/scsi/fcoe/fcoe_ctlr.c4
-rw-r--r--drivers/scsi/fcoe/fcoe_sysfs.c24
-rw-r--r--drivers/scsi/fcoe/fcoe_transport.c28
-rw-r--r--drivers/scsi/libfc/fc_exch.c4
-rw-r--r--drivers/scsi/libfc/fc_rport.c27
6 files changed, 66 insertions, 47 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 32ae6c67ea3a..3336e5754930 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -774,7 +774,6 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
774 struct fcoe_port *port; 774 struct fcoe_port *port;
775 struct net_device *realdev; 775 struct net_device *realdev;
776 int rc; 776 int rc;
777 struct netdev_fcoe_hbainfo fdmi;
778 777
779 port = lport_priv(lport); 778 port = lport_priv(lport);
780 fcoe = port->priv; 779 fcoe = port->priv;
@@ -788,9 +787,13 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
788 return; 787 return;
789 788
790 if (realdev->netdev_ops->ndo_fcoe_get_hbainfo) { 789 if (realdev->netdev_ops->ndo_fcoe_get_hbainfo) {
791 memset(&fdmi, 0, sizeof(fdmi)); 790 struct netdev_fcoe_hbainfo *fdmi;
791 fdmi = kzalloc(sizeof(*fdmi), GFP_KERNEL);
792 if (!fdmi)
793 return;
794
792 rc = realdev->netdev_ops->ndo_fcoe_get_hbainfo(realdev, 795 rc = realdev->netdev_ops->ndo_fcoe_get_hbainfo(realdev,
793 &fdmi); 796 fdmi);
794 if (rc) { 797 if (rc) {
795 printk(KERN_INFO "fcoe: Failed to retrieve FDMI " 798 printk(KERN_INFO "fcoe: Failed to retrieve FDMI "
796 "information from netdev.\n"); 799 "information from netdev.\n");
@@ -800,38 +803,39 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
800 snprintf(fc_host_serial_number(lport->host), 803 snprintf(fc_host_serial_number(lport->host),
801 FC_SERIAL_NUMBER_SIZE, 804 FC_SERIAL_NUMBER_SIZE,
802 "%s", 805 "%s",
803 fdmi.serial_number); 806 fdmi->serial_number);
804 snprintf(fc_host_manufacturer(lport->host), 807 snprintf(fc_host_manufacturer(lport->host),
805 FC_SERIAL_NUMBER_SIZE, 808 FC_SERIAL_NUMBER_SIZE,
806 "%s", 809 "%s",
807 fdmi.manufacturer); 810 fdmi->manufacturer);
808 snprintf(fc_host_model(lport->host), 811 snprintf(fc_host_model(lport->host),
809 FC_SYMBOLIC_NAME_SIZE, 812 FC_SYMBOLIC_NAME_SIZE,
810 "%s", 813 "%s",
811 fdmi.model); 814 fdmi->model);
812 snprintf(fc_host_model_description(lport->host), 815 snprintf(fc_host_model_description(lport->host),
813 FC_SYMBOLIC_NAME_SIZE, 816 FC_SYMBOLIC_NAME_SIZE,
814 "%s", 817 "%s",
815 fdmi.model_description); 818 fdmi->model_description);
816 snprintf(fc_host_hardware_version(lport->host), 819 snprintf(fc_host_hardware_version(lport->host),
817 FC_VERSION_STRING_SIZE, 820 FC_VERSION_STRING_SIZE,
818 "%s", 821 "%s",
819 fdmi.hardware_version); 822 fdmi->hardware_version);
820 snprintf(fc_host_driver_version(lport->host), 823 snprintf(fc_host_driver_version(lport->host),
821 FC_VERSION_STRING_SIZE, 824 FC_VERSION_STRING_SIZE,
822 "%s", 825 "%s",
823 fdmi.driver_version); 826 fdmi->driver_version);
824 snprintf(fc_host_optionrom_version(lport->host), 827 snprintf(fc_host_optionrom_version(lport->host),
825 FC_VERSION_STRING_SIZE, 828 FC_VERSION_STRING_SIZE,
826 "%s", 829 "%s",
827 fdmi.optionrom_version); 830 fdmi->optionrom_version);
828 snprintf(fc_host_firmware_version(lport->host), 831 snprintf(fc_host_firmware_version(lport->host),
829 FC_VERSION_STRING_SIZE, 832 FC_VERSION_STRING_SIZE,
830 "%s", 833 "%s",
831 fdmi.firmware_version); 834 fdmi->firmware_version);
832 835
833 /* Enable FDMI lport states */ 836 /* Enable FDMI lport states */
834 lport->fdmi_enabled = 1; 837 lport->fdmi_enabled = 1;
838 kfree(fdmi);
835 } else { 839 } else {
836 lport->fdmi_enabled = 0; 840 lport->fdmi_enabled = 0;
837 printk(KERN_INFO "fcoe: No FDMI support.\n"); 841 printk(KERN_INFO "fcoe: No FDMI support.\n");
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 795843dde8ec..203415e02518 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -2090,7 +2090,11 @@ static struct fc_rport_operations fcoe_ctlr_vn_rport_ops = {
2090 */ 2090 */
2091static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport) 2091static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport)
2092{ 2092{
2093 struct fc_rport_priv *rdata;
2094
2093 mutex_lock(&lport->disc.disc_mutex); 2095 mutex_lock(&lport->disc.disc_mutex);
2096 list_for_each_entry_rcu(rdata, &lport->disc.rports, peers)
2097 lport->tt.rport_logoff(rdata);
2094 lport->disc.disc_callback = NULL; 2098 lport->disc.disc_callback = NULL;
2095 mutex_unlock(&lport->disc.disc_mutex); 2099 mutex_unlock(&lport->disc.disc_mutex);
2096} 2100}
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index 8c05ae017f5b..c9382d6eee78 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -507,7 +507,7 @@ static const struct attribute_group *fcoe_fcf_attr_groups[] = {
507 NULL, 507 NULL,
508}; 508};
509 509
510struct bus_type fcoe_bus_type; 510static struct bus_type fcoe_bus_type;
511 511
512static int fcoe_bus_match(struct device *dev, 512static int fcoe_bus_match(struct device *dev,
513 struct device_driver *drv) 513 struct device_driver *drv)
@@ -541,25 +541,25 @@ static void fcoe_fcf_device_release(struct device *dev)
541 kfree(fcf); 541 kfree(fcf);
542} 542}
543 543
544struct device_type fcoe_ctlr_device_type = { 544static struct device_type fcoe_ctlr_device_type = {
545 .name = "fcoe_ctlr", 545 .name = "fcoe_ctlr",
546 .groups = fcoe_ctlr_attr_groups, 546 .groups = fcoe_ctlr_attr_groups,
547 .release = fcoe_ctlr_device_release, 547 .release = fcoe_ctlr_device_release,
548}; 548};
549 549
550struct device_type fcoe_fcf_device_type = { 550static struct device_type fcoe_fcf_device_type = {
551 .name = "fcoe_fcf", 551 .name = "fcoe_fcf",
552 .groups = fcoe_fcf_attr_groups, 552 .groups = fcoe_fcf_attr_groups,
553 .release = fcoe_fcf_device_release, 553 .release = fcoe_fcf_device_release,
554}; 554};
555 555
556struct bus_attribute fcoe_bus_attr_group[] = { 556static struct bus_attribute fcoe_bus_attr_group[] = {
557 __ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store), 557 __ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store),
558 __ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store), 558 __ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store),
559 __ATTR_NULL 559 __ATTR_NULL
560}; 560};
561 561
562struct bus_type fcoe_bus_type = { 562static struct bus_type fcoe_bus_type = {
563 .name = "fcoe", 563 .name = "fcoe",
564 .match = &fcoe_bus_match, 564 .match = &fcoe_bus_match,
565 .bus_attrs = fcoe_bus_attr_group, 565 .bus_attrs = fcoe_bus_attr_group,
@@ -569,7 +569,7 @@ struct bus_type fcoe_bus_type = {
569 * fcoe_ctlr_device_flush_work() - Flush a FIP ctlr's workqueue 569 * fcoe_ctlr_device_flush_work() - Flush a FIP ctlr's workqueue
570 * @ctlr: Pointer to the FIP ctlr whose workqueue is to be flushed 570 * @ctlr: Pointer to the FIP ctlr whose workqueue is to be flushed
571 */ 571 */
572void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr) 572static void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr)
573{ 573{
574 if (!fcoe_ctlr_work_q(ctlr)) { 574 if (!fcoe_ctlr_work_q(ctlr)) {
575 printk(KERN_ERR 575 printk(KERN_ERR
@@ -590,8 +590,8 @@ void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr)
590 * Return value: 590 * Return value:
591 * 1 on success / 0 already queued / < 0 for error 591 * 1 on success / 0 already queued / < 0 for error
592 */ 592 */
593int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr, 593static int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr,
594 struct work_struct *work) 594 struct work_struct *work)
595{ 595{
596 if (unlikely(!fcoe_ctlr_work_q(ctlr))) { 596 if (unlikely(!fcoe_ctlr_work_q(ctlr))) {
597 printk(KERN_ERR 597 printk(KERN_ERR
@@ -609,7 +609,7 @@ int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr,
609 * fcoe_ctlr_device_flush_devloss() - Flush a FIP ctlr's devloss workqueue 609 * fcoe_ctlr_device_flush_devloss() - Flush a FIP ctlr's devloss workqueue
610 * @ctlr: Pointer to FIP ctlr whose workqueue is to be flushed 610 * @ctlr: Pointer to FIP ctlr whose workqueue is to be flushed
611 */ 611 */
612void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr) 612static void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr)
613{ 613{
614 if (!fcoe_ctlr_devloss_work_q(ctlr)) { 614 if (!fcoe_ctlr_devloss_work_q(ctlr)) {
615 printk(KERN_ERR 615 printk(KERN_ERR
@@ -631,9 +631,9 @@ void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr)
631 * Return value: 631 * Return value:
632 * 1 on success / 0 already queued / < 0 for error 632 * 1 on success / 0 already queued / < 0 for error
633 */ 633 */
634int fcoe_ctlr_device_queue_devloss_work(struct fcoe_ctlr_device *ctlr, 634static int fcoe_ctlr_device_queue_devloss_work(struct fcoe_ctlr_device *ctlr,
635 struct delayed_work *work, 635 struct delayed_work *work,
636 unsigned long delay) 636 unsigned long delay)
637{ 637{
638 if (unlikely(!fcoe_ctlr_devloss_work_q(ctlr))) { 638 if (unlikely(!fcoe_ctlr_devloss_work_q(ctlr))) {
639 printk(KERN_ERR 639 printk(KERN_ERR
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index f3a5a53e8631..f1ae5edb2de1 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -180,24 +180,10 @@ void fcoe_ctlr_get_lesb(struct fcoe_ctlr_device *ctlr_dev)
180{ 180{
181 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr_dev); 181 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr_dev);
182 struct net_device *netdev = fcoe_get_netdev(fip->lp); 182 struct net_device *netdev = fcoe_get_netdev(fip->lp);
183 struct fcoe_fc_els_lesb *fcoe_lesb; 183 struct fc_els_lesb *fc_lesb;
184 struct fc_els_lesb fc_lesb; 184
185 185 fc_lesb = (struct fc_els_lesb *)(&ctlr_dev->lesb);
186 __fcoe_get_lesb(fip->lp, &fc_lesb, netdev); 186 __fcoe_get_lesb(fip->lp, fc_lesb, netdev);
187 fcoe_lesb = (struct fcoe_fc_els_lesb *)(&fc_lesb);
188
189 ctlr_dev->lesb.lesb_link_fail =
190 ntohl(fcoe_lesb->lesb_link_fail);
191 ctlr_dev->lesb.lesb_vlink_fail =
192 ntohl(fcoe_lesb->lesb_vlink_fail);
193 ctlr_dev->lesb.lesb_miss_fka =
194 ntohl(fcoe_lesb->lesb_miss_fka);
195 ctlr_dev->lesb.lesb_symb_err =
196 ntohl(fcoe_lesb->lesb_symb_err);
197 ctlr_dev->lesb.lesb_err_block =
198 ntohl(fcoe_lesb->lesb_err_block);
199 ctlr_dev->lesb.lesb_fcs_error =
200 ntohl(fcoe_lesb->lesb_fcs_error);
201} 187}
202EXPORT_SYMBOL_GPL(fcoe_ctlr_get_lesb); 188EXPORT_SYMBOL_GPL(fcoe_ctlr_get_lesb);
203 189
@@ -721,7 +707,6 @@ ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
721{ 707{
722 struct net_device *netdev = NULL; 708 struct net_device *netdev = NULL;
723 struct fcoe_transport *ft = NULL; 709 struct fcoe_transport *ft = NULL;
724 struct fcoe_ctlr_device *ctlr_dev = NULL;
725 int rc = 0; 710 int rc = 0;
726 int err; 711 int err;
727 712
@@ -768,9 +753,8 @@ ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
768 goto out_putdev; 753 goto out_putdev;
769 } 754 }
770 755
771 LIBFCOE_TRANSPORT_DBG("transport %s %s to create fcoe on %s.\n", 756 LIBFCOE_TRANSPORT_DBG("transport %s succeeded to create fcoe on %s.\n",
772 ft->name, (ctlr_dev) ? "succeeded" : "failed", 757 ft->name, netdev->name);
773 netdev->name);
774 758
775out_putdev: 759out_putdev:
776 dev_put(netdev); 760 dev_put(netdev);
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 8b928c67e4b9..587992952b3c 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -337,7 +337,7 @@ static void fc_exch_release(struct fc_exch *ep)
337 * fc_exch_timer_cancel() - cancel exch timer 337 * fc_exch_timer_cancel() - cancel exch timer
338 * @ep: The exchange whose timer to be canceled 338 * @ep: The exchange whose timer to be canceled
339 */ 339 */
340static inline void fc_exch_timer_cancel(struct fc_exch *ep) 340static inline void fc_exch_timer_cancel(struct fc_exch *ep)
341{ 341{
342 if (cancel_delayed_work(&ep->timeout_work)) { 342 if (cancel_delayed_work(&ep->timeout_work)) {
343 FC_EXCH_DBG(ep, "Exchange timer canceled\n"); 343 FC_EXCH_DBG(ep, "Exchange timer canceled\n");
@@ -1567,7 +1567,7 @@ static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp)
1567 fc_exch_rctl_name(fh->fh_r_ctl)); 1567 fc_exch_rctl_name(fh->fh_r_ctl));
1568 1568
1569 if (cancel_delayed_work_sync(&ep->timeout_work)) { 1569 if (cancel_delayed_work_sync(&ep->timeout_work)) {
1570 FC_EXCH_DBG(ep, "Exchange timer canceled\n"); 1570 FC_EXCH_DBG(ep, "Exchange timer canceled due to ABTS response\n");
1571 fc_exch_release(ep); /* release from pending timer hold */ 1571 fc_exch_release(ep); /* release from pending timer hold */
1572 } 1572 }
1573 1573
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 6bbb9447b75d..c710d908fda6 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -926,6 +926,20 @@ err:
926 kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy); 926 kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy);
927} 927}
928 928
929static bool
930fc_rport_compatible_roles(struct fc_lport *lport, struct fc_rport_priv *rdata)
931{
932 if (rdata->ids.roles == FC_PORT_ROLE_UNKNOWN)
933 return true;
934 if ((rdata->ids.roles & FC_PORT_ROLE_FCP_TARGET) &&
935 (lport->service_params & FCP_SPPF_INIT_FCN))
936 return true;
937 if ((rdata->ids.roles & FC_PORT_ROLE_FCP_INITIATOR) &&
938 (lport->service_params & FCP_SPPF_TARG_FCN))
939 return true;
940 return false;
941}
942
929/** 943/**
930 * fc_rport_enter_plogi() - Send Port Login (PLOGI) request 944 * fc_rport_enter_plogi() - Send Port Login (PLOGI) request
931 * @rdata: The remote port to send a PLOGI to 945 * @rdata: The remote port to send a PLOGI to
@@ -938,6 +952,12 @@ static void fc_rport_enter_plogi(struct fc_rport_priv *rdata)
938 struct fc_lport *lport = rdata->local_port; 952 struct fc_lport *lport = rdata->local_port;
939 struct fc_frame *fp; 953 struct fc_frame *fp;
940 954
955 if (!fc_rport_compatible_roles(lport, rdata)) {
956 FC_RPORT_DBG(rdata, "PLOGI suppressed for incompatible role\n");
957 fc_rport_state_enter(rdata, RPORT_ST_PLOGI_WAIT);
958 return;
959 }
960
941 FC_RPORT_DBG(rdata, "Port entered PLOGI state from %s state\n", 961 FC_RPORT_DBG(rdata, "Port entered PLOGI state from %s state\n",
942 fc_rport_state(rdata)); 962 fc_rport_state(rdata));
943 963
@@ -1646,6 +1666,13 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,
1646 rjt_data.explan = ELS_EXPL_NONE; 1666 rjt_data.explan = ELS_EXPL_NONE;
1647 goto reject; 1667 goto reject;
1648 } 1668 }
1669 if (!fc_rport_compatible_roles(lport, rdata)) {
1670 FC_RPORT_DBG(rdata, "Received PLOGI for incompatible role\n");
1671 mutex_unlock(&rdata->rp_mutex);
1672 rjt_data.reason = ELS_RJT_LOGIC;
1673 rjt_data.explan = ELS_EXPL_NONE;
1674 goto reject;
1675 }
1649 1676
1650 /* 1677 /*
1651 * Get session payload size from incoming PLOGI. 1678 * Get session payload size from incoming PLOGI.