Commit 6c983d32 authored by James Smart's avatar James Smart Committed by Martin K. Petersen
Browse files

scsi: lpfc: Register for Application Services FC-4 type in Fabric topology

Add new FC-4 type 0x60 Application Services for fabric registration when
VMID is enabled.

Modified rft struture to indicate __be format. Removed redundant ipReg
variable as it was not used.

Link: https://lore.kernel.org/r/20220412222008.126521-19-jsmart2021@gmail.com


Co-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 6c8a3ce6
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -2018,28 +2018,30 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
		vport->ct_flags &= ~FC_CT_RFT_ID;
		CtReq->CommandResponse.bits.CmdRsp =
		    cpu_to_be16(SLI_CTNS_RFT_ID);
		CtReq->un.rft.PortId = cpu_to_be32(vport->fc_myDID);
		CtReq->un.rft.port_id = cpu_to_be32(vport->fc_myDID);

		/* Register Application Services type if vmid enabled. */
		if (phba->cfg_vmid_app_header)
			CtReq->un.rft.app_serv_reg =
				cpu_to_be32(RFT_APP_SERV_REG);

		/* Register FC4 FCP type if enabled.  */
		if (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH ||
		    vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP)
			CtReq->un.rft.fcpReg = 1;
			CtReq->un.rft.fcp_reg = cpu_to_be32(RFT_FCP_REG);

		/* Register NVME type if enabled.  Defined LE and swapped.
		 * rsvd[0] is used as word1 because of the hard-coded
		 * word0 usage in the ct_request data structure.
		 */
		/* Register NVME type if enabled. */
		if (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH ||
		    vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)
			CtReq->un.rft.rsvd[0] =
				cpu_to_be32(LPFC_FC4_TYPE_BITMASK);
			CtReq->un.rft.nvme_reg = cpu_to_be32(RFT_NVME_REG);

		ptr = (uint32_t *)CtReq;
		lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
				 "6433 Issue RFT (%s %s): %08x %08x %08x %08x "
				 "%08x %08x %08x %08x\n",
				 CtReq->un.rft.fcpReg ? "FCP" : " ",
				 CtReq->un.rft.rsvd[0] ? "NVME" : " ",
				 "6433 Issue RFT (%s %s %s): %08x %08x %08x "
				 "%08x %08x %08x %08x %08x\n",
				 CtReq->un.rft.fcp_reg ? "FCP" : " ",
				 CtReq->un.rft.nvme_reg ? "NVME" : " ",
				 CtReq->un.rft.app_serv_reg ? "APPS" : " ",
				 *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3),
				 *(ptr + 4), *(ptr + 5),
				 *(ptr + 6), *(ptr + 7));
+18 −18
Original line number Diff line number Diff line
@@ -97,6 +97,18 @@ union CtCommandResponse {
#define FC4_FEATURE_INIT	0x2
#define FC4_FEATURE_NVME_DISC	0x4

enum rft_word0 {
	RFT_FCP_REG	= (0x1 << 8),
};

enum rft_word1 {
	RFT_NVME_REG	= (0x1 << 8),
};

enum rft_word3 {
	RFT_APP_SERV_REG	= (0x1 << 0),
};

struct lpfc_sli_ct_request {
	/* Structure is in Big Endian format */
	union CtRevisionId RevisionId;
@@ -131,25 +143,13 @@ struct lpfc_sli_ct_request {
			uint8_t Fc4Type;
		} gid_ff;
		struct rft {
			uint32_t PortId;	/* For RFT_ID requests */

#ifdef __BIG_ENDIAN_BITFIELD
			uint32_t rsvd0:16;
			uint32_t rsvd1:7;
			uint32_t fcpReg:1;	/* Type 8 */
			uint32_t rsvd2:2;
			uint32_t ipReg:1;	/* Type 5 */
			uint32_t rsvd3:5;
#else	/*  __LITTLE_ENDIAN_BITFIELD */
			uint32_t rsvd0:16;
			uint32_t fcpReg:1;	/* Type 8 */
			uint32_t rsvd1:7;
			uint32_t rsvd3:5;
			uint32_t ipReg:1;	/* Type 5 */
			uint32_t rsvd2:2;
#endif
			__be32 port_id; /* For RFT_ID requests */

			uint32_t rsvd[7];
			__be32 fcp_reg;	/* rsvd 31:9, fcp_reg 8, rsvd 7:0 */
			__be32 nvme_reg; /* rsvd 31:9, nvme_reg 8, rsvd 7:0 */
			__be32 word2;
			__be32 app_serv_reg; /* rsvd 31:1, app_serv_reg 0 */
			__be32 word[4];
		} rft;
		struct rnn {
			uint32_t PortId;	/* For RNN_ID requests */