Switching chip management method and equipment
By introducing microcontrollers to unified control of multiple switching chips and adapting to multiple CPU platforms, the multi-type equipment and SDK adaptation problems faced by device manufacturers in the development of switching chip driver software, and the effect of reducing adaptation workload and accelerating product speed to market is achieved.
Patent Information
- Application Number
- CN202411695095.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-07
AI Technical Summary
During the development of switching chip driver software, equipment manufacturers need to face multiple types of devices and adapt to each CPU platform and each switching chip SDK, which leads to increased development difficulty and affects the speed of product launch.
A microcontroller is introduced to uniformly control multiple switching chips, control the differences between different switching chips within the microcontroller, adapt to multiple different CPU platforms, and reduce the adaptive workload of switching chips.
Through the unified control of the microcontroller, the workload of switching chip adaptation is reduced, product development efficiency is improved, and product launch speed is accelerated.
Smart Images

Figure CN119583486A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a switching chip management method and equipment, belonging to the field of network communication equipment industry. Background Art
[0002] A switching chip refers to an integrated circuit chip used to implement data exchange functions in the communications field. It is usually used in network switches, routers, and other electronic devices. When a data packet arrives at an interface of the switching chip, the switching chip forwards the data packet to the appropriate output interface based on the destination address and switching algorithm of the data packet, thereby achieving efficient data transmission. Firewalls, SD-WAN and other devices are traffic detection and forwarding devices. The more network ports they have, the more they can meet the access needs of more devices. Therefore, equipment manufacturers increase the number of device ports through PCIE expansion, switching chip expansion, and other methods. Among them, the method of expanding the switching chip is more cost-effective and has been widely used in various products.
[0003] A software development kit (SDK) is a tool used by software engineers to develop application software for specific software packages, software frameworks, hardware platforms, operating systems, etc. During product development, developers need to perform different interface adaptation work based on different business needs for SDKs provided by different manufacturers. In the development of the switch chip driver software, the main work is to encapsulate the business layer interface based on the switch chip SDK software. If you want to expand the switch chip in the device, you need to re-adapt the driver software according to the CPU platform and switch chip model used by the device. For equipment manufacturers, they need to face multiple types of equipment and adapt each CPU platform and each switch chip SDK one by one, which greatly increases the development difficulty of equipment manufacturers and affects the speed of product launch.
[0004] Chinese patent CN113900646A "Software Development Kit Interface Adaptation Method, Device, Equipment and Storage Medium" includes: determining the interface adaptation standard of the software development kit to be adapted; creating an interface conversion layer according to the interface adaptation standard; converting the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer; creating a business thread based on the standard interface definition to complete the adaptation of the software development kit interface. The interface definition of the software development kit to be adapted is converted into a standard interface definition through the interface conversion layer, so that when developing products, there is no need to consider the differences in API usage of the SDK provided by each manufacturer, and related product development can be completed based on the standard interface definition. The present invention can effectively reduce the dependence of product development on the original SDK, shorten the development cycle, and effectively improve product development efficiency. However, the invention needs to transplant the required adaptation program in the processor, so it is still necessary to consider the processor differences for related debugging work. Summary of the invention
[0005] In order to overcome the problems existing in the prior art, the present invention designs a switching chip management method and device, introduces a microcontroller to uniformly control multiple switching chips, controls the differences between different switching chips inside the microcontroller, can adapt to multiple different CPU platforms, further reduce the workload of switching chip adaptation, and speed up product launch.
[0006] In order to achieve the above object, the present invention adopts the following technical solution:
[0007] Technical Solution 1
[0008] A switch chip management method comprises the following steps:
[0009] The central processing unit sends a command frame to the microcontroller, the command frame including a switch chip identifier, a switch chip port identifier, and a command identifier;
[0010] The microcontroller receives and parses the command frame to obtain the parsing result;
[0011] The microcontroller calls the function interface provided by the corresponding toolkit according to the analysis result to perform the switch chip management action;
[0012] The microcontroller returns a response frame to the central processor, and the response frame includes the execution status of the switch chip management action.
[0013] Furthermore, if the command frame is a query command, the microcontroller preferentially queries the data in the cache; if the cache misses, the SDK interface is called to query the data and the query data is stored in the cache.
[0014] Furthermore, the command frame format includes a start character, a frame length, a frame sequence number, a command identifier, a switching chip identifier, a switching chip port identifier, a command parameter, and an end character.
[0015] Furthermore, the response frame format includes a start character, a frame length, a frame sequence number, a command identifier, an execution status, a response parameter, and an end character.
[0016] Furthermore, the microcontroller and the central processing unit are connected to the switching chip via a multiplexing switch; the multiplexing switch is controlled by the central processing unit and is used to make the switching chip electrically connected to only one of the microcontroller and the central processing unit at a certain moment.
[0017] Technical Solution 2
[0018] An electronic device, comprising:
[0019] Several network ports;
[0020] Several switching chips for forwarding data between different network ports;
[0021] The central processing unit is used to send a command frame to the microcontroller; the command frame includes a switch chip identifier, a switch chip port identifier, and a command identifier;
[0022] The microcontroller is used to receive and parse the command frame to obtain the parsing result, and call the functional interface provided by the corresponding toolkit according to the parsing result to execute the switching chip management action, and return a response frame to the central processing unit; the response frame includes the execution status of the switching chip management action.
[0023] Furthermore, if the command frame is a query command, the microcontroller preferentially queries the data in the cache; if the cache misses, the SDK interface is called to query the data and the query data is stored in the cache.
[0024] Furthermore, the command frame format includes a start character, a frame length, a frame sequence number, a command identifier, a switching chip identifier, a switching chip port identifier, a command parameter, and an end character.
[0025] Furthermore, the response frame format includes a start character, a frame length, a frame sequence number, a command identifier, an execution status, a response parameter, and an end character.
[0026] Furthermore, the microcontroller and the central processing unit are connected to the switching chip via a multiplexing switch; the multiplexing switch is controlled by the central processing unit and is used to make the switching chip electrically connected to only one of the microcontroller and the central processing unit at a certain moment.
[0027] Compared with the prior art, the present invention has the following characteristics and beneficial effects:
[0028] The present invention introduces a microcontroller to uniformly control multiple switching chips, controls the differences between different switching chips inside the microcontroller, can adapt to multiple different CPU platforms, further reduces the workload of switching chip adaptation, and speeds up product launch. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a hardware architecture diagram of the present invention;
[0030] Figure 2 It is the software architecture diagram of the present invention;
[0031] Figure 3 It is the MCU working flow chart of the present invention. DETAILED DESCRIPTION
[0032] The present invention is described in more detail below with reference to the embodiments.
[0033] Embodiment 1
[0034] like Figure 1As shown, a communication device includes: a central processing unit (CPU), a microcontroller (MCU), a switching chip, and multiple network ports. The central processing unit runs Linux software for managing the network ports. The microcontroller is electrically connected to each switching chip respectively. The central processing unit is electrically connected to the microcontroller and each switching chip respectively. The central processing unit sends a command frame to the microcontroller, and the command frame includes a switching chip identifier, a switching chip port identifier, and a command identifier; the microcontroller receives and parses the command frame to obtain a parsing result; the microcontroller calls the switching chip SDK interface according to the parsing result to execute the switching chip management action; the microcontroller returns a response frame to the central processing unit, and the response frame includes the execution status of the switching chip management action. The switching chip SDK is used to implement switching chip management and provides multiple software functions and application programming interfaces (APIs), such as the Realtek Switch SDK developed by Realtek.
[0035] In one implementation, a data frame is defined, and both the command frame and the response frame adopt the frame format, which is defined as follows:
[0036] Frame Start Data length Frame number data Frame End SWMG 2 bytes 2 bytes END
[0037] Frame start: 4 bytes, the content is fixed as "SWMG", indicating the start of a valid frame; Data length: the number of bytes of the entire frame including the frame start and frame end; Frame sequence number: a 2-byte integer; Each time the CPU sends a command, the value increases by 1 and rolls back to "0" after reaching the maximum value; CPU command frame: used to identify a command frame sent; MCU response frame: used to identify the response to a command frame; Data: frame content; Frame end: 3 bytes, the content is fixed as "END", indicating the end of a valid frame.
[0038] The command frame data items are defined as follows:
[0039] Command Identifier Switch chip number Port Number Command parameters 2 bytes 1 byte 1 byte
[0040] The response frame data items are defined as follows:
[0041] Command Identifier Execution Status Response Data 2 bytes 4 bytes
[0042] The microprocessor identifies different commands according to the command identifier, identifies different switching chips according to the switching chip number, and identifies different ports on a switching chip according to the port number.
[0043] The CPU sends commands according to the command definition, without worrying about which specific switch chip the MCU is connected to. The MCU will call the chip manufacturer's SDK to manage the switch chip based on the connected chip model.
[0044] The beneficial effect of this embodiment is that a definition format of a command frame and a response frame is provided, command frames and response frames are used for data interaction, a switching chip is abstracted on the CPU side, and a CPU is abstracted on the switching chip side.
[0045] In one implementation, the switch chip management commands include DSA initialization, connection status acquisition, connection rate configuration, port statistics acquisition, etc. When the MCU is connected to two switch chips, YT9215 and 88E6176, the CPU can send the same command, but when the MCU parses the command, it will call different SDKs to configure the chip according to the connected chip. Taking obtaining port statistics as an example, the relevant work steps are as follows:
[0046] S1, the CPU sends a statistical information acquisition command frame, in which the switch chip number and the port number are specified;
[0047] S2. MCU parses the command frame to obtain statistical information and calls SDK to obtain relevant information.
[0048] S21. When connected to YT9215, obtain port statistics information through the "yt_stat_mib_port_get" interface of YT_SWITCH_SDK (YT9215 chip SDK);
[0049] S22. When connected to 88E6176, obtain port statistics information through the "msdStatsPortAllCountersGet" interface of UMSD (SDK of 88E6176 chip).
[0050] In one implementation, if the switch chip management command is a query command, the microcontroller preferentially obtains data from the cache; when the cache misses, the SDK interface is called to query the data and the query results are stored in the cache, thereby avoiding repeated queries of the actual switch chip and improving the switch chip management performance.
[0051] In one implementation, the central processing unit includes at least one network port connected to the switching chip; or the central processing unit extends at least one network port through a PCIE bus and connects to the switching chip.
[0052] In one implementation, the central processing unit integrates or extends a MAC interface (Media Access Control) on a peripheral PCIE bus, and the central processing unit is connected to a network port of a switching chip via the MAC.
[0053] In one embodiment, the central processing unit is integrated or extended to have at least one MDIO bus controller compliant with the 802.3 standard connected to the switch chip, and the MDIO bus controller is used to read / write the registers of the switch chip to control its behavior or obtain its status.
[0054] In one implementation, the switch chip provides multiple network interfaces to the outside world and provides connection functions with other network devices. For the CPU side, the switch chip provides a network interface for the data communication channel to the CPU port. The CPU and the switch chip are connected through various MII interfaces defined by the 802.3 standard. Various MII interfaces are referred to as "xMII" here, including but not limited to: MII, RGMII, SGMII, etc.
[0055] In one implementation, the microcontroller is connected to the switch chip via the MDIO bus to manage the switch chip; the microcontroller is connected to the central processor via a certain communication interface to communicate with the central processor. The MDIO bus is provided with a multiplexing switch, which is controlled by the CPU and is used to control that only one of the MCU or the CPU is physically connected to the MDIO of the switch chip at the same time.
[0056] A switch includes a switch chip, a CPU, a port transceiver (PHY), a PCB, a MAC, a serial-to-parallel converter (SERDES), a power module and other components. The switch chip is used to process a large amount of exchange data and forward messages; the CPU is used to configure switch functions, monitor network traffic, implement security policies and other management tasks; the PHY works at the physical layer and is used to process the physical layer data of the electrical interface and implement the 802.3 physical layer related specifications; the MAC works at the data link layer and implements the 802.3 data link layer related specifications; the SERDES is used to connect the MAC and the PHY and is responsible for the mutual conversion between parallel signals and serial signals on the link; the power module is used to provide power supply to ensure the normal operation of the switch.
[0057] As shown in 2, a method for adapting a switching chip software development kit interface includes:
[0058] A unified interface layer is constructed based on the MCU; the unified interface layer unifies the SDK interfaces and provides a switch chip register access interface for the user layer and the kernel network card driver module. The implementation method of the unified interface layer can be found in Chinese patent CN113900646A "Software Development Kit Interface Adaptation Method, Device, Equipment and Storage Medium", which will not be repeated here.
[0059] The CPU core runs the network card driver module (net_xspeed), which provides software support for the user layer to access the network through the socket; or, the DPDK can be implemented by the fast-forwarding software that bypasses the kernel protocol stack, which can also realize the network card driver function. The network card driver module sends command frames to the MCU, uses the unified interface layer to parse and execute commands, and thus converts the switch chip management command into a call to the SDK interface to complete the switch chip management process.
[0060] The beneficial effect of this embodiment is that the same interface layer is constructed in the MCU, and the CPU software side only needs to set the kernel network card driver and the DPDK network card driver to realize the management of the extended switching chip. Since the net_xspeed driver is highly versatile, it can be directly applied to various CPU platforms based on Linux, and there is no need to adapt to the CPU platform, which can speed up the product development speed.
[0061] In one implementation, the CPU core controls the switching of the multiplexing switch, and the CPU core runs software to control the accessors of the MDIO bus as needed.
[0062] It should be noted that each functional unit / module in each embodiment of the present invention may be integrated into one processing unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated into one unit / module. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of software functional unit / module.
[0063] Through the description of the above embodiments, it can be clearly understood by those skilled in the art that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code or any appropriate combination thereof. For hardware implementation, the processor can be implemented in one or more of the following units: an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a processor, a controller, a microcontroller, a microcontroller, other electronic units designed to implement the functions described herein or a combination thereof. For software implementation, part or all of the processes of the embodiments can be completed by instructing the relevant hardware through a computer program. When implemented, the above program can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any medium that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a computer can access. Computer-readable media can include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer.
[0064] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should analyze that the technical solution of the present invention can be modified or replaced by equivalents without departing from the essence and scope of the technical solution of the present invention.
Claims
1. A method for managing a switching chip, characterized in that: The following steps are involved: The central processing unit sends a command frame to the microcontroller, the command frame including a switch chip identifier, a switch chip port identifier, and a command identifier; The microcontroller receives and parses the command frame to obtain the parsing result; The microcontroller calls the function interface provided by the corresponding toolkit according to the analysis result to perform the switch chip management action; The microcontroller returns a response frame to the central processor, and the response frame includes the execution status of the switch chip management action.
2. A method for managing a switching chip according to claim 1, characterized in that: If the command frame is a query command, the microcontroller preferentially queries the data in the cache; If the cache does not hit, the SDK interface is called to query the data and the query data is stored in the cache.
3. A method for managing a switching chip according to claim 1, characterized in that: The command frame format includes a start character, a frame length, a frame sequence number, a command identifier, a switching chip identifier, a switching chip port identifier, a command parameter, and an end character.
4. A method for managing a switching chip according to claim 1, characterized in that: The response frame format includes a start character, a frame length, a frame sequence number, a command identifier, an execution status, a response parameter, and an end character.
5. A switch chip management method according to claim 1, characterized in that: The microcontroller and the central processing unit are connected to the switching chip through a multiplexing switch; the multiplexing switch is controlled by the central processing unit and is used to make the switching chip electrically connected to only one of the microcontroller and the central processing unit at a certain time.
6. An electronic device, characterized in that: include: Several network ports; Several switching chips for forwarding data between different network ports; A central processing unit, used for sending command frames to the microcontroller; The command frame includes a switch chip identifier, a switch chip port identifier, and a command identifier; The microcontroller is used to receive and parse the command frame to obtain the parsing result, and call the function interface provided by the corresponding toolkit according to the parsing result to execute the switch chip management action, and return a response frame to the central processing unit; the response frame includes the execution status of the switch chip management action.
7. An electronic device according to claim 6, characterized in that: If the command frame is a query command, the microcontroller will first query the data in the cache; if the cache does not hit, the SDK interface will be called to query the data and store the query data in the cache.
8. The electronic device according to claim 6, characterized in that: The command frame format includes a start character, a frame length, a frame sequence number, a command identifier, a switching chip identifier, a switching chip port identifier, a command parameter, and an end character.
9. The electronic device according to claim 6, characterized in that: The response frame format includes a start character, a frame length, a frame sequence number, a command identifier, an execution status, a response parameter, and an end character.
10. The electronic device according to claim 6, characterized in that: The microcontroller and the central processing unit are connected to the switching chip through a multiplexing switch; the multiplexing switch is controlled by the central processing unit and is used to make the switching chip electrically connected to only one of the microcontroller and the central processing unit at a certain time.
Citation Information
Patent Citations
Software development kit interface adaptation method and device, equipment and storage medium
CN113900646A
