aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2010-07-20 18:19:58 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:05:52 -0400
commit3d902ac09a2812b359edf633425d1327a18399e9 (patch)
tree188605c45a1502862610b03e8429a67ed3d3a7b7
parent0685230c59b5482e04ab50e7afc51119ceaba651 (diff)
[SCSI] libfcoe: fcoe: fnic: change fcoe_ctlr_init interface to specify mode
There are three modes that libfcoe currently supports, and a new one is coming. Change the fcoe_ctlr_init() interface to add the mode desired. This should not change any functionality. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/fcoe/fcoe.c2
-rw-r--r--drivers/scsi/fcoe/libfcoe.c4
-rw-r--r--drivers/scsi/fnic/fnic_main.c4
-rw-r--r--include/scsi/libfcoe.h11
4 files changed, 15 insertions, 6 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index a120962b25b8..9d64e08305c7 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -357,7 +357,7 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev)
357 /* 357 /*
358 * Initialize FIP. 358 * Initialize FIP.
359 */ 359 */
360 fcoe_ctlr_init(&fcoe->ctlr); 360 fcoe_ctlr_init(&fcoe->ctlr, FIP_MODE_AUTO);
361 fcoe->ctlr.send = fcoe_fip_send; 361 fcoe->ctlr.send = fcoe_fip_send;
362 fcoe->ctlr.update_mac = fcoe_update_src_mac; 362 fcoe->ctlr.update_mac = fcoe_update_src_mac;
363 fcoe->ctlr.get_src_addr = fcoe_get_src_mac; 363 fcoe->ctlr.get_src_addr = fcoe_get_src_mac;
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index e510888e78ca..76056e4c9297 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -108,10 +108,10 @@ static inline int fcoe_ctlr_fcf_usable(struct fcoe_fcf *fcf)
108 * fcoe_ctlr_init() - Initialize the FCoE Controller instance 108 * fcoe_ctlr_init() - Initialize the FCoE Controller instance
109 * @fip: The FCoE controller to initialize 109 * @fip: The FCoE controller to initialize
110 */ 110 */
111void fcoe_ctlr_init(struct fcoe_ctlr *fip) 111void fcoe_ctlr_init(struct fcoe_ctlr *fip, enum fip_state mode)
112{ 112{
113 fip->state = FIP_ST_LINK_WAIT; 113 fip->state = FIP_ST_LINK_WAIT;
114 fip->mode = FIP_ST_AUTO; 114 fip->mode = mode;
115 INIT_LIST_HEAD(&fip->fcfs); 115 INIT_LIST_HEAD(&fip->fcfs);
116 mutex_init(&fip->ctlr_mutex); 116 mutex_init(&fip->ctlr_mutex);
117 fip->flogi_oxid = FC_XID_UNKNOWN; 117 fip->flogi_oxid = FC_XID_UNKNOWN;
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 265e73d9cd6f..d0fe1c3345b8 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -617,7 +617,6 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
617 fnic->ctlr.send = fnic_eth_send; 617 fnic->ctlr.send = fnic_eth_send;
618 fnic->ctlr.update_mac = fnic_update_mac; 618 fnic->ctlr.update_mac = fnic_update_mac;
619 fnic->ctlr.get_src_addr = fnic_get_mac; 619 fnic->ctlr.get_src_addr = fnic_get_mac;
620 fcoe_ctlr_init(&fnic->ctlr);
621 if (fnic->config.flags & VFCF_FIP_CAPABLE) { 620 if (fnic->config.flags & VFCF_FIP_CAPABLE) {
622 shost_printk(KERN_INFO, fnic->lport->host, 621 shost_printk(KERN_INFO, fnic->lport->host,
623 "firmware supports FIP\n"); 622 "firmware supports FIP\n");
@@ -625,10 +624,11 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
625 vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0); 624 vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0);
626 vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS); 625 vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS);
627 vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr); 626 vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr);
627 fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_AUTO);
628 } else { 628 } else {
629 shost_printk(KERN_INFO, fnic->lport->host, 629 shost_printk(KERN_INFO, fnic->lport->host,
630 "firmware uses non-FIP mode\n"); 630 "firmware uses non-FIP mode\n");
631 fnic->ctlr.mode = FIP_ST_NON_FIP; 631 fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_NON_FIP);
632 } 632 }
633 fnic->state = FNIC_IN_FC_MODE; 633 fnic->state = FNIC_IN_FC_MODE;
634 634
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 7d18b500f2c1..1a84a3182da0 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -54,6 +54,15 @@ enum fip_state {
54 FIP_ST_ENABLED, 54 FIP_ST_ENABLED,
55}; 55};
56 56
57/*
58 * Modes:
59 * The mode is the state that is to be entered after link up.
60 * It must not change after fcoe_ctlr_init() sets it.
61 */
62#define FIP_MODE_AUTO FIP_ST_AUTO
63#define FIP_MODE_NON_FIP FIP_ST_NON_FIP
64#define FIP_MODE_FABRIC FIP_ST_ENABLED
65
57/** 66/**
58 * struct fcoe_ctlr - FCoE Controller and FIP state 67 * struct fcoe_ctlr - FCoE Controller and FIP state
59 * @state: internal FIP state for network link and FIP or non-FIP mode. 68 * @state: internal FIP state for network link and FIP or non-FIP mode.
@@ -152,7 +161,7 @@ struct fcoe_fcf {
152}; 161};
153 162
154/* FIP API functions */ 163/* FIP API functions */
155void fcoe_ctlr_init(struct fcoe_ctlr *); 164void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state);
156void fcoe_ctlr_destroy(struct fcoe_ctlr *); 165void fcoe_ctlr_destroy(struct fcoe_ctlr *);
157void fcoe_ctlr_link_up(struct fcoe_ctlr *); 166void fcoe_ctlr_link_up(struct fcoe_ctlr *);
158int fcoe_ctlr_link_down(struct fcoe_ctlr *); 167int fcoe_ctlr_link_down(struct fcoe_ctlr *);