Commit 13c8adcf authored by Marek Behún's avatar Marek Behún Committed by David S. Miller

net: sfp: Add and use macros for SFP quirks definitions

Add macros SFP_QUIRK(), SFP_QUIRK_M() and SFP_QUIRK_F() for defining SFP
quirk table entries. Use them to deduplicate the code a little bit.
Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 31eb8907
...@@ -350,42 +350,33 @@ static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id, ...@@ -350,42 +350,33 @@ static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id,
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, modes); linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, modes);
} }
#define SFP_QUIRK(_v, _p, _m, _f) \
{ .vendor = _v, .part = _p, .modes = _m, .fixup = _f, }
#define SFP_QUIRK_M(_v, _p, _m) SFP_QUIRK(_v, _p, _m, NULL)
#define SFP_QUIRK_F(_v, _p, _f) SFP_QUIRK(_v, _p, NULL, _f)
static const struct sfp_quirk sfp_quirks[] = { static const struct sfp_quirk sfp_quirks[] = {
{ // Alcatel Lucent G-010S-P can operate at 2500base-X, but incorrectly
// Alcatel Lucent G-010S-P can operate at 2500base-X, but // report 2500MBd NRZ in their EEPROM
// incorrectly report 2500MBd NRZ in their EEPROM SFP_QUIRK_M("ALCATELLUCENT", "G010SP", sfp_quirk_2500basex),
.vendor = "ALCATELLUCENT",
.part = "G010SP", // Alcatel Lucent G-010S-A can operate at 2500base-X, but report 3.2GBd
.modes = sfp_quirk_2500basex, // NRZ in their EEPROM
}, { SFP_QUIRK("ALCATELLUCENT", "3FE46541AA", sfp_quirk_2500basex,
// Alcatel Lucent G-010S-A can operate at 2500base-X, but sfp_fixup_long_startup),
// report 3.2GBd NRZ in their EEPROM
.vendor = "ALCATELLUCENT", SFP_QUIRK_F("HALNy", "HL-GSFP", sfp_fixup_halny_gsfp),
.part = "3FE46541AA",
.modes = sfp_quirk_2500basex, // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd NRZ in
.fixup = sfp_fixup_long_startup, // their EEPROM
}, { SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex,
.vendor = "HALNy", sfp_fixup_ignore_tx_fault),
.part = "HL-GSFP",
.fixup = sfp_fixup_halny_gsfp, // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report
}, { // 2500MBd NRZ in their EEPROM
// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex),
// NRZ in their EEPROM
.vendor = "HUAWEI", SFP_QUIRK_M("UBNT", "UF-INSTANT", sfp_quirk_ubnt_uf_instant),
.part = "MA5671A",
.modes = sfp_quirk_2500basex,
.fixup = sfp_fixup_ignore_tx_fault,
}, {
// Lantech 8330-262D-E can operate at 2500base-X, but
// incorrectly report 2500MBd NRZ in their EEPROM
.vendor = "Lantech",
.part = "8330-262D-E",
.modes = sfp_quirk_2500basex,
}, {
.vendor = "UBNT",
.part = "UF-INSTANT",
.modes = sfp_quirk_ubnt_uf_instant,
}
}; };
static size_t sfp_strlen(const char *str, size_t maxlen) static size_t sfp_strlen(const char *str, size_t maxlen)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment