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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef included_vnet_optics_sfp_h
17 #define included_vnet_optics_sfp_h
19 #include <vppinfra/format.h>
21 #define foreach_sfp_id \
22 _ (UNKNOWN, "unknown") \
24 _ (ON_MB, "on-motherboard") \
25 _ (SFP, "SFP/SFP+/SFP28") \
26 _ (300_PIN_XBI, "300-pin-XBI") \
27 _ (XENPAK, "XENPAK") \
33 _ (DWDM_SFP, "DWDM-SFP") \
35 _ (QSFP_PLUS, "QSFP+") \
37 _ (SMM_HD_4X, "SMM-HD-4X") \
38 _ (SMM_HD_8X, "SMM-HD-8X") \
39 _ (QSFP28, "QSFP28") \
41 _ (SMM_HD_4X_FAN, "SMM-HD-4X-fanout") \
42 _ (SMM_HD_8X_FAN, "SMM-HD-8X-fanout") \
44 _ (MQSFP, "microQSFP") \
45 _ (QSFP_DD, "QSFP-DD") \
49 #define _(f,s) SFP_ID_##f,
61 u8 nominal_bit_rate_100mbits_per_sec;
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];
78 u8 vendor_serial_number[16];
79 u8 vendor_date_code[8];
82 u8 vendor_specific[32];
85 /* Vendor specific data follows. */
86 u8 vendor_specific1[0];
90 sfp_eeprom_is_valid (sfp_eeprom_t * e)
94 for (i = 0; i < 63; i++)
96 return sum == e->cc_base;
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) \
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) \
125 #define _(a,b,f) SFP_COMPATIBILITY_##f,
126 foreach_sfp_compatibility
129 } sfp_compatibility_t;
131 u32 sfp_is_comatible (sfp_eeprom_t * e, sfp_compatibility_t c);
133 format_function_t format_sfp_eeprom;
135 #endif /* included_vnet_optics_sfp_h */
138 * fd.io coding-style-patch-verification: ON
141 * eval: (c-set-style "gnu")