2 * Routines for FC Link Control Frames
3 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include "packet-fclctl.h"
17 const value_string fc_lctl_proto_val
[] = {
18 {FC_LCTL_ACK1
, "ACK1"},
19 {FC_LCTL_ACK0
, "ACK0"},
20 {FC_LCTL_PRJT
, "P_RJT"},
21 {FC_LCTL_FRJT
, "F_RJT"},
22 {FC_LCTL_PBSY
, "P_BSY"},
23 {FC_LCTL_FBSYL
, "F_BSY (Data frame)"},
24 {FC_LCTL_FBSYB
, "F_BSY (Link Ctl)"},
25 {FC_LCTL_LCR
, "LCR"},
26 {FC_LCTL_NTY
, "NTY"},
27 {FC_LCTL_END
, "END"},
31 static const value_string fc_lctl_fbsy_val
[] = {
32 {FC_LCTL_FBSY_FBSY
, "Fabric Busy"},
33 {FC_LCTL_FBSY_NBSY
, "N_Port Busy"},
37 static const value_string fc_lctl_pbsy_acode_val
[] = {
38 {FC_LCTL_PBSY_ACODE_SEQBSY
, "Sequence Marked Busy"},
39 {FC_LCTL_PBSY_ACODE_C2BSY
, "Class 2 Frame Busy"},
43 static const value_string fc_lctl_pbsy_rjt_val
[] = {
44 {FC_LCTL_PBSY_PORTBSY
, "Physical N_Port Busy"},
45 {FC_LCTL_PBSY_RSRCBSY
, "N_Port Resource Busy"},
46 {FC_LCTL_PBSY_MCASTBSY
, "Partial Multicast Busy"},
47 {FC_LCTL_PBSY_VENDBSY
, "Vendor unique Busy"},
51 static const value_string fc_lctl_rjt_acode_val
[] = {
52 {FC_LCTL_RJT_ACODE_RETRY
, "Retryable Error"},
53 {FC_LCTL_RJT_ACODE_NORETRY
, "Non-retryable Error"},
57 static const value_string fc_lctl_rjt_val
[] = {
58 {FC_LCTL_RJT_INVDID
, "Invalid D_ID"},
59 {FC_LCTL_RJT_INVSID
, "Invalid S_ID"},
60 {FC_LCTL_RJT_NPORT_NOTAVAIL_T
, "N_Port Not Avail (Temporary)"},
61 {FC_LCTL_RJT_NPORT_NOTAVAIL_P
, "N_Port Not Avail (Permanent)"},
62 {FC_LCTL_RJT_CLASS_NOTSUPP
, "Class Not Supported"},
63 {FC_LCTL_RJT_DELIM_USERR
, "Delimiter Usage Error"},
64 {FC_LCTL_RJT_TYPE_NOTSUPP
, "Type Not Supported"},
65 {FC_LCTL_RJT_INV_LCTL
, "Invalid Link Ctl Frame"},
66 {FC_LCTL_RJT_INV_RCTL
, "Invalid R_CTL"},
67 {FC_LCTL_RJT_INV_FCTL
, "Invalid F_CTL"},
68 {FC_LCTL_RJT_INV_OXID
, "Invalid OX_ID"},
69 {FC_LCTL_RJT_INV_RXID
, "Invalid RX_ID"},
70 {FC_LCTL_RJT_INV_SEQID
, "Invalid SEQID"},
71 {FC_LCTL_RJT_INV_DFCTL
, "Invalid DF_CTL"},
72 {FC_LCTL_RJT_INV_SEQCNT
, "Invalid SEQCNT"},
73 {FC_LCTL_RJT_INV_PARAM
, "Invalid Parameter"},
74 {FC_LCTL_RJT_EXCHG_ERR
, "Exchange Error"},
75 {FC_LCTL_RJT_PROTO_ERR
, "Protocol Error"},
76 {FC_LCTL_RJT_INV_LEN
, "Incorrect Length"},
77 {FC_LCTL_RJT_UNEXP_ACK
, "Unexpected ACK"},
78 {FC_LCTL_RJT_CLS_NOTSUPP
, "Class Not Supported by Entity at 0xFFFFFE"},
79 {FC_LCTL_RJT_LOGI_REQD
, "Login Required"},
80 {FC_LCTL_RJT_TOOMANY_SEQ
, "Excessive Sequences Attempted"},
81 {FC_LCTL_RJT_EXCHG_NOTESTD
, "Exchange Not Established"},
82 {FC_LCTL_RJT_RSVD
, "Reserved"},
83 {FC_LCTL_RJT_FPATH_NOTAVAIL
, "Fabric Path Not Available"},
84 {FC_LCTL_RJT_INV_VCID
, "Invalid VC_ID"},
85 {FC_LCTL_RJT_INV_CSCTL
, "Invalid CS_CTL"},
86 {FC_LCTL_RJT_OORSRC
, "Insufficient Resources of VC (Class 4)"},
87 {FC_LCTL_RJT_INV_CLASS
, "Invalid Class of Service"},
88 {FC_LCTL_RJT_PRMPT_RJT
, "Preemption Request Rejected"},
89 {FC_LCTL_RJT_PRMPT_DIS
, "Preemption Not Enabled"},
90 {FC_LCTL_RJT_MCAST_ERR
, "Multicast Error"},
91 {FC_LCTL_RJT_MCAST_TERM
, "Multicast Error Terminate"},
92 {FC_LCTL_RJT_PRLI_REQD
, "PRLI Required"},
93 {FC_LCTL_RJT_VEND_ERR
, "Vendor Unique Error"},
96 static value_string_ext fc_lctl_rjt_val_ext
= VALUE_STRING_EXT_INIT(fc_lctl_rjt_val
);
99 fclctl_get_typestr (uint8_t linkctl_type
, uint8_t type
)
101 if ((linkctl_type
== FC_LCTL_FBSYB
) ||
102 (linkctl_type
== FC_LCTL_FBSYL
)) {
103 return (val_to_str ((type
& 0xF0), fc_lctl_fbsy_val
, "0x%x"));
109 fclctl_get_paramstr (wmem_allocator_t
*pool
, uint32_t linkctl_type
, uint32_t param
)
111 if (linkctl_type
== FC_LCTL_PBSY
) {
112 return wmem_strdup_printf(pool
, "%s, %s",
113 val_to_str (((param
& 0xFF000000) >> 24), fc_lctl_pbsy_acode_val
, "0x%x"),
114 val_to_str (((param
& 0x00FF0000) >> 16), fc_lctl_pbsy_rjt_val
, "0x%x"));
116 if ((linkctl_type
== FC_LCTL_FRJT
) ||
117 (linkctl_type
== FC_LCTL_PRJT
)) {
118 return wmem_strdup_printf(pool
, "%s, %s",
119 val_to_str (((param
& 0xFF000000) >> 24), fc_lctl_rjt_acode_val
, "0x%x"),
120 val_to_str_ext (((param
& 0x00FF0000) >> 16), &fc_lctl_rjt_val_ext
, "%x"));
126 * Editor modelines - https://www.wireshark.org/tools/modelines.html
131 * indent-tabs-mode: nil
134 * vi: set shiftwidth=4 tabstop=8 expandtab:
135 * :indentSize=4:tabSize=8:noTabs=true: