Skip to content

[Accton] Check TX_DISABLE support before access in onlp_sfpi_control_…#196

Open
eric271110 wants to merge 3 commits into
accton:support_new_platform_and_syncfrom
eric271110:add_sfp_functionality_new_platform
Open

[Accton] Check TX_DISABLE support before access in onlp_sfpi_control_…#196
eric271110 wants to merge 3 commits into
accton:support_new_platform_and_syncfrom
eric271110:add_sfp_functionality_new_platform

Conversation

@eric271110

Copy link
Copy Markdown

…get/set

platform:
as7926-40xfb
as9716_32d
as9817-64nb
as9817-64
as9926-24

merge from [Accton][as9726-32d] Check TX_DISABLE support before access in onlp_sfpi_control_get/set (#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.

…get/set

platform:
as7926-40xfb
as9716_32d
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:
as7926-40xfb
as9716_32d
as9817-64nb
as9817-64
as9926-24
platform:
as9926-24db

Signed-off-by: Eric Yang <eric_yang@accton.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant