Management system and method for FPGA counter on front-end network shunting equipment

By introducing CSV configuration files and dynamic loading modules on the FPGA network shunt device, the coupling between the counter module and the functional module is disabled, flexible counter adjustment and rapid change is realized, and the adjustment and modification of the counter module in the prior art is solved. Complexity issues improve system flexibility and scalability.

CN119065736APending Publication Date: 2024-12-03SHANGHAI EMBEDWAY INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411062110.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

There is coupling between the counter module and the functional module in the existing FPGA network shunt device, which leads to the adjustment and modification of the counter module need to be recoded and compiled, which lacks flexibility and clipping, and the counter type attribute field is not flexible enough, making it difficult to quickly. Applied to changes in counter modules.

Method used

A management system for FPGA counters on front-end network shunt devices is designed, using CSV format configuration files to describe counter table items and counter attributes. The dynamic loading and cropping modules realizes flexible expansion and management of counters, providing counter table management and shared memory Storage, counter maintenance and external management interfaces support quick application of counter module changes through configuration files.

Benefits of technology

It realizes the decoupling of the counter module and the functional module, provides flexible and cropable counter adjustment, simplifies the expansion and maintenance of the counter module, improves the responsiveness and flexibility of the system, reduces the development complexity and cycle, and has good Universality and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065736A_ABST
    Figure CN119065736A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of FPGA (Field Programmable Gate Array) counters, in particular to a management system and method for an FPGA counter on front-end network shunting equipment, comprising a counter configuration file module which uses a configuration file in a CSV (Common Saturation Value) format and comprises a unified structure for describing all counter table entries required to be acquired and counters, the structure comprises a counter table item field; the dynamic loading and cutting module is responsible for reading the CSV configuration file during running, and flexible cutting and expansion of the counter are achieved through dynamic loading; the counter table management module comprises a counter table creating sub-module and a counter table management sub-module, wherein the counter table creating sub-module is used for receiving input of a CSV configuration file; b, a counter data assignment sub-module for assigning a dynamically created management structure; and the shared memory storage module is used for storing the counter information acquired from the FPGA by using a shared memory. The method has the advantages that the method has excellent universality and expandability, and the memory space used by the counter module is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of FPGA counter technology, and in particular to a management system and method for FPGA counters on a front-end network shunting device. Background Art

[0002] In the prior art, in a network splitter device using FPGA technology, the system is composed of multiple functional modules, each module is equipped with an independent counter table, and these tables are composed of multiple counters. Specifically, the system includes M functional modules, each module has T counter tables, and each table contains C counters. The value ranges of parameters M, T and C are 1 to 8, 1 to 8 and 10 to 256 respectively. The reading method of the counter is predefined, including six methods from R1 to R6.

[0003] The total number of counters in the FPGA device is M times T times C, and the number of independent counter tables is M times T. Each counter has a series of attributes, such as the counter name, the total number of packets received and transmitted, the total number of bytes, and the packet rate and byte rate.

[0004] Currently, the storage, management, and maintenance of counters are implemented through software, where each functional module is managed by an independent thread that handles the configuration of data table items, data access, and counter reading. In the entire system, there are M threads that manage their own counter tables. The existing software management lacks abstract design, and the implementation of counter threads is completely based on hard coding, which limits the flexibility of the system. When it is necessary to add, modify, or adjust the counter module, the software must be recoded and compiled to update the functional implementation of the counter. (See Figure 1 ) There is an urgent need to design a management system and method for FPGA counters on front-end network shunting devices, so as to release the coupling between counter modules and functional modules, and support flexible and customizable counter adjustments. In addition, a new counter type attribute field is added to provide better flexibility for upper-layer applications to obtain single or multiple counter tables, and an interface reload configuration file is provided to more quickly apply changes to counter modules. Summary of the invention

