Method and application of loading exchange chip SDK driver by SAI

By using the SAI-loaded switching chip SDK driver method, the compatibility problem of different switching chip models was solved, enabling one SAI file to adapt to multiple chips and reducing software maintenance costs.

CN116302200BActive Publication Date: 2026-04-07SUZHOU CENTEC COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-23
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In the existing technology, switch chip manufacturers need to provide different SAI and SDK packages for different models of switch chips, which leads to increased software maintenance and testing costs.

Method used

By obtaining the PCIe ID of the switching chip through SAI and querying the configuration file, loading the SDK library file, attaching API functions to the global function table, and calling the APIs provided by the SDK at runtime, a single SAI file can be adapted to different switching chips.

Benefits of technology

This reduces software testing and maintenance costs, enables a single SAI file to be adapted to different models of switching chips, and reduces SDK dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302200B_ABST
    Figure CN116302200B_ABST
Patent Text Reader

Abstract

The application discloses a method and application of SAI loading SDK driver of a switching chip, and the method comprises the following steps: an SAI obtains a PCIE ID of the switching chip and queries a configuration file to obtain an SDK library file of the switching chip, wherein the configuration file comprises one-to-one corresponding PCIE ID and SDK library file; the SAI loads the SDK library file of the switching chip, and obtains an API provided by the SDK by querying the SDK library file; the SAI mounts a function of the API provided by the SDK to a global function table; and the SAI calls an interface provided by the global function table to call the API provided by the SDK. The method can realize that one SAI file is simultaneously adapted to functions of different switching chips.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of electronic communication, in particular to a method for loading SDK driver of SAI into switch chip and application. BACKGROUND

[0002] SAI (Switch Abstraction Interface) is an abstraction of switch function for supporting different switch chips, which is implemented as a switch abstraction layer in the switch chip, and the switch abstraction layer is used to provide a unified API for controlling the switch chip. Through the switch abstraction layer, the development of upper network application of network operating system (NOS) can not depend on the API provided by SDK (Software Development Kit) of switch chip of switch chip manufacturer, and the development efficiency of upper network application is improved.

[0003] In the prior art, in order to protect the intellectual property rights, the chip manufacturer opens the API interface of the switch chip in the form of SDK for the network equipment manufacturer to develop the equipment, and the switch chip manufacturer needs to encapsulate the SAI layer for the SDK of the switch chip. If the SDK implementation of the switch chip manufacturer is to control and support different types of chips by using a compilation macro, the switch chip manufacturer still needs to provide different SAI and SDK packages for different types of chips to realize the binding by directly linking the SAI library file to the SDK library file in the case of providing a unified SAI layer.

[0004] In the case that the SDK provided by the chip manufacturer only supports one chip, the switch chip manufacturer needs to provide different SAI packages to adapt to different types of switch chips of the manufacturer, thereby increasing the software maintenance and testing cost.

[0005] The information disclosed in this BACKGROUND section is only for the purpose of increasing the understanding of the background of the present application and should not be taken as admitting that the information forms prior art that is already known to those of ordinary skill in the art. SUMMARY

[0006] The present application aims to provide a method for loading SDK driver of SAI into switch chip and application, which can realize the function that one SAI file is adapted to different switch chips.

[0007] To achieve the above-mentioned purpose, the embodiment of the present application provides a method for loading SDK driver of SAI into switch chip.

[0008] In one or more embodiments of the present invention, the switching chip includes a Switching Abstraction Interface (SAI) and a High-Speed ​​Peripheral Component Interface (PCIE). The method includes: the SAI obtains the PCIE ID of the switching chip and queries a configuration file to obtain the SDK library file of the switching chip, wherein the configuration file includes a one-to-one corresponding PCIE ID and SDK library file.

[0009] The SAI loads the SDK library file of the switching chip and obtains the APIs provided by the corresponding SDK by querying the SDK library file;

[0010] The SAI mounts the functions of the API provided by the SDK to the global function table; and

[0011] The SAI calls the interface provided by the global function table to call the API provided by the SDK.

[0012] In one or more embodiments of the present invention, the SAI obtaining the PCIe ID of the switching chip includes: the SAI accessing the PCIe configuration space to obtain the PCIe ID of the switching chip.

[0013] In one or more embodiments of the present invention, loading the SDK library file of the switching chip includes: the SAI using the dlopen function to load the SDK library file of the switching chip.

[0014] In one or more embodiments of the present invention, the configuration file further includes an API prefix, wherein the API prefix corresponds one-to-one with the PCIE ID and the SDK library file.

[0015] In one or more embodiments of the present invention, the global function table includes function handles and values ​​corresponding to the function handles. The SAI attaches functions of the API provided by the SDK to the global function table, including: the SAI using the API prefix and function name to look up the symbol table in the SDK library file to obtain the API provided by the SDK; and the SAI using the API provided by the SDK to assign values ​​to the function handles in the global function table.

[0016] In one or more embodiments of the present invention, the SAI calls the interface provided by the global function table to call the API provided by the SDK, including: when the SAI is running, it calls the function handle of the global function table to call the API provided by the SDK of the corresponding switching chip.

[0017] In another aspect of the invention, a switching chip is provided, which includes a query module, a loading module, a mounting module, and a calling module.

[0018] The query module is configured to acquire the PCIE ID of the switch chip and query a configuration file to acquire an SDK library file of the switch chip, wherein the configuration file comprises a one-to-one correspondence of PCIE ID and SDK library file.

[0019] The loading module is configured to load the SDK library file of the switch chip, and acquire an API provided by the SDK by querying the SDK library file.

[0020] The mounting module is configured to mount a function of the API provided by the SDK to a global function table.

[0021] The calling module is configured to call an interface provided by the global function table to call the API provided by the SDK.

[0022] In one or more embodiments of the present application, the switch chip further comprises an access module configured to access a configuration space of the PCIE to acquire the PCIE ID of the switch chip.

[0023] In one or more embodiments of the present application, the loading module is further configured to load the SDK library file of the switch chip by using a dlopen function.

[0024] In one or more embodiments of the present application, the loading module is further configured to use the API prefix and the function name to search a symbol table in the SDK library file to obtain the API provided by the SDK, and use the API provided by the SDK to assign a function handle in the global function table, wherein the configuration file further comprises an API prefix.

[0025] In one or more embodiments of the present application, the calling module is further configured to call the function handle of the global function table to call the API provided by the SDK of the corresponding switch chip at runtime, wherein the global function table comprises the function handle and a value corresponding to the function handle.

[0026] In another aspect of the present application, an electronic device is provided, comprising at least one processor, and a memory storing instructions which, when executed by the at least one processor, cause the at least one processor to perform the method of loading the SDK driver of the switch chip by the SAI as described above.

[0027] In another aspect of the present application, a computer readable storage medium is provided, and a computer program is stored on the computer readable storage medium, and the computer program, when executed by a processor, implements the steps of the method for loading an SAI into a switch chip SDK driver as described.

[0028] Compared with the prior art, the method and application for loading an SAI into a switch chip SDK driver according to the embodiment of the present application can solve the problem that different types of chips of a manufacturer need to be adapted to different SAI packages. By compiling the SDK provided by the manufacturer into different library files for the SAI to load on demand, the SAI binds the SDK of the switch chip at runtime, and thus realizes that one SAI file can adapt the SDK of different switch chips without relying on the SDK provided by the manufacturer, thereby supporting different types of switch chips and reducing the cost of software testing and maintenance. BRIEF DESCRIPTION OF DRAWINGS

[0029] Figure 1 is a flowchart of the method for loading an SAI into a switch chip SDK driver according to an embodiment of the present application;

[0030] Figure 2 is a specific flowchart of the method for loading an SAI into a switch chip SDK driver according to an embodiment of the present application;

[0031] Figure 3 is a structure diagram of a switch chip according to an embodiment of the present application;

[0032] Figure 4 is a hardware structure diagram of a computing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0033] The specific embodiments of the present application are described in detail below with reference to the accompanying drawings, but it should be understood that the scope of protection of the present application is not limited by the specific embodiments.

