Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: fc: Add EDC ELS definition

Add Exchange Diagnostic Capabilities (EDC) ELS definition and the following
capability descriptors:

- Link Fault Capability Descriptor

- Congestion Signaling Capability Descriptor

Definitions taken from FC-LS-5 r5.01

Link: https://lore.kernel.org/r/20210816162901.121235-2-jsmart2021@gmail.com
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

James Smart and committed by
Martin K. Petersen
54404d35 922ad26e

+106
+106
include/uapi/scsi/fc/fc_els.h
··· 41 41 ELS_REC = 0x13, /* read exchange concise */ 42 42 ELS_SRR = 0x14, /* sequence retransmission request */ 43 43 ELS_FPIN = 0x16, /* Fabric Performance Impact Notification */ 44 + ELS_EDC = 0x17, /* Exchange Diagnostic Capabilities */ 44 45 ELS_RDP = 0x18, /* Read Diagnostic Parameters */ 45 46 ELS_RDF = 0x19, /* Register Diagnostic Functions */ 46 47 ELS_PRLI = 0x20, /* process login */ ··· 112 111 [ELS_REC] = "REC", \ 113 112 [ELS_SRR] = "SRR", \ 114 113 [ELS_FPIN] = "FPIN", \ 114 + [ELS_EDC] = "EDC", \ 115 115 [ELS_RDP] = "RDP", \ 116 116 [ELS_RDF] = "RDF", \ 117 117 [ELS_PRLI] = "PRLI", \ ··· 220 218 enum fc_ls_tlv_dtag { 221 219 ELS_DTAG_LS_REQ_INFO = 0x00000001, 222 220 /* Link Service Request Information Descriptor */ 221 + ELS_DTAG_LNK_FAULT_CAP = 0x0001000D, 222 + /* Link Fault Capability Descriptor */ 223 + ELS_DTAG_CG_SIGNAL_CAP = 0x0001000F, 224 + /* Congestion Signaling Capability Descriptor */ 223 225 ELS_DTAG_LNK_INTEGRITY = 0x00020001, 224 226 /* Link Integrity Notification Descriptor */ 225 227 ELS_DTAG_DELIVERY = 0x00020002, ··· 242 236 */ 243 237 #define FC_LS_TLV_DTAG_INIT { \ 244 238 { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, \ 239 + { ELS_DTAG_LNK_FAULT_CAP, "Link Fault Capability" }, \ 240 + { ELS_DTAG_CG_SIGNAL_CAP, "Congestion Signaling Capability" }, \ 245 241 { ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, \ 246 242 { ELS_DTAG_DELIVERY, "Delivery Notification Present" }, \ 247 243 { ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, \ ··· 1149 1141 */ 1150 1142 struct fc_els_lsri_desc lsri; 1151 1143 struct fc_tlv_desc desc[0]; /* Supported Descriptor list */ 1144 + }; 1145 + 1146 + 1147 + /* 1148 + * Diagnostic Capability Descriptors for EDC ELS 1149 + */ 1150 + 1151 + /* 1152 + * Diagnostic: Link Fault Capability Descriptor 1153 + */ 1154 + struct fc_diag_lnkflt_desc { 1155 + __be32 desc_tag; /* Descriptor Tag (0x0001000D) */ 1156 + __be32 desc_len; /* Length of Descriptor (in bytes). 1157 + * Size of descriptor excluding 1158 + * desc_tag and desc_len fields. 1159 + * 12 bytes 1160 + */ 1161 + __be32 degrade_activate_threshold; 1162 + __be32 degrade_deactivate_threshold; 1163 + __be32 fec_degrade_interval; 1164 + }; 1165 + 1166 + enum fc_edc_cg_signal_cap_types { 1167 + /* Note: Capability: bits 31:4 Rsvd; bits 3:0 are capabilities */ 1168 + EDC_CG_SIG_NOTSUPPORTED = 0x00, /* neither supported */ 1169 + EDC_CG_SIG_WARN_ONLY = 0x01, 1170 + EDC_CG_SIG_WARN_ALARM = 0x02, /* both supported */ 1171 + }; 1172 + 1173 + /* 1174 + * Initializer useful for decoding table. 1175 + * Please keep this in sync with the above definitions. 1176 + */ 1177 + #define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT { \ 1178 + { EDC_CG_SIG_NOTSUPPORTED, "Signaling Not Supported" }, \ 1179 + { EDC_CG_SIG_WARN_ONLY, "Warning Signal" }, \ 1180 + { EDC_CG_SIG_WARN_ALARM, "Warning and Alarm Signals" }, \ 1181 + } 1182 + 1183 + enum fc_diag_cg_sig_freq_types { 1184 + EDC_CG_SIGFREQ_CNT_MIN = 1, /* Min Frequency Count */ 1185 + EDC_CG_SIGFREQ_CNT_MAX = 999, /* Max Frequency Count */ 1186 + 1187 + EDC_CG_SIGFREQ_SEC = 0x1, /* Units: seconds */ 1188 + EDC_CG_SIGFREQ_MSEC = 0x2, /* Units: milliseconds */ 1189 + }; 1190 + 1191 + struct fc_diag_cg_sig_freq { 1192 + __be16 count; /* Time between signals 1193 + * note: upper 6 bits rsvd 1194 + */ 1195 + __be16 units; /* Time unit for count 1196 + * note: upper 12 bits rsvd 1197 + */ 1198 + }; 1199 + 1200 + /* 1201 + * Diagnostic: Congestion Signaling Capability Descriptor 1202 + */ 1203 + struct fc_diag_cg_sig_desc { 1204 + __be32 desc_tag; /* Descriptor Tag (0x0001000F) */ 1205 + __be32 desc_len; /* Length of Descriptor (in bytes). 1206 + * Size of descriptor excluding 1207 + * desc_tag and desc_len fields. 1208 + * 16 bytes 1209 + */ 1210 + __be32 xmt_signal_capability; 1211 + struct fc_diag_cg_sig_freq xmt_signal_frequency; 1212 + __be32 rcv_signal_capability; 1213 + struct fc_diag_cg_sig_freq rcv_signal_frequency; 1214 + }; 1215 + 1216 + /* 1217 + * ELS_EDC - Exchange Diagnostic Capabilities 1218 + */ 1219 + struct fc_els_edc { 1220 + __u8 edc_cmd; /* command (0x17) */ 1221 + __u8 edc_zero[3]; /* specified as zero - part of cmd */ 1222 + __be32 desc_len; /* Length of Descriptor List (in bytes). 1223 + * Size of ELS excluding edc_cmd, 1224 + * edc_zero and desc_len fields. 1225 + */ 1226 + struct fc_tlv_desc desc[0]; 1227 + /* Diagnostic Descriptor list */ 1228 + }; 1229 + 1230 + /* 1231 + * ELS EDC LS_ACC Response. 1232 + */ 1233 + struct fc_els_edc_resp { 1234 + struct fc_els_ls_acc acc_hdr; 1235 + __be32 desc_list_len; /* Length of response (in 1236 + * bytes). Excludes acc_hdr 1237 + * and desc_list_len fields. 1238 + */ 1239 + struct fc_els_lsri_desc lsri; 1240 + struct fc_tlv_desc desc[0]; 1241 + /* Supported Diagnostic Descriptor list */ 1152 1242 }; 1153 1243 1154 1244