From patchwork Thu Jun 3 12:16:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javed Hasan X-Patchwork-Id: 12297111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A241C47096 for ; Thu, 3 Jun 2021 12:17:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BAEB610A1 for ; Thu, 3 Jun 2021 12:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230102AbhFCMS6 (ORCPT ); Thu, 3 Jun 2021 08:18:58 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:61162 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229765AbhFCMS5 (ORCPT ); Thu, 3 Jun 2021 08:18:57 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 153CB28H011295 for ; Thu, 3 Jun 2021 05:17:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=3+HsN8/pVILzoYPJ9OOFx+UL7c5E5acPiqULhzQJyQU=; b=fVf/LmrWkq2CmgkSWp7TNd4yNoZMPv7aMAoLX8uWyZaxSUqiYolzLgQXtZDEbnua09dV ns1jDtFV5S7TsLgE2kkVLD464fXt5fs3nqrrqpdeS88dNFCU7aGBms+Tvqv+f7FE8MHE oFqCnmVBUuZhLUA9Wc/lWnhFCLuSzYK/g6ZVwiww+y+P4T0CzR4r+VKTHRIxQ3K7O3QW FSzG+LfGWTdjiGbRMaCpnz25DLruOfmu7W3nDNy/8uFGYzvm5g/XCprl6onPZ0rmR2A+ o6zjAal3+Xs8qBVOXxWmIhz8zTGm8+mF1BH35NC2F8Uw+Ajn8LijPNsXIlNuo6+akweI Bw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 38xe7xuhc2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 03 Jun 2021 05:17:13 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Jun 2021 05:17:12 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 3 Jun 2021 05:17:11 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 0E2CA3F7040; Thu, 3 Jun 2021 05:17:12 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 153CHB4e010132; Thu, 3 Jun 2021 05:17:11 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 153CHBO8010122; Thu, 3 Jun 2021 05:17:11 -0700 From: Javed Hasan To: CC: , , Subject: [PATCH 1/5] libfc: initialisation of RHBA and RPA attributes Date: Thu, 3 Jun 2021 05:16:19 -0700 Message-ID: <20210603121623.10084-2-jhasan@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20210603121623.10084-1-jhasan@marvell.com> References: <20210603121623.10084-1-jhasan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: wfI37ZfFhmp5CXxHeLvkL1kofuWmbzWZ X-Proofpoint-GUID: wfI37ZfFhmp5CXxHeLvkL1kofuWmbzWZ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-03_08:2021-06-02,2021-06-03 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org -initialisation of RHBA and RPA attributes Signed-off-by: Javed Hasan Reviewed-by: Himanshu Madhani --- drivers/scsi/libfc/fc_lport.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index cf36c8cb5493..72d13a2a4691 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -93,7 +93,10 @@ #define FC_LOCAL_PTP_FID_LO 0x010101 #define FC_LOCAL_PTP_FID_HI 0x010102 -#define DNS_DELAY 3 /* Discovery delay after RSCN (in seconds)*/ +#define DNS_DELAY 3 /* Discovery delay after RSCN (in seconds)*/ +#define MAX_CT_PAYLOAD 2048 +#define DISCOVERED_PORTS 4 +#define NUMBER_OF_PORTS 1 static void fc_lport_error(struct fc_lport *, struct fc_frame *); @@ -1859,8 +1862,27 @@ int fc_lport_init(struct fc_lport *lport) fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_1GBIT; if (lport->link_supported_speeds & FC_PORTSPEED_10GBIT) fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_10GBIT; + if (lport->link_supported_speeds & FC_PORTSPEED_40GBIT) + fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_40GBIT; + if (lport->link_supported_speeds & FC_PORTSPEED_100GBIT) + fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_100GBIT; + if (lport->link_supported_speeds & FC_PORTSPEED_25GBIT) + fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_25GBIT; + if (lport->link_supported_speeds & FC_PORTSPEED_50GBIT) + fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_50GBIT; + if (lport->link_supported_speeds & FC_PORTSPEED_100GBIT) + fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_100GBIT; + fc_fc4_add_lport(lport); + fc_host_num_discovered_ports(lport->host) = DISCOVERED_PORTS; + fc_host_port_state(lport->host) = FC_PORTSTATE_ONLINE; + fc_host_max_ct_payload(lport->host) = MAX_CT_PAYLOAD; + fc_host_num_ports(lport->host) = NUMBER_OF_PORTS; + fc_host_bootbios_state(lport->host) = 0X00000000; + snprintf(fc_host_bootbios_version(lport->host), + FC_SYMBOLIC_NAME_SIZE, "%s", "Unknown"); + return 0; } EXPORT_SYMBOL(fc_lport_init); From patchwork Thu Jun 3 12:16:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javed Hasan X-Patchwork-Id: 12297113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF961C47096 for ; Thu, 3 Jun 2021 12:17:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1991613E6 for ; Thu, 3 Jun 2021 12:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbhFCMTX (ORCPT ); Thu, 3 Jun 2021 08:19:23 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:63424 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbhFCMTX (ORCPT ); Thu, 3 Jun 2021 08:19:23 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 153CApMU014633 for ; Thu, 3 Jun 2021 05:17:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=ckTtXtJFD+tl0HN/hWhCXR6x91vc6SBHfQdVTfpuaDA=; b=RV9bEYzeX0t2R8K4VdetNm1zO+lpFBbK8fkND2pU16xajak9oAbm/NqQCB6cHx/DIgHX Zn7dM3tRfNhrEVw2Rhi7PjmYHtOqQakijX6hVLa1H7S0zCiTEJFollPTT1zc2DYrjzdf ui+M0GAt6r+NKunzgBt7Hnz7Yx0Anbj+cikS8ty/bSWB8wkxxODebnZtR6Is+dKOhCQs tV6c85FBYODHth3sBgnNPQpZVmk2Ok//nsfhHD6SCdHEs49uZi3F5v/kbs5k2wWHT8uY rT4FWvvsNk8G94QXuoRfdZeLKYjO4Meq8+dDvhDCZuek8fuKECCOb96xA5pzwnUi63MI dw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 38xhym2hkn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 03 Jun 2021 05:17:38 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Jun 2021 05:17:36 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 3 Jun 2021 05:17:35 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 2DA683F703F; Thu, 3 Jun 2021 05:17:36 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 153CHaEq010136; Thu, 3 Jun 2021 05:17:36 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 153CHZnE010135; Thu, 3 Jun 2021 05:17:35 -0700 From: Javed Hasan To: CC: , , Subject: [PATCH 2/5] qedf: Added vendor identifier attribute Date: Thu, 3 Jun 2021 05:16:20 -0700 Message-ID: <20210603121623.10084-3-jhasan@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20210603121623.10084-1-jhasan@marvell.com> References: <20210603121623.10084-1-jhasan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: IDFdPimGiJhl4Np5qw8fRjrNZBZ_1uFx X-Proofpoint-GUID: IDFdPimGiJhl4Np5qw8fRjrNZBZ_1uFx X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-03_08:2021-06-02,2021-06-03 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org -Added vendor identifier attribute. Signed-off-by: Javed Hasan Reviewed-by: Himanshu Madhani --- drivers/scsi/qedf/qedf_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 9c7efdf40dd5..136aef247c10 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1715,6 +1715,9 @@ static void qedf_setup_fdmi(struct qedf_ctx *qedf) FW_MAJOR_VERSION, FW_MINOR_VERSION, FW_REVISION_VERSION, FW_ENGINEERING_VERSION); + snprintf(fc_host_vendor_identifier(lport->host), + FC_VENDOR_IDENTIFIER, "%s", "Marvell"); + } static int qedf_lport_setup(struct qedf_ctx *qedf) From patchwork Thu Jun 3 12:16:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javed Hasan X-Patchwork-Id: 12297115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B62C3C47096 for ; Thu, 3 Jun 2021 12:18:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CCD5613C9 for ; Thu, 3 Jun 2021 12:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229765AbhFCMTq (ORCPT ); Thu, 3 Jun 2021 08:19:46 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:54564 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229817AbhFCMTq (ORCPT ); Thu, 3 Jun 2021 08:19:46 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 153CANOP011022 for ; Thu, 3 Jun 2021 05:18:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=chEwQB0eX+okAH7TaN7P64PKw+RbNTmzOOsj5v3uv1c=; b=KMyp+AjJYReVaH4/U3WHxgZn0XfA1hs+5hb/a80JPcTK8LS7MNiLKBr4mqTZBv0SJaBG 6PNESlS3JrPurX1yWLu30mBmHudpbRvV3BD1uRRBD8abo/0IsP129OoaVqUtT0Bi6xYf 3nIc8WQpzx6NU6CPBUe9w7c4PdnTlOUd68f950mdnHPIvc/fnBZaK8bguQEK5ej/2llI irZZ5Q3cSTorVmgQ36AVkPOzuVUy0UuYo6rd9kWjjJ7hhsfaVHBY9yrmK173K6wx0Ks+ C2AMbJfF4M8cIYoX6E6yOLSwtY5BB7oVA4Ijyfvb6gc1a87CP4C1a2yN6y/+V72ssL1D zA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 38xe7xuhdx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 03 Jun 2021 05:18:01 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Jun 2021 05:17:59 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 3 Jun 2021 05:18:00 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 4D0A63F703F; Thu, 3 Jun 2021 05:18:00 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 153CI0hh010140; Thu, 3 Jun 2021 05:18:00 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 153CI071010139; Thu, 3 Jun 2021 05:18:00 -0700 From: Javed Hasan To: CC: , , Subject: [PATCH 3/5] libfc: Added FDMI-2 attributes Date: Thu, 3 Jun 2021 05:16:21 -0700 Message-ID: <20210603121623.10084-4-jhasan@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20210603121623.10084-1-jhasan@marvell.com> References: <20210603121623.10084-1-jhasan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 1Ui74reZWdJWbqFdP-hbH7_-49FWl_vw X-Proofpoint-GUID: 1Ui74reZWdJWbqFdP-hbH7_-49FWl_vw X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-03_08:2021-06-02,2021-06-03 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org All the attributes added for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration. Signed-off-by: Javed Hasan Reviewed-by: Himanshu Madhani --- drivers/scsi/libfc/fc_encode.h | 248 ++++++++++++++++++++++++++++++- include/scsi/scsi_transport_fc.h | 25 +++- 2 files changed, 269 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/libfc/fc_encode.h b/drivers/scsi/libfc/fc_encode.h index 9ea4ceadb559..9957476e2ac5 100644 --- a/drivers/scsi/libfc/fc_encode.h +++ b/drivers/scsi/libfc/fc_encode.h @@ -192,10 +192,11 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, struct fc_fdmi_attr_entry *entry; struct fs_fdmi_attrs *hba_attrs; int numattrs = 0; + struct fc_host_attrs *fc_host = shost_to_fc_host(lport->host); switch (op) { case FC_FDMI_RHBA: - numattrs = 10; + numattrs = 11; len = sizeof(struct fc_fdmi_rhba); len -= sizeof(struct fc_fdmi_attr_entry); len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); @@ -209,8 +210,21 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN; len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN; len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN; + len += FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN; + + if (fc_host->fdmi_version == FDMI_V2) { + numattrs += 7; + len += FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN; + len += FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN; + len += FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN; + len += FC_FDMI_HBA_ATTR_FABRICNAME_LEN; + len += FC_FDMI_HBA_ATTR_BIOSVERSION_LEN; + len += FC_FDMI_HBA_ATTR_BIOSSTATE_LEN; + len += FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN; + } + ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT, - FC_FDMI_SUBTYPE); + FC_FDMI_SUBTYPE); /* HBA Identifier */ put_unaligned_be64(lport->wwpn, &ct->payload.rhba.hbaid.id); @@ -315,7 +329,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, &entry->type); put_unaligned_be16(len, &entry->len); fc_ct_ms_fill_attr(entry, - fc_host_optionrom_version(lport->host), + "unknown", FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN); /* Firmware Version */ @@ -343,6 +357,100 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, "%s v%s", init_utsname()->sysname, init_utsname()->release); + + /* Max CT payload */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_MAXCTPAYLOAD, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_max_ct_payload(lport->host), + &entry->value); + + if (fc_host->fdmi_version == FDMI_V2) { + /* Node symbolic name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_NODESYMBLNAME, + &entry->type); + put_unaligned_be16(len, &entry->len); + fc_ct_ms_fill_attr(entry, + fc_host_symbolic_name(lport->host), + FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN); + + /* Vendor specific info */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(0, + &entry->value); + + /* Number of ports */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_NUMBEROFPORTS, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_num_ports(lport->host), + &entry->value); + + /* Fabric name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_FABRICNAME_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_FABRICNAME, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be64(fc_host_fabric_name(lport->host), + &entry->value); + + /* BIOS version */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_FABRICNAME_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_BIOSVERSION_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_BIOSVERSION, + &entry->type); + put_unaligned_be16(len, &entry->len); + fc_ct_ms_fill_attr(entry, + fc_host_bootbios_version(lport->host), + FC_FDMI_HBA_ATTR_BIOSVERSION_LEN); + + /* BIOS state */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_BIOSVERSION_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_BIOSSTATE_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_BIOSSTATE, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_bootbios_state(lport->host), + &entry->value); + + /* Vendor identifier */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_HBA_ATTR_BIOSSTATE_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN; + put_unaligned_be16(FC_FDMI_HBA_ATTR_VENDORIDENTIFIER, + &entry->type); + put_unaligned_be16(len, &entry->len); + fc_ct_ms_fill_attr(entry, + fc_host_vendor_identifier(lport->host), + FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN); + } + break; case FC_FDMI_RPA: numattrs = 6; @@ -355,6 +463,24 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN; len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN; len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN; + + + if (fc_host->fdmi_version == FDMI_V2) { + numattrs += 10; + + len += FC_FDMI_PORT_ATTR_NODENAME_LEN; + len += FC_FDMI_PORT_ATTR_PORTNAME_LEN; + len += FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN; + len += FC_FDMI_PORT_ATTR_PORTTYPE_LEN; + len += FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN; + len += FC_FDMI_PORT_ATTR_FABRICNAME_LEN; + len += FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN; + len += FC_FDMI_PORT_ATTR_PORTSTATE_LEN; + len += FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN; + len += FC_FDMI_PORT_ATTR_PORTID_LEN; + + } + ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT, FC_FDMI_SUBTYPE); @@ -443,6 +569,122 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, fc_ct_ms_fill_attr(entry, init_utsname()->nodename, FC_FDMI_PORT_ATTR_HOSTNAME_LEN); + + + if (fc_host->fdmi_version == FDMI_V2) { + + /* Node name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_HOSTNAME_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_NODENAME_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_NODENAME, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be64(fc_host_node_name(lport->host), + &entry->value); + + /* Port name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_NODENAME_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_PORTNAME_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTNAME, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be64(lport->wwpn, + &entry->value); + + /* Port symbolic name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_PORTNAME_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_SYMBOLICNAME, + &entry->type); + put_unaligned_be16(len, &entry->len); + fc_ct_ms_fill_attr(entry, + fc_host_symbolic_name(lport->host), + FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN); + + /* Port type */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_PORTTYPE_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTTYPE, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_port_type(lport->host), + &entry->value); + + /* Supported class of service */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_PORTTYPE_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_supported_classes(lport->host), + &entry->value); + + /* Port Fabric name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_FABRICNAME_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_FABRICNAME, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be64(fc_host_fabric_name(lport->host), + &entry->value); + + /* Port active FC-4 */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_FABRICNAME_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_CURRENTFC4TYPE, + &entry->type); + put_unaligned_be16(len, &entry->len); + memcpy(&entry->value, fc_host_active_fc4s(lport->host), + FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN); + + /* Port state */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_PORTSTATE_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTSTATE, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_port_state(lport->host), + &entry->value); + + /* Discovered ports */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_PORTSTATE_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_DISCOVEREDPORTS, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_num_discovered_ports(lport->host), + &entry->value); + + /* Port ID */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + + FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN); + len = FC_FDMI_ATTR_ENTRY_HEADER_LEN; + len += FC_FDMI_PORT_ATTR_PORTID_LEN; + put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTID, + &entry->type); + put_unaligned_be16(len, &entry->len); + put_unaligned_be32(fc_host_port_id(lport->host), + &entry->value); + } + break; case FC_FDMI_DPRT: len = sizeof(struct fc_fdmi_dprt); diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 14214ee121ad..2300bfd10694 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -517,10 +517,11 @@ enum fc_host_event_code { * managed by the transport w/o driver interaction. */ +#define FC_VENDOR_IDENTIFIER 8 #define FC_FC4_LIST_SIZE 32 #define FC_SYMBOLIC_NAME_SIZE 256 #define FC_VERSION_STRING_SIZE 64 -#define FC_SERIAL_NUMBER_SIZE 80 +#define FC_SERIAL_NUMBER_SIZE 64 struct fc_host_attrs { /* Fixed Attributes */ @@ -532,6 +533,10 @@ struct fc_host_attrs { u32 supported_speeds; u32 maxframe_size; u16 max_npiv_vports; + u32 max_ct_payload; + u32 num_ports; + u32 num_discovered_ports; + u32 bootbios_state; char serial_number[FC_SERIAL_NUMBER_SIZE]; char manufacturer[FC_SERIAL_NUMBER_SIZE]; char model[FC_SYMBOLIC_NAME_SIZE]; @@ -540,6 +545,9 @@ struct fc_host_attrs { char driver_version[FC_VERSION_STRING_SIZE]; char firmware_version[FC_VERSION_STRING_SIZE]; char optionrom_version[FC_VERSION_STRING_SIZE]; + char vendor_identifier[FC_VENDOR_IDENTIFIER]; + char bootbios_version[FC_SYMBOLIC_NAME_SIZE]; + /* Dynamic Attributes */ u32 port_id; @@ -573,6 +581,9 @@ struct fc_host_attrs { /* bsg support */ struct request_queue *rqst_q; + + /* FDMI support version*/ + u8 fdmi_version; }; #define shost_to_fc_host(x) \ @@ -652,6 +663,18 @@ struct fc_host_attrs { (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) #define fc_host_dev_loss_tmo(x) \ (((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo) +#define fc_host_max_ct_payload(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->max_ct_payload) +#define fc_host_vendor_identifier(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->vendor_identifier) +#define fc_host_num_discovered_ports(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->num_discovered_ports) +#define fc_host_num_ports(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->num_ports) +#define fc_host_bootbios_version(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->bootbios_version) +#define fc_host_bootbios_state(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->bootbios_state) /* The functions by which the transport class and the driver communicate */ struct fc_function_template { From patchwork Thu Jun 3 12:16:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javed Hasan X-Patchwork-Id: 12297117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0F46C47082 for ; Thu, 3 Jun 2021 12:18:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC52B613C9 for ; Thu, 3 Jun 2021 12:18:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbhFCMUK (ORCPT ); Thu, 3 Jun 2021 08:20:10 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:43380 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229817AbhFCMUK (ORCPT ); Thu, 3 Jun 2021 08:20:10 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 153CAXJh011116 for ; Thu, 3 Jun 2021 05:18:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=x0tnzWjGkVbHbWOr3IZg4/g4rD7ok9wcrnp6pW84qJ8=; b=ETBfDy5yrD/Mv54UShpKFY+JUnU6qZDAN7hjX4imsDdRAOiNBzCbrURLCLo2/du+et09 yDrYpYDGtxWC5RHIDdcYTBA8C5sTa9HEG7z7lB1v9/yDHSP69Zp81qTvUeVK0YMIuRwk eZYDGU0funnmzK9qTwVsjGRDyohHau8TnWZKTxR6jiXuuQqX+eWfr7EU0gST0/KZA5FZ iF1VDowIYI2fwcnNsTI34BSus52GSKDjUNzgpWnHKTON+k69v7N8JucYVJEy6bVrqti7 TBH8Vn0Ljv+nRLVik0buYEAbvvCHPre3Y3ywpldV/7NjePqS9X2+Geedd+8+giGRfVR3 7Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 38xe7xuhes-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 03 Jun 2021 05:18:26 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Jun 2021 05:18:24 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 3 Jun 2021 05:18:24 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 6E1EF3F703F; Thu, 3 Jun 2021 05:18:24 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 153CIO3e010152; Thu, 3 Jun 2021 05:18:24 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 153CIOVn010143; Thu, 3 Jun 2021 05:18:24 -0700 From: Javed Hasan To: CC: , , Subject: [PATCH 4/5] libfc: FDMI enhancement. Date: Thu, 3 Jun 2021 05:16:22 -0700 Message-ID: <20210603121623.10084-5-jhasan@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20210603121623.10084-1-jhasan@marvell.com> References: <20210603121623.10084-1-jhasan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: phD9Ienxqzhq-yIKpStXhcJA4sqEZ8Ll X-Proofpoint-GUID: phD9Ienxqzhq-yIKpStXhcJA4sqEZ8Ll X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-03_08:2021-06-02,2021-06-03 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added all the attributes for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration. Signed-off-by: Javed Hasan Reviewed-by: Himanshu Madhani --- drivers/scsi/libfc/fc_lport.c | 64 +++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 72d13a2a4691..fe95b8cf43e9 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -1188,7 +1188,7 @@ static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp, struct fc_lport *lport = lp_arg; struct fc_frame_header *fh; struct fc_ct_hdr *ct; - + struct fc_host_attrs *fc_host = shost_to_fc_host(lport->host); FC_LPORT_DBG(lport, "Received a ms %s\n", fc_els_resp_type(fp)); if (fp == ERR_PTR(-FC_EX_CLOSED)) @@ -1222,7 +1222,13 @@ static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp, switch (lport->state) { case LPORT_ST_RHBA: - if (ntohs(ct->ct_cmd) == FC_FS_ACC) + if ((ntohs(ct->ct_cmd) == FC_FS_RJT) && fc_host->fdmi_version == FDMI_V2) { + FC_LPORT_DBG(lport, "Error for FDMI-V2, fall back to FDMI-V1\n"); + fc_host->fdmi_version = FDMI_V1; + + fc_lport_enter_ms(lport, LPORT_ST_RHBA); + + } else if (ntohs(ct->ct_cmd) == FC_FS_ACC) fc_lport_enter_ms(lport, LPORT_ST_RPA); else /* Error Skip RPA */ fc_lport_enter_scr(lport); @@ -1436,7 +1442,7 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) int size = sizeof(struct fc_ct_hdr); size_t len; int numattrs; - + struct fc_host_attrs *fc_host = shost_to_fc_host(lport->host); lockdep_assert_held(&lport->lp_mutex); FC_LPORT_DBG(lport, "Entered %s state from %s state\n", @@ -1449,10 +1455,10 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) case LPORT_ST_RHBA: cmd = FC_FDMI_RHBA; /* Number of HBA Attributes */ - numattrs = 10; + numattrs = 11; len = sizeof(struct fc_fdmi_rhba); len -= sizeof(struct fc_fdmi_attr_entry); - len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); + len += FC_FDMI_HBA_ATTR_NODENAME_LEN; len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN; len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN; @@ -1463,6 +1469,21 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN; len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN; len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN; + len += FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN; + + + if (fc_host->fdmi_version == FDMI_V2) { + numattrs += 7; + len += FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN; + len += FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN; + len += FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN; + len += FC_FDMI_HBA_ATTR_FABRICNAME_LEN; + len += FC_FDMI_HBA_ATTR_BIOSVERSION_LEN; + len += FC_FDMI_HBA_ATTR_BIOSSTATE_LEN; + len += FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN; + } + + len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); size += len; break; @@ -1472,7 +1493,6 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) numattrs = 6; len = sizeof(struct fc_fdmi_rpa); len -= sizeof(struct fc_fdmi_attr_entry); - len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN; len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN; len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN; @@ -1480,6 +1500,22 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN; len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN; + if (fc_host->fdmi_version == FDMI_V2) { + numattrs += 10; + len += FC_FDMI_PORT_ATTR_NODENAME_LEN; + len += FC_FDMI_PORT_ATTR_PORTNAME_LEN; + len += FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN; + len += FC_FDMI_PORT_ATTR_PORTTYPE_LEN; + len += FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN; + len += FC_FDMI_PORT_ATTR_FABRICNAME_LEN; + len += FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN; + len += FC_FDMI_PORT_ATTR_PORTSTATE_LEN; + len += FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN; + len += FC_FDMI_PORT_ATTR_PORTID_LEN; + } + + len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); + size += len; break; case LPORT_ST_DPRT: @@ -1549,6 +1585,7 @@ static void fc_lport_timeout(struct work_struct *work) struct fc_lport *lport = container_of(work, struct fc_lport, retry_work.work); + struct fc_host_attrs *fc_host = shost_to_fc_host(lport->host); mutex_lock(&lport->lp_mutex); @@ -1576,6 +1613,13 @@ static void fc_lport_timeout(struct work_struct *work) fc_lport_enter_fdmi(lport); break; case LPORT_ST_RHBA: + if (fc_host->fdmi_version == FDMI_V2) { + FC_LPORT_DBG(lport, "timeout for FDMI-V2 RHBA,fall back to FDMI-V1\n"); + fc_host->fdmi_version = FDMI_V1; + fc_lport_enter_ms(lport, LPORT_ST_RHBA); + break; + } + fallthrough; case LPORT_ST_RPA: case LPORT_ST_DHBA: case LPORT_ST_DPRT: @@ -1842,6 +1886,13 @@ EXPORT_SYMBOL(fc_lport_config); */ int fc_lport_init(struct fc_lport *lport) { + struct fc_host_attrs *fc_host; + + fc_host = shost_to_fc_host(lport->host); + + /* Set FDMI version to FDMI-2 specification*/ + fc_host->fdmi_version = FDMI_V2; + fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; fc_host_node_name(lport->host) = lport->wwnn; fc_host_port_name(lport->host) = lport->wwpn; @@ -1850,6 +1901,7 @@ int fc_lport_init(struct fc_lport *lport) sizeof(fc_host_supported_fc4s(lport->host))); fc_host_supported_fc4s(lport->host)[2] = 1; fc_host_supported_fc4s(lport->host)[7] = 1; + fc_host_num_discovered_ports(lport->host) = 4; /* This value is also unchanging */ memset(fc_host_active_fc4s(lport->host), 0, From patchwork Thu Jun 3 12:16:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Javed Hasan X-Patchwork-Id: 12297119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UPPERCASE_50_75, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1E4FC47096 for ; Thu, 3 Jun 2021 12:18:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCC78610A1 for ; Thu, 3 Jun 2021 12:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229927AbhFCMUe (ORCPT ); Thu, 3 Jun 2021 08:20:34 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:13426 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229765AbhFCMUe (ORCPT ); Thu, 3 Jun 2021 08:20:34 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 153CAO7M011040 for ; Thu, 3 Jun 2021 05:18:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0220; bh=Q9U88xC49m5YWxGPIUgLDyr6ZS/eDaNiREhQ9H1KR/g=; b=co7RFv9PBdeBdRPhdNuA8gjghHEe/YKw8RXYk8d+QX4t8pzcdysRysZiHcq0hl8C4PA6 st8gL/D2wKPjgu+NFrjOvVkBrMzzer4shEslqqdPJC9PqxbYpx2zwjOTNl/qjtO7fvaW TtU4Ap7MdkI2G/jLPQqb4Xiz0WAfgbZ4DAORIAnVQpikDKsCsjxQiLvSwngtbLfct1c7 s8SgBXBxAUDkBvprNnHgP2yft1/Uf+iHeZeClduz5ZVHto8LrENCfPw6biGsnuGAkwPu ZUmgEZLdjl4PqoEtGS4z92WfS0kBIxs502ZRXew3nd078FuuPZc8kdFpwHXYJwiSpmOl uA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 38xe7xuhfe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 03 Jun 2021 05:18:50 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Jun 2021 05:18:48 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 3 Jun 2021 05:18:48 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 96B133F703F; Thu, 3 Jun 2021 05:18:48 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 153CImFk010156; Thu, 3 Jun 2021 05:18:48 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 153CImDo010155; Thu, 3 Jun 2021 05:18:48 -0700 From: Javed Hasan To: CC: , , Subject: [PATCH 5/5] fc: FDMI enhancement Date: Thu, 3 Jun 2021 05:16:23 -0700 Message-ID: <20210603121623.10084-6-jhasan@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20210603121623.10084-1-jhasan@marvell.com> References: <20210603121623.10084-1-jhasan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: x3xiDx5xf2t3eY0r1fR7fAz7QztsTcaO X-Proofpoint-GUID: x3xiDx5xf2t3eY0r1fR7fAz7QztsTcaO X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-03_08:2021-06-02,2021-06-03 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added RHBA and RPA attributes type and length. As par FC_GC_7 document section "Table 400 – Attribute Entry Types and associated Values" ascii type attributes length can be vary from "4 to 256 byte". If we keep all RHBA ascii attributes length 256 then total length is going upto 2750, which is far more than 2048 (max frame size). In libfc we do have logic to split FCP commands but not for CT commands. Practically all version/names get covered with in 64 bytes except OS name, for that we need 128 bytes. Hence length of all RBHA ascii attributes length reduced to 64 bytes and 128 bytes in case OS name. RPA attributes total length is with in frame size. Signed-off-by: Javed Hasan Reviewed-by: Himanshu Madhani --- include/scsi/fc/fc_ms.h | 55 +++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h index 800d53dc9470..00191695233a 100644 --- a/include/scsi/fc/fc_ms.h +++ b/include/scsi/fc/fc_ms.h @@ -24,6 +24,12 @@ */ #define FC_FDMI_SUBTYPE 0x10 /* fs_ct_hdr.ct_fs_subtype */ +/* + * Management server FDMI specifications. + */ +#define FDMI_V1 1 /* FDMI version 1 specifications */ +#define FDMI_V2 2 /* FDMI version 2 specifications */ + /* * Management server FDMI Requests. */ @@ -57,6 +63,13 @@ enum fc_fdmi_hba_attr_type { FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009, FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B, + FC_FDMI_HBA_ATTR_NODESYMBLNAME = 0x000C, + FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO = 0x000D, + FC_FDMI_HBA_ATTR_NUMBEROFPORTS = 0x000E, + FC_FDMI_HBA_ATTR_FABRICNAME = 0x000F, + FC_FDMI_HBA_ATTR_BIOSVERSION = 0x0010, + FC_FDMI_HBA_ATTR_BIOSSTATE = 0x0011, + FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0, }; /* @@ -65,14 +78,21 @@ enum fc_fdmi_hba_attr_type { #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 #define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 #define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64 -#define FC_FDMI_HBA_ATTR_MODEL_LEN 256 -#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 -#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256 +#define FC_FDMI_HBA_ATTR_MODEL_LEN 64 +#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 64 +#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 64 +#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 64 +#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 64 +#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 64 +#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 128 #define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4 +#define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN 64 +#define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN 4 +#define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN 4 +#define FC_FDMI_HBA_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN 64 +#define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN 4 +#define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8 /* * Port Attribute Type @@ -84,6 +104,16 @@ enum fc_fdmi_port_attr_type { FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004, FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005, FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006, + FC_FDMI_PORT_ATTR_NODENAME = 0x0007, + FC_FDMI_PORT_ATTR_PORTNAME = 0x0008, + FC_FDMI_PORT_ATTR_SYMBOLICNAME = 0x0009, + FC_FDMI_PORT_ATTR_PORTTYPE = 0x000A, + FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC = 0x000B, + FC_FDMI_PORT_ATTR_FABRICNAME = 0x000C, + FC_FDMI_PORT_ATTR_CURRENTFC4TYPE = 0x000D, + FC_FDMI_PORT_ATTR_PORTSTATE = 0x101, + FC_FDMI_PORT_ATTR_DISCOVEREDPORTS = 0x102, + FC_FDMI_PORT_ATTR_PORTID = 0x103, }; /* @@ -95,6 +125,17 @@ enum fc_fdmi_port_attr_type { #define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4 #define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256 #define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_NODENAME_LEN 8 +#define FC_FDMI_PORT_ATTR_PORTNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_PORTTYPE_LEN 4 +#define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN 4 +#define FC_FDMI_PORT_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN 32 +#define FC_FDMI_PORT_ATTR_PORTSTATE_LEN 4 +#define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN 4 +#define FC_FDMI_PORT_ATTR_PORTID_LEN 4 + /* * HBA Attribute ID