From: Jakub Kicinski <kuba@kernel.org>
To: tillo@tillo.ch
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux@armlinux.org.uk, andrew@lunn.ch,
hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, maxime.chevallier@bootlin.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/2] net: sfp: add quirks for OEM XGSPONST2001 and FS XGS-SFP-ONT-MACI
Date: Mon, 10 Aug 2026 17:14:29 -0700 [thread overview]
Message-ID: <20260811001429.1036686-1-kuba@kernel.org> (raw)
In-Reply-To: <20260806074308.1996917-3-tillo@tillo.ch>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: sfp: add quirks for OEM XGSPONST2001 and FS XGS-SFP-ONT-MACI
This adds two sfp_quirks entries applying sfp_fixup_potron to XGS-PON ONT
sticks that report broken TX_FAULT/LOS and need a longer T_START_UP. Both
entries use SFP_QUIRK_F_PREFIX so the vendor PN field is matched as a
prefix rather than by exact length.
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index dfb2b883d7616..4d8219e5ed599 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -556,6 +556,13 @@ static const struct sfp_quirk sfp_quirks[] = {
> SFP_QUIRK("FS", "GPON-ONU-34-20BI", sfp_quirk_2500basex,
> sfp_fixup_ignore_tx_fault),
>
> + // Fiberstore XGS-SFP-ONT-MACI is a MAC-mode XGS-PON ONT stick with
> + // ONT-class serial-passthrough TX_FAULT/LOS wiring and slow startup;
> + // mask both signals and extend T_START_UP via the potron fixup. The
> + // EEPROM vendor PN field is not space-padded past the legitimate
> + // string, so match it as a prefix.
> + SFP_QUIRK_F_PREFIX("FS", "XGS-SFP-ONT-MACI", sfp_fixup_potron),
[Severity: Medium]
Can the prefix behaviour make any difference for this particular part
string? "XGS-SFP-ONT-MACI" is 16 characters, which is the full width of
the field it is compared against:
include/linux/sfp.h:
char vendor_pn[16];
sfp_lookup_quirk() bounds the computed length to that width:
ps = sfp_strlen(id->base.vendor_pn, ARRAY_SIZE(id->base.vendor_pn));
and sfp_match() then does:
if (prefix ? qs_len > len : qs_len != len)
return false;
return !strncmp(qs, str, qs_len);
With qs_len == 16 and ps <= 16, "qs_len > len" and "qs_len != len" accept
exactly the same input (ps == 16), and the strncmp() covers all 16 bytes.
So there are no EEPROM bytes left "past the legitimate string" for this
entry, and the part comparison is identical to what plain SFP_QUIRK_F()
would perform.
That leaves two possibilities for this module. Either the PN field really
does read "XGS-SFP-ONT-MACI" and SFP_QUIRK_F() would have matched just as
well, so the commit message statement
"a plain SFP_QUIRK_F entry would silently never apply and the
kernel would honor the spurious TX_FAULT and eventually disable
the module"
does not hold for this entry, or the field really does contain garbage,
which then falls inside the 16 compared bytes and neither prefix nor exact
matching can ever fire, making the new entry dead code.
Which of the two is it, and could the comment and the commit message be
adjusted to describe what the code actually does here?
> SFP_QUIRK_F("HALNy", "HL-GSFP", sfp_fixup_halny_gsfp),
>
> SFP_QUIRK_F("H-COM", "SPP425H-GAB4", sfp_fixup_potron),
> @@ -616,6 +623,14 @@ static const struct sfp_quirk sfp_quirks[] = {
> SFP_QUIRK_S("OEM", "SFP-2.5G-LH20-A", sfp_quirk_2500basex),
> SFP_QUIRK_F("OEM", "RTSFP-10", sfp_fixup_rollball_cc),
> SFP_QUIRK_F("OEM", "RTSFP-10G", sfp_fixup_rollball_cc),
> +
> + // OEM XGSPONST2001 is an XGS-PON ONT stick with broken TX_FAULT and
> + // LOS indicators and slow startup, just like potron. The EEPROM
> + // vendor PN field is filled with non-printable garbage past the
> + // legitimate string instead of space padding, so match it as a
> + // prefix.
> + SFP_QUIRK_F_PREFIX("OEM", "XGSPONST2001", sfp_fixup_potron),
[Severity: Low]
This isn't a bug, but both new comments and the SFP_QUIRK_F_PREFIX macro
comment justify prefix matching purely in terms of the vendor PN field,
while struct sfp_quirk carries a single flag:
drivers/net/phy/sfp.h:
bool prefix_match;
and sfp_lookup_quirk() hands that same flag to the vendor comparison:
if (sfp_match(q->vendor, id->base.vendor_name, vs,
q->prefix_match) &&
sfp_match(q->part, id->base.vendor_pn, ps,
q->prefix_match))
So for these two entries the vendor test also becomes a prefix test on
very short strings, and a module reporting vendor_name "OEMTEK" or "FSCOM"
now passes the vendor check. The PN still has to prefix-match the full
model string, so the practical widening is limited to close clones, but
since sfp_fixup_potron() masks both TX_FAULT and LOS, an unintended match
silently hides genuine fault reporting.
Would it be worth either noting in the comments that the vendor field is
matched as a prefix too, or splitting the flag so prefix semantics only
apply to the part field?
> SFP_QUIRK_F("Turris", "RTSFP-2.5G", sfp_fixup_rollball),
> SFP_QUIRK_F("Turris", "RTSFP-10", sfp_fixup_rollball),
> SFP_QUIRK_F("Turris", "RTSFP-10G", sfp_fixup_rollball),
prev parent reply other threads:[~2026-08-11 0:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 7:43 [PATCH net-next v2 0/2] net: sfp: quirk support for XGS-PON ONT sticks with unclean EEPROMs Martino Dell'Ambrogio
2026-08-06 7:43 ` [PATCH net-next v2 1/2] net: sfp: allow prefix matching in quirk lookup Martino Dell'Ambrogio
2026-08-11 0:14 ` Jakub Kicinski
2026-08-06 7:43 ` [PATCH net-next v2 2/2] net: sfp: add quirks for OEM XGSPONST2001 and FS XGS-SFP-ONT-MACI Martino Dell'Ambrogio
2026-08-11 0:14 ` Jakub Kicinski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260811001429.1036686-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tillo@tillo.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.