[0034] Unless otherwise explicitly indicated, throughout the specification and claims, the term "comprise" or its variants such as "comprises" or "comprising" will be understood to encompass the stated element or elements, and not to exclude any other element or elements.

[0035] The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0036] Embodiment 1

[0037] As shown in Figures 1-2 , a method for loading an SAI into a switch chip SDK driver in an embodiment of the present application is introduced, and the method includes the following steps.

[0038] In step S101, the SAI acquires the PCIE ID of the switch chip and queries a configuration file to acquire the SDK library file of the switch chip.

[0039] Specifically, the SAI accesses the configuration space of the PCIE (Peripheral Component Interconnect Express) to acquire the PCIE ID of the switch chip. By accessing the configuration space of the PCIE, some information of the hardware device can be obtained, for example, in this embodiment, the ID of the PCIE device of the switch chip can be obtained, so as to access the specific register.

[0040] In this embodiment, the configuration file includes one-to-one corresponding PCIE ID, SDK library file and API prefix, and the structure of the specific configuration file is shown in Table 1.

[0041] PCIEID SDKLIB APIPREFIX CB10:8180 libsdk_8180.so 8180 CB10:5236 libsdk_5236.so 5236 CB10:8096 libsdk_8096.so 8096

[0042] Table 1: Configuration file example

[0043] As shown in Table 1, in the configuration file, one PCIE ID has and only has one corresponding SDK LIB (SDK library file) and one corresponding API PREFIX (API prefix). As an example, when searching in the configuration file using the PCIE ID CB10:8180, the SDK library file queried is the libsdk_8180.so file, and the API prefix queried is 8180. By using the configuration file, the correspondence between the switch chip PCIE ID and the SDK library file can be maintained.

[0044] In step S102, the SAI loads the SDK library file of the switch chip, and acquires the API provided by the corresponding SDK by querying the SDK library file.

[0045] Specifically, the SAI uses the dlopen function to load the SDK library file of the switch chip.

[0046] The function dlopen can open the specified dynamic library file in the specified mode, and return a handle to the calling process. Correspondingly, the function dlclose is used to unload the opened library file.

[0047] In this embodiment, the API provided by the SDK of one switch chip is stored in the SDK library file, and by loading the SDK library file and querying, the API provided by the SDK can be obtained.

[0048] In step S103, the SAI mounts the functions of the API provided by the SDK to the global function table.

[0049] Specifically, one SAI has a global function table for calling, which includes function handles and values corresponding to the function handles. The structure of the global function table is shown in Table 2.

[0050] FUNC VALUE linkagg_get_nonuc_ports NULL linkagg_get_property NULL linkagg_get_psc NULL … NULL

[0051] Table 2: Global function table example

[0052] The function handle can be used for function transmission, specifying a callback function, and constructing a handle of a function defined in an inline manner instead of being stored in a program file, and is a MATLAB data type for storing an association relationship of a function.

[0053] As shown in Table 2, when the global function table is created, only multiple function handles such as linkagg_get_nonuc_ports, linkagg_get_propert, and linkagg_get_psc are created, and the function handles are not assigned values. Therefore, in the initial global function table, the initial value of each function handle is NULL, that is, the function handle does not store a corresponding function path at this time.

[0054] In this embodiment, the SAI uses the API prefix and the function name to search a symbol table in the SDK library file to obtain the API provided by the SDK. At this time, the function handle of the global function table of the SAI is still NULL, and the SAI assigns values to the function handles in the global function table by using the API provided by the SDK.

[0055] Further, after the function handles in the global function table are assigned values, the function handles store corresponding function paths, that is, the API of the SDK. Subsequently, the required SDK API can be directly queried and called by calling the global function table, that is, the API functions provided by the SDK are mounted to the global function table.

[0056] In step S104, the SAI calls the interface provided by the global function table to call the API provided by the SDK.

