Information statistical method and device of MAC management information base, medium and electronic equipment
By storing packet statistics in memory and registers in a multi-port Ethernet network chip, the problem of resource waste in chip design is solved and efficient resource utilization is achieved.
Patent Information
- Application Number
- CN202410908050.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-11-01
AI Technical Summary
In a multi-port Ethernet network chip, the more ports, the more packet types, and the more register resources are required, resulting in a large amount of area occupied and waste of resources in the chip design.
By storing the statistical information of the target port message in memory and registers associated with the target port, using the processing methods of memory address and register address, the statistical information storage of message type and message length is optimized, and the use of registers is reduced quantity.
It effectively reduces the area occupied in chip design, saves resources, and improves resource utilization.
Smart Images

Figure CN118890325A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of network chips and relates to an information statistics method for a MAC management information base, and in particular to an information statistics method, device, medium and electronic device for a MAC management information base. Background Art
[0002] In a multi-port Ethernet network chip, the MAC of each port will count the message after sending or receiving a message to facilitate the analysis of problems and phenomena. When counting messages, the message type and message length are generally counted, and the number of messages and bytes under these two categories also need to be counted. The message count counter and byte count counter each require 64 bits. Assuming that 10 message types and 5 message lengths are counted for a port, that is, each message type and message length needs to be counted for the number of messages and bytes, then a port requires registers 10*(64+64)+5*(64+64). Then in a multi-port switching chip, the more ports and message types there are, the more register resources are required. This will take up a lot of area in chip design. Summary of the invention
[0003] The purpose of the present application is to provide a method, device, medium and electronic device for counting information of a MAC management information base, so as to solve the problem that a large amount of area is occupied in chip design in current multi-port information storage.
[0004] In a first aspect, the present application provides an information statistics method for a MAC management information base, which is applied to a chip message statistics information scheduling system, and the scheduling method includes: obtaining a target port message and a target port number; based on the length of the target port message, a preset message type and a preset message length segment, storing the first statistical information, the second statistical information and the third statistical information of the target port message in a first memory, a second memory and a first register associated with the target port, respectively; processing the address of the first memory, the address of the second memory, the target port number, the preset message type and the preset message length segment to obtain the address of the first statistical information and the address of the second statistical information; based on the address of the first statistical information and the address of the second statistical information, obtaining the first statistical information and the second statistical information.
[0005] In the information statistics method, by storing the first statistical information, the second statistical information and the third statistical information respectively in the first memory, the second memory and the first register associated with the target port, the area occupied in the chip design can be reduced, thereby saving resources.
[0006] In one embodiment of the present application, the target port includes a sending side and a receiving side. Based on the length of the target port message, the preset message type and the preset message length segmentation, the first statistical information, the second statistical information and the third statistical information of the target port message are stored in the first memory, the second memory and the register associated with the target port respectively. The implementation method includes: if the length of the sending side message is less than the minimum message length in the preset message length, the third statistical information of the sending side message is stored in the first register associated with the sending side, otherwise the first statistical information and the second statistical information of the sending side message are stored in the first memory and the second memory respectively; if the length of the receiving side message is less than the minimum message length in the preset message length, the third statistical information of the receiving side message is stored in the first register associated with the receiving side, otherwise the first statistical information and the second statistical information of the receiving side message are stored in the first memory and the second memory respectively.
[0007] In one embodiment of the present application, an implementation method for storing the first statistical information and the second statistical information of the sending side message in the first memory and the second memory, respectively, includes: storing the first statistical information and the second statistical information of the sending side message in the queue associated with the sending side; when the queue associated with the sending side is scheduled, storing the first statistical information and the second statistical information of the sending side message read from the queue associated with the sending side in the total queue; when the total queue is not empty, based on the sending side message type, the length of the sending side message, the sending side port number, the preset message type and the preset message length segmentation, storing the first statistical information and the second statistical information of the sending side message read from the total queue in the first memory and the second memory, respectively.
[0008] In one embodiment of the present application, the first memory supports system bus read, system bus clear read, logical read and logical write, and the completion of the system bus read, the system bus clear read, the logical read and the logical write takes a total of three time slots, expressed as: stage 0 -> stage 1 -> stage 2 -> stage 0.
[0009] In one embodiment of the present application, when the total queue is not empty, based on the sending side message type and the sending side port number, the implementation method of storing the first statistical information of the sending side message read from the total queue in the first memory includes: when the total queue is not empty, reading the total queue in the current stage 1 to obtain the read total queue data; reading the first memory in the current stage 2 to obtain the read statistical information in the next stage 0; based on the read total queue data, the read statistical information, the sending side message type, the sending side port number and the preset message type, writing back the updated first statistical information of the sending side message to the first memory in the next stage 1.
[0010] In one embodiment of the present application, an implementation method for obtaining the first statistical information based on the address of the first statistical information includes: based on the first address associated with the first statistical information, latching the first statistical information read from the first memory in a second register, and obtaining statistical information of a first segment of preset bits of the first statistical information; based on the second address associated with the first statistical information, obtaining statistical information of a second segment of preset bits of the first statistical information, the statistical information of the second segment of preset bits being the statistical information in the second register; based on the third address associated with the first statistical information, obtaining statistical information of a third segment of preset bits of the first statistical information, the statistical information of the third segment of preset bits being the statistical information in the second register; based on the fourth address associated with the first statistical information, obtaining statistical information of a fourth segment of preset bits of the first statistical information, the statistical information of the fourth segment of preset bits being the statistical information in the second register.
[0011] In one embodiment of the present application, the address of the first statistical information is represented as:
[0012] address1=((ram_address+port_offset+type_item_offset_1)<<2)+MAC_BASE
[0013] Wherein, address1 represents the address of the first statistical information, ram_address represents the address of the first memory, port_offset represents the offset associated with the target port number and the preset message type, type_item_offset_1 represents the offset associated with the preset message type, and MAC_BASE represents the MAC start address associated with the target port;
[0014] address2=((pkt_length_block_base+pkt_length_port_offset+type_item_offset_2)<<2)+MAC_BASE
[0015] Among them, address2 represents the address of the second statistical information, pkt_length_block_base represents the address of the second memory, pkt_length_port_offset represents the offset associated with the target port number and the preset message length segment, and type_item_offset_2 represents the offset associated with the preset message length segment.
[0016] In a second aspect, the present application provides an information statistics device of a MAC management information base, which is applied to a chip message statistics information scheduling system, and the information statistics device includes: a message acquisition module, used to obtain a target port message and a target port number; an information storage module, used to store the first statistical information, the second statistical information and the third statistical information of the target port message in a first memory, a second memory and a first register associated with the target port, respectively, based on the length of the target port message, a preset message type and a preset message length segment; an address acquisition module, used to process the address of the first memory, the address of the second memory, the target port number, the preset message type and the preset message length segment to obtain the address of the first statistical information and the address of the second statistical information; a statistical information acquisition module, used to obtain the first statistical information and the second statistical information based on the address of the first statistical information and the address of the second statistical information.
[0017] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the information statistics method described in any one of the first aspects of the present application.
[0018] In a fourth aspect, the present application provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing the information statistics method described in any one of the first aspects of the present application when the computer program is called.
[0019] As described above, the information statistics method, device, medium and electronic device of the MAC management information base of the present application have the following beneficial effects:
[0020] In the information statistics method, by storing the first statistical information, the second statistical information and the third statistical information respectively in the first memory, the second memory and the first register associated with the target port, the area occupied in the chip design can be reduced, thereby saving resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 Shown is a structural diagram of the chip message statistical information scheduling system of an embodiment of the present application.
[0022] Figure 2 Shown is a flow chart of the information statistics method described in an embodiment of the present application.
[0023] Figure 3 Shown is a flowchart of an implementation method of the present application embodiment of storing the first statistical information, the second statistical information and the third statistical information of the target port message in the first memory, the second memory and the register associated with the target port respectively.
[0024] Figure 4 Shown is a flowchart of an implementation method of the present application for storing the first statistical information and the second statistical information of the sending side message in the first memory and the second memory respectively.
[0025] Figure 5 Shown is a schematic diagram of time slot allocation according to an embodiment of the present application.
[0026] Figure 6 Shown is a flowchart of an implementation method of storing the first statistical information of the sending side message read from the total queue in the first memory in an embodiment of the present application.
[0027] Figure 7 Shown is a flowchart of an implementation method of obtaining the first statistical information based on the address of the first statistical information in an embodiment of the present application.
[0028] Figure 8 Shown is a schematic diagram of the CPU access chip message statistics information in the information statistics method described in an embodiment of the present application.
[0029] Fig. 9 Shown is a schematic diagram of the structure of an information statistics device for a MAC management information base according to an embodiment of the present application.
[0030] Component number description
[0031] 10Chip message statistics information scheduling system
[0032] System
[0033] 110 cpu
[0034] 120 System access bus
[0035] 130 Chip
[0036] 1310 Queue associated with the receiving side
[0037] 1320 The first register associated with the receiving side
[0038] 1330 Queue associated with the sender
[0039] 1340 The first register associated with the sending side
[0040] 1350 Total Queue
[0041] 1360 First Address Translation Unit
[0042] 1370 Second Address Translation Unit
[0043] 1380 First Memory
[0044] 1390 Second Memory
[0045] 900 MAC Management Information Base Information Statistics
[0046] Meter Device
[0047] 910 Message acquisition module
[0048] 920 Information storage module
[0049] 930 Address acquisition module
[0050] 940 Statistics Information Acquisition Module
[0051] Steps S11-S14
[0052] Steps S21-S22
[0053] Steps S31-S33
[0054] Steps S41-S43
[0055] Steps S51-S54 DETAILED DESCRIPTION
[0056] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0057] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present application in a schematic manner, and therefore the illustrations only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0058] The technical solutions in the embodiments of the present application are described in detail below in conjunction with the drawings in the embodiments of the present application.
[0059] The information statistics method of the MAC management information base provided in the embodiment of the present application can be run in the chip message statistics information scheduling system. Figure 1 For example, the chip message statistics information scheduling system 10 includes: CPU 110, network chip 130 and system bus 120 connecting the CPU and the network chip. The network chip 130 may be a multi-port Ethernet network chip.
[0060] Optionally, the network chip 130 may include queues 1310 associated with the receiving side of several chip ports, a first register 1320 associated with the receiving side, a queue 1330 associated with the sending side, a first register 1340 associated with the sending side, a total queue 1350, a first address translation unit 1360, a second address translation unit 1370, a first memory 1380, and a second memory 1390. The structure of the network chip is used to implement the reading and writing of message statistical information in the first memory 1380 and the second memory 1390, and can implement polling scheduling of statistical information in the multi-port sending side and receiving side queues.
[0061] Optionally, Figure 1 Each MAC corresponds to a chip port, for example, MAC0 corresponds to port 0, MAC0RX corresponds to the receiving side of port 0, and MAC0TX corresponds to the transmitting side of port 0.
[0062] like Figure 2 As shown, this embodiment provides an information statistics method for a MAC management information base, which can be implemented by a chip message statistics information scheduling system. The information statistics method includes:
[0063] S11, obtain the target port message and the target port number.
[0064] Optionally, the target port includes a sending side and a receiving side, and the target port message may include messages from the sending side and the receiving side of the target port. The target port number is the port number of the target port. The target port refers to the port of the message to be counted, and the port in the chip can be set as the target port according to actual conditions.
[0065] S12, based on the length of the target port message, the preset message type and the preset message length segment, the first statistical information, the second statistical information and the third statistical information of the target port message are respectively stored in the first memory, the second memory and the first register associated with the target port.
[0066] Optionally, the preset message types may include: “Rx_Unicasts”, i.e. unicast on the receiving side, “Rx_Multicasts”, i.e. multicast on the receiving side, “Rx_Broadcasts”, i.e. broadcast on the receiving side, “Rx_Pause”, i.e. flow control on the receiving side, “Rx_Control_Frame”, i.e. control frame on the receiving side, “Rx_CRC_ERROR”, i.e. cyclic redundancy check error on the receiving side, “Rx_MII_ProtocalErr”, i.e. MII interface protocol error on the receiving side, “Tx_Unicasts”, i.e. unicast on the sending side, “Tx_Multicasts”, i.e. multicast on the sending side, “Tx_Broadcasts”, i.e. broadcast on the sending side, “Tx_Pause”, i.e. flow control frame on the sending side, “Tx_Control_Frame”, i.e. control frame on the sending side, “Tx_Err_Frame”, i.e. cyclic redundancy check error on the sending side, and “Tx_Drop_Frame”, i.e. frame discarded on the sending side.
[0067] Optionally, the preset message length segment may refer to several different message length segments divided according to the preset message length, and the preset message length segment may include: "Rx_64B" i.e. 64 bytes on the receiving side, "Rx_65_127B" i.e. 65-127 bytes on the receiving side, "Rx_128_255B" i.e. 128-255 bytes on the receiving side, "Rx_256_511B" i.e. 256-511 bytes on the receiving side, "Rx_512_1023B" means 512-1023 bytes on the receiving side, "Tx_64B" means 64 bytes on the sending side, "Tx_65_127B" means 65-127 bytes on the sending side, "Tx_128_255B" means 128-255 bytes on the sending side, "Tx_256_511B" means 256-511 bytes on the sending side, and "Tx_512_1023B" means 512-1023 bytes on the sending side. The preset message length segment can be flexibly set according to actual conditions, and this embodiment does not explicitly limit this.
[0068] Optionally, the first statistical information may be statistical information associated with the target port message type, specifically statistical information of the target port message under the preset message type, for example, including statistical information of the target port message under Rx_Unicasts, statistical information under Rx_Multicasts, etc. The second statistical information may be statistical information associated with the length of the target port message, specifically statistical information of the target port message under the preset message length segment, for example, including statistical information of the target port message under Rx_64B, statistical information under Rx_65_127B, etc. The third statistical information may refer to statistical information associated with the target port message type and statistical information associated with the target port message length type when the length of the target port message is less than the preset message length. The statistical information of the target port message may include the number of messages and the number of bytes contained in the target port message. The target port message may include multiple messages, one message may be regarded as a data packet, the number of messages may refer to the number of data packets, the message length of a message may refer to the number of bytes contained in the message, and the number of bytes contained in the target port message may refer to the sum of the number of bytes of all messages contained in the target port message.
[0069] Optionally, the first register may include several registers, for example, the first register includes a register associated with the sending side of the target port and a register associated with the receiving side of the target port.
[0070] Optionally, the first memory and the second memory may be two memories divided from one memory.
[0071] S13, segmentally process the address of the first memory, the address of the second memory, the target port number, the preset message type and the preset message length to obtain the address of the first statistical information and the address of the second statistical information.
[0072] Optionally, if the target port supports n statistical items on the receiving side and m statistical items on the sending side according to the message type, then the port supports n+m statistical items, each statistical item occupies an address of the first memory, and the RAM size for storing message type statistics is (M+N)×(m+n)×(64+64) bits. The preset message type of the target port can be as follows
[0073] As shown in Table 1:
[0074]
[0075]
[0076] Table 1
[0077] Optionally, if the target port supports i statistical items on the receiving side and j statistical items on the sending side according to the message length, then the port supports i+j statistical items, each statistical item occupies an address of the second memory, and the RAM size for storing message length statistics is (M+N)×(i+j)×(64+64) bits. The preset message length segmentation of the target port can be shown in Table 2 below:
[0078]
[0079] Table 2
[0080] Optionally, the address of the first statistical information is expressed as:
[0081] address1=((ram_address+port_offset+type_item_offset_1)<<2)+MAC_BASE
[0082] Among them, address1 represents the address of the first statistical information, ram_address represents the address of the first memory, port_offset represents the offset associated with the target port number and the preset message type, type_item_offset_1 represents the type offset associated with the preset message type, and MAC_BASE represents the MAC starting address associated with the target port.
[0083] address2=((pkt_length_block_base+pkt_length_port_offset+type_item_offset_2)<<2)+MAC_BASE
[0084] Among them, address2 represents the address of the second statistical information, pkt_length_block_base represents the address of the second memory, pkt_length_port_offset represents the offset associated with the target port number and the preset message length segment, and type_item_offset_2 represents the offset associated with the preset message length segment. Since the statistical information of each preset message length segment is different, the address when storing the statistical information under different preset message length segments in the memory requires a certain offset, that is, the offset associated with the preset message length segment, the offset associated with the preset message type is the offset of the address when storing the statistical information under different message types in the memory, and the offset of the target port is the offset when storing the statistical information of different ports in the memory, which will not be repeated in this embodiment.
[0085] Optionally, port_offset = port × (MAX_MAC_MIB_TYPE_ITEM × ENTRY_SIZE)
[0086] Among them, port can represent the target port number, MAX_MAC_MIB_TYPE_ITEM can represent the number of the preset message types, ENTRY_SIZE represents 4 LWs (Load Words), that is, 16 bytes, the value of MAX_MAC_MIB_TYPE_ITEM in this embodiment can be 14, and the value of ENTRY_SIZE in this embodiment can be 4.
[0087] Optionally, type_item_offset_1 = item1 × ENTRY_SIZE
[0088] Among them, item 1 can represent the order of each message type in the preset message type, for example, item 1 of Rx_Unicasts can be 1, item 2 of Rx_Multicasts can be 2, and so on, which will not be described in detail in this embodiment.
[0089] Optionally, pkt_length_block_base=ram_address+(MAX_MAC_PORT×MAX_MAC_MIB_TYPE_ITEM×ENTRY_SIZE)
[0090] Among them, MAX_MAC_PORT can represent the number of the target ports in the chip. For example, the chip may include 5 target ports, and MAX_MAC_PORT is 5.
[0091] Optionally, pkt_length_port_offset = port × MAX_MAC_MIB_LENGTH_ITEM × ENTRY_SIZE
[0092] Among them, MAX_MAC_MIB_LENGTH_ITEM represents the number of the preset message length segments, and MAX_MAC_MIB_LENGTH_ITEM can be 10 in this embodiment.
[0093] Optionally, type_item_offset_2 = item2 × ENTRY_SIZE
[0094] Among them, item2 can represent the order of each message length segment in the preset message length segment. For example, item2 of Rx_64B can be 1, item2 of Rx_65_127B can be 2, and so on. This embodiment will not be repeated here.
[0095] S14: Based on the address of the first statistical information and the address of the second statistical information, obtain the first statistical information and the second statistical information.
[0096] Optionally, based on the address of the first statistical information and the address of the second statistical information, the process of obtaining the first statistical information and the second statistical information can be executed by the CPU.
[0097] Optionally, according to the address of the first statistical information and the address of the second statistical information, the first statistical information and the second statistical information can be accessed in the first memory and the second memory according to the system bus to obtain the first statistical information and the second statistical information, which will not be elaborated in this embodiment.
[0098] According to the above description, the information statistics method described in this embodiment includes: obtaining a target port message and a target port number; based on the length of the target port message, a preset message type and a preset message length segment, storing the first statistical information, the second statistical information and the third statistical information of the target port message in a first memory, a second memory and a first register associated with the target port, respectively; processing the address of the first memory, the address of the second memory, the target port number, the preset message type and the preset message length segment to obtain the address of the first statistical information and the address of the second statistical information; based on the address of the first statistical information and the address of the second statistical information, obtaining the first statistical information and the second statistical information.
[0099] In the information statistics method, by storing the first statistical information, the second statistical information and the third statistical information respectively in the first memory, the second memory and the first register associated with the target port to implement the scheduling of chip message statistical information, the area occupied in the chip design can be reduced, thereby saving resources.
[0100] like Figure 3 As shown, this embodiment provides a method for implementing the segmentation based on the length, preset message type and preset message length of the target port message, storing the first statistical information, the second statistical information and the third statistical information of the target port message in the first memory, the second memory and the register associated with the target port respectively, including:
[0101] S21, if the length of the sending side message is less than the minimum message length in the preset message length, the third statistical information of the sending side message is stored in the first register associated with the sending side; otherwise, the first statistical information and the second statistical information of the sending side message are stored in the first memory and the second memory respectively.
[0102] Optionally, the minimum message length in the preset message length can be flexibly set according to actual conditions, and the present embodiment does not clearly limit this. In the present embodiment, the minimum message length in the preset message length is 64 bytes, i.e. 64 bytes. For messages with a message length less than 64 bytes, it can be regarded as an ultra-short packet. When multiple ports all use a memory at the same time, the access bandwidth of the memory determines how many ports can be hung at most. The frequency of ultra-short packets accessing the memory will be greater than the maximum bandwidth, and the continuous operation of the ultra-short packets on the memory will occupy the bandwidth of other normal ports accessing the memory, causing normal message information to be lost without time to be stored. In order not to affect the statistical information of normal messages, its statistical information is placed separately in the register resources, and only messages with a length greater than or equal to 64 bytes are counted in the memory resources.
[0103] S22: If the length of the receiving side message is less than the minimum message length in the preset message length, the third statistical information of the receiving side message is stored in the first register associated with the receiving side; otherwise, the first statistical information and the second statistical information of the receiving side message are stored in the first memory and the second memory respectively.
[0104] like Figure 4 As shown, this embodiment provides an implementation method for storing the first statistical information and the second statistical information of the sending side message in the first memory and the second memory respectively, including:
[0105] S31, storing the first statistical information and the second statistical information of the sending side message in a queue associated with the sending side.
[0106] Optionally, the queue associated with the sending side may refer to a queue set on the sending side, and the queue may be a fifo with a depth of 3. The queue may be used to store an 8-bit ID signal and a 16-bit message length, and the ID signal is used to identify the message type.
[0107] S32: When the queue associated with the sending side is scheduled, the first statistical information and the second statistical information of the sending side message read from the queue associated with the sending side are stored in the total queue.
[0108] Optionally, the scheduling method of the queue associated with the sending side can be a calander+RR scheduling method, which is a scheduling method combining calendar scheduling and polling scheduling. Similarly, the scheduling method of the queue associated with the receiving side is similar to the scheduling method of the queue associated with the sending side, which will not be described in detail in this embodiment. The total queue can be represented as SFIFO.
[0109] S33, when the total queue is not empty, based on the sending side message type, the length of the sending side message, the sending side port number, the preset message type and the preset message length segmentation, the first statistical information and the second statistical information of the sending side message read from the total queue are stored in the first memory and the second memory respectively.
[0110] Optionally, based on the sending side message type, the length of the sending side message, the sending side port number, the preset message type and the preset message length segment, the implementation method of storing the first statistical information and the second statistical information of the sending side message read in the total queue in the first memory and the second memory respectively includes: performing a first address conversion process on the sending side message type and the sending side port number based on the preset message type to obtain the address of the first statistical information in the first memory; performing a second address conversion process on the length of the sending side message and the sending side port number based on the preset message length segment to obtain the address of the second statistical information in the second memory; according to the address of the first statistical information in the first memory and the address of the second statistical information in the second memory, the first statistical information and the second statistical information of the sending side message are stored in the first memory and the second memory respectively. The first address conversion process can be completed by the first address conversion unit, and the second address conversion process can be completed by the second address conversion unit. The first address conversion process may refer to a process of calculating the address1 mentioned above, and the second address conversion process may refer to a process of calculating the address2 mentioned above, which will not be described in detail in this embodiment.
[0111] Optionally, the first memory and the second memory support system bus read, system bus clear read, logic read and logic write, and the system bus read, system bus clear read, logic read and logic write are completed through three time slots, which are expressed as: stage 0->stage 1->stage 2->stage 0. Figure 5 , Figure 5 A schematic diagram showing the time slot allocation is shown. Figure 5apb_read_req in it represents bus read request, cpu_mem_rd represents the read interface signal of CPU accessing memory, cpu_rd_dat_vld represents the read return valid indication signal when CPU accesses memory, cpu_mem_wr_clear represents the flag that the address content needs to be cleared to 0 after CPU accesses memory, cpu_mem_wr_dat represents the data of write clear operation; logic_req represents the request signal of hardware logic to access memory, logic_rd represents the read interface signal from hardware logic to memory, logic_rd_dat_vld represents the read return valid indication signal when hardware logic accesses memory, and logic_wr represents the indication signal of hardware logic writing memory.
[0112] Optionally, the logic write may refer to the operation of the hardware circuit writing updated statistical information into the memory, and the logic read may refer to the operation of the hardware circuit reading statistical information from the memory. The system bus read may refer to the system bus reading data from the memory, and the system bus clear read may refer to that if the system bus is set to read clear, then after the system bus reads the address in the memory, the data stored in the address will be cleared to 0 by the hardware.
[0113] Optionally, the first register supports any system bus read operation, write clear operation, read clear operation or logical read and write operation. The first memory and the second memory support the read and read clear functions of the system bus, do not support the write operation of the system bus, support logical read and write operations, and must read before writing.
[0114] Optionally, the chip message statistics information scheduling system supports the configurable clear read function of the system bus. If the clear read function is used, the data is written back in stage 2, and the write-back value is 0. If the clear read function is not used, the address value in the memory is maintained after each system read operation. It should be noted that the write-back here is not a write operation generated by the system bus operation.
[0115] Optionally, the chip message statistics information scheduling system supports initialization of all addresses in the first memory and the second memory. If this signal is configured, all addresses in the first memory and the second memory will be written to 0, and the first register storage will be written to 0.
[0116] Optionally, the implementation process of storing the first statistical information and the second statistical information of the receiving side message in the first memory and the second memory respectively is basically the same as the implementation process of storing the first statistical information and the second statistical information of the sending side message in the first memory and the second memory respectively. The only difference is that the sending side and the receiving side are different, and this embodiment will not go into details.
[0117] like Figure 6 As shown, this embodiment provides a method for implementing the first statistical information of the sending side message read from the total queue and stored in the first memory, including:
[0118] S41, when the total queue is not empty, reading the total queue in the current stage 1 to obtain the read total queue data.
[0119] Optionally, the read total queue data includes first statistical information of the sending side message.
[0120] S42, reading the first memory in the current stage 2 to obtain read statistics information in the next stage 0.
[0121] S43, based on the read total queue data, the read statistical information, the sending side message type, the sending side port number and the preset message type, write back the updated first statistical information of the sending side message to the first memory in the next stage 1.
[0122] Optionally, the implementation method of storing the second statistical information of the sending side message read from the total queue in the second memory includes: when the total queue is not empty, reading the total queue in the current stage 1 to obtain the read total queue data; reading the second memory in the current stage 2 to obtain the read statistical information in the next stage 0; based on the read total queue data, the read statistical information, the length of the sending side message, the sending side port number and the preset message length segment, writing back the updated second statistical information of the sending side message to the second memory in the next stage 1. This embodiment will not be repeated in detail.
[0123] Optionally, each address in the first memory can store 128 bits, including a 64-bit message count and a 64-bit byte count. For a system bus with a bit width of 32 bits, reading an address once requires returning data four times, 32 bits each time, so each address of the first memory corresponds to a 16-byte address of the system bus. In implementation, the system bus must align the address with 16 bytes when accessing the memory, that is, each time an address that is a multiple of 16 must be accessed, and addresses of 0, 16, 32, 48, 64... will be converted into memory addresses of 0, 1, 2, 3, 4 at the entry of the memory.
[0124] like Figure 7 As shown, this embodiment provides a method for obtaining the first statistical information based on the address of the first statistical information, including:
[0125] S51, based on a first address associated with the first statistical information, latching the first statistical information read from the first memory in a second register, and obtaining statistical information of a first segment of preset bits of the first statistical information.
[0126] Optionally, the first address may be the address of the first statistical information, expressed as 16ptr, i.e., a 16-bit pointer. The preset bit is related to the bit width of the system bus and may be flexibly set according to actual conditions, which is not explicitly limited in this embodiment. The preset bit may be 32 bits, and the statistical information of the first segment of preset bits may be the statistical information of the lower 32 bits of the first statistical information. The second register and the first register are only used to represent two different registers.
[0127] S52: Based on a second address associated with the first statistical information, obtain statistical information of a second segment of preset bits of the first statistical information, where the statistical information of the second segment of preset bits is the statistical information in the second register.
[0128] Optionally, the second address may be represented as an address of 16ptr+4. The second segment of statistical information of preset bits may refer to the second 32-bit statistical information in the first statistical information.
[0129] S53: Based on a third address associated with the first statistical information, obtain statistical information of a third segment of preset bits of the first statistical information, where the statistical information of the third segment of preset bits is the statistical information in the second register.
[0130] Optionally, the third address may be represented as an address of 16ptr+8. The third segment of statistical information of preset bits may refer to the third 32-bit statistical information in the first statistical information.
[0131] S54: Based on a fourth address associated with the first statistical information, obtain statistical information of a fourth segment of preset bits of the first statistical information, where the statistical information of the fourth segment of preset bits is the statistical information in the second register.
[0132] Optionally, the fourth address may be represented as an address of 16ptr+12. The fourth segment of statistical information of preset bits may refer to the fourth 32-bit statistical information in the first statistical information.
[0133] Optionally, the principle of the implementation method for obtaining the second statistical information based on the address of the second statistical information is basically the same as the principle of the implementation method for obtaining the first statistical information based on the address of the first statistical information. The first statistical information is replaced with the second statistical information, and the first memory is replaced with the second memory. To save space in the specification, this embodiment will not go into details.
[0134] Optionally, when the number of the chip ports is large, resulting in insufficient memory read and write bandwidth, the ports of the chip may be grouped, and each group may include the first memory, the second memory and the first register.
[0135] In the embodiment of the present application, for ultra-short packets with a message length less than 64 bytes, the frequency of accessing the memory will be greater than the maximum bandwidth, and the continuous operation of the ultra-short packets on the memory will occupy the bandwidth of other normal ports to access the memory, resulting in the normal message information being lost because it has no time to be stored. In order not to affect the statistical information of normal messages, the statistical information will be placed separately in the register resources. Only messages with a length greater than or equal to 64 bytes will be counted in the memory resources.
[0136] Assume that the maximum rate supported by all ports is 1Gbps, the protocol stipulates that IPG is 12 bytes and preamble is 8 bytes. This design supports the case where both IPG and preamble are smaller than the protocol. Assume that the minimum supported IPG+preamble is 12 bytes, the minimum packet length is 64 bytes, the clock frequency is 125MHZ, and 1 byte is processed per cycle. There is one message in each direction every 76 cycles, and each message is counted by message type and byte number at the same time. Each statistics occupies one read operation and one write operation of the memory. Each 1G port will access the memory once every 76 cycles. The statistical value is placed in the memory, and it must support the system bus to read at any time, and also support the clear operation (the system bus writes 0 to the address). In order to hang as many ports as possible on a piece of memory, the memory can use 1r1w dual-port RAM. In every 3 cycles, two cycles are used for logical read and logical write, and one cycle is used for CPU access. That is, one statistics requires 3 clock cycles. Then the memory access bandwidth for statistics is 1s / 24ns=41.7M times / s. For a 1G port, the maximum number of messages in 1 second is 1Gbit / (76×8)=1.64M / s. If the statistics of TX and RX are placed in a RAM, the maximum number of 1G ports that can be connected to a RAM is M=41.7 / 1.64 / 2=12.6.
[0137] Assuming that the maximum rate supported by all ports is 2.5Gbps, the minimum message length of RX and TX is 76Bytes, and the clock frequency is 125MHZ, then the maximum number of 2.5G ports that can be connected to a RAM is N = 41.7 / 4.11 / 2 = 5.
[0138] For a system that mixes 1G and 2.5G, a 1R1W Memory read and write bandwidth can accommodate M 1G MACs and N 2.5G MACs, and 1.64M+4.11N<41.7 / 2.
[0139] In one embodiment of the present application, please refer to Figure 8 , Figure 8 It represents the process of CPU accessing chip message statistics information in the scheduling method described in this embodiment, and the specific embodiment will not be repeated here.
[0140] In one embodiment of the present application, the information statistics method of the MAC management system library can be illustrated by the following procedure:
[0141]
[0142]
[0143]
[0144] The protection scope of the information statistics method described in the embodiment of the present application is not limited to the execution order of the steps listed in the present embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present application are included in the protection scope of the present application.
[0145] like Fig. 9 As shown, this embodiment provides an information statistics device 900, which is applied to a chip message statistics information scheduling system, and the information statistics device includes:
[0146] The message acquisition module 910 is used to acquire the target port message and the target port number.
[0147] The information storage module 920 is used to store the first statistical information, the second statistical information and the third statistical information of the target port message in the first memory, the second memory and the first register associated with the target port respectively based on the length of the target port message, the preset message type and the preset message length segment.
[0148] The address acquisition module 930 is used to process the address of the first memory, the address of the second memory, the target port number, the preset message type and the preset message length segment to obtain the address of the first statistical information and the address of the second statistical information.
[0149] The statistical information acquisition module 940 is used to acquire the first statistical information and the second statistical information based on the address of the first statistical information and the address of the second statistical information.
[0150] In the MAC management information base information statistics device 900 provided in this embodiment, the message acquisition module 910 and Figure 2 The information storage module 920 corresponds to step S11 of the scheduling method shown in FIG. Figure 2 The address acquisition module 930 corresponds to step S12 of the scheduling method shown in FIG. Figure 2 The scheduling method shown in step S13 corresponds to the statistical information acquisition module 940. Figure 2 This corresponds to step S14 of the scheduling method shown.
[0151] In the several embodiments provided in the present application, it should be understood that the disclosed device or method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.
[0152] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present application. For example, the functional modules / units in the various embodiments of the present application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0153] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0154] This embodiment provides an electronic device, the electronic device comprising a memory storing a computer program; a processor connected to the memory for communication, and executing the computer program when the computer program is called. Figure 2 The information statistics method shown.
[0155] The present application embodiment also provides a computer-readable storage medium. A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above embodiment can be completed by a program to instruct the processor, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state hard disk (SSD)), etc.
[0156] The present application embodiment may also provide a computer program product, the computer program product including one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer or data center.
[0157] When the computer program product is executed by a computer, the computer executes the method described in the above method embodiment. The computer program product may be a software installation package, and when the above method is required, the computer program product may be downloaded and executed on a computer.
[0158] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.
[0159] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A method for collecting information of a MAC management information base, characterized in that: Applied to a chip message statistics information scheduling system, the information statistics method includes: Get the target port message and target port number; Based on the length of the target port message, the preset message type and the preset message length segmentation, the first statistical information, the second statistical information and the third statistical information of the target port message are stored in the first memory, the second memory and the first register associated with the target port respectively; Processing the address of the first memory, the address of the second memory, the target port number, the preset message type, and the preset message length segmentally to obtain the address of the first statistical information and the address of the second statistical information; Based on the address of the first statistical information and the address of the second statistical information, the first statistical information and the second statistical information are obtained.
2. The information statistics method according to claim 1, characterized in that: The target port includes a sending side and a receiving side. Based on the length of the target port message, the preset message type and the preset message length segmentation, the implementation method of storing the first statistical information, the second statistical information and the third statistical information of the target port message in the first memory, the second memory and the register associated with the target port respectively includes: If the length of the sending side message is less than the minimum message length in the preset message length, the third statistical information of the sending side message is stored in the first register associated with the sending side, otherwise the first statistical information and the second statistical information of the sending side message are stored in the first memory and the second memory respectively; If the length of the receiving side message is less than the minimum message length in the preset message length, the third statistical information of the receiving side message is stored in the first register associated with the receiving side; otherwise, the first statistical information and the second statistical information of the receiving side message are stored in the first memory and the second memory respectively.
3. The information statistics method according to claim 2, characterized in that: The implementation method of storing the first statistical information and the second statistical information of the sending side message in the first memory and the second memory respectively includes: storing the first statistical information and the second statistical information of the sending side message in a queue associated with the sending side; When the queue associated with the sending side is scheduled, the first statistical information and the second statistical information of the sending side message read from the queue associated with the sending side are stored in the total queue; When the total queue is not empty, based on the sending side message type, the length of the sending side message, the sending side port number, the preset message type and the preset message length segmentation, the first statistical information and the second statistical information of the sending side message read from the total queue are stored in the first memory and the second memory respectively.
4. The information statistics method according to claim 3, characterized in that: The first memory supports system bus read, system bus clear read, logical read and logical write. The system bus read, system bus clear read, logical read and logical write are completed through three time slots, which are expressed as: stage 0->stage 1->stage 2->stage 0.
5. The information statistics method according to claim 4, characterized in that: When the total queue is not empty, based on the sending side message type and the sending side port number, the implementation method of storing the first statistical information of the sending side message read from the total queue in the first memory includes: When the total queue is not empty, reading the total queue in the current stage 1 to obtain the read total queue data; Reading the first memory in the current stage 2 to obtain the read statistics in the next stage 0; Based on the read total queue data, the read statistical information, the sending side message type, the sending side port number and the preset message type, the updated first statistical information of the sending side message is written back to the first memory in the next stage 1.
6. The information statistics method according to claim 1, characterized in that: The implementation method for acquiring the first statistical information based on the address of the first statistical information includes: Based on a first address associated with the first statistical information, latching the first statistical information read from the first memory in a second register, and acquiring statistical information of a first segment of preset bits of the first statistical information; Based on a second address associated with the first statistical information, obtain statistical information of a second segment of preset bits of the first statistical information, where the statistical information of the second segment of preset bits is the statistical information in the second register; Based on a third address associated with the first statistical information, obtain statistical information of a third segment of preset bits of the first statistical information, where the statistical information of the third segment of preset bits is the statistical information in the second register; Based on a fourth address associated with the first statistical information, statistical information of a fourth segment of preset bits of the first statistical information is obtained, where the statistical information of the fourth segment of preset bits is the statistical information in the second register.
7. The information statistics method according to claim 1, characterized in that: The address of the first statistical information is expressed as: address1=((ram_address+port_offset+type_item_offset_1)<<2)+MAC_BASE Wherein, address1 represents the address of the first statistical information, ram_address represents the address of the first memory, port_offset represents the offset associated with the target port number and the preset message type, type_item_offset_1 represents the offset associated with the preset message type, and MAC_BASE represents the MAC start address associated with the target port; address2=((pkt_length_block_base+pkt_length_port_offset+type_item_offset_2)<<2)+MAC_BASE Among them, address2 represents the address of the second statistical information, pkt_length_block_base represents the address of the second memory, pkt_length_port_offset represents the offset associated with the target port number and the preset message length segment, and type_item_offset_2 represents the offset associated with the preset message length segment.
8. An information statistics device for a MAC management information base, characterized in that: Applied to a chip message statistics information scheduling system, the information statistics device includes: A message acquisition module is used to obtain the target port message and the target port number; An information storage module, configured to store first statistical information, second statistical information, and third statistical information of the target port message in a first memory, a second memory, and a first register associated with the target port, respectively, based on the length of the target port message, a preset message type, and a preset message length segment; an address acquisition module, configured to process the address of the first memory, the address of the second memory, the target port number, the preset message type, and the preset message length segment to obtain the address of the first statistical information and the address of the second statistical information; The statistical information acquisition module is used to acquire the first statistical information and the second statistical information based on the address of the first statistical information and the address of the second statistical information.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the information statistics method described in any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: The electronic device comprises: A memory storing a computer program; A processor is communicatively connected to the memory and executes the information statistics method according to any one of claims 1 to 7 when calling the computer program.
Citation Information
Patent Citations
Method for allocating chip to stats
CN105389267A
Traffic statistics method and device, gateway equipment and storage medium
CN112565018A
Flow statistical method and device and electronic equipment
CN112994983A
Message transmission method, electronic device, and storage medium
WO2024114138A1
Cited By
Message reordering device and method, chip and electronic equipment
CN119484450A
Packet reordering apparatus and method, chip and electronic device
CN119484450B
