* [PATCH 1/2] ethdev: decode newer SFF compliance codes
@ 2026-10-09 19:34 Roman Khromenok
2026-10-09 19:34 ` [PATCH 2/2] test: check " Roman Khromenok
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Roman Khromenok @ 2026-10-09 19:34 UTC (permalink / raw)
To: dev; +Cc: stephen
Decode the compliance codes added by SFF-8472 Rev 12.5a and
SFF-8636 Rev 2.12, as ethtool does since commits 057c4fd and
75d6232:
- SFF-8472 byte 10: Fibre Channel 1600 and 3200 MBytes/s.
- SFF-8636 byte 133: SAS 24.0G, and SAS 12.0G which was defined
but not reported.
- SFF-8636 byte 138: Fibre Channel 3200 MBytes/s.
Also decode the SFF-8472 Fibre Channel Speed 2 byte 62 (64GFC),
which byte 10 bit 1 refers to. ethtool does not decode it.
Signed-off-by: Roman Khromenok <roma55592@yandex.ru>
---
Checked against the SFF-8472 Rev 12.5a (Table 5-3) and SFF-8636
Rev 2.12 (Table 6-17) specifications. Based on next-net/for-main.
lib/ethdev/sff_8079.c | 7 +++++++
lib/ethdev/sff_8636.c | 6 ++++++
lib/ethdev/sff_8636.h | 2 ++
3 files changed, 15 insertions(+)
diff --git a/lib/ethdev/sff_8079.c b/lib/ethdev/sff_8079.c
index 9632a26af3..5ca13eb368 100644
--- a/lib/ethdev/sff_8079.c
+++ b/lib/ethdev/sff_8079.c
@@ -173,10 +173,17 @@ static void sff_8079_show_transceiver(const uint8_t *data, struct sff_output *d)
sff_output_field(d, name, "FC: 1200 MBytes/sec");
if (data[10] & (1 << 6))
sff_output_field(d, name, "FC: 800 MBytes/sec");
+ if (data[10] & (1 << 5))
+ sff_output_field(d, name, "FC: 1600 MBytes/sec");
if (data[10] & (1 << 4))
sff_output_field(d, name, "FC: 400 MBytes/sec");
+ if (data[10] & (1 << 3))
+ sff_output_field(d, name, "FC: 3200 MBytes/sec");
if (data[10] & (1 << 2))
sff_output_field(d, name, "FC: 200 MBytes/sec");
+ /* bit 1 refers to the Fibre Channel Speed 2 byte */
+ if ((data[10] & (1 << 1)) && (data[62] & (1 << 0)))
+ sff_output_field(d, name, "FC: 64GFC");
if (data[10] & (1 << 0))
sff_output_field(d, name, "FC: 100 MBytes/sec");
diff --git a/lib/ethdev/sff_8636.c b/lib/ethdev/sff_8636.c
index ad36927540..5e77f1b855 100644
--- a/lib/ethdev/sff_8636.c
+++ b/lib/ethdev/sff_8636.c
@@ -364,6 +364,10 @@ static void sff_8636_show_transceiver(const uint8_t *data, struct sff_output *d)
sff_output_field(d, name, "SONET: OC-48, short reach");
/* SAS/SATA Compliance Codes */
+ if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_24G)
+ sff_output_field(d, name, "SAS 24.0G");
+ if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_12G)
+ sff_output_field(d, name, "SAS 12.0G");
if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_6G)
sff_output_field(d, name, "SAS 6.0G");
if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_3G)
@@ -432,6 +436,8 @@ static void sff_8636_show_transceiver(const uint8_t *data, struct sff_output *d)
sff_output_field(d, name, "FC: 1600 MBytes/sec");
if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_400_MBPS)
sff_output_field(d, name, "FC: 400 MBytes/sec");
+ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_3200_MBPS)
+ sff_output_field(d, name, "FC: 3200 MBytes/sec");
if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_200_MBPS)
sff_output_field(d, name, "FC: 200 MBytes/sec");
if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_100_MBPS)
diff --git a/lib/ethdev/sff_8636.h b/lib/ethdev/sff_8636.h
index d2a923a7c0..9b15636c0c 100644
--- a/lib/ethdev/sff_8636.h
+++ b/lib/ethdev/sff_8636.h
@@ -294,6 +294,7 @@
/* SAS/SATA Complaince Codes - 133 */
#define SFF_8636_SAS_COMP_OFFSET 0x85
+#define SFF_8636_SAS_24G RTE_BIT32(7)
#define SFF_8636_SAS_12G RTE_BIT32(6)
#define SFF_8636_SAS_6G RTE_BIT32(5)
#define SFF_8636_SAS_3G RTE_BIT32(4)
@@ -346,6 +347,7 @@
#define SFF_8636_FC_SPEED_800_MBPS RTE_BIT32(6)
#define SFF_8636_FC_SPEED_1600_MBPS RTE_BIT32(5)
#define SFF_8636_FC_SPEED_400_MBPS RTE_BIT32(4)
+#define SFF_8636_FC_SPEED_3200_MBPS RTE_BIT32(3)
#define SFF_8636_FC_SPEED_200_MBPS RTE_BIT32(2)
#define SFF_8636_FC_SPEED_100_MBPS RTE_BIT32(0)
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] test: check newer SFF compliance codes
2026-10-09 19:34 [PATCH 1/2] ethdev: decode newer SFF compliance codes Roman Khromenok
@ 2026-10-09 19:34 ` Roman Khromenok
2026-10-10 18:23 ` Stephen Hemminger
2026-10-10 18:23 ` [PATCH 1/2] ethdev: decode " Stephen Hemminger
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Roman Khromenok @ 2026-10-09 19:34 UTC (permalink / raw)
To: dev; +Cc: stephen
Check the SFF-8472 Fibre Channel 1600, 3200 MBytes/s and 64GFC
codes, with 64GFC reported only when byte 10 refers to byte 62,
and the SFF-8636 SAS 24.0G, 12.0G and Fibre Channel 3200 MBytes/s
codes.
Add a helper to look for a value of a field reported more than
once, such as "Transceiver type".
Signed-off-by: Roman Khromenok <roma55592@yandex.ru>
---
app/test/test_ethdev_module_eeprom.c | 62 ++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/app/test/test_ethdev_module_eeprom.c b/app/test/test_ethdev_module_eeprom.c
index 25307678a1..01eefa7d65 100644
--- a/app/test/test_ethdev_module_eeprom.c
+++ b/app/test/test_ethdev_module_eeprom.c
@@ -4,6 +4,7 @@
#include <errno.h>
#include <stdalign.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
@@ -67,6 +68,27 @@ parse(uint32_t type, const uint8_t *data, uint32_t length)
#define CHECK_NO_FIELD(name) \
TEST_ASSERT_NULL(find_field(name), "Unexpected field \"%s\"", name)
+/* A field name may be reported more than once, e.g. "Transceiver type" */
+static bool
+has_field_value(const char *name, const char *value)
+{
+ unsigned int i;
+
+ for (i = 0; i < fields.count; i++)
+ if (strcmp(fields.field[i].name, name) == 0 &&
+ strcmp(fields.field[i].value, value) == 0)
+ return true;
+ return false;
+}
+
+#define CHECK_FIELD_VALUE(name, value) \
+ TEST_ASSERT(has_field_value(name, value), \
+ "Field \"%s\" with value \"%s\" not found", name, value)
+
+#define CHECK_NO_FIELD_VALUE(name, value) \
+ TEST_ASSERT(!has_field_value(name, value), \
+ "Unexpected field \"%s\" with value \"%s\"", name, value)
+
static void
put_u16(uint8_t *data, unsigned int offset, uint16_t value)
{
@@ -243,6 +265,44 @@ test_module_eeprom_qsfp_8636_thresholds(void)
return TEST_SUCCESS;
}
+static int
+test_module_eeprom_sfp_compliance(void)
+{
+ uint8_t data[RTE_ETH_MODULE_SFF_8472_LEN];
+
+ fill_sfp(data);
+ data[10] = 0x28; /* FC speed: 1600 and 3200 MBytes/s */
+ data[62] = 0x01; /* 64GFC, without the byte 10 bit 1 pointer */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8472, data, sizeof(data)),
+ "Failed to parse SFF-8472 data");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 1600 MBytes/sec");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 3200 MBytes/sec");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "FC: 64GFC");
+
+ data[10] |= 0x02; /* see byte 62, Fibre Channel Speed 2 */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8472, data, sizeof(data)),
+ "Failed to parse SFF-8472 data with Fibre Channel Speed 2");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 64GFC");
+ return TEST_SUCCESS;
+}
+
+static int
+test_module_eeprom_qsfp_compliance(void)
+{
+ uint8_t data[RTE_ETH_MODULE_SFF_8636_LEN];
+
+ fill_qsfp(data);
+ data[133] = 0xc0; /* SAS 24.0G and 12.0G */
+ data[138] = 0x08; /* FC speed: 3200 MBytes/s */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8636, data, sizeof(data)),
+ "Failed to parse SFF-8636 data");
+ CHECK_FIELD_VALUE("Transceiver type", "SAS 24.0G");
+ CHECK_FIELD_VALUE("Transceiver type", "SAS 12.0G");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 3200 MBytes/sec");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "SAS 6.0G");
+ return TEST_SUCCESS;
+}
+
/* SFF-8472 status bits and their implemented bits */
#define SFP_ENH_OPTIONS 93
#define SFP_A2_STATUS 110
@@ -567,6 +627,8 @@ static struct unit_test_suite module_eeprom_testsuite = {
TEST_CASE(test_module_eeprom_sfp_8472_cal_saturate_min),
TEST_CASE(test_module_eeprom_sfp_8472_cal_round),
TEST_CASE(test_module_eeprom_sfp_8472_status),
+ TEST_CASE(test_module_eeprom_sfp_compliance),
+ TEST_CASE(test_module_eeprom_qsfp_compliance),
TEST_CASE(test_module_eeprom_qsfp_8636),
TEST_CASE(test_module_eeprom_qsfp_8636_thresholds),
TEST_CASE(test_module_eeprom_qsfp_8636_signals_not_implemented),
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ethdev: decode newer SFF compliance codes
2026-10-09 19:34 [PATCH 1/2] ethdev: decode newer SFF compliance codes Roman Khromenok
2026-10-09 19:34 ` [PATCH 2/2] test: check " Roman Khromenok
@ 2026-10-10 18:23 ` Stephen Hemminger
2026-10-10 18:42 ` [PATCH v2 " Roman Khromenok
2026-10-10 18:42 ` [PATCH v2 2/2] test: check " Roman Khromenok
3 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2026-10-10 18:23 UTC (permalink / raw)
To: Roman Khromenok; +Cc: dev
On Fri, 9 Oct 2026 21:34:26 +0200
Roman Khromenok <roma55592@yandex.ru> wrote:
> Decode the compliance codes added by SFF-8472 Rev 12.5a and
> SFF-8636 Rev 2.12, as ethtool does since commits 057c4fd and
> 75d6232:
>
> - SFF-8472 byte 10: Fibre Channel 1600 and 3200 MBytes/s.
> - SFF-8636 byte 133: SAS 24.0G, and SAS 12.0G which was defined
> but not reported.
> - SFF-8636 byte 138: Fibre Channel 3200 MBytes/s.
>
> Also decode the SFF-8472 Fibre Channel Speed 2 byte 62 (64GFC),
> which byte 10 bit 1 refers to. ethtool does not decode it.
>
> Signed-off-by: Roman Khromenok <roma55592@yandex.ru>
> ---
AI feedback.
Subject: Re: [PATCH 1/2] ethdev: decode newer SFF compliance codes
Bit assignments match SFF-8472 Table 5-3 (byte 10, byte 62) and
SFF-8636 Table 6-17 (bytes 133, 138). Gating byte 62 on byte 10
bit 1 is correct, and the A0 buffer is always 256 bytes so the
byte 62 read is in bounds. Nothing blocking; a few small items.
[PATCH 1/2] ethdev: decode newer SFF compliance codes
Info:
- "FC: 64GFC" breaks the naming of every other entry in this
group, which all give MBytes/sec. 64GFC is 6400 MBytes/sec:
if ((data[10] & (1 << 1)) && (data[62] & (1 << 0)))
sff_output_field(d, name, "FC: 6400 MBytes/sec");
- Refer to the ethtool commits 057c4fd and 75d6232 with
12 character hashes and the subject in ("...") form, so they
can be found without guessing.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] test: check newer SFF compliance codes
2026-10-09 19:34 ` [PATCH 2/2] test: check " Roman Khromenok
@ 2026-10-10 18:23 ` Stephen Hemminger
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2026-10-10 18:23 UTC (permalink / raw)
To: Roman Khromenok; +Cc: dev
On Fri, 9 Oct 2026 21:34:27 +0200
Roman Khromenok <roma55592@yandex.ru> wrote:
> Check the SFF-8472 Fibre Channel 1600, 3200 MBytes/s and 64GFC
> codes, with 64GFC reported only when byte 10 refers to byte 62,
> and the SFF-8636 SAS 24.0G, 12.0G and Fibre Channel 3200 MBytes/s
> codes.
>
> Add a helper to look for a value of a field reported more than
> once, such as "Transceiver type".
>
> Signed-off-by: Roman Khromenok <roma55592@yandex.ru>
> ---
More AI feedback.
[PATCH 2/2] test: check newer SFF compliance codes
Info:
- Each test sets both new bits of a pair at once (byte 10 = 0x28,
byte 133 = 0xc0), so a swapped mapping (1600 vs 3200, 24G vs
12G) still passes. Set one bit and check the other is absent:
data[133] = 0x80; /* SAS 24.0G only */
...
CHECK_FIELD_VALUE("Transceiver type", "SAS 24.0G");
CHECK_NO_FIELD_VALUE("Transceiver type", "SAS 12.0G");
Same for byte 10: 0x20 alone for 1600, then 0x08 alone for 3200.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] ethdev: decode newer SFF compliance codes
2026-10-09 19:34 [PATCH 1/2] ethdev: decode newer SFF compliance codes Roman Khromenok
2026-10-09 19:34 ` [PATCH 2/2] test: check " Roman Khromenok
2026-10-10 18:23 ` [PATCH 1/2] ethdev: decode " Stephen Hemminger
@ 2026-10-10 18:42 ` Roman Khromenok
2026-10-10 18:42 ` [PATCH v2 2/2] test: check " Roman Khromenok
3 siblings, 0 replies; 6+ messages in thread
From: Roman Khromenok @ 2026-10-10 18:42 UTC (permalink / raw)
To: dev; +Cc: stephen
Decode the compliance codes added by SFF-8472 Rev 12.5a and
SFF-8636 Rev 2.12, as ethtool does since its commits
057c4fdd85b5 ("sfpid: add support for newer SFF-8472 compliance codes")
and 75d62323302b ("qsfp: add support for newer SFF-8636 compliance codes"):
- SFF-8472 byte 10: Fibre Channel 1600 and 3200 MBytes/s.
- SFF-8636 byte 133: SAS 24.0G, and SAS 12.0G which was defined
but not reported.
- SFF-8636 byte 138: Fibre Channel 3200 MBytes/s.
Also decode the SFF-8472 Fibre Channel Speed 2 byte 62, which byte 10
bit 1 refers to: 64GFC, reported as 6400 MBytes/s like the other
Fibre Channel speeds. ethtool does not decode it.
Signed-off-by: Roman Khromenok <roma55592@yandex.ru>
---
v2:
- report 64GFC as "FC: 6400 MBytes/sec", like the other
Fibre Channel speeds
- refer to the ethtool commits with 12 character hashes
and their subjects
- 2/2: set one bit at a time in the tests and check that
the other code of the same byte is absent
Checked against SFF-8472 Rev 12.5a (Table 5-3) and SFF-8636
Rev 2.12 (Table 6-17). Based on next-net/for-main.
lib/ethdev/sff_8079.c | 7 +++++++
lib/ethdev/sff_8636.c | 6 ++++++
lib/ethdev/sff_8636.h | 2 ++
3 files changed, 15 insertions(+)
diff --git a/lib/ethdev/sff_8079.c b/lib/ethdev/sff_8079.c
index 9632a26af3..c8db5c0975 100644
--- a/lib/ethdev/sff_8079.c
+++ b/lib/ethdev/sff_8079.c
@@ -173,10 +173,17 @@ static void sff_8079_show_transceiver(const uint8_t *data, struct sff_output *d)
sff_output_field(d, name, "FC: 1200 MBytes/sec");
if (data[10] & (1 << 6))
sff_output_field(d, name, "FC: 800 MBytes/sec");
+ if (data[10] & (1 << 5))
+ sff_output_field(d, name, "FC: 1600 MBytes/sec");
if (data[10] & (1 << 4))
sff_output_field(d, name, "FC: 400 MBytes/sec");
+ if (data[10] & (1 << 3))
+ sff_output_field(d, name, "FC: 3200 MBytes/sec");
if (data[10] & (1 << 2))
sff_output_field(d, name, "FC: 200 MBytes/sec");
+ /* bit 1 refers to the Fibre Channel Speed 2 byte */
+ if ((data[10] & (1 << 1)) && (data[62] & (1 << 0)))
+ sff_output_field(d, name, "FC: 6400 MBytes/sec");
if (data[10] & (1 << 0))
sff_output_field(d, name, "FC: 100 MBytes/sec");
diff --git a/lib/ethdev/sff_8636.c b/lib/ethdev/sff_8636.c
index ad36927540..5e77f1b855 100644
--- a/lib/ethdev/sff_8636.c
+++ b/lib/ethdev/sff_8636.c
@@ -364,6 +364,10 @@ static void sff_8636_show_transceiver(const uint8_t *data, struct sff_output *d)
sff_output_field(d, name, "SONET: OC-48, short reach");
/* SAS/SATA Compliance Codes */
+ if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_24G)
+ sff_output_field(d, name, "SAS 24.0G");
+ if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_12G)
+ sff_output_field(d, name, "SAS 12.0G");
if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_6G)
sff_output_field(d, name, "SAS 6.0G");
if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_3G)
@@ -432,6 +436,8 @@ static void sff_8636_show_transceiver(const uint8_t *data, struct sff_output *d)
sff_output_field(d, name, "FC: 1600 MBytes/sec");
if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_400_MBPS)
sff_output_field(d, name, "FC: 400 MBytes/sec");
+ if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_3200_MBPS)
+ sff_output_field(d, name, "FC: 3200 MBytes/sec");
if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_200_MBPS)
sff_output_field(d, name, "FC: 200 MBytes/sec");
if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_100_MBPS)
diff --git a/lib/ethdev/sff_8636.h b/lib/ethdev/sff_8636.h
index d2a923a7c0..9b15636c0c 100644
--- a/lib/ethdev/sff_8636.h
+++ b/lib/ethdev/sff_8636.h
@@ -294,6 +294,7 @@
/* SAS/SATA Complaince Codes - 133 */
#define SFF_8636_SAS_COMP_OFFSET 0x85
+#define SFF_8636_SAS_24G RTE_BIT32(7)
#define SFF_8636_SAS_12G RTE_BIT32(6)
#define SFF_8636_SAS_6G RTE_BIT32(5)
#define SFF_8636_SAS_3G RTE_BIT32(4)
@@ -346,6 +347,7 @@
#define SFF_8636_FC_SPEED_800_MBPS RTE_BIT32(6)
#define SFF_8636_FC_SPEED_1600_MBPS RTE_BIT32(5)
#define SFF_8636_FC_SPEED_400_MBPS RTE_BIT32(4)
+#define SFF_8636_FC_SPEED_3200_MBPS RTE_BIT32(3)
#define SFF_8636_FC_SPEED_200_MBPS RTE_BIT32(2)
#define SFF_8636_FC_SPEED_100_MBPS RTE_BIT32(0)
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] test: check newer SFF compliance codes
2026-10-09 19:34 [PATCH 1/2] ethdev: decode newer SFF compliance codes Roman Khromenok
` (2 preceding siblings ...)
2026-10-10 18:42 ` [PATCH v2 " Roman Khromenok
@ 2026-10-10 18:42 ` Roman Khromenok
3 siblings, 0 replies; 6+ messages in thread
From: Roman Khromenok @ 2026-10-10 18:42 UTC (permalink / raw)
To: dev; +Cc: stephen
Check the SFF-8472 Fibre Channel 1600, 3200 and 6400 MBytes/s codes,
with 6400 MBytes/s reported only when byte 10 refers to byte 62,
and the SFF-8636 SAS 24.0G, 12.0G and Fibre Channel 3200 MBytes/s
codes. Each bit is set alone and the other code of the same byte
is checked to be absent, so that swapped bits are detected.
Add a helper to look for a value of a field reported more than
once, such as "Transceiver type".
Signed-off-by: Roman Khromenok <roma55592@yandex.ru>
---
app/test/test_ethdev_module_eeprom.c | 84 ++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/app/test/test_ethdev_module_eeprom.c b/app/test/test_ethdev_module_eeprom.c
index 25307678a1..5f7e5db403 100644
--- a/app/test/test_ethdev_module_eeprom.c
+++ b/app/test/test_ethdev_module_eeprom.c
@@ -4,6 +4,7 @@
#include <errno.h>
#include <stdalign.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
@@ -67,6 +68,27 @@ parse(uint32_t type, const uint8_t *data, uint32_t length)
#define CHECK_NO_FIELD(name) \
TEST_ASSERT_NULL(find_field(name), "Unexpected field \"%s\"", name)
+/* A field name may be reported more than once, e.g. "Transceiver type" */
+static bool
+has_field_value(const char *name, const char *value)
+{
+ unsigned int i;
+
+ for (i = 0; i < fields.count; i++)
+ if (strcmp(fields.field[i].name, name) == 0 &&
+ strcmp(fields.field[i].value, value) == 0)
+ return true;
+ return false;
+}
+
+#define CHECK_FIELD_VALUE(name, value) \
+ TEST_ASSERT(has_field_value(name, value), \
+ "Field \"%s\" with value \"%s\" not found", name, value)
+
+#define CHECK_NO_FIELD_VALUE(name, value) \
+ TEST_ASSERT(!has_field_value(name, value), \
+ "Unexpected field \"%s\" with value \"%s\"", name, value)
+
static void
put_u16(uint8_t *data, unsigned int offset, uint16_t value)
{
@@ -243,6 +265,66 @@ test_module_eeprom_qsfp_8636_thresholds(void)
return TEST_SUCCESS;
}
+static int
+test_module_eeprom_sfp_compliance(void)
+{
+ uint8_t data[RTE_ETH_MODULE_SFF_8472_LEN];
+
+ /* one bit at a time, so that swapped bits are detected */
+ fill_sfp(data);
+ data[10] = 0x20; /* FC speed: 1600 MBytes/s */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8472, data, sizeof(data)),
+ "Failed to parse SFF-8472 data with FC 1600");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 1600 MBytes/sec");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "FC: 3200 MBytes/sec");
+
+ data[10] = 0x08; /* FC speed: 3200 MBytes/s */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8472, data, sizeof(data)),
+ "Failed to parse SFF-8472 data with FC 3200");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 3200 MBytes/sec");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "FC: 1600 MBytes/sec");
+
+ data[10] = 0;
+ data[62] = 0x01; /* 64GFC, without the byte 10 bit 1 pointer */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8472, data, sizeof(data)),
+ "Failed to parse SFF-8472 data with byte 62 only");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "FC: 6400 MBytes/sec");
+
+ data[10] = 0x02; /* see byte 62, Fibre Channel Speed 2 */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8472, data, sizeof(data)),
+ "Failed to parse SFF-8472 data with Fibre Channel Speed 2");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 6400 MBytes/sec");
+ return TEST_SUCCESS;
+}
+
+static int
+test_module_eeprom_qsfp_compliance(void)
+{
+ uint8_t data[RTE_ETH_MODULE_SFF_8636_LEN];
+
+ /* one bit at a time, so that swapped bits are detected */
+ fill_qsfp(data);
+ data[133] = 0x80; /* SAS 24.0G */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8636, data, sizeof(data)),
+ "Failed to parse SFF-8636 data with SAS 24.0G");
+ CHECK_FIELD_VALUE("Transceiver type", "SAS 24.0G");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "SAS 12.0G");
+
+ data[133] = 0x40; /* SAS 12.0G */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8636, data, sizeof(data)),
+ "Failed to parse SFF-8636 data with SAS 12.0G");
+ CHECK_FIELD_VALUE("Transceiver type", "SAS 12.0G");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "SAS 24.0G");
+
+ data[133] = 0;
+ data[138] = 0x08; /* FC speed: 3200 MBytes/s */
+ TEST_ASSERT_SUCCESS(parse(RTE_ETH_MODULE_SFF_8636, data, sizeof(data)),
+ "Failed to parse SFF-8636 data with FC 3200");
+ CHECK_FIELD_VALUE("Transceiver type", "FC: 3200 MBytes/sec");
+ CHECK_NO_FIELD_VALUE("Transceiver type", "FC: 1600 MBytes/sec");
+ return TEST_SUCCESS;
+}
+
/* SFF-8472 status bits and their implemented bits */
#define SFP_ENH_OPTIONS 93
#define SFP_A2_STATUS 110
@@ -567,6 +649,8 @@ static struct unit_test_suite module_eeprom_testsuite = {
TEST_CASE(test_module_eeprom_sfp_8472_cal_saturate_min),
TEST_CASE(test_module_eeprom_sfp_8472_cal_round),
TEST_CASE(test_module_eeprom_sfp_8472_status),
+ TEST_CASE(test_module_eeprom_sfp_compliance),
+ TEST_CASE(test_module_eeprom_qsfp_compliance),
TEST_CASE(test_module_eeprom_qsfp_8636),
TEST_CASE(test_module_eeprom_qsfp_8636_thresholds),
TEST_CASE(test_module_eeprom_qsfp_8636_signals_not_implemented),
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-10 18:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09 19:34 [PATCH 1/2] ethdev: decode newer SFF compliance codes Roman Khromenok
2026-10-09 19:34 ` [PATCH 2/2] test: check " Roman Khromenok
2026-10-10 18:23 ` Stephen Hemminger
2026-10-10 18:23 ` [PATCH 1/2] ethdev: decode " Stephen Hemminger
2026-10-10 18:42 ` [PATCH v2 " Roman Khromenok
2026-10-10 18:42 ` [PATCH v2 2/2] test: check " Roman Khromenok
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.