FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
sfp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef included_vnet_optics_sfp_h
17 #define included_vnet_optics_sfp_h
18 
19 #include <vppinfra/format.h>
20 
21 #define foreach_sfp_id \
22  _ (UNKNOWN, "unknown") \
23  _ (GBIC, "GBIC") \
24  _ (ON_MB, "on-motherboard") \
25  _ (SFP, "SFP/SFP+/SFP28") \
26  _ (300_PIN_XBI, "300-pin-XBI") \
27  _ (XENPAK, "XENPAK") \
28  _ (XFP, "XFP") \
29  _ (XFF, "XFF") \
30  _ (XFP_E, "XFP-E") \
31  _ (XPAK, "XPAK") \
32  _ (X2, "X2") \
33  _ (DWDM_SFP, "DWDM-SFP") \
34  _ (QSFP, "QSFP") \
35  _ (QSFP_PLUS, "QSFP+") \
36  _ (CXP, "CXP") \
37  _ (SMM_HD_4X, "SMM-HD-4X") \
38  _ (SMM_HD_8X, "SMM-HD-8X") \
39  _ (QSFP28, "QSFP28") \
40  _ (CXP2, "CXP2") \
41  _ (SMM_HD_4X_FAN, "SMM-HD-4X-fanout") \
42  _ (SMM_HD_8X_FAN, "SMM-HD-8X-fanout") \
43  _ (CDFP, "CDFP") \
44  _ (MQSFP, "microQSFP") \
45  _ (QSFP_DD, "QSFP-DD") \
46 
47 typedef enum
48 {
49 #define _(f,s) SFP_ID_##f,
51 #undef _
52 } sfp_id_t;
53 
54 typedef struct
55 {
56  u8 id;
59  u8 compatibility[8];
63  u8 length[5];
65  u8 vendor_name[16];
67  u8 vendor_oui[3];
68  u8 vendor_part_number[16];
69  u8 vendor_revision[2];
70  /* 16 bit value network byte order. */
71  u8 wavelength_or_att[2];
72  u8 wavelength_tolerance_or_att[2];
75 
77  u8 options[3];
78  u8 vendor_serial_number[16];
79  u8 vendor_date_code[8];
80  u8 reserved92[3];
82  u8 vendor_specific[32];
83  u8 reserved128[384];
84 
85  /* Vendor specific data follows. */
86  u8 vendor_specific1[0];
87 } sfp_eeprom_t;
88 
91 {
92  int i;
93  u8 sum = 0;
94  for (i = 0; i < 63; i++)
95  sum += ((u8 *) e)[i];
96  return sum == e->cc_base;
97 }
98 
99 /* _ (byte_index, bit_index, name) */
100 #define foreach_sfp_compatibility \
101  _ (0, 0, 40g_active_cable) \
102  _ (0, 1, 40g_base_lr4) \
103  _ (0, 2, 40g_base_sr4) \
104  _ (0, 3, 40g_base_cr4) \
105  _ (0, 4, 10g_base_sr) \
106  _ (0, 5, 10g_base_lr) \
107  _ (0, 5, 10g_base_lrm) \
108  _ (1, 3, 40g_otn) \
109  _ (1, 2, oc48_long_reach) \
110  _ (1, 1, oc48_intermediate_reach) \
111  _ (1, 0, oc48_short_reach) \
112  _ (2, 6, oc12_long_reach) \
113  _ (2, 5, oc12_intermediate_reach) \
114  _ (2, 4, oc12_short_reach) \
115  _ (2, 2, oc3_long_reach) \
116  _ (2, 1, oc3_intermediate_reach) \
117  _ (2, 0, oc3_short_reach) \
118  _ (3, 3, 1g_base_t) \
119  _ (3, 2, 1g_base_cx) \
120  _ (3, 1, 1g_base_lx) \
121  _ (3, 0, 1g_base_sx)
122 
123 typedef enum
124 {
125 #define _(a,b,f) SFP_COMPATIBILITY_##f,
127 #undef _
130 
132 
134 
135 #endif /* included_vnet_optics_sfp_h */
136 
137 /*
138  * fd.io coding-style-patch-verification: ON
139  *
140  * Local Variables:
141  * eval: (c-set-style "gnu")
142  * End:
143  */
u8 connector_type
Definition: sfp.h:58
u8 extended_id
Definition: sfp.h:57
u8 nominal_bit_rate_100mbits_per_sec
Definition: sfp.h:61
#define foreach_sfp_compatibility
Definition: sfp.h:100
static uword sfp_eeprom_is_valid(sfp_eeprom_t *e)
Definition: sfp.h:90
int i
unsigned char u8
Definition: types.h:56
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
u8 link_codes
Definition: sfp.h:76
u8 checksum_63_to_94
Definition: sfp.h:81
u8 ext_module_codes
Definition: sfp.h:66
unsigned int u32
Definition: types.h:88
u8 id
Definition: sfp.h:56
format_function_t format_sfp_eeprom
Definition: sfp.h:133
#define always_inline
Definition: ipsec.h:28
u8 reserved13
Definition: sfp.h:62
svmdb_client_t * c
u8 cc_base
Definition: sfp.h:74
sfp_id_t
Definition: sfp.h:47
u8 encoding
Definition: sfp.h:60
#define foreach_sfp_id
Definition: sfp.h:21
sfp_compatibility_t
Definition: sfp.h:123
u64 uword
Definition: types.h:112
static struct option options[]
Definition: main.c:52
u8 device_tech
Definition: sfp.h:64
u8 max_case_temp
Definition: sfp.h:73
u32 sfp_is_comatible(sfp_eeprom_t *e, sfp_compatibility_t c)
Definition: sfp.c:64