Skip to content

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

Open
eric271110 wants to merge 3 commits into
accton:support_linux_6.1from
eric271110:add_sfp_functionality_linux6.1
Open

[Accton] Check TX_DISABLE support before access in onlp_sfpi_control_…#194
eric271110 wants to merge 3 commits into
accton:support_linux_6.1from
eric271110:add_sfp_functionality_linux6.1

Conversation

@eric271110

Copy link
Copy Markdown

…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)

  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:
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>
@eric271110 eric271110 force-pushed the add_sfp_functionality_linux6.1 branch from 087b196 to 08284d2 Compare June 15, 2026 09:10
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