hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/include/uapi/scsi/fc/fc_els.h
....@@ -2,19 +2,6 @@
22 /*
33 * Copyright(c) 2007 Intel Corporation. All rights reserved.
44 *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms and conditions of the GNU General Public License,
7
- * version 2, as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program; if not, write to the Free Software Foundation, Inc.,
16
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17
- *
185 * Maintained at www.Open-FCoE.org
196 */
207
....@@ -22,6 +9,7 @@
229 #define _FC_ELS_H_
2310
2411 #include <linux/types.h>
12
+#include <asm/byteorder.h>
2513
2614 /*
2715 * Fibre Channel Switch - Enhanced Link Services definitions.
....@@ -52,6 +40,9 @@
5240 ELS_RRQ = 0x12, /* reinstate recovery qualifier */
5341 ELS_REC = 0x13, /* read exchange concise */
5442 ELS_SRR = 0x14, /* sequence retransmission request */
43
+ ELS_FPIN = 0x16, /* Fabric Performance Impact Notification */
44
+ ELS_RDP = 0x18, /* Read Diagnostic Parameters */
45
+ ELS_RDF = 0x19, /* Register Diagnostic Functions */
5546 ELS_PRLI = 0x20, /* process login */
5647 ELS_PRLO = 0x21, /* process logout */
5748 ELS_SCN = 0x22, /* state change notification */
....@@ -119,6 +110,9 @@
119110 [ELS_RRQ] = "RRQ", \
120111 [ELS_REC] = "REC", \
121112 [ELS_SRR] = "SRR", \
113
+ [ELS_FPIN] = "FPIN", \
114
+ [ELS_RDP] = "RDP", \
115
+ [ELS_RDF] = "RDF", \
122116 [ELS_PRLI] = "PRLI", \
123117 [ELS_PRLO] = "PRLO", \
124118 [ELS_SCN] = "SCN", \
....@@ -217,6 +211,99 @@
217211 ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
218212 /* TBD - above definitions incomplete */
219213 };
214
+
215
+/*
216
+ * Link Service TLV Descriptor Tag Values
217
+ */
218
+enum fc_ls_tlv_dtag {
219
+ ELS_DTAG_LS_REQ_INFO = 0x00000001,
220
+ /* Link Service Request Information Descriptor */
221
+ ELS_DTAG_LNK_INTEGRITY = 0x00020001,
222
+ /* Link Integrity Notification Descriptor */
223
+ ELS_DTAG_DELIVERY = 0x00020002,
224
+ /* Delivery Notification Descriptor */
225
+ ELS_DTAG_PEER_CONGEST = 0x00020003,
226
+ /* Peer Congestion Notification Descriptor */
227
+ ELS_DTAG_CONGESTION = 0x00020004,
228
+ /* Congestion Notification Descriptor */
229
+ ELS_DTAG_FPIN_REGISTER = 0x00030001,
230
+ /* FPIN Registration Descriptor */
231
+};
232
+
233
+/*
234
+ * Initializer useful for decoding table.
235
+ * Please keep this in sync with the above definitions.
236
+ */
237
+#define FC_LS_TLV_DTAG_INIT { \
238
+ { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, \
239
+ { ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, \
240
+ { ELS_DTAG_DELIVERY, "Delivery Notification Present" }, \
241
+ { ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, \
242
+ { ELS_DTAG_CONGESTION, "Congestion Notification" }, \
243
+ { ELS_DTAG_FPIN_REGISTER, "FPIN Registration" }, \
244
+}
245
+
246
+
247
+/*
248
+ * Generic Link Service TLV Descriptor format
249
+ *
250
+ * This structure, as it defines no payload, will also be referred to
251
+ * as the "tlv header" - which contains the tag and len fields.
252
+ */
253
+struct fc_tlv_desc {
254
+ __be32 desc_tag; /* Notification Descriptor Tag */
255
+ __be32 desc_len; /* Length of Descriptor (in bytes).
256
+ * Size of descriptor excluding
257
+ * desc_tag and desc_len fields.
258
+ */
259
+ __u8 desc_value[0]; /* Descriptor Value */
260
+};
261
+
262
+/* Descriptor tag and len fields are considered the mandatory header
263
+ * for a descriptor
264
+ */
265
+#define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc)
266
+
267
+/*
268
+ * Macro, used when initializing payloads, to return the descriptor length.
269
+ * Length is size of descriptor minus the tag and len fields.
270
+ */
271
+#define FC_TLV_DESC_LENGTH_FROM_SZ(desc) \
272
+ (sizeof(desc) - FC_TLV_DESC_HDR_SZ)
273
+
274
+/* Macro, used on received payloads, to return the descriptor length */
275
+#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) \
276
+ (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
277
+
278
+/*
279
+ * This helper is used to walk descriptors in a descriptor list.
280
+ * Given the address of the current descriptor, which minimally contains a
281
+ * tag and len field, calculate the address of the next descriptor based
282
+ * on the len field.
283
+ */
284
+static inline void *fc_tlv_next_desc(void *desc)
285
+{
286
+ struct fc_tlv_desc *tlv = desc;
287
+
288
+ return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv));
289
+}
290
+
291
+
292
+/*
293
+ * Link Service Request Information Descriptor
294
+ */
295
+struct fc_els_lsri_desc {
296
+ __be32 desc_tag; /* descriptor tag (0x0000 0001) */
297
+ __be32 desc_len; /* Length of Descriptor (in bytes) (4).
298
+ * Size of descriptor excluding
299
+ * desc_tag and desc_len fields.
300
+ */
301
+ struct {
302
+ __u8 cmd; /* ELS cmd byte */
303
+ __u8 bytes[3]; /* bytes 1..3 */
304
+ } rqst_w0; /* Request word 0 */
305
+};
306
+
220307
221308 /*
222309 * Common service parameters (N ports).
....@@ -829,4 +916,120 @@
829916 ELS_CLID_IC_LIP = 8, /* receiving LIP */
830917 };
831918
919
+
920
+enum fc_fpin_li_event_types {
921
+ FPIN_LI_UNKNOWN = 0x0,
922
+ FPIN_LI_LINK_FAILURE = 0x1,
923
+ FPIN_LI_LOSS_OF_SYNC = 0x2,
924
+ FPIN_LI_LOSS_OF_SIG = 0x3,
925
+ FPIN_LI_PRIM_SEQ_ERR = 0x4,
926
+ FPIN_LI_INVALID_TX_WD = 0x5,
927
+ FPIN_LI_INVALID_CRC = 0x6,
928
+ FPIN_LI_DEVICE_SPEC = 0xF,
929
+};
930
+
931
+/*
932
+ * Initializer useful for decoding table.
933
+ * Please keep this in sync with the above definitions.
934
+ */
935
+#define FC_FPIN_LI_EVT_TYPES_INIT { \
936
+ { FPIN_LI_UNKNOWN, "Unknown" }, \
937
+ { FPIN_LI_LINK_FAILURE, "Link Failure" }, \
938
+ { FPIN_LI_LOSS_OF_SYNC, "Loss of Synchronization" }, \
939
+ { FPIN_LI_LOSS_OF_SIG, "Loss of Signal" }, \
940
+ { FPIN_LI_PRIM_SEQ_ERR, "Primitive Sequence Protocol Error" }, \
941
+ { FPIN_LI_INVALID_TX_WD, "Invalid Transmission Word" }, \
942
+ { FPIN_LI_INVALID_CRC, "Invalid CRC" }, \
943
+ { FPIN_LI_DEVICE_SPEC, "Device Specific" }, \
944
+}
945
+
946
+
947
+/*
948
+ * Link Integrity Notification Descriptor
949
+ */
950
+struct fc_fn_li_desc {
951
+ __be32 desc_tag; /* Descriptor Tag (0x00020001) */
952
+ __be32 desc_len; /* Length of Descriptor (in bytes).
953
+ * Size of descriptor excluding
954
+ * desc_tag and desc_len fields.
955
+ */
956
+ __be64 detecting_wwpn; /* Port Name that detected event */
957
+ __be64 attached_wwpn; /* Port Name of device attached to
958
+ * detecting Port Name
959
+ */
960
+ __be16 event_type; /* see enum fc_fpin_li_event_types */
961
+ __be16 event_modifier; /* Implementation specific value
962
+ * describing the event type
963
+ */
964
+ __be32 event_threshold;/* duration in ms of the link
965
+ * integrity detection cycle
966
+ */
967
+ __be32 event_count; /* minimum number of event
968
+ * occurrences during the event
969
+ * threshold to caause the LI event
970
+ */
971
+ __be32 pname_count; /* number of portname_list elements */
972
+ __be64 pname_list[0]; /* list of N_Port_Names accessible
973
+ * through the attached port
974
+ */
975
+};
976
+
977
+/*
978
+ * ELS_FPIN - Fabric Performance Impact Notification
979
+ */
980
+struct fc_els_fpin {
981
+ __u8 fpin_cmd; /* command (0x16) */
982
+ __u8 fpin_zero[3]; /* specified as zero - part of cmd */
983
+ __be32 desc_len; /* Length of Descriptor List (in bytes).
984
+ * Size of ELS excluding fpin_cmd,
985
+ * fpin_zero and desc_len fields.
986
+ */
987
+ struct fc_tlv_desc fpin_desc[0]; /* Descriptor list */
988
+};
989
+
990
+/* Diagnostic Function Descriptor - FPIN Registration */
991
+struct fc_df_desc_fpin_reg {
992
+ __be32 desc_tag; /* FPIN Registration (0x00030001) */
993
+ __be32 desc_len; /* Length of Descriptor (in bytes).
994
+ * Size of descriptor excluding
995
+ * desc_tag and desc_len fields.
996
+ */
997
+ __be32 count; /* Number of desc_tags elements */
998
+ __be32 desc_tags[0]; /* Array of Descriptor Tags.
999
+ * Each tag indicates a function
1000
+ * supported by the N_Port (request)
1001
+ * or by the N_Port and Fabric
1002
+ * Controller (reply; may be a subset
1003
+ * of the request).
1004
+ * See ELS_FN_DTAG_xxx for tag values.
1005
+ */
1006
+};
1007
+
1008
+/*
1009
+ * ELS_RDF - Register Diagnostic Functions
1010
+ */
1011
+struct fc_els_rdf {
1012
+ __u8 fpin_cmd; /* command (0x19) */
1013
+ __u8 fpin_zero[3]; /* specified as zero - part of cmd */
1014
+ __be32 desc_len; /* Length of Descriptor List (in bytes).
1015
+ * Size of ELS excluding fpin_cmd,
1016
+ * fpin_zero and desc_len fields.
1017
+ */
1018
+ struct fc_tlv_desc desc[0]; /* Descriptor list */
1019
+};
1020
+
1021
+/*
1022
+ * ELS RDF LS_ACC Response.
1023
+ */
1024
+struct fc_els_rdf_resp {
1025
+ struct fc_els_ls_acc acc_hdr;
1026
+ __be32 desc_list_len; /* Length of response (in
1027
+ * bytes). Excludes acc_hdr
1028
+ * and desc_list_len fields.
1029
+ */
1030
+ struct fc_els_lsri_desc lsri;
1031
+ struct fc_tlv_desc desc[0]; /* Supported Descriptor list */
1032
+};
1033
+
1034
+
8321035 #endif /* _FC_ELS_H_ */