Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme_fc: retry initial controller connections 3 times
@ 2017-09-19 23:16 James Smart
  2017-09-20 21:31 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: James Smart @ 2017-09-19 23:16 UTC (permalink / raw)


Currently, if a frame is lost of command fails as part of initial
association create for a new controller, the new controller connection
request will immediately fail.

Add in an immediate 3 retry loop before giving up.

Signed-off-by: James Smart <james.smart at broadcom.com>
---
 drivers/nvme/host/fc.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index af075e998944..1b91614263e3 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2734,7 +2734,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 {
 	struct nvme_fc_ctrl *ctrl;
 	unsigned long flags;
-	int ret, idx;
+	int ret, idx, retry;
 
 	if (!(rport->remoteport.port_role &
 	    (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) {
@@ -2825,9 +2825,19 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 	list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list);
 	spin_unlock_irqrestore(&rport->lock, flags);
 
-	ret = nvme_fc_create_association(ctrl);
+	for (retry = 0; retry < 3; retry++) {
+		ret = nvme_fc_create_association(ctrl);
+		if (!ret)
+			break;
+	}
+
 	if (ret) {
+		/* couldn't schedule retry - fail out */
+		dev_err(ctrl->ctrl.device,
+			"NVME-FC{%d}: Connect retry failed\n", ctrl->cnum);
+
 		ctrl->ctrl.opts = NULL;
+
 		/* initiate nvme ctrl ref counting teardown */
 		nvme_uninit_ctrl(&ctrl->ctrl);
 		nvme_put_ctrl(&ctrl->ctrl);
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] nvme_fc: retry initial controller connections 3 times
  2017-09-19 23:16 [PATCH] nvme_fc: retry initial controller connections 3 times James Smart
@ 2017-09-20 21:31 ` Christoph Hellwig
  2017-09-20 21:43   ` James Smart
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2017-09-20 21:31 UTC (permalink / raw)


On Tue, Sep 19, 2017@04:16:08PM -0700, James Smart wrote:
> Currently, if a frame is lost of command fails as part of initial
> association create for a new controller, the new controller connection
> request will immediately fail.
> 
> Add in an immediate 3 retry loop before giving up.

How do we end up with the magic 3 value?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] nvme_fc: retry initial controller connections 3 times
  2017-09-20 21:31 ` Christoph Hellwig
@ 2017-09-20 21:43   ` James Smart
  0 siblings, 0 replies; 3+ messages in thread
From: James Smart @ 2017-09-20 21:43 UTC (permalink / raw)


On 9/20/2017 2:31 PM, Christoph Hellwig wrote:
> On Tue, Sep 19, 2017@04:16:08PM -0700, James Smart wrote:
>> Currently, if a frame is lost of command fails as part of initial
>> association create for a new controller, the new controller connection
>> request will immediately fail.
>>
>> Add in an immediate 3 retry loop before giving up.
> 
> How do we end up with the magic 3 value?
> 

:) it's better than 2 ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-20 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19 23:16 [PATCH] nvme_fc: retry initial controller connections 3 times James Smart
2017-09-20 21:31 ` Christoph Hellwig
2017-09-20 21:43   ` James Smart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox