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 * Print SFF 8636 device tech values.
27 * Pick up private sff header file with offsets from lib/libsff.
32 lst_print_array(nvlist_t
*nvl
, const char *key
)
38 if ((ret
= nvlist_lookup_string_array(nvl
, key
, &vals
, &count
)) != 0) {
39 errx(1, "TEST FAILED failed to find key %s: %s\n", key
,
44 for (i
= 0; i
< count
; i
++) {
45 (void) printf("\t%d\t%s\n", i
, vals
[i
]);
55 bzero(buf
, sizeof (buf
));
56 buf
[SFF_8472_IDENTIFIER
] = SFF_8024_ID_QSFP
;
59 * The upper four bits of this value are used as a 4-bit identifier. The
60 * lower four bits are used as options.
62 for (i
= 0; i
< 16; i
++) {
66 buf
[SFF_8636_DEVICE_TECH
] = i
<< 4;
67 buf
[SFF_8636_DEVICE_TECH
] |= (i
% 16);
69 if ((ret
= libsff_parse(buf
, sizeof (buf
), 0xa0, &nvl
)) != 0) {
70 errx(1, "TEST FAILED: failed to parse QSFP device tech "
71 "%d: %s\n", i
, strerror(ret
));
74 lst_print_array(nvl
, LIBSFF_KEY_TRAN_TECH
);