[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a management system and method for FPGA counters on a front-end network shunting device to release the coupling between the counter module and the functional module, realize flexible and customizable counter adjustment, add a counter type attribute field, and provide better flexibility for upper-layer applications to obtain single or multiple counter tables. At the same time, an interface overload configuration file is provided, which can be applied to changes in the counter module more quickly.

[0006] In order to achieve the above purpose, a management system for FPGA counters on a front-end network shunting device is designed, including: a counter configuration file module, the counter configuration file module uses a configuration file in CSV format, contains a unified structure describing all counter table items and counters that need to be obtained, the structure includes counter table item fields: table_id, table_name and table_mask, and counter fields: cnt_name, cnt_addr, cnt_offset, cnt_read_mode, cnt_reg_cnt_l, cnt_reg_cnt_h, cnt_module_id and cnt_module_type; a dynamic loading and cutting module, the dynamic loading and cutting module is responsible for reading the CSV configuration file at runtime, and dynamic loading realizes flexible cutting and expansion of counters; a counter table management module, the counter table management module includes a. counter table creation submodule: used to receive the input of the CSV configuration file, the first reading is used to calculate the number of counter table items and the number of valid counters, and dynamically create the counter table table_X and the counter management structure cnt_array; b. .Counter data assignment submodule: In the second reading, the dynamically created management structure is assigned according to table_id to complete the initialization of the counter management structure; shared memory storage module, using shared memory to store the counter information obtained from FPGA, including counter name, counter value and rate.

[0007] Preferably, the system described in the present invention also includes: a counter maintenance module, which uses threaded polling, including a. a module for reading and writing FPGA counter registers, which selects a specified module in the FPGA register and specifies the counter to be read, reads a 16-bit, 32-bit or 64-bit counter value according to the counter bit width, calculates the rate according to the read counter value, and writes the acquired data into the shared memory of the software management table item in a fixed format, and b. a counter adaptation module, which monitors the expansion or modification and update of the counter configuration file, and when an update of the configuration file is detected, re-establishes the software management table item, and writes the read counter value, rate and other information into the updated shared memory area.

[0008] Preferably, the system described in the present invention also includes a counter external management interface, which provides users with access to the counter interface in the shared memory, supports query and clear operations of counter table items, and simultaneously operates on a single or multiple counter table items through table_id, table_name and table_mask to obtain the counter information of the specified counter table item. The upper-level software can flexibly obtain the counter information in any counter table by mapping the shared memory.

[0009] Preferably, the system of the present invention also includes a shared memory dump module, which can intuitively display the counter table read during program execution, the organizational structure of the counter table, and the number of counters contained in each counter table to assist debugging and analysis.

[0010] The present invention also provides a management method for FPGA counters on a front-end network shunting device, comprising the following steps: S1. Introducing a csv configuration file for describing various types of counters that need to be read, supporting flexible cutting and expansion of counters through the csv configuration file, and the counter module can be quickly applied to a running program by overloading the configuration file; S2. Creating a counter table consisting of multiple counters, in the csv configuration file, the unified structure described for each counter table item has the fields: table_id, table_name and table_mask; the unified structure described for each counter has the fields: cnt_name, cnt_addr, cnt_offset, cnt_read_mode, cnt_reg_cnt_l, cnt_reg_cnt_h, cnt_module_id and cnt_module_type, by writing the information of the above fields of the FPGA counter in the configuration file, the FPGA counter can be added to the counter module managed by the software, and the modification and deletion of the counter only requires changing the csv configuration file.

[0011] Preferably, the method of the present invention also includes step S3. Constructing software table items of the counter, software management table items, which are used to store counter information obtained from the FPGA, and using shared memory to save data. When the configuration file is loaded, the counter configuration file will be read twice to construct the software table items of the counter. The specific method is as follows: the first reading will calculate the number of counter table items and the number of valid counters in each counter table item according to table_id. After the reading is completed, the counter table table_X and the counter management structure cnt_array are dynamically created, wherein table_X contains attribute information of the counter table, and cnt_array contains description information of all its counters. The second reading will find the dynamically created counter table management structure with table_id as the index, and assign values ​​to the data of table_X and cnt_array. After the management structure is initialized, it is no longer necessary to read the counter configuration file.

[0012] Preferably, the method described in the present invention also includes step S4. Counter maintenance step, which is divided into two parts: read and write FPGA counter register maintenance and counter adaptive maintenance. The read and write FPGA counter register maintenance is to select a module in the FPGA register, then select the counter to be read in a certain FPGA register, and then read the counter 16-bit, 32-bit or 64-bit value in the specified FPGA register according to the counter bit width, calculate the rate according to the read counter value, and write the acquired data into the shared memory of the software management table item in a fixed format; counter adaptive maintenance is used for the update of counter configuration file expansion or modification. When the counter maintenance module detects that the configuration file is updated, it will re-establish the software management table item, and then write the read counter value, rate and other information into the updated shared memory area.

[0013] Preferably, the method of the present invention also includes step S5. The user accesses the counter method in the shared memory, sets the counter external management interface, provides a query and clear interface for the counter table items, operates a single or multiple counter table items at a time through table_id, table_name and table_mask to obtain the counter information of the specified counter table item.

[0014] Preferably, the method of the present invention further comprises step S5. A method in which a user accesses a counter in a shared memory, and the upper layer software obtains counter information in any counter table by mapping the shared memory.

[0015] Compared with the prior art, the present invention has the following advantages: By introducing counter configuration files in CSV format, we are able to achieve a unified description of many different types of counters. This approach replaces the original solution in which each module was independently coded to achieve counter management and maintenance. Using CSV configuration files, modifications and updates to counter modules can be reflected instantly, improving the responsiveness and flexibility of the system. In addition, by using CSV files, the expansion of counter modules is natively supported, which not only simplifies the project development process, but also significantly reduces the complexity of development work. This design effectively shortens the development cycle, makes the system have good versatility and scalability, and provides convenience for possible changes in requirements or functional enhancements in the future. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 , is a schematic diagram of a counter table and a counter reading method in the prior art; Figure 2 , is a schematic diagram of initializing the counter module of the present invention; Figure 3 , is a schematic diagram of the management structure of the counter module of the present invention; Figure 4 , is a diagram of counter reading method R1~R6 according to an embodiment of the present invention. DETAILED DESCRIPTION

[0017] In order to make the purpose, principle and structure of the present invention more clear, it is further described below in conjunction with the drawings and specific embodiments.

[0018] The present invention provides a management system and method for an FPGA counter on a front-end network shunting device.

[0019] Counters are an important part of each functional module inside the FPGA. They are usually used to display the current status of each functional module of the FPGA, and provide an important basis for accurate debugging and diagnosis of module functions. It is for this reason that a large number of counters are usually designed in FPGA functional modules. According to the different FPGA functional modules, the same type of counters need to be divided into multiple counter sub-tables.

[0020] Usually, the reading method, data storage method and display method of the counters in these sub-tables are different. These differences lead to a variety of processing methods for each counter sub-table. The simple processing method is to use the functional module as the boundary, and directly create and process various counters in the code. Although this implementation method is simple in logic, when the counter table needs to be adjusted, the code implementation of the entire module needs to be updated, which means that the addition, deletion, query and modification of the counter require updating the release version, which is costly. In addition, there are many types of network splitter devices, and the FPGA function version of each device is independent. The counter is directly related to the FPGA function version and indirectly related to the board type. In the debugging process in the early stage of FPGA development, some auxiliary debugging counters are also needed. These characteristics lead to frequent changes in counters. The frequent changes in counters make us hope that the use of counters can be clearer and simpler, and application development can be faster, without the need to recompile the code and rerun the program. Based on the above problems, we designed and invented a new implementation solution (see Figure 2 ).

[0021] The counter configuration file is used to describe all the counter table items and counters that need to be obtained. This solution introduces a csv configuration file to describe the various counters that need to be read. It supports flexible trimming and expansion of counters through the csv configuration file. Changes to the counter module can also be quickly applied to the running program by reloading the configuration file. A counter table usually consists of dozens or hundreds of counters. In the csv configuration file, the unified structure describing each counter table item has the fields: table_id, table_name, and table_mask; the unified structure describing each counter has the fields: cnt_name, cnt_addr, cnt_offset, cnt_read_mode, cnt_reg_cnt_l, cnt_reg_cnt_h, cnt_module_id, and cnt_module_type. By correctly writing the information of the above fields of the FPGA counter in the configuration file, the FPGA counter can be added to the counter module managed by the software. The modification and deletion of the counter only requires changing the csv configuration file. The fields of the csv configuration file are defined as follows: Counter entry attributes: table_id: the id of the counter table, any value between 0 and 63 (M*T), can be specified by the user, and is used for table entry lookup; table_name: the name of the counter table, used to provide the user with the table item name; table_mask: association code of counter table, describing the relationship between counter tables, used for multi-table association display; Counter properties: cnt_name: the name of the counter; cnt_addr: FPGA register address of the counter; cnt_offset: FPGA register write address offset of the counter (select counter); cnt_read_mode: counter reading mode; cnt_reg_cnt_l: the value of the counter, read the lower 16 bits of the 32-bit counter from the FPGA register address; cnt_reg_cnt_h: the value of the counter, read the high 16 bits of the 32-bit counter from the FPGA register address; cnt_module_id: module address of the counter, used to select the FPGA register address of the module; cnt_module_type: module type of the counter, which is related to the read mode cnt_read_mode; Software management entries are usually used to store counter information obtained from FPGA, including counter name, counter value, rate, etc., and use shared memory to save data. When the configuration file is loaded, the counter configuration file will be read twice to build the software entry of the counter (see Figure 3 ). The first reading will calculate the number of counter table entries and the number of valid counters in each counter table entry based on table_id. After the reading is completed, the counter table table_X and the counter management structure cnt_array are dynamically created, where table_X contains the attribute information of the counter table (table_id, etc.), and cnt_array contains the description information of all its counters (cnt_name, etc.). The second reading will use table_id as the index to find the dynamically created counter table management structure, and assign values ​​to the data of table_X and cnt_array. After the management structure is initialized, there is no need to read the counter configuration file.

[0022] The counter maintenance module uses threaded polling and is divided into two parts: the FPGA counter register read and write module and the counter adaptive module. The FPGA counter register read and write module usually selects the module in a certain FPGA register, then selects the counter to be read in a certain FPGA register, and then reads the counter 16-bit, 32-bit or 64-bit value in the specified FPGA register according to the counter bit width. There are many supported reading methods (see Figure 4 ). Calculate the rate based on the counter value read out, and write the acquired data into Figure 3 The software management table entry is in the shared memory; the counter adaptive module is used to update the counter configuration file expansion or modification. When the counter maintenance module detects that the configuration file is updated, it will re-establish the software management table entry, and then write the read counter value, rate and other information into the updated shared memory area.

[0023] The external management interface of the counter provides users with an interface to access the counter in the shared memory. It usually provides an interface to query and clear counter table entries. It can operate on a single or multiple counter table entries at a time through table_id, table_name, and table_mask to obtain the counter information of the specified counter table entry. The upper-level software can also obtain this part of the data by mapping the shared memory, and flexibly obtain the counter information in any counter table. In this design, a shared memory dump program is provided. By using this dump program, we can very intuitively see which counter tables are read during the program running, the organizational structure of these counter tables, and how many counters are contained in the counter table.

[0024] The new solution analyzes all FPGA counter types, reading methods and other information, and designs a common structure for the management of FPGA counters to describe each FPGA counter. Through the globally unified counter configuration file, all FPGA counters can be described more accurately, and field information such as counter module type, counter name, counter reading address, and counter reading method can be set in the configuration file.

[0025] It is worth mentioning that: The technical solution of the present invention improves the design with respect to the prior art, abstracts the counter attributes, reading, maintenance, etc., adopts independent software sub-modules for counter table building and reading, and then combines these software sub-modules to design an overall counter module. All counter description information of each module and each type is given through a csv format configuration file, and a management structure is used for software maintenance to maintain all counter information. The coupling between the counter module and the functional module is removed, and flexible and customizable counter adjustment is supported. In addition, a new counter type attribute field is added, which provides better flexibility for upper-level applications to obtain single or multiple counter tables, and provides an interface overload configuration file, which can be applied to changes in the counter module more quickly.

[0026] After the present invention defines the counter configuration file in this way, the overall or partial debugging of a single counter module becomes simpler and more convenient. The counter module only needs to modify the counter configuration file and reload it to be immediately applied to the running program. Therefore, it is no longer necessary to go through a series of complicated processes such as adjusting the code, compiling the program, and publishing the version.

[0027] At the same time, the technical solution of the present invention encapsulates the limited counter reading method into a more general counter reading interface. A counter maintenance module is used globally to read all counter configuration information from the set counter configuration file, and then build a software table for overall counter storage, management and maintenance. That is, all counter information is stored in a table item inside the software, and a unified interface can be used to obtain counter information. A general query interface can also be provided to the outside world, and the content of a single or multiple counter table items can be obtained using one interface.

[0028] In general, the technical aspects of the present invention abstract the counter model, which has excellent versatility and scalability. It supports dynamic real-time update of counter configuration files to support adding or changing counters. It manages counters in a unified way and optimizes the memory space used by the counter module. It provides a unified and simple interface for adding, deleting, modifying and checking counters.

[0029] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent substitutions or changes according to the technical solutions and novel concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A management system for FPGA counters on a front-end network shunting device, characterized in that include A counter configuration file module, wherein the counter configuration file module uses a configuration file in CSV format, and contains a unified structure describing all counter table entries and counters that need to be obtained, wherein the structure includes counter table entry fields: table_id, table_name, and table_mask, and counter fields: cnt_name, cnt_addr, cnt_offset, cnt_read_mode, cnt_reg_cnt_l, cnt_reg_cnt_h, cnt_module_id, and cnt_module_type; A dynamic loading and cutting module, which is responsible for reading the CSV configuration file at runtime and dynamically loading to realize flexible cutting and expansion of the counter; A counter table management module, the counter table management module includes a. a counter table creation submodule: used for receiving the input of the CSV configuration file, reading the first pass to calculate the number of counter table items and the number of valid counters, and dynamically creating the counter table table_X and the counter management structure cnt_array; b. Counter data assignment submodule: In the second reading, assign values ​​to the dynamically created management structure according to table_id to complete the initialization of the counter management structure; Shared memory storage module,Uses shared memory to store counter information obtained from FPGA, including counter name, counter value and rate.

2. A management system for FPGA counters on a front-end network shunting device as claimed in claim 1, characterized in that Also includes The counter maintenance module uses threaded polling, including a. reading and writing FPGA counter register module, selecting the specified module in the FPGA register and specifying the counter to be read, reading the 16-bit, 32-bit or 64-bit counter value according to the counter bit width, calculating the rate according to the read counter value, and writing the acquired data into the shared memory of the software management table item in a fixed format, b. counter adaptation module, monitoring the extension or modification update of the counter configuration file, when the configuration file update is detected, re-establishing the software management table item, and writing the read counter value, rate and other information into the updated shared memory area.

3. A management system for FPGA counters on a front-end network shunting device as claimed in claim 1, characterized in that It also includes a counter external management interface, which provides users with access to the counter interface in shared memory, supports query and clear operations on counter table items, and operates on single or multiple counter table items simultaneously through table_id, table_name and table_mask to obtain the counter information of the specified counter table item. The upper-level software can flexibly obtain the counter information in any counter table by mapping shared memory.

4. A management system for FPGA counters on a front-end network shunting device as claimed in claim 1, characterized in that It also includes a shared memory dump module that can visually display the counter tables read during program execution, the organizational structure of the counter tables, and the number of counters contained in each counter table to assist debugging and analysis.

5. A method for managing FPGA counters on a front-end network shunting device, characterized in that: The following steps are involved: S1. Introduce csv configuration files to describe various counters that need to be read. Support flexible cutting and expansion of counters through csv configuration files. The counter module can be quickly applied to the running program by overloading the configuration files. s2. Create a counter table consisting of multiple counters. In the csv configuration file, the unified structure describing each counter table item has the fields: table_id, table_name, and table_mask; the unified structure describing each counter has the fields: cnt_name, cnt_addr, cnt_offset, cnt_read_mode, cnt_reg_cnt_l, cnt_reg_cnt_h, cnt_module_id, and cnt_module_type. By writing the information of the above fields of the FPGA counter in the configuration file, the FPGA counter can be added to the counter module managed by the software. The modification and deletion of the counter only requires changing the csv configuration file.

6. A method for managing FPGA counters on a front-end network shunting device as claimed in claim 5, characterized in that It also includes step S3. Constructing software table items of the counter and software management table items, which are used to store the counter information obtained from the FPGA, and save the data in a shared memory manner. When the configuration file is loaded, the counter configuration file will be read twice to construct the software table items of the counter. The specific method is as follows: The first reading will calculate the number of counter table items and the number of valid counters in each counter table item according to table_id. After the reading is completed, a counter table table_X and a counter management structure cnt_array are dynamically created, wherein table_X contains the attribute information of the counter table, and cnt_array contains the description information of all its counters. The second reading will find the dynamically created counter table management structure with table_id as the index, and assign values ​​to the data of table_X and cnt_array. After the management structure is initialized, there is no need to read the counter configuration file anymore.

7. A method for managing FPGA counters on a front-end network shunting device as claimed in claim 6, characterized in that It also includes step S4. Counter maintenance step, which is divided into two parts: read and write FPGA counter register maintenance and counter adaptive maintenance. The read and write FPGA counter register maintenance is to select a module in the FPGA register, then select the counter to be read in a certain FPGA register, and then read the counter 16-bit, 32-bit or 64-bit value in the specified FPGA register according to the counter bit width. According to the read counter value, the rate is calculated, and the acquired data is written into the shared memory of the software management table item in a fixed format; counter adaptive maintenance is used for the update of counter configuration file expansion or modification. When the counter maintenance module detects that the configuration file is updated, it will re-establish the software management table item, and then write the read counter value, rate and other information into the updated shared memory area.

8. A method for managing FPGA counters on a front-end network shunting device as claimed in claim 7, characterized in that It also includes step S5. The user accesses the counter method in the shared memory, sets the counter external management interface, provides the query and clear interface of the counter table items, operates one or more counter table items at a time through table_id, table_name and table_mask to obtain the counter information of the specified counter table item.

9. A method for managing FPGA counters on a front-end network shunting device as claimed in claim 7, characterized in that The method also includes step S5. A user accesses a counter method in a shared memory, and the upper-layer software obtains counter information in any counter table by mapping the shared memory.