Skip to content

NDI design

Amy Buck edited this page Dec 21, 2016 · 1 revision

The NDI provides a very thin shim layer to the NAS feature components for converting the NPU ID and port ID into the SAI instance and the SAI port ID. The NDI creates a per NPU database which contains NPU-specific information such as NPU vendor type and its platform-specific capabilities.

Many platform-specific capabilities are stored in the configuration files which are read and stored in the NDI NPU database during initialization time. NDI subscribes for platform-specific events like SFP/QSFP OIR events or platform events which requires an NPU configuration update. NDI will have separate repos and it contains different files containing NDI APIs for each feature set.

Initialization

SAI currently supports only a single NPU instance. The following initialization steps are only valid for single NPU platforms.

1. NDI initializes the NPU configuration tables based on configuration files, and the configuration provided from the upper layer.

2. There are two options of linking the SAI library with the NDI:

  • Dynamic linking — based on the platform and NPU type, NDI links to the appropriate SAI library
  • Static linking — the makefile is modified to link the SAI library with NDI statically based on the platform type

3. NDI initializes service_method_table(s) for each of the SAI library instance and then calls sai_api_initialize() to initialize and pass service_method_table_t to SAI. The service method tables contain APIs to retrieve various generic or vendor-specific switch attributes for each NPU from NDI. Service methods accept NPU’s profile ID as an input for retrieving vendor defined settings. SAI retrieves switch settings during NPU initialization through sai_initialize_switch().

4. NDI calls sai_api_query() for each of the SAI API id for each SAI library. NDI retrieves all mandatory and optional method tables of SAI functionalities and stores in its own SAI method table.

5. Once the full SAI library is ready to be accesses by the NDI, the NDI creates vendor-defined settings as key/value pair profile tables which can be accesses by SAI during NPU initialization for each NPU. The profile table also contains platform-specific and run-time configurations.

6. NDI calls sai_initialize_switch() with the switch profile ID, hardware ID, name of corresponding microcode, and callback tables. SAI uses service methods to obtain all vendor and platform-specific attributes, then configures and initializes the NPU.

7. NDI uses the following values:

  • Profile ID is a list of key-value string pairs containing vendor-defined settings
  • Switch hardware ID
  • Microcode
  • Callback tables (sai_switch_notification_t)

8. NDI passes the following notification methods through the sai_initialize_switch() function as part of callbacks.

  • Switch state change notification
  • FDB event notification
  • Port state change notification
  • Switch shutdown request notification — adapter can also request for NPU shutdown due to an unrecoverable failure on a maintenance operation

The following default platform properties are maintained by NDI in a per-platform configuration file. Some of the attributes may be maintained by either NAS or only upper layer:

  • NPU vendor and chip ID
  • UFT table size
  • Port to interface mapping
  • Runtime fan-out configuration
  • Port configuration (speed, fan-out allowed, and restriction and limitations)
  • Optics information (indexing, optics restrictions like LR/SR allowed)

PAL interface

NDI interfaces with PAL modules for run-time control and status of NPU related functionality such as physical media, CPLD, and so on. It registers with PAL for events which requires NPU configuration update like optics OIR event.

Optics event handling

The optics event handling design is subject to change in the future based on the implementation of PAL and SDI. NDI subscribes for optics OIR events. Optics event handler calls SAI interface to update port configurations like interface type, pre-emphasis setting, and so on based on newly detected SFP/QSFP. Currently SFP drivers publish optics OIR events.

NDI data structure

NDI NPU database is local to the NDI. NAS components access it only through the NDI APIs for accessing their respective feature API set.

Clone this wiki locally