Re: [PATCH v5 11/31] elx: libefc: SLI and FC PORT state machine interfaces
From: Daniel Wagner <hidden>
Date: 2021-01-04 14:43:40
On Sun, Jan 03, 2021 at 09:11:14AM -0800, James Smart wrote:
This patch continues the libefc library population. This patch adds library interface definitions for: - SLI and FC port (aka n_port_id) registration, allocation and deallocation. Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com> Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com> Signed-off-by: James Smart <redacted>
Just one nitpick, rest looks good. Reviewed-by: Daniel Wagner <redacted>
quoted hunk ↗ jump to hunk
--- drivers/scsi/elx/libefc/efc_nport.c | 794 ++++++++++++++++++++++++++++ drivers/scsi/elx/libefc/efc_nport.h | 50 ++ 2 files changed, 844 insertions(+) create mode 100644 drivers/scsi/elx/libefc/efc_nport.c create mode 100644 drivers/scsi/elx/libefc/efc_nport.hdiff --git a/drivers/scsi/elx/libefc/efc_nport.c b/drivers/scsi/elx/libefc/efc_nport.c new file mode 100644 index 000000000000..fad42cd8a108 --- /dev/null +++ b/drivers/scsi/elx/libefc/efc_nport.c@@ -0,0 +1,794 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Broadcom. All Rights Reserved. The term + * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. + */ + +/* + * NPORT + * + * Port object for physical port and NPIV ports. + */ + +/* + * NPORT REFERENCE COUNTING + * + * A nport reference should be taken when: + * - an nport is allocated + * - a vport populates associated nport + * - a remote node is allocated + * - a unsolicited frame is processed + * The reference should be dropped when: + * - the unsolicited frame processesing is done + * - the remote node is removed + * - the vport is removed + * - the nport is removed + */
Thanks for this. It really helps!
+
+#include "efc.h"
+
+int
+efc_nport_cb(void *arg, int event, void *data)
+{
+ struct efc *efc = arg;
+ struct efc_nport *nport = data;
+ unsigned long flags = 0;
+
+ efc_log_debug(efc, "nport event: %s\n", efc_sm_event_name(event));
+
+ spin_lock_irqsave(&efc->lock, flags);
+ efc_sm_post_event(&nport->sm, event, NULL);
+ spin_unlock_irqrestore(&efc->lock, flags);
+
+ return EFC_SUCCESS;No caller tests for the return value which is always success, thus the function could have no return value.