* [PATCH 0/4] Open-FCoE.org libfc and fcoe updates for scsi-misc
@ 2011-10-28 18:34 Yi Zou
2011-10-28 18:34 ` [PATCH 1/4] drivers/firmware/edd: Treat "XPRS" host bus type the same as "PCI" Yi Zou
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Yi Zou @ 2011-10-28 18:34 UTC (permalink / raw)
To: linux-scsi; +Cc: robert.w.love
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: Yi Zou <yi.zou@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] drivers/firmware/edd: Treat "XPRS" host bus type the same as "PCI"
2011-10-28 18:34 [PATCH 0/4] Open-FCoE.org libfc and fcoe updates for scsi-misc Yi Zou
@ 2011-10-28 18:34 ` Yi Zou
2011-10-28 18:34 ` [PATCH 2/4] libfc: fix checking FC_TYPE_BLS Yi Zou
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yi Zou @ 2011-10-28 18:34 UTC (permalink / raw)
To: linux-scsi; +Cc: robert.w.love, Michael Chan, Yi Zou
From: Michael Chan <mchan@broadcom.com>
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.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
---
drivers/firmware/edd.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index f1b7f65..e229576 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -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.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] libfc: fix checking FC_TYPE_BLS
2011-10-28 18:34 [PATCH 0/4] Open-FCoE.org libfc and fcoe updates for scsi-misc Yi Zou
2011-10-28 18:34 ` [PATCH 1/4] drivers/firmware/edd: Treat "XPRS" host bus type the same as "PCI" Yi Zou
@ 2011-10-28 18:34 ` Yi Zou
2011-10-28 18:34 ` [PATCH 3/4] libfc: avoid exchanges collision during lport reset Yi Zou
2011-10-28 18:34 ` [PATCH 4/4] libfc: improve flogi retries to avoid lport stuck Yi Zou
3 siblings, 0 replies; 5+ messages in thread
From: Yi Zou @ 2011-10-28 18:34 UTC (permalink / raw)
To: linux-scsi; +Cc: robert.w.love, Vasu Dev, Yi Zou
From: Vasu Dev <vasu.dev@intel.com>
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
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
---
drivers/scsi/libfc/fc_exch.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 7c055fd..81235f3 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -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;
/*
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] libfc: avoid exchanges collision during lport reset
2011-10-28 18:34 [PATCH 0/4] Open-FCoE.org libfc and fcoe updates for scsi-misc Yi Zou
2011-10-28 18:34 ` [PATCH 1/4] drivers/firmware/edd: Treat "XPRS" host bus type the same as "PCI" Yi Zou
2011-10-28 18:34 ` [PATCH 2/4] libfc: fix checking FC_TYPE_BLS Yi Zou
@ 2011-10-28 18:34 ` Yi Zou
2011-10-28 18:34 ` [PATCH 4/4] libfc: improve flogi retries to avoid lport stuck Yi Zou
3 siblings, 0 replies; 5+ messages in thread
From: Yi Zou @ 2011-10-28 18:34 UTC (permalink / raw)
To: linux-scsi; +Cc: robert.w.love, Vasu Dev, Yi Zou
From: Vasu Dev <vasu.dev@intel.com>
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.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
---
drivers/scsi/libfc/fc_exch.c | 4 ++++
drivers/scsi/libfc/fc_lport.c | 10 +---------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 81235f3..1b22130 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -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);
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 628f347..e0fb891 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -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);
- }
}
/**
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] libfc: improve flogi retries to avoid lport stuck
2011-10-28 18:34 [PATCH 0/4] Open-FCoE.org libfc and fcoe updates for scsi-misc Yi Zou
` (2 preceding siblings ...)
2011-10-28 18:34 ` [PATCH 3/4] libfc: avoid exchanges collision during lport reset Yi Zou
@ 2011-10-28 18:34 ` Yi Zou
3 siblings, 0 replies; 5+ messages in thread
From: Yi Zou @ 2011-10-28 18:34 UTC (permalink / raw)
To: linux-scsi; +Cc: robert.w.love, Vasu Dev, Yi Zou
From: Vasu Dev <vasu.dev@intel.com>
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.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 13 ++----
drivers/scsi/libfc/fc_lport.c | 90 ++++++++++++++++++++++-------------------
2 files changed, 54 insertions(+), 49 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 66fbff9..04686b5 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -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);
}
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index e0fb891..2cb12b9 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1473,6 +1473,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
void *lp_arg)
{
struct fc_lport *lport = lp_arg;
+ struct fc_frame_header *fh;
struct fc_els_flogi *flp;
u32 did;
u16 csp_flags;
@@ -1500,49 +1501,56 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
goto err;
}
+ fh = fc_frame_header_get(fp);
did = fc_frame_did(fp);
- if (fc_frame_payload_op(fp) == ELS_LS_ACC && did) {
- flp = fc_frame_payload_get(fp, sizeof(*flp));
- if (flp) {
- mfs = ntohs(flp->fl_csp.sp_bb_data) &
- FC_SP_BB_DATA_MASK;
- if (mfs >= FC_SP_MIN_MAX_PAYLOAD &&
- mfs < lport->mfs)
- lport->mfs = mfs;
- csp_flags = ntohs(flp->fl_csp.sp_features);
- r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov);
- e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov);
- if (csp_flags & FC_SP_FT_EDTR)
- e_d_tov /= 1000000;
-
- lport->npiv_enabled = !!(csp_flags & FC_SP_FT_NPIV_ACC);
-
- if ((csp_flags & FC_SP_FT_FPORT) == 0) {
- if (e_d_tov > lport->e_d_tov)
- lport->e_d_tov = e_d_tov;
- lport->r_a_tov = 2 * e_d_tov;
- fc_lport_set_port_id(lport, did, fp);
- printk(KERN_INFO "host%d: libfc: "
- "Port (%6.6x) entered "
- "point-to-point mode\n",
- lport->host->host_no, did);
- fc_lport_ptp_setup(lport, fc_frame_sid(fp),
- get_unaligned_be64(
- &flp->fl_wwpn),
- get_unaligned_be64(
- &flp->fl_wwnn));
- } else {
- lport->e_d_tov = e_d_tov;
- lport->r_a_tov = r_a_tov;
- fc_host_fabric_name(lport->host) =
- get_unaligned_be64(&flp->fl_wwnn);
- fc_lport_set_port_id(lport, did, fp);
- fc_lport_enter_dns(lport);
- }
- }
- } else {
- FC_LPORT_DBG(lport, "FLOGI RJT or bad response\n");
+ if (fh->fh_r_ctl != FC_RCTL_ELS_REP || did == 0 ||
+ fc_frame_payload_op(fp) != ELS_LS_ACC) {
+ FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n");
fc_lport_error(lport, fp);
+ goto err;
+ }
+
+ flp = fc_frame_payload_get(fp, sizeof(*flp));
+ if (!flp) {
+ FC_LPORT_DBG(lport, "FLOGI bad response\n");
+ fc_lport_error(lport, fp);
+ goto err;
+ }
+
+ mfs = ntohs(flp->fl_csp.sp_bb_data) &
+ FC_SP_BB_DATA_MASK;
+ if (mfs >= FC_SP_MIN_MAX_PAYLOAD &&
+ mfs < lport->mfs)
+ lport->mfs = mfs;
+ csp_flags = ntohs(flp->fl_csp.sp_features);
+ r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov);
+ e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov);
+ if (csp_flags & FC_SP_FT_EDTR)
+ e_d_tov /= 1000000;
+
+ lport->npiv_enabled = !!(csp_flags & FC_SP_FT_NPIV_ACC);
+
+ if ((csp_flags & FC_SP_FT_FPORT) == 0) {
+ if (e_d_tov > lport->e_d_tov)
+ lport->e_d_tov = e_d_tov;
+ lport->r_a_tov = 2 * e_d_tov;
+ fc_lport_set_port_id(lport, did, fp);
+ printk(KERN_INFO "host%d: libfc: "
+ "Port (%6.6x) entered "
+ "point-to-point mode\n",
+ lport->host->host_no, did);
+ fc_lport_ptp_setup(lport, fc_frame_sid(fp),
+ get_unaligned_be64(
+ &flp->fl_wwpn),
+ get_unaligned_be64(
+ &flp->fl_wwnn));
+ } else {
+ lport->e_d_tov = e_d_tov;
+ lport->r_a_tov = r_a_tov;
+ fc_host_fabric_name(lport->host) =
+ get_unaligned_be64(&flp->fl_wwnn);
+ fc_lport_set_port_id(lport, did, fp);
+ fc_lport_enter_dns(lport);
}
out:
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-28 18:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 18:34 [PATCH 0/4] Open-FCoE.org libfc and fcoe updates for scsi-misc Yi Zou
2011-10-28 18:34 ` [PATCH 1/4] drivers/firmware/edd: Treat "XPRS" host bus type the same as "PCI" Yi Zou
2011-10-28 18:34 ` [PATCH 2/4] libfc: fix checking FC_TYPE_BLS Yi Zou
2011-10-28 18:34 ` [PATCH 3/4] libfc: avoid exchanges collision during lport reset Yi Zou
2011-10-28 18:34 ` [PATCH 4/4] libfc: improve flogi retries to avoid lport stuck Yi Zou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox