Skip to contentSkip to conversation

Open-FCoE.org libfc and fcoe updates for scsi-misc

PATCH New Yi Zou 1 participant 5 messages Oct 28, 2011

Subsystems (2)
lore
Share & tools
lore

Yi Zou

author
#0 lore raw

cover Open-FCoE.org libfc and fcoe updates for scsi-misc

This series consists of updates for the libfc and fcoe modules. These patches are directly applicable to latest tip of Linus's tree and I expect to be applied cleanly on scsi-misc as well.

thanks,
yi

---

Michael Chan (1):
drivers/firmware/edd: Treat "XPRS" host bus type the same as "PCI"

Vasu Dev (3):
libfc: improve flogi retries to avoid lport stuck
libfc: avoid exchanges collision during lport reset
libfc: fix checking FC_TYPE_BLS

 drivers/firmware/edd.c        |    6 +-
 drivers/scsi/fcoe/fcoe.c      |   13 ++---
 drivers/scsi/libfc/fc_exch.c  |    7 ++-
 drivers/scsi/libfc/fc_lport.c |  100 +++++++++++++++++++++--------------------
 4 files changed, 64 insertions(+), 62 deletions(-)
Signature · 1 line
Signature: Yi Zou <[email protected]>
author
#1 lore raw

PATCH 1/4 drivers/firmware/edd: Treat "XPRS" host bus type the same as "PCI"

From: Michael Chan <[email protected]>

PCI Express devices will return "XPRS" host bus type during BIOS EDD call. "XPRS" should be treated just like "PCI" so that the proper pci_dev symlink will be created. Scripts such as fcoe_edd.sh will then work correctly.

---

 drivers/firmware/edd.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/edd.c +3 -3
index f1b7f65..e229576 100644
@@ -151,7 +151,8 @@ edd_show_host_bus(struct edd_device *edev, char *buf)
 		p += scnprintf(p, left, "\tbase_address: %x\n",
 			     info->params.interface_path.isa.base_address);
 	} else if (!strncmp(info->params.host_bus_type, "PCIX", 4) ||
-		   !strncmp(info->params.host_bus_type, "PCI", 3)) {
+		   !strncmp(info->params.host_bus_type, "PCI", 3) ||
+		   !strncmp(info->params.host_bus_type, "XPRS", 4)) {
 		p += scnprintf(p, left,
 			     "\t%02x:%02x.%d  channel: %u\n",
 			     info->params.interface_path.pci.bus,
@@ -159,7 +160,6 @@ edd_show_host_bus(struct edd_device *edev, char *buf)
 			     info->params.interface_path.pci.function,
 			     info->params.interface_path.pci.channel);
 	} else if (!strncmp(info->params.host_bus_type, "IBND", 4) ||
-		   !strncmp(info->params.host_bus_type, "XPRS", 4) ||
 		   !strncmp(info->params.host_bus_type, "HTPT", 4)) {
 		p += scnprintf(p, left,
 			     "\tTBD: %llx\n",
@@ -668,7 +668,7 @@ edd_get_pci_dev(struct edd_device *edev)
 {
 	struct edd_info *info = edd_dev_get_info(edev);
 
-	if (edd_dev_is_type(edev, "PCI")) {
+	if (edd_dev_is_type(edev, "PCI") || edd_dev_is_type(edev, "XPRS")) {
 		return pci_get_bus_and_slot(info->params.interface_path.pci.bus,
 				     PCI_DEVFN(info->params.interface_path.pci.slot,
 					       info->params.interface_path.pci.
author
#2 lore raw

PATCH 2/4 libfc: fix checking FC_TYPE_BLS

In reply to Yi Zou

From: Vasu Dev <[email protected]>

Its checked after skb freed, so instead have fh_type cached and then check FC_TYPE_BLS against cached fh_type value.

This wrong check was causing double exch locking as reported by Bhanu at
https://lists.open-fcoe.org/pipermail/devel/2011-October/011793.html

---

 drivers/scsi/libfc/fc_exch.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/libfc/fc_exch.c +2 -1
index 7c055fd..81235f3 100644
@@ -469,6 +469,7 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp,
 	struct fc_frame_header *fh = fc_frame_header_get(fp);
 	int error;
 	u32 f_ctl;
+	u8 fh_type = fh->fh_type;
 
 	ep = fc_seq_exch(sp);
 	WARN_ON((ep->esb_stat & ESB_ST_SEQ_INIT) != ESB_ST_SEQ_INIT);
@@ -493,7 +494,7 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp,
 	 */
 	error = lport->tt.frame_send(lport, fp);
 
-	if (fh->fh_type == FC_TYPE_BLS)
+	if (fh_type == FC_TYPE_BLS)
 		return error;
 
 	/*
author
#3 lore raw

PATCH 3/4 libfc: avoid exchanges collision during lport reset

In reply to Yi Zou

From: Vasu Dev <[email protected]>

Currently timer delay is large and is using msleep to avoid avoid exchanges collision across lport reset, so instead do this by initializing exches pool indexes during reset also.

---

 drivers/scsi/libfc/fc_exch.c  |    4 ++++
 drivers/scsi/libfc/fc_lport.c |   10 +---------
 2 files changed, 5 insertions(+), 9 deletions(-)
drivers/scsi/libfc/fc_exch.c +4 -0
index 81235f3..1b22130 100644
@@ -1793,6 +1793,9 @@ restart:
 			goto restart;
 		}
 	}
+	pool->next_index = 0;
+	pool->left = FC_XID_UNKNOWN;
+	pool->right = FC_XID_UNKNOWN;
 	spin_unlock_bh(&pool->lock);
 }
 
@@ -2281,6 +2284,7 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport,
 		goto free_mempool;
 	for_each_possible_cpu(cpu) {
 		pool = per_cpu_ptr(mp->pool, cpu);
+		pool->next_index = 0;
 		pool->left = FC_XID_UNKNOWN;
 		pool->right = FC_XID_UNKNOWN;
 		spin_lock_init(&pool->lock);
drivers/scsi/libfc/fc_lport.c +1 -9
index 628f347..e0fb891 100644
@@ -1030,16 +1030,8 @@ static void fc_lport_enter_reset(struct fc_lport *lport)
 			   FCH_EVT_LIPRESET, 0);
 	fc_vports_linkchange(lport);
 	fc_lport_reset_locked(lport);
-	if (lport->link_up) {
-		/*
-		 * Wait upto resource allocation time out before
-		 * doing re-login since incomplete FIP exchanged
-		 * from last session may collide with exchanges
-		 * in new session.
-		 */
-		msleep(lport->r_a_tov);
+	if (lport->link_up)
 		fc_lport_enter_flogi(lport);
-	}
 }
 
 /**
author
#4 lore raw

PATCH 4/4 libfc: improve flogi retries to avoid lport stuck

In reply to Yi Zou

From: Vasu Dev <[email protected]>

Adds more cases to do flogi retry, now also retry on getting bad response due to either no ELS response or flogi response payload length not large enough. In those cases flogi was not retried and that was leaving lport offline.

---

 drivers/scsi/fcoe/fcoe.c      |   13 ++----
 drivers/scsi/libfc/fc_lport.c |   90 ++++++++++++++++++++++-------------------
 2 files changed, 54 insertions(+), 49 deletions(-)
drivers/scsi/fcoe/fcoe.c +5 -8
index 66fbff9..04686b5 100644
@@ -2365,14 +2365,11 @@ static void fcoe_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
 		goto done;
 
 	mac = fr_cb(fp)->granted_mac;
-	if (is_zero_ether_addr(mac)) {
-		/* pre-FIP */
-		if (fcoe_ctlr_recv_flogi(fip, lport, fp)) {
-			fc_frame_free(fp);
-			return;
-		}
-	}
-	fcoe_update_src_mac(lport, mac);
+	/* pre-FIP */
+	if (is_zero_ether_addr(mac))
+		fcoe_ctlr_recv_flogi(fip, lport, fp);
+	if (!is_zero_ether_addr(mac))
+		fcoe_update_src_mac(lport, mac);
 done:
 	fc_lport_flogi_resp(seq, fp, lport);
 }
drivers/scsi/libfc/fc_lport.c +49 -41

104 lines not on this page · raw message