[0057] In this embodiment, the SDK of the chip manufacturer is compiled into different library files by the foregoing operation and stored in the global function table of the SAI, which can be loaded by the SAI on demand. The SAI, at runtime, calls the function handles in the global function table of the SAI according to the requirement of using the switch chip, and realizes the calling of the API provided by the SDK of the required switch chip.

[0058] The method and application for loading an SDK driver of a switch chip by an SAI according to the embodiments of the present application can solve the problem that different types of chips provided by manufacturers need to be adapted to different SAI packages, and by compiling SDKs provided by manufacturers into different library files for loading by SAI on demand, the SDK of a switch chip is bound by SAI at runtime, so that one SAI file can be adapted to the SDK of different switch chips without relying on the SDK provided by the manufacturer, thereby supporting different types of switch chips and reducing the cost of software testing and maintenance.

[0059] As shown in Figure 3 The present application discloses a switch chip for implementing SAI loading of an SDK driver of a switch chip.

[0060] In the embodiments of the present application, the switch chip comprises a query module, a loading module, a mounting module and a calling module.

[0061] The query module 301 is configured to acquire the PCIE ID of the switch chip and query a configuration file by the SAI, and acquire the SDK library file of the switch chip, wherein the configuration file comprises a one-to-one corresponding PCIE ID and SDK library file.

[0062] The loading module 302 is configured to load the SDK library file of the switch chip by the SAI, and acquire the API provided by the corresponding SDK by querying the SDK library file.

[0063] The mounting module 303 is configured to mount the function of the API provided by the SDK to a global function table by the SAI.

[0064] The calling module 304 is configured to call the interface provided by the global function table to call the API provided by the SDK by the SAI.

[0065] The switch chip further comprises an access module configured to access the configuration space of the PCIE to acquire the PCIE ID of the switch chip by the SAI.

[0066] The loading module 302 is further configured to load the SDK library file of the switch chip by the SAI using a dlopen function.

[0067] The loading module 302 is further configured to find a symbol table in the SDK library file by the SAI using the API prefix and the function name, to obtain the API provided by the SDK, and assign a value to the function handle in the global function table by the SAI using the API provided by the SDK.

[0068] The calling module 304 is further configured to, at runtime, invoke the function handle of the global function table to invoke an API provided by the SDK of the corresponding switch chip, wherein the global function table comprises the function handle and a value corresponding to the function handle.

[0069] Figure 4 A hardware structure diagram of a computing device 40 for SAI loading a switch chip SDK driver according to an embodiment of the present specification is shown. As shown, the computing device 40 can include at least one processor 401, a memory 402 (e.g., a non-volatile memory), a memory 403, and a communication interface 404, and the at least one processor 401, the memory 402, the memory 403, and the communication interface 404 are connected together via a bus 405. The at least one processor 401 executes at least one computer-readable instruction stored or encoded in the memory 402. Figure 4

[0070] It should be understood that the computer-executable instructions stored in the memory 402, when executed, cause the at least one processor 401 to perform various operations and functions described above in conjunction with the various embodiments of the present specification. Figures 1-4

[0071] In an embodiment of the present specification, the computing device 40 can include, but is not limited to, a personal computer, a server computer, a workstation, a desktop computer, a laptop computer, a notebook computer, a mobile computing device, a smart phone, a tablet computer, a cellular phone, a personal digital assistant (PDA), a handheld device, a messaging device, a wearable computing device, a consumer electronic device, and the like.

[0072] According to an embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium can have instructions (i.e., the above-described elements implemented in software) that, when executed by a machine, cause the machine to perform various operations and functions described above in conjunction with the various embodiments of the present specification. Specifically, a system or apparatus equipped with a readable storage medium on which software program codes implementing the functions of any of the above-described embodiments are stored, and causing a computer or processor of the system or apparatus to read out and execute the instructions stored in the readable storage medium can be provided. Figures 1-4

[0073] ​​​The method and application of SAI loading switch chip SDK driver according to the embodiment of the present application can solve the problem that different types of chips of manufacturers need to be adapted to different SAI packages, and by compiling the SDK provided by the manufacturers into different library files for SAI to load as needed, SAI binds the SDK of the switch chip at runtime, so that one SAI file can adapt to the SDK of different switch chips without relying on the SDK provided by the manufacturers, thereby supporting different types of switch chips and reducing the cost of software testing and maintenance.

[0074] Those skilled in the art will appreciate that embodiments of the present application can be supplied as methods, systems, or computer program products. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) embodying computer-readable program code.

[0075] The present application is described in reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 means for performing the functions specified in the flowchart

[0076] These computer program instructions can also be stored in a computer-readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including instruction means, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 one or more blocks

[0077] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable data processing apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 one or more blocks

[0078] The foregoing description of specific exemplary embodiments of the application has been presented for the purposes of illustration and description. It is not intended to be a limitation on the broad concepts of the application. Obviously, many modifications and variations of the specific exemplary embodiments described herein are possible in light of this disclosure, and it is intended that the scope of the application be limited only by the claims appended hereto and their equivalents. Examples of selected embodiments were chosen and described in order to explain the principles of the application and its practical application. Those skilled in the art will readily appreciate that various modifications and changes can be made to the specific exemplary embodiments without departing from the scope of the application. The scope of the application is defined only and exactly by the claims.

Claims

1. A method for loading a switch chip SDK driver using SAI, wherein the switch chip includes a Switch Abstraction Interface (SAI) and a High-Speed ​​Peripheral Component Interface (PCIE), characterized in that, The method includes: The SAI obtains the PCIE ID of the switching chip and queries the configuration file to obtain the SDK library file of the switching chip. The configuration file includes a one-to-one corresponding PCIE ID and SDK library file, and the configuration file also includes an API prefix that corresponds one-to-one with the PCIE ID and SDK library file. The SAI loads the SDK library file of the switching chip and uses the API prefix and function name to look up the symbol table in the SDK library file to obtain the API provided by the corresponding SDK. The SAI uses the API provided by the SDK to assign values ​​to function handles in the global function table, thereby mounting functions from the SDK's API to the global function table. The global function table includes function handles and their corresponding values. The SAI calls the interface provided by the global function table to call the API provided by the SDK.

2. The method for loading the SAI switching chip SDK driver as described in claim 1, characterized in that, The SAI obtains the PCIe ID of the switching chip, including: The SAI accesses the PCIe configuration space to obtain the PCIe ID of the switching chip.

3. The method for loading the SAI switching chip SDK driver as described in claim 1, characterized in that, The SDK library file for loading the switching chip includes: The SAI uses the dlopen function to load the SDK library file of the switching chip.

4. The method for loading the SAI switching chip SDK driver as described in claim 1, characterized in that, The SAI calls the interface provided by the global function table to call the API provided by the SDK, including: When the SAI is running, it calls the function handles of the global function table to invoke the APIs provided by the SDK of the corresponding switching chip.

5. A switching chip for implementing the method of any one of claims 1 to 4, characterized in that, The switching chip includes a Switching Abstraction Interface (SAI) and a High-Speed ​​Peripheral Component Interface (PCIE), and: The query module is used by the SAI to obtain the PCIe ID of the switching chip and query the configuration file to obtain the SDK library file of the switching chip, wherein the configuration file includes a one-to-one corresponding PCIe ID and SDK library file; The loading module is used by the SAI to load the SDK library file of the switching chip and obtain the APIs provided by the corresponding SDK by querying the SDK library file; The mounting module is used by SAI to mount the functions of the API provided by the SDK to the global function table; as well as The calling module is used by the SAI to call the interface provided by the global function table to call the API provided by the SDK.

6. The switching chip as described in claim 5, characterized in that, The switching chip also includes: The access module is used by the SAI to access the PCIe configuration space to obtain the PCIe ID of the switching chip.

7. An electronic device, characterized in that, include: At least one processor; as well as A memory that stores instructions, which, when executed by the at least one processor, cause the at least one processor to perform the SAI method for loading the switching chip SDK driver as described in any one of claims 1 to 4.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method for loading the SAI switching chip SDK driver as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and device for managing storage devices

    CN106648649A

  • Data processing method and device for VPN equipment

    CN111786872A