git: 456c941b7d7e - stable/12 - ocs_fc: Ignore flogi failure when the discovery is already done.

From: Ram Kishore Vegesna <ram_at_FreeBSD.org>
Date: Mon, 07 Mar 2022 11:00:37 UTC
The branch stable/12 has been updated by ram:

URL: https://cgit.FreeBSD.org/src/commit/?id=456c941b7d7e89a05c380667db9f7fbee23f122f

commit 456c941b7d7e89a05c380667db9f7fbee23f122f
Author:     Ram Kishore Vegesna <ram@FreeBSD.org>
AuthorDate: 2022-03-03 11:44:03 +0000
Commit:     Ram Kishore Vegesna <ram@FreeBSD.org>
CommitDate: 2022-03-07 10:48:21 +0000

    ocs_fc: Ignore flogi failure when the discovery is already done.
    
    Summary:
    Some targets are not responding to the FLOGI in point-to-point topology,
    If the pt2pt discovery is done, Ignore the FLOGI failure.
    
    MFC after: 3 days
    
    Differential Revision: https://reviews.freebsd.org/D34422
    
    (cherry picked from commit 79c56c9af583b4c6e079594b7b6ff8176e6bff7d)
---
 sys/dev/ocs_fc/ocs_fabric.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/sys/dev/ocs_fc/ocs_fabric.c b/sys/dev/ocs_fc/ocs_fabric.c
index 162dd558fc6d..015d6bde8b3f 100644
--- a/sys/dev/ocs_fc/ocs_fabric.c
+++ b/sys/dev/ocs_fc/ocs_fabric.c
@@ -229,10 +229,22 @@ __ocs_fabric_flogi_wait_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 		if (node_check_els_req(ctx, evt, arg, FC_ELS_CMD_FLOGI, __ocs_fabric_common, __func__)) {
 			return NULL;
 		}
-		node_printf(node, "FLOGI failed evt=%s, shutting down sport [%s]\n", ocs_sm_event_name(evt),
-			sport->display_name);
 		ocs_assert(node->els_req_cnt, NULL);
 		node->els_req_cnt--;
+		if (node->sport->domain->attached) {
+			node_printf(node, "FLOGI failed, Domain already attached\n");
+			if (node->sport->p2p_winner) {
+				node_printf(node, "p2p winner, domain already attached\n");
+				ocs_node_post_event(node, OCS_EVT_DOMAIN_ATTACH_OK, NULL);
+			} else {
+				node_printf(node, "peer p2p winner, shutdown node\n");
+				node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT;
+				ocs_fabric_initiate_shutdown(node);
+			}
+			break;
+		}
+		node_printf(node, "FLOGI failed evt=%s, shutting down sport [%s]\n", ocs_sm_event_name(evt),
+			sport->display_name);
 		ocs_sm_post_event(&sport->sm, OCS_EVT_SHUTDOWN, NULL);
 		break;
 	}