2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright (c) 2017, Joyent, Inc.
17 * Parse raw SFF data into an nvlist that can be processed by users, providing
18 * them with what can be printable strings. At the moment, we handle the
19 * majority of parsing page 0xa0 based on SFF 8472 (thus covering INF-8074 and
20 * friends) and SFF 8636 (thus covering SFF-8436 and friends). Interfaces that
21 * parse data into logical structures may be useful to add when considering
22 * monitoring data in page 0xa2.
24 * When parsing, we try to make sure that the user has supplied, or at least
25 * thinks they have supplied, a buffer of sufficient length. The general design
26 * is that we require the buffer to be large enough to cover all of the offsets
27 * that we care about. If the buffer isn't this large, then we leave it be.
29 * This library is private and subject to change at any time.
40 #define MIN(a, b) ((a) < (b) ? (a) : (b))
43 * Maximum size of a string buffer while parsing.
45 #define SFP_STRBUF 128
48 * Minimum length of the buffer we require to parse the SFP data.
50 #define SFP_MIN_LEN_8472 96
51 #define SFP_MIN_LEN_8636 224
54 * This table is derived from SFF 8024 Section 4.1, Table 4-1.
56 static const char *sff_8024_id_strs
[SFF_8024_NIDS
] = {
57 "Unknown or Unspecified",
59 "Module/connector soldered to motherboard",
68 "DWDM-SFP/SFP+ (not using SFF-8472)",
72 "Shielded Mini Multilane HD 4X",
73 "Shielded Mini Multilane HD 8X",
75 "CXP2 (aka CXP28) or later",
76 "CDFP (Style 1/Style2)",
77 "Shielded Mini Multilane HD 4X Fanout Cable",
78 "Shielded Mini Multilane HD 8X Fanout Cable",
84 * The set of values used for the encoding depends on whether we're a basic SFP
85 * device or not. The values are inconsistent between SFP and QSFP based
88 * This table is derived from SFF 8024 r3.9 Table 4-2.
90 #define SFF_8024_NENCS 9
91 static const char *sff_8024_enc_sfp
[] = {
103 static const char *sff_8024_enc_qsfp
[] = {
116 * This table is derived from SFF 8024 r3.9 Section 4.4.
118 #define SFF_8024_EXT_SPEC_NENTRIES 27
119 static const char *sff_8024_ext_spec
[] = {
121 "100G AOC or 25GAUI C2M AOC",
122 "100GBASE-SR4 or 25GBASE-SR",
123 "100GBASE-LR4 or 25GBASE-LR",
124 "100GBASE-ER4 or 25GBASE-ER",
127 "100G PSM4 Parallel SMF",
128 "100G ACC or 25GAUI C2M ACC",
131 "100GBASE-CR4 or 25GBASE-CR CA-L",
138 "40G PSM4 Parallel SMF",
139 "G959.1 profile P1I1-2D1",
140 "G959.1 profile P1S1-2D2",
141 "G959.1 profile P1L1-2D2",
142 "10GBASE-T with SFI electrical interface",
144 "100G AOC or 25GAUI C2M AOC",
145 "100G ACC or 25GAUI C2M ACC",
149 typedef struct sff_pair
{
155 * This table is derived from SFF 8024 r3.9 Section 4.3.
157 static sff_pair_t sff_8024_connectors
[] = {
159 { 0x01, "SC (Subscriber Connector)" },
160 { 0x02, "Fibre Channel Style 1 copper connector" },
161 { 0x03, "Fibre Channel Style 2 copper connector" },
162 { 0x04, "BNC/TNC (Bayonet/Threaded Neill-Concelman)" },
163 { 0x05, "Fibre Channel coax headers" },
164 { 0x06, "Fiber Jack" },
165 { 0x07, "LC (Lucent Connector)" },
166 { 0x08, "MT-RJ (Mechanical Transfer - Registered Jack)" },
167 { 0x09, "MU (Multiple Optical)" },
169 { 0x0B, "Optical Pigtail" },
170 { 0x0C, "MPO 1x12 (Multifiber Parallel Optic)" },
171 { 0x0D, "MPO 2x16" },
172 { 0x20, "HSSDC II (High Speed Serial Data Connector)" },
173 { 0x21, "Copper pigtail" },
174 { 0x22, "RJ45 (Registered Jack)" },
175 { 0x23, "No separable connector" },
176 { 0x24, "MXC 2x16" },
181 * This is derived from SFF 8472 r12.2 Table 5-3.
183 #define SFF_8472_COMP_10GETH_MASK 0xf0
184 static sff_pair_t sff_8472_comp_10geth
[] = {
185 { 0x80, "10G Base-ER" },
186 { 0x40, "10G Base-LRM" },
187 { 0x20, "10G Base-LR" },
188 { 0x10, "10G Base-SR" },
193 * This is derived from SFF 8472 r12.2 Table 5-3.
195 #define SFF_8472_COMP_IB_MASK 0x0f
196 static sff_pair_t sff_8472_comp_ib
[] = {
199 { 0x02, "1X Copper Active" },
200 { 0x01, "1X Copper Passive" },
205 * This is derived from SFF 8472 r12.2 Table 5-3.
207 #define SFF_8472_COMP_ESCON_MASK 0xc0
208 static sff_pair_t sff_8472_comp_escon
[] = {
209 { 0x80, "ESCON MMF, 1310nm LED" },
210 { 0x40, "ESCON SMF, 1310nm Laser" },
215 * This is derived from SFF 8472 r12.2 Table 5-3. These values come from both
216 * bytes 4 and 5. We treat this as a uint16_t with the low byte as byte 4 and
217 * the high byte as byte 5.
219 #define SFF_8472_COMP_SOCON_MASK 0x773f
220 static sff_pair_t sff_8472_comp_sonet
[] = {
221 { 0x20, "OC-192, short reach" },
222 { 0x10, "SONET reach specifier bit 1" },
223 { 0x08, "ONET reach specifier bit 2" },
224 { 0x04, "OC-48, long reach" },
225 { 0x02, "OC-48, intermediate reach" },
226 { 0x01, "OC-48, short reach" },
227 /* 0x8000 is unallocated */
228 { 0x4000, "OC-12, single mode, long reach" },
229 { 0x2000, "OC-12, single mode, inter. reach" },
230 { 0x1000, "OC-12, short reach" },
231 /* 0x800 is unallocted */
232 { 0x0400, "OC-3, single mode, long reach" },
233 { 0x0200, "OC-3, single mode, inter. reach" },
234 { 0x0100, "OC-3, short reach" },
239 * This is derived from SFF 8472 r12.2 Table 5-3.
241 #define SFF_8472_COMP_ETH_MASK 0xff
242 static sff_pair_t sff_8472_comp_eth
[] = {
244 { 0x40, "BASE-BX10" },
245 { 0x20, "100BASE-FX" },
246 { 0x10, "100BASE-LX/LX10" },
247 { 0x08, "1000BASE-T" },
248 { 0x04, "1000BASE-CX" },
249 { 0x02, "1000BASE-LX" },
250 { 0x01, "1000BASE-SX" },
255 * This is derived from SFF 8472 r12.2 Table 5-3.
257 #define SFF_8472_COMP_FCLEN_MASK 0xf8
258 static sff_pair_t sff_8472_comp_fclen
[] = {
259 { 0x80, "very long distance (V)" },
260 { 0x40, "short distance (S)" },
261 { 0x20, "intermeddiate distance (I)" },
262 { 0x10, "long distance (L)" },
263 { 0x08, "medium distance (M)" },
268 * This is derived from SFF 8472 r12.2 Table 5-3. These values come from both
269 * bytes 7 and 8. We treat this as a uint16_t with the low byte as byte 7 and
270 * the high byte as byte 8.
272 #define SFF_8472_COMP_TECH_MASK 0xf007
273 static sff_pair_t sff_8472_comp_tech
[] = {
274 { 0x4, "Shortwave laser, linear Rx (SA)" },
275 { 0x2, "Longwave laser (LC)" },
276 { 0x1, "Electrical inter-enclosure (EL)" },
277 { 0x8000, "Electrical intra-enclosure (EL)" },
278 { 0x4000, "Shortwave laser w/o OFC (SN)" },
279 { 0x2000, "Shortwave laser with OFC (SL)" },
280 { 0x1000, "Longwave laser (LL)" },
285 * This is derived from SFF 8472 r12.2 Table 5-3.
287 #define SFF_8472_COMP_CABLE_MASK 0x0c
288 #define SFF_8472_COMP_CABLE_ACTIVE 0x08
289 #define SFF_8472_COMP_CABLE_PASSIVE 0x04
290 static sff_pair_t sff_8472_comp_cable
[] = {
291 { 0x08, "Active Cable" },
292 { 0x04, "Passive Cable" },
297 * This is derived from SFF 8472 r12.2 Table 5-3.
299 #define SFF_8472_COMP_MEDIA_MASK 0xfd
300 static sff_pair_t sff_8472_comp_media
[] = {
301 { 0x80, "Twin Axial Pair (TW)" },
302 { 0x40, "Twisted Pair (TP)" },
303 { 0x20, "Miniature Coax (MI)" },
304 { 0x10, "Video Coax (TV)" },
305 { 0x08, "Multimode, 62.5um (M6)" },
306 { 0x04, "Multimode, 50um (M5, M5E)" },
307 /* 0x02 is Unallocated */
308 { 0x01, "Single Mode (SM)" },
313 * This is derived from SFF 8472 r12.2 Table 5-3.
315 #define SFF_8472_COMP_SPEED_MASK 0xfd
316 static sff_pair_t sff_8472_comp_speed
[] = {
317 { 0x80, "1200 MBytes/sec" },
318 { 0x40, "800 MBytes/sec" },
319 { 0x20, "1600 MBytes/sec" },
320 { 0x10, "400 MBytes/sec" },
321 { 0x08, "3200 MBytes/sec" },
322 { 0x04, "200 MBytes/sec" },
323 /* 0x02 is Unallocated */
324 { 0x01, "100 MBytes/sec" },
329 * This is derived from SFF 8472 r12.2 Table 8-1.
330 * Note, only byte 60 is allocated at this time.
332 #define SFF_8472_PCABLE_COMP_MASK 0x3f
333 static sff_pair_t sff_8472_pcable_comp
[] = {
334 { 0x20, "Reserved for SFF-8461" },
335 { 0x10, "Reserved for SFF-8461" },
336 { 0x08, "Reserved for SFF-8461" },
337 { 0x04, "Reserved for SFF-8461" },
338 { 0x02, "Compliant to FC-PI-4 Appendix H" },
339 { 0x01, "Compliant to SFF-8431 Appendix E" },
344 * This is derived from SFF 8472 r12.2 Table 8-2.
345 * Note, only byte 60 is allocated at this time.
347 #define SFF_8472_ACABLE_COMP_MASK 0xf
348 static sff_pair_t sff_8472_acable_comp
[] = {
349 { 0x08, "Compliant to FC-PI-4 Limiting" },
350 { 0x04, "Compliant to SFF-8431 Limiting" },
351 { 0x02, "Compliant to FC-PI-4 Appendix H" },
352 { 0x01, "Compliant to SFF-8431 Appendix" },
357 * This is derived from SFF 8472 r12.2 Table 8-3.
358 * Note that we combined byte 64 and 65. Byte 64 is the upper bit.
360 #define SFF_8472_OPTION_MASK 0x3ffe
361 static sff_pair_t sff_8472_options
[] = {
362 { 0x2000, "Power Level 3 Requirement"},
363 { 0x1000, "Paging Implemented"},
364 { 0x0800, "Retimer or CDR implemented"},
365 { 0x0400, "Cooled Transceiver Implemented"},
366 { 0x0200, "Power Level 2 Requirement"},
367 { 0x0100, "Linear Receiver Output Implemented"},
368 { 0x0080, "Receiver decision threshold implemented"},
369 { 0x0040, "Tunable transmitter"},
370 { 0x0020, "RATE_SELECT implemented"},
371 { 0x0010, "TX_DISABLE implemented"},
372 { 0x0008, "TX_FAULT implemented"},
373 { 0x0004, "Rx_LOS inverted"},
374 { 0x0002, "Rx_LOS implemented"},
378 * This is derived from SFF 8472 r12.2 Table 8-6.
380 #define SFF_8472_EXTOPT_MASK 0xfe
381 static sff_pair_t sff_8472_extopts
[] = {
382 { 0x80, "Alarm/Warning flags implemented" },
383 { 0x40, "Soft TX_DISABLE implemented" },
384 { 0x20, "Soft TX_FAULT implemented" },
385 { 0x10, "Soft RX_LOS implemented" },
386 { 0x08, "Soft RATE_SELECT implemented" },
387 { 0x04, "Application Select implemented" },
388 { 0x02, "Soft Rate Select Control Implemented" },
393 * This is derived from SFF 8472 r12.2 Table 8-8.
395 #define SFF_8472_8472_COMP_NENTRIES 9
396 static const char *sff_8472_8472_comp
[] = {
409 * This is derived from SFF 8636 r2.7 Table 6-17.
411 #define SFF_8636_COMP_10GETH_MASK 0x7f
412 static sff_pair_t sff_8636_comp_10geth
[] = {
413 { 0x40, "10GBASE-LRM" },
414 { 0x20, "10GBASE-LR" },
415 { 0x10, "10GBASE-SR" },
416 { 0x08, "40GBASE-CR4" },
417 { 0x04, "40GBASE-SR4" },
418 { 0x02, "40GBASE-LR4" },
419 { 0x01, "40G Active Cable (XLPPI)" },
424 * This is derived from SFF 8636 r2.7 Table 6-17.
426 #define SFF_8636_COMP_SONET_MASK 0x07
427 static sff_pair_t sff_8636_comp_sonet
[] = {
428 { 0x04, "OC 48, long reach" },
429 { 0x02, "OC 48, intermediate reach" },
430 { 0x01, "OC 48 short reach" },
435 * This is derived from SFF 8636 r2.7 Table 6-17.
437 #define SFF_8636_COMP_SAS_MASK 0xf0
438 static sff_pair_t sff_8636_comp_sas
[] = {
439 { 0x80, "SAS 24.0 Gb/s" },
440 { 0x40, "SAS 12.0 Gb/s" },
441 { 0x20, "SAS 6.0 Gb/s" },
442 { 0x10, "SAS 3.0 Gb/s" },
447 * This is derived from SFF 8636 r2.7 Table 6-17.
449 #define SFF_8636_COMP_ETH_MASK 0x0f
450 static sff_pair_t sff_8636_comp_eth
[] = {
451 { 0x08, "1000BASE-T" },
452 { 0x04, "1000BASE-CX" },
453 { 0x02, "1000BASE-LX" },
454 { 0x01, "1000BASE-SX" },
459 * This is derived from SFF 8636 r2.7 Table 6-17.
461 #define SFF_8636_COMP_FCLEN_MASK 0xf8
462 static sff_pair_t sff_8636_comp_fclen
[] = {
463 { 0x80, "very long distance (V)" },
464 { 0x40, "short distance (S)" },
465 { 0x20, "intermeddiate distance (I)" },
466 { 0x10, "long distance (L)" },
467 { 0x08, "medium distance (M)" },
472 * This is derived from SFF 8636 r2.7 Table 6-17.
474 #define SFF_8636_COMP_TECH_MASK 0xf003
475 static sff_pair_t sff_8636_comp_tech
[] = {
476 { 0x2, "Longwave laser (LC)" },
477 { 0x1, "Electrical inter-enclosure (EL)" },
478 { 0x8000, "Electrical intra-enclosure (EL)" },
479 { 0x4000, "Shortwave laser w/o OFC (SN)" },
480 { 0x2000, "Shortwave laser with OFC (SL)" },
481 { 0x1000, "Longwave laser (LL)" },
486 * This is derived from SFF 8636 r2.7 Table 6-17.
488 #define SFF_8636_COMP_MEDIA_MASK 0xff
489 static sff_pair_t sff_8636_comp_media
[] = {
490 { 0x80, "Twin Axial Pair (TW)" },
491 { 0x40, "Twisted Pair (TP)" },
492 { 0x20, "Miniature Coax (MI)" },
493 { 0x10, "Video Coax (TV)" },
494 { 0x08, "Multimode, 62.5um (M6)" },
495 { 0x04, "Multimode, 50m (M5)" },
496 { 0x02, "Multimode, 50um (OM3)" },
497 { 0x01, "Single Mode (SM)" },
502 * This is derived from SFF 8636 r2.7 Table 6-17.
504 #define SFF_8636_COMP_SPEED_MASK 0xfd
505 static sff_pair_t sff_8636_comp_speed
[] = {
506 { 0x80, "1200 MBytes/sec" },
507 { 0x40, "800 MBytes/sec" },
508 { 0x20, "1600 MBytes/sec" },
509 { 0x10, "400 MBytes/sec" },
510 { 0x08, "3200 MBytes/sec" },
511 { 0x04, "200 MBytes/sec" },
512 { 0x01, "100 MBytes/sec" },
517 * This is derived from SFF 8636 r2.7 Table 6-20.
519 static const char *sff_8636_trans_tech
[] = {
530 "Copper cable unequalized",
531 "Copper cable passive equalized",
532 "Copper cable, near and far end limiting active equalizers",
533 "Copper cable, far end limiting active equalizers",
534 "Copper cable, near end limiting active equalizers",
535 "Copper cable, linear active equalizers"
539 * This is derived from SFF 8636 r2.7 Table 6-21.
541 #define SFF_8636_EXTMOD_CODES 0x1f
542 static sff_pair_t sff_8636_extmod_codes
[] = {
552 * This is derived from SFF 8636 r2.7 Table 6-22. This combines bytes 193-195.
553 * We treat byte 193 as the most significant.
555 #define SFF_8636_OPTION_MASK 0x0ffffe
556 static sff_pair_t sff_8636_options
[] = {
557 { 0x080000, "TX Input Equalization Auto Adaptive Capable" },
558 { 0x040000, "TX Input Equalization Fixed Programmable" },
559 { 0x020000, "RX Output Emphasis Fixed Programmable Settings" },
560 { 0x010000, "RX Output Amplitude Fixed Programmable Settings" },
561 { 0x008000, "TX CDR On/Off Control implemented" },
562 { 0x004000, "RX CDR On/Off Control implemented" },
563 { 0x002000, "Tx CDR Loss of Lock Flag implemented" },
564 { 0x001000, "Rx CDR Loss of Lock Flag implemented" },
565 { 0x000800, "Rx Squelch Disable implemented" },
566 { 0x000400, "Rx Output Disable capable" },
567 { 0x000200, "Tx Squelch Disable implemented" },
568 { 0x000100, "Tx Squelch implemented" },
569 { 0x000080, "Memory page 02h provided" },
570 { 0x000040, "Memory page 01h provided" },
571 { 0x000020, "Rate Select implemented" },
572 { 0x000010, "Tx_DISABLE implemented" },
573 { 0x000008, "Tx_FAULT implemented" },
574 { 0x000004, "Tx Squelch for Pave" },
575 { 0x000002, "Tx Loss of Signal implemented" },
580 * This is derived from SFF 8636 r2.7 Table 6-25.
582 #define SFF_8636_ENHANCED_OPTIONS_MASK 0x1c
583 static sff_pair_t sff_8636_eopt
[] = {
584 { 0x10, "Initialization Complete Flag Implemented" },
585 { 0x08, "Extended Rate Selection Supported" },
586 { 0x04, "Application Select Table Supported" },
591 sff_pair_find(uint_t val
, sff_pair_t
*pairs
)
593 while (pairs
->sp_name
!= NULL
) {
594 if (val
== pairs
->sp_val
)
595 return (pairs
->sp_name
);
603 sff_parse_id(uint8_t id
, nvlist_t
*nvl
)
607 if (id
>= SFF_8024_VENDOR
) {
608 val
= "Vendor Specific";
609 } else if (id
>= SFF_8024_NIDS
) {
612 val
= sff_8024_id_strs
[id
];
615 return (nvlist_add_string(nvl
, LIBSFF_KEY_IDENTIFIER
, val
));
619 sff_add_unit_string(uint64_t val
, uint64_t factor
, const char *unit
,
620 nvlist_t
*nvl
, const char *key
)
622 char str
[SFP_STRBUF
];
625 (void) snprintf(str
, sizeof (str
), "%" PRIu64
" %s", val
, unit
);
626 return (nvlist_add_string(nvl
, key
, str
));
630 sff_parse_connector(uint8_t con
, nvlist_t
*nvl
)
635 val
= "Vendor Specific";
637 if ((val
= sff_pair_find(con
, sff_8024_connectors
)) == NULL
)
641 return (nvlist_add_string(nvl
, LIBSFF_KEY_CONNECTOR
, val
));
645 * Many of the values in the specifications are bitfields of which one or more
646 * bits may be set. We represent that as an array of strings. One entry will be
647 * added for each set bit that's found in pairs.
650 sff_gather_bitfield(uint32_t value
, const char *name
, sff_pair_t
*pairs
,
654 const char *vals
[32];
658 for (i
= 0; i
< 32; i
++) {
663 if ((bit
& value
) == 0)
666 str
= sff_pair_find(bit
, pairs
);
676 * The nvlist routines don't touch the array, so we end up lying about
677 * the type of data so that we can avoid a rash of additional
678 * allocations and strdups.
680 return (nvlist_add_string_array(nvl
, name
, (char **)vals
, count
));
684 sff_parse_compliance(const uint8_t *buf
, nvlist_t
*nvl
)
689 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_10GE
] &
690 SFF_8472_COMP_10GETH_MASK
, LIBSFF_KEY_COMPLIANCE_10GBE
,
691 sff_8472_comp_10geth
, nvl
)) != 0)
694 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_IB
] &
695 SFF_8472_COMP_IB_MASK
, LIBSFF_KEY_COMPLIANCE_IB
,
696 sff_8472_comp_ib
, nvl
)) != 0)
699 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_ESCON
] &
700 SFF_8472_COMP_ESCON_MASK
, LIBSFF_KEY_COMPLIANCE_ESCON
,
701 sff_8472_comp_escon
, nvl
)) != 0)
704 v
= buf
[SFF_8472_COMPLIANCE_SONET_LOW
] |
705 (buf
[SFF_8472_COMPLIANCE_SONET_HIGH
] << 8);
706 if ((ret
= sff_gather_bitfield(v
& SFF_8472_COMP_SOCON_MASK
,
707 LIBSFF_KEY_COMPLIANCE_SONET
, sff_8472_comp_sonet
, nvl
)) != 0)
710 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_ETHERNET
] &
711 SFF_8472_COMP_ETH_MASK
, LIBSFF_KEY_COMPLIANCE_GBE
,
712 sff_8472_comp_eth
, nvl
)) != 0)
715 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_FCLEN
] &
716 SFF_8472_COMP_FCLEN_MASK
, LIBSFF_KEY_COMPLIANCE_FC_LEN
,
717 sff_8472_comp_fclen
, nvl
)) != 0)
720 v
= buf
[SFF_8472_COMPLIANCE_FC_LOW
] |
721 (buf
[SFF_8472_COMPLIANCE_FC_HIGH
] << 8);
722 if ((ret
= sff_gather_bitfield(v
& SFF_8472_COMP_TECH_MASK
,
723 LIBSFF_KEY_COMPLIANCE_FC_TECH
, sff_8472_comp_tech
, nvl
)) != 0)
726 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_SFP
] &
727 SFF_8472_COMP_CABLE_MASK
, LIBSFF_KEY_COMPLIANCE_SFP
,
728 sff_8472_comp_cable
, nvl
)) != 0)
731 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_FC_MEDIA
] &
732 SFF_8472_COMP_MEDIA_MASK
, LIBSFF_KEY_COMPLIANCE_FC_MEDIA
,
733 sff_8472_comp_media
, nvl
)) != 0)
736 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_COMPLIANCE_FC_SPEED
] &
737 SFF_8472_COMP_SPEED_MASK
, LIBSFF_KEY_COMPLIANCE_FC_SPEED
,
738 sff_8472_comp_speed
, nvl
)) != 0)
745 sff_parse_encoding(uint8_t val
, nvlist_t
*nvl
, boolean_t sfp
)
748 if (val
>= SFF_8024_NENCS
) {
751 str
= sff_8024_enc_sfp
[val
];
753 str
= sff_8024_enc_qsfp
[val
];
756 return (nvlist_add_string(nvl
, LIBSFF_KEY_ENCODING
, str
));
760 sff_parse_br(const uint8_t *buf
, nvlist_t
*nvl
)
762 if (buf
[SFF_8472_BR_NOMINAL
] == 0xff) {
764 if ((ret
= sff_add_unit_string(buf
[SFF_8472_BR_MAX
],
765 SFF_8472_BR_MAX_FACTOR
, "MBd", nvl
,
766 LIBSFF_KEY_BR_MAX
)) != 0)
768 return (sff_add_unit_string(buf
[SFF_8472_BR_MIN
],
769 SFF_8472_BR_MIN_FACTOR
, "MBd", nvl
, LIBSFF_KEY_BR_MIN
));
771 return (sff_add_unit_string(buf
[SFF_8472_BR_NOMINAL
],
772 SFF_8472_BR_NOMINAL_FACTOR
, "MBd", nvl
,
773 LIBSFF_KEY_BR_NOMINAL
));
778 sff_parse_lengths(const uint8_t *buf
, nvlist_t
*nvl
)
782 if (buf
[SFF_8472_LENGTH_SMF_KM
] != 0) {
783 if ((ret
= sff_add_unit_string(buf
[SFF_8472_LENGTH_SMF_KM
],
784 SFF_8472_LENGTH_SMF_KM_FACTOR
, "km", nvl
,
785 LIBSFF_KEY_LENGTH_SMF_KM
)) != 0)
789 if (buf
[SFF_8472_LENGTH_SMF
] != 0) {
790 if ((ret
= sff_add_unit_string(buf
[SFF_8472_LENGTH_SMF
],
791 SFF_8472_LENGTH_SMF_FACTOR
, "m", nvl
,
792 LIBSFF_KEY_LENGTH_SMF
)) != 0)
796 if (buf
[SFF_8472_LENGTH_50UM
] != 0) {
797 if ((ret
= sff_add_unit_string(buf
[SFF_8472_LENGTH_50UM
],
798 SFF_8472_LENGTH_50UM_FACTOR
, "m", nvl
,
799 LIBSFF_KEY_LENGTH_OM2
)) != 0)
803 if (buf
[SFF_8472_LENGTH_62UM
] != 0) {
804 if ((ret
= sff_add_unit_string(buf
[SFF_8472_LENGTH_62UM
],
805 SFF_8472_LENGTH_62UM_FACTOR
, "m", nvl
,
806 LIBSFF_KEY_LENGTH_OM1
)) != 0)
810 if (buf
[SFF_8472_LENGTH_COPPER
] != 0) {
811 if ((ret
= sff_add_unit_string(buf
[SFF_8472_LENGTH_COPPER
],
812 SFF_8472_LENGTH_COPPER_FACTOR
, "m", nvl
,
813 LIBSFF_KEY_LENGTH_COPPER
)) != 0)
817 if (buf
[SFF_8472_LENGTH_OM3
] != 0) {
818 if ((ret
= sff_add_unit_string(buf
[SFF_8472_LENGTH_OM3
],
819 SFF_8472_LENGTH_OM3_FACTOR
, "m", nvl
,
820 LIBSFF_KEY_LENGTH_OM3
)) != 0)
828 * Strings in the SFF specification are written into fixed sized buffers. The
829 * strings are padded to the right with spaces (ASCII 0x20) and there is no NUL
830 * character like in a standard C string. While the string is padded with
831 * spaces, spaces may appear in the middle of the string and should not be
832 * confused as padding.
835 sff_parse_string(const uint8_t *buf
, uint_t start
, uint_t len
,
836 const char *field
, nvlist_t
*nvl
)
839 char strbuf
[SFP_STRBUF
];
841 assert(len
< sizeof (strbuf
));
844 if (buf
[start
+ len
- 1] != ' ')
852 * This is supposed to be 7-bit printable ASCII. If we find any
853 * characters that aren't, don't include this string.
855 for (i
= 0; i
< len
; i
++) {
856 if (isascii(buf
[start
+ i
]) == 0 ||
857 isprint(buf
[start
+ i
]) == 0) {
861 bcopy(&buf
[start
], strbuf
, len
);
864 return (nvlist_add_string(nvl
, field
, strbuf
));
868 sff_parse_optical(const uint8_t *buf
, nvlist_t
*nvl
)
871 * The value in byte 8 determines whether we interpret this as
872 * describing aspects of a copper device or if it describes the
875 if (buf
[SFF_8472_COMPLIANCE_SFP
] & SFF_8472_COMP_CABLE_PASSIVE
) {
876 return (sff_gather_bitfield(buf
[SFF_8472_PASSIVE_SPEC
] &
877 SFF_8472_PCABLE_COMP_MASK
, LIBSFF_KEY_COMPLIANCE_PASSIVE
,
878 sff_8472_pcable_comp
, nvl
));
879 } else if (buf
[SFF_8472_COMPLIANCE_SFP
] & SFF_8472_COMP_CABLE_ACTIVE
) {
880 return (sff_gather_bitfield(buf
[SFF_8472_ACTIVE_SPEC
] &
881 SFF_8472_ACABLE_COMP_MASK
, LIBSFF_KEY_COMPLIANCE_ACTIVE
,
882 sff_8472_acable_comp
, nvl
));
885 uint16_t val
= (buf
[SFF_8472_WAVELENGTH_HI
] << 8) |
886 buf
[SFF_8472_WAVELENGTH_LOW
];
888 return (sff_add_unit_string(val
, SFF_8472_WAVELENGTH_FACTOR
,
889 "nm", nvl
, LIBSFF_KEY_WAVELENGTH
));
894 sff_parse_options(const uint8_t *buf
, nvlist_t
*nvl
)
898 val
= (buf
[SFF_8472_OPTIONS_HI
] << 8) | buf
[SFF_8472_OPTIONS_LOW
];
899 return (sff_gather_bitfield(val
& SFF_8472_OPTION_MASK
,
900 LIBSFF_KEY_OPTIONS
, sff_8472_options
, nvl
));
904 sff_parse_8472_comp(uint8_t val
, nvlist_t
*nvl
)
908 if (val
>= SFF_8472_8472_COMP_NENTRIES
) {
911 str
= sff_8472_8472_comp
[val
];
914 return (nvlist_add_string(nvl
, LIBSFF_KEY_COMPLIANCE_8472
, str
));
918 * Parse an SFP that is either based on INF 8074 or SFF 8472. These are GBIC,
919 * SFP, SFP+, and SFP28 based devices.
921 * The SFP parsing into an nvlist_t is incomplete. At the moment we're not
922 * parsing the following pieces from SFF 8472 page 0xa0:
924 * o Rate Selection Logic
925 * o Diagnostic Monitoring Type
928 sff_parse_sfp(const uint8_t *buf
, nvlist_t
*nvl
)
932 if ((ret
= sff_parse_id(buf
[SFF_8472_IDENTIFIER
], nvl
)) != 0)
936 * The extended identifier is derived from SFF 8472, Table 5-2. It
937 * generally is just the value 4. The other values are not well defined.
939 if ((ret
= nvlist_add_uint8(nvl
, LIBSFF_KEY_8472_EXT_IDENTIFIER
,
940 buf
[SFF_8472_EXT_IDENTIFER
])) != 0)
943 if ((ret
= sff_parse_connector(buf
[SFF_8472_CONNECTOR
], nvl
)) != 0)
946 if ((ret
= sff_parse_compliance(buf
, nvl
)) != 0)
949 if ((ret
= sff_parse_encoding(buf
[SFF_8472_ENCODING
], nvl
,
953 if ((ret
= sff_parse_br(buf
, nvl
)) != 0)
956 if ((ret
= sff_parse_lengths(buf
, nvl
)) != 0)
959 if ((ret
= sff_parse_string(buf
, SFF_8472_VENDOR
, SFF_8472_VENDOR_LEN
,
960 LIBSFF_KEY_VENDOR
, nvl
)) != 0)
963 if ((ret
= nvlist_add_byte_array(nvl
, LIBSFF_KEY_OUI
,
964 (uchar_t
*)&buf
[SFF_8472_OUI
], SFF_8472_OUI_LEN
)) != 0)
967 if ((ret
= sff_parse_string(buf
, SFF_8472_VENDOR_PN
,
968 SFF_8472_VENDOR_PN_LEN
, LIBSFF_KEY_PART
, nvl
)) != 0)
971 if ((ret
= sff_parse_string(buf
, SFF_8472_VENDOR_REV
,
972 SFF_8472_VENDOR_REV_LEN
, LIBSFF_KEY_REVISION
, nvl
)) != 0)
975 if ((ret
= sff_parse_optical(buf
, nvl
)) != 0)
978 if ((ret
= sff_parse_options(buf
, nvl
)) != 0)
981 if ((ret
= sff_parse_string(buf
, SFF_8472_VENDOR_SN
,
982 SFF_8472_VENDOR_SN_LEN
, LIBSFF_KEY_SERIAL
, nvl
)) != 0)
985 if ((ret
= sff_parse_string(buf
, SFF_8472_DATE_CODE
,
986 SFF_8472_DATE_CODE_LEN
, LIBSFF_KEY_DATECODE
, nvl
)) != 0)
989 if ((ret
= sff_gather_bitfield(buf
[SFF_8472_ENHANCED_OPTIONS
] &
990 SFF_8472_EXTOPT_MASK
, LIBSFF_KEY_EXTENDED_OPTIONS
,
991 sff_8472_extopts
, nvl
)) != 0)
994 if ((ret
= sff_parse_8472_comp(buf
[SFF_8472_SFF_8472_COMPLIANCE
],
1002 sff_qsfp_parse_compliance(const uint8_t *buf
, nvlist_t
*nvl
)
1007 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_COMPLIANCE_10GBEP
] &
1008 SFF_8636_COMP_10GETH_MASK
, LIBSFF_KEY_COMPLIANCE_10GBE
,
1009 sff_8636_comp_10geth
, nvl
)) != 0)
1012 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_COMPLIANCE_SONET
] &
1013 SFF_8636_COMP_SONET_MASK
, LIBSFF_KEY_COMPLIANCE_SONET
,
1014 sff_8636_comp_sonet
, nvl
)) != 0)
1017 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_COMPLIANCE_SAS
] &
1018 SFF_8636_COMP_SAS_MASK
, LIBSFF_KEY_COMPLIANCE_SAS
,
1019 sff_8636_comp_sas
, nvl
)) != 0)
1022 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_COMPLIANCE_ETHERNET
] &
1023 SFF_8636_COMP_ETH_MASK
, LIBSFF_KEY_COMPLIANCE_GBE
,
1024 sff_8636_comp_eth
, nvl
)) != 0)
1027 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_COMPLIANCE_FCLEN
] &
1028 SFF_8636_COMP_FCLEN_MASK
, LIBSFF_KEY_COMPLIANCE_FC_LEN
,
1029 sff_8636_comp_fclen
, nvl
)) != 0)
1032 fc_val
= buf
[SFF_8636_COMPLIANCE_FC_LOW
] |
1033 (buf
[SFF_8636_COMPLIANCE_FC_HIGH
] << 8);
1034 if ((ret
= sff_gather_bitfield(fc_val
& SFF_8636_COMP_TECH_MASK
,
1035 LIBSFF_KEY_COMPLIANCE_FC_TECH
, sff_8636_comp_tech
, nvl
)) != 0)
1038 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_COMPLIANCE_FC_MEDIA
] &
1039 SFF_8636_COMP_MEDIA_MASK
, LIBSFF_KEY_COMPLIANCE_FC_MEDIA
,
1040 sff_8636_comp_media
, nvl
)) != 0)
1043 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_COMPLIANCE_FC_SPEED
] &
1044 SFF_8636_COMP_SPEED_MASK
, LIBSFF_KEY_COMPLIANCE_FC_SPEED
,
1045 sff_8636_comp_speed
, nvl
)) != 0)
1052 sff_qsfp_parse_br(const uint8_t *buf
, nvlist_t
*nvl
)
1054 if (buf
[SFF_8636_BR_NOMINAL
] == 0xff) {
1055 return (sff_add_unit_string(buf
[SFF_8636_BR_NOMINAL_EXT
],
1056 SFF_8636_BR_NOMINAL_EXT_FACTOR
, "Mbps", nvl
,
1057 LIBSFF_KEY_BR_NOMINAL
));
1059 return (sff_add_unit_string(buf
[SFF_8636_BR_NOMINAL
],
1060 SFF_8636_BR_NOMINAL_FACTOR
, "Mbps", nvl
,
1061 LIBSFF_KEY_BR_NOMINAL
));
1066 sff_qsfp_parse_lengths(const uint8_t *buf
, nvlist_t
*nvl
)
1070 if (buf
[SFF_8636_LENGTH_SMF
] != 0) {
1071 if ((ret
= sff_add_unit_string(buf
[SFF_8636_LENGTH_SMF
],
1072 SFF_8636_LENGTH_SMF_FACTOR
, "km", nvl
,
1073 LIBSFF_KEY_LENGTH_SMF_KM
)) != 0)
1077 if (buf
[SFF_8636_LENGTH_OM3
] != 0) {
1078 if ((ret
= sff_add_unit_string(buf
[SFF_8636_LENGTH_OM3
],
1079 SFF_8636_LENGTH_OM3_FACTOR
, "m", nvl
,
1080 LIBSFF_KEY_LENGTH_OM3
)) != 0)
1084 if (buf
[SFF_8636_LENGTH_OM2
] != 0) {
1085 if ((ret
= sff_add_unit_string(buf
[SFF_8636_LENGTH_OM2
],
1086 SFF_8636_LENGTH_OM2_FACTOR
, "m", nvl
,
1087 LIBSFF_KEY_LENGTH_OM2
)) != 0)
1091 if (buf
[SFF_8636_LENGTH_OM1
] != 0) {
1092 if ((ret
= sff_add_unit_string(buf
[SFF_8636_LENGTH_OM1
],
1093 SFF_8636_LENGTH_OM1_FACTOR
, "m", nvl
,
1094 LIBSFF_KEY_LENGTH_OM1
)) != 0)
1098 if (buf
[SFF_8636_LENGTH_COPPER
] != 0) {
1099 if ((ret
= sff_add_unit_string(buf
[SFF_8636_LENGTH_COPPER
],
1100 SFF_8636_LENGTH_COPPER_FACTOR
, "m", nvl
,
1101 LIBSFF_KEY_LENGTH_COPPER
)) != 0)
1109 sff_qsfp_parse_tech(uint8_t val
, nvlist_t
*nvl
)
1111 const char *strs
[5];
1113 strs
[0] = sff_8636_trans_tech
[(val
& 0xf0) >> 4];
1115 strs
[1] = "Active Wavelength Control";
1117 strs
[1] = "No Wavelength Control";
1121 strs
[2] = "Cooled Transmitter";
1123 strs
[2] = "Uncooled Transmitter";
1127 strs
[3] = "APD Detector";
1129 strs
[3] = "Pin Detector";
1133 strs
[4] = "Transmitter Tunable";
1135 strs
[4] = "Transmitter Not Tunable";
1139 * The nvlist routines don't touch the array, so we end up lying about
1140 * the type of data so that we can avoid a rash of additional
1141 * allocations and strdups.
1143 return (nvlist_add_string_array(nvl
, LIBSFF_KEY_TRAN_TECH
,
1148 sff_qsfp_parse_copperwave(const uint8_t *buf
, nvlist_t
*nvl
)
1153 * The values that we get depend on whether or not we are a copper
1154 * device or not. We can determine this based on the identification
1155 * information in the device technology field.
1157 if ((buf
[SFF_8636_DEVICE_TECH
] & 0xf0) >= 0xa0) {
1158 if ((ret
= sff_add_unit_string(buf
[SFF_8636_ATTENUATE_2G
], 1,
1159 "dB", nvl
, LIBSFF_KEY_ATTENUATE_2G
)) != 0)
1161 if ((ret
= sff_add_unit_string(buf
[SFF_8636_ATTENUATE_5G
], 1,
1162 "dB", nvl
, LIBSFF_KEY_ATTENUATE_5G
)) != 0)
1164 if ((ret
= sff_add_unit_string(buf
[SFF_8636_ATTENUATE_7G
], 1,
1165 "dB", nvl
, LIBSFF_KEY_ATTENUATE_7G
)) != 0)
1167 if ((ret
= sff_add_unit_string(buf
[SFF_8636_ATTENUATE_12G
], 1,
1168 "dB", nvl
, LIBSFF_KEY_ATTENUATE_12G
)) != 0)
1173 char strbuf
[SFP_STRBUF
];
1176 * Because we need to divide the units here into doubles, we
1177 * can't use the standard unit routine.
1179 val
= (buf
[SFF_8636_WAVELENGTH_NOMINAL_HI
] << 8) |
1180 buf
[SFF_8636_WAVELENGTH_NOMINAL_LOW
];
1183 (void) snprintf(strbuf
, sizeof (strbuf
), "%.3lf nm", d
);
1184 if ((ret
= nvlist_add_string(nvl
, LIBSFF_KEY_WAVELENGTH
,
1189 val
= (buf
[SFF_8636_WAVELENGTH_TOLERANCE_HI
] << 8) |
1190 buf
[SFF_8636_WAVELENGTH_TOLERANCE_LOW
];
1193 (void) snprintf(strbuf
, sizeof (strbuf
), "%.3lf nm", d
);
1194 if ((ret
= nvlist_add_string(nvl
,
1195 LIBSFF_KEY_WAVE_TOLERANCE
, strbuf
)) != 0)
1204 sff_qsfp_parse_casetemp(uint8_t val
, nvlist_t
*nvl
)
1207 * The default temperature per SFF 8636 r2.7 6.3.21 'Maximum Case
1208 * Temperature' is 70 C. If the value is zero, we're supposed to assume
1214 return (sff_add_unit_string(val
, 1, "C", nvl
,
1215 LIBSFF_KEY_MAX_CASE_TEMP
));
1219 sff_qsfp_parse_extcomp(uint8_t val
, nvlist_t
*nvl
)
1223 if (val
>= SFF_8024_EXT_SPEC_NENTRIES
) {
1226 str
= sff_8024_ext_spec
[val
];
1229 return (nvlist_add_string(nvl
, LIBSFF_KEY_EXT_SPEC
, str
));
1233 sff_qsfp_parse_options(const uint8_t *buf
, nvlist_t
*nvl
)
1237 val
= (buf
[SFF_8636_OPTIONS_HI
] << 16) |
1238 (buf
[SFF_8636_OPTIONS_MID
] << 8) | buf
[SFF_8636_OPTIONS_LOW
];
1240 return (sff_gather_bitfield(val
& SFF_8636_OPTION_MASK
,
1241 LIBSFF_KEY_OPTIONS
, sff_8636_options
, nvl
));
1245 sff_qsfp_parse_diag(uint8_t val
, nvlist_t
*nvl
)
1251 buf
[0] = "Received power measurements: Average Power";
1253 buf
[0] = "Received power measurements: OMA";
1258 buf
[1] = "Transmitter power measurement";
1262 * The nvlist routines don't touch the array, so we end up lying about
1263 * the type of data so that we can avoid a rash of additional
1264 * allocations and strdups.
1266 return (nvlist_add_string_array(nvl
, LIBSFF_KEY_DIAG_MONITOR
,
1267 (char **)buf
, count
));
1271 * Parse a QSFP family device that is based on SFF-8436 / SFF-8636. Note that we
1272 * ignore the lower half of page 0xa0 at this time and instead focus on the
1273 * upper half of page 0xa0 which has identification information.
1275 * For the moment we're not parsing the following fields:
1277 * o Extended Identifier (byte 129)
1278 * o Extended Rate Select Compliance (byte 141)
1281 sff_parse_qsfp(const uint8_t *buf
, nvlist_t
*nvl
)
1285 if ((ret
= sff_parse_id(buf
[SFF_8636_IDENTIFIER
], nvl
)) != 0)
1288 if ((ret
= sff_parse_connector(buf
[SFF_8636_CONNECTOR
], nvl
)) != 0)
1291 if ((ret
= sff_qsfp_parse_compliance(buf
, nvl
)) != 0)
1294 if ((ret
= sff_parse_encoding(buf
[SFF_8636_ENCODING
], nvl
,
1298 if ((ret
= sff_qsfp_parse_br(buf
, nvl
)) != 0)
1301 if ((ret
= sff_qsfp_parse_lengths(buf
, nvl
)) != 0)
1304 if ((ret
= sff_qsfp_parse_tech(buf
[SFF_8636_DEVICE_TECH
], nvl
)) != 0)
1307 if ((ret
= sff_parse_string(buf
, SFF_8636_VENDOR
, SFF_8636_VENDOR_LEN
,
1308 LIBSFF_KEY_VENDOR
, nvl
)) != 0)
1311 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_EXTENDED_MODULE
] &
1312 SFF_8636_EXTMOD_CODES
, LIBSFF_KEY_EXT_MOD_CODES
,
1313 sff_8636_extmod_codes
, nvl
)) != 0)
1316 if ((ret
= nvlist_add_byte_array(nvl
, LIBSFF_KEY_OUI
,
1317 (uchar_t
*)&buf
[SFF_8636_OUI
], SFF_8636_OUI_LEN
)) != 0)
1320 if ((ret
= sff_parse_string(buf
, SFF_8636_VENDOR_PN
,
1321 SFF_8636_VENDOR_PN_LEN
, LIBSFF_KEY_PART
, nvl
)) != 0)
1324 if ((ret
= sff_parse_string(buf
, SFF_8636_VENDOR_REV
,
1325 SFF_8636_VENDOR_REV_LEN
, LIBSFF_KEY_REVISION
, nvl
)) != 0)
1328 if ((ret
= sff_qsfp_parse_copperwave(buf
, nvl
)) != 0)
1331 if ((ret
= sff_qsfp_parse_casetemp(buf
[SFF_8636_MAX_CASE_TEMP
],
1335 if ((ret
= sff_qsfp_parse_extcomp(buf
[SFF_8636_LINK_CODES
], nvl
)) != 0)
1338 if ((ret
= sff_qsfp_parse_options(buf
, nvl
)) != 0)
1341 if ((ret
= sff_parse_string(buf
, SFF_8636_VENDOR_SN
,
1342 SFF_8636_VENDOR_SN_LEN
, LIBSFF_KEY_SERIAL
, nvl
)) != 0)
1345 if ((ret
= sff_parse_string(buf
, SFF_8636_DATE_CODE
,
1346 SFF_8636_DATE_CODE_LEN
, LIBSFF_KEY_DATECODE
, nvl
)) != 0)
1349 if ((ret
= sff_qsfp_parse_diag(buf
[SFF_8636_DIAG_MONITORING
],
1353 if ((ret
= sff_gather_bitfield(buf
[SFF_8636_ENHANCED_OPTIONS
] &
1354 SFF_8636_ENHANCED_OPTIONS_MASK
, LIBSFF_KEY_ENHANCED_OPTIONS
,
1355 sff_8636_eopt
, nvl
)) != 0)
1362 libsff_parse(const uint8_t *buf
, size_t len
, uint_t page
, nvlist_t
**nvpp
)
1365 nvlist_t
*nvp
= NULL
;
1369 * At the moment, we only support page a0.
1371 if (page
!= 0xa0 || buf
== NULL
|| len
== 0 || nvpp
== NULL
)
1377 * Make sure that the library has been given valid data to parse.
1379 if (uucopy(buf
, ubuf
, MIN(sizeof (ubuf
), len
)) != 0)
1382 if ((ret
= nvlist_alloc(&nvp
, NV_UNIQUE_NAME
, 0)) != 0)
1386 case SFF_8024_ID_QSFP
:
1387 case SFF_8024_ID_QSFP_PLUS
:
1388 case SFF_8024_ID_QSFP28
:
1390 * For QSFP based products, identification information is spread
1391 * across both the top and bottom half of page 0xa0.
1393 if (len
< SFP_MIN_LEN_8636
) {
1397 ret
= sff_parse_qsfp(ubuf
, nvp
);
1400 if (len
< SFP_MIN_LEN_8472
) {
1404 ret
= sff_parse_sfp(ubuf
, nvp
);