[Accton] Check TX_DISABLE support before access in onlp_sfpi_control_…#194
Open
eric271110 wants to merge 3 commits into
Open
[Accton] Check TX_DISABLE support before access in onlp_sfpi_control_…#194eric271110 wants to merge 3 commits into
eric271110 wants to merge 3 commits into
Conversation
…get/set platform: as7535_28xb as7926-40xfb as7946-30xb as7946-74xkb as9716_32d as9736_64d as9737-32db as9817-64nb as9817-64 as9926-24 merge from [Accton][as9726-32d] Check TX_DISABLE support before access in onlp_sfpi_control_get/set (accton#191) 1. Flat-memory CMIS modules (typically passive DACs / simple AOCs) only have lower memory + page 00h. The page select register is silently discarded, so a request for page 01h or 10h actually still reads page 00h vendor info, returning plausible-looking but meaningless bytes. 2. control_get previously did not check the TX Disable Supported advertising bit at all; it walked straight to page 10h and read byte 0x82. control_set checked the advertising bit but missed the flat-memory case. Both paths now: - Read lower-memory byte 0x02 bit 7 (Flat_mem) first. Flat-memory modules return ONLP_STATUS_E_UNSUPPORTED immediately, without touching the page select registers. - For paged modules, check the TX Disable Supported advertising bit on page 01h byte 0x9B bit 1, mirroring the existing set path. - control_get's restore block preserves E_UNSUPPORTED instead of overwriting it with E_INTERNAL. Verified on a real switch via libonlp.onlp_sfp_control_get(): an unsupported / flat-memory module now returns -10 (E_UNSUPPORTED) instead of a stale lane-mask byte. Signed-off-by: Eric Yang <eric_yang@accton.com>
platform: as7535_28xb as7926-40xfb as7946-30xb as7946-74xkb as9716_32d as9736_64d as9737-32db as9817-64nb as9817-64 as9726-32d as9926-24 Signed-off-by: Eric Yang <eric_yang@accton.com>
platform: as9926-24db Signed-off-by: Eric Yang <eric_yang@accton.com>
087b196 to
08284d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…get/set
platform:
as7535_28xb
as7926-40xfb
as7946-30xb
as7946-74xkb
as9716_32d
as9736_64d
as9737-32db
as9817-64nb
as9817-64
as9926-24
merge from [Accton][as9726-32d] Check TX_DISABLE support before access in onlp_sfpi_control_get/set (#191)
Flat-memory CMIS modules (typically passive DACs / simple AOCs) only have lower memory + page 00h. The page select register is silently discarded, so a request for page 01h or 10h actually still reads page 00h vendor info, returning plausible-looking but meaningless bytes.
control_get previously did not check the TX Disable Supported advertising bit at all; it walked straight to page 10h and read byte 0x82. control_set checked the advertising bit but missed the flat-memory case.
Both paths now:
Verified on a real switch via libonlp.onlp_sfp_control_get(): an unsupported / flat-memory module now returns -10 (E_UNSUPPORTED) instead of a stale lane-mask byte.