Optical fiber communication data interaction processing method and device
By using programmable array logic and target programs to manage memory caches in fiber communication data interaction processing, the problems of complex and inefficient interaction processing in the prior art are solved, and concise and efficient data interaction processing is achieved, which meets the needs of multi-protocol compatibility and large-data throughput.
Patent Information
- Application Number
- CN202510216656.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-02-26
AI Technical Summary
The existing fiber optic communication data interaction processing methods are complex, the interaction process is cumbersome, the development and debugging work is large, the interaction efficiency is low, and the maintenance and positioning problems are difficult, which cannot meet the needs of users' multi-protocol compatibility and large data throughput.
When writing fiber optic communication data into the memory buffer, the target program preset in the programmable array logic is triggered to determine the number of copies occupied by the packet according to the packet length, and update the write address offset and remaining space in the write channel management module. The data transfer module is used to perform data reading processing, and the read address offset in the read channel management module is updated to free up capacity space.
The process of fiber optic communication data interaction processing is simplified, interactive efficiency is improved, development and maintenance is reduced, and the requirements of multi-protocol compatibility and large-data throughput are effectively met.
Smart Images

Figure CN119718680A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of optical fiber communication technology, and in particular to an optical fiber communication data interaction processing method and device, and also to a computer device, a non-transitory computer-readable storage medium and a computer program product. Background Art
[0002] FC (Fiber Channel) bus is a high-speed serial bus with high bandwidth, high reliability and strong anti-interference ability. The FC-AE (Fiber Channel-Avionics Environment) standard for avionics environment is being widely used in more and more avionics products and equipment. With the increase in the types of user equipment (Ethernet equipment, video equipment, etc.), nodes with a single function of FC-AE-1553 protocol can no longer meet user needs. User needs are developing towards multi-protocol (FC-AE-1553 protocol, FC-AE-ASM protocol, FC-AE-IPFC protocol) compatibility and large data throughput, and the amount of data in optical fiber communication is increasing.
[0003] In the fiber optic bus communication system (i.e. FC-AE communication system), software logic data interaction is an extremely important link. To meet the customer's requirements for multi-protocol compatibility and large data throughput, an extremely efficient fiber optic communication data interaction processing method is needed. However, the existing fiber optic communication data interaction processing methods are either complex in design, cumbersome in interaction process, and have a large workload for development and debugging, or have low interaction efficiency, or have difficulty in maintenance and positioning problems. Therefore, how to design a simple, efficient, and easy-to-maintain fiber optic communication data interaction processing solution has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The present invention provides a method for processing optical fiber communication data interaction, which is used to solve the defect that the optical fiber communication data interaction scheme existing in the prior art has great limitations, resulting in poor efficiency of optical fiber communication data interaction.
[0005] The present invention provides a method for interactively processing optical fiber communication data, comprising: In the case of writing optical fiber communication data to the memory cache area, triggering the running of a preset target program in the programmable array logic to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and updating the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and using the write channel management module to save the data packet length information; In the case where the target program detects the presence of data packets in the status information of the memory cache area, the data packets in the memory cache area are read and processed according to the data packet length information and the read address offset and using the data movement module in the target program, and the second target number of copies of the memory cache area occupied by the current read data packet is determined according to the read data packet length of the optical fiber communication data; according to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area.
[0006] According to the optical fiber communication data interactive processing method of the present invention, the method further comprises: querying whether the remaining space of the memory cache area meets the writing condition of the optical fiber communication data by running the target program in the programmable array logic, and obtaining the current write address offset from the write channel management module of the target program when it is found that the remaining space of the memory cache area meets the writing condition of the optical fiber communication data; triggering the data moving module of the target program according to the current write address offset, so as to write the optical fiber communication data into the memory cache area through the target program in the programmable array logic, and configuring the data packet length information of the optical fiber communication data to the write channel management module and the read channel management module of the target program; In the case of obtaining an interrupt signal sent by the target program in the programmable array logic, obtaining data packet length information and a read address offset from a read channel management module of the target program, processing the optical fiber communication data according to the read address offset and the data packet length information, and after the data processing is completed, updating the read address offset in the read channel management module and releasing the capacity space corresponding to the memory cache area.
[0007] According to the optical fiber communication data interactive processing method of the present invention, the first target number of copies of the memory cache area occupied by the current write data packet is determined according to the write data packet length of the optical fiber communication data, and the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area are updated according to the first target number of copies and the capacity space of each copy, which specifically includes: Determine the first target number of copies of the memory cache area occupied by the current write data packet according to the length of the write data packet of the optical fiber communication data and the capacity space of each copy pre-divided; Obtaining an initial write address offset recorded in a write channel management module in the target program; Determine an increased write address offset according to the first target number of copies and the capacity space of each copy; Determine a target write address offset according to the initial write address offset and the increased write address offset, update the write address offset recorded in the write channel management module in the target program based on the target write address offset, and use the target write address offset as the updated write address offset; Determine the occupied capacity space according to the first target number of copies and the capacity space of each copy; Acquire the initial capacity space of the memory cache area; determine the actual remaining space based on the initial capacity space and the occupied capacity space; and update the remaining space of the memory cache area based on the actual remaining space.
[0008] According to the optical fiber communication data interaction processing method of the present invention, the updating of the read address offset in the read channel management module of the target program according to the second target number of copies and the capacity space of each copy specifically includes: Obtaining an initial read address offset recorded in a read channel management module in the target program; Determining a reduced read address offset according to the second target number of copies and the capacity space of each copy; A target read address offset is determined according to the initial read address offset and the reduced write address offset, and based on the target read address offset, the read address offset recorded in the read channel management module in the target program is updated, and the target read address offset is used as the updated read address offset.
[0009] According to the fiber optic communication data interactive processing method of the present invention, when the fiber optic communication data is written into the memory cache area, before triggering the running of the preset target program in the programmable array logic, it also includes: querying whether the remaining space of the memory cache area meets the writing condition of the fiber optic communication data, and when the remaining space of the memory cache area meets the writing condition of the fiber optic communication data, querying and obtaining the current write address offset from the write channel management module in the target program of the programmable array logic; writing the fiber optic communication data into the memory cache area according to the current write address offset, and after the writing is completed, pre-configuring the data packet length information of the fiber optic communication data to the write channel management module.
[0010] According to the optical fiber communication data interactive processing method of the present invention, before querying whether the remaining space of the memory buffer area meets the writing condition of the optical fiber communication data, it also includes: Preliminarily dividing the capacity space of the memory cache area into preset equal parts, obtaining a target number of parts corresponding to the memory cache area and the capacity space of each part; The target number of copies corresponding to the memory cache area and the capacity space of each copy are synchronized to the target program preset in the programmable array logic.
[0011] The present invention also provides an optical fiber communication data interaction processing device, comprising: A first data write management unit is used to trigger the running of a preset target program in the programmable array logic when writing optical fiber communication data to the memory cache area, so as to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and to update the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and to save the data packet length information by using the write channel management module; A data reading management unit is used to read and process the data packets in the memory cache area according to the data packet length information and the read address offset and by using the data movement module in the target program when the target program detects the presence of data packets in the status information of the memory cache area, and determine the second target number of copies of the memory cache area occupied by the current read data packet according to the read data packet length of the optical fiber communication data; based on the second target number of copies and the capacity space of each copy, update the read address offset in the read channel management module of the target program to release the capacity space corresponding to the data packet in the memory cache area.
[0012] The optical fiber communication data interaction processing device according to the present invention further includes: a second data write management unit, configured to query whether the remaining space of the memory cache area meets the write condition of the optical fiber communication data by running the target program in the programmable array logic, and obtain the current write address offset from the write channel management module of the target program when it is found that the remaining space of the memory cache area meets the write condition of the optical fiber communication data; trigger the data migration module of the target program according to the current write address offset, so as to write the optical fiber communication data into the memory cache area through the target program in the programmable array logic, and configure the data packet length information of the optical fiber communication data to the write channel management module and the read channel management module of the target program; A data processing unit is used to obtain data packet length information and a read address offset from a read channel management module of the target program when an interrupt signal sent by the target program in the programmable array logic is obtained, and to process the optical fiber communication data according to the read address offset and the data packet length information. After the data processing is completed, the read address offset in the read channel management module is updated, and the capacity space corresponding to the memory cache area is released.
[0013] According to the optical fiber communication data interactive processing device of the present invention, the first target number of copies of the memory cache area occupied by the current write data packet is determined according to the write data packet length of the optical fiber communication data, and the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area are updated according to the first target number of copies and the capacity space of each copy, which specifically includes: Determine the first target number of copies of the memory cache area occupied by the current write data packet according to the length of the write data packet of the optical fiber communication data and the capacity space of each copy pre-divided; Obtaining an initial write address offset recorded in a write channel management module in the target program; Determine an increased write address offset according to the first target number of copies and the capacity space of each copy; Determine a target write address offset according to the initial write address offset and the increased write address offset, update the write address offset recorded in the write channel management module in the target program based on the target write address offset, and use the target write address offset as the updated write address offset; Determine the occupied capacity space according to the first target number of copies and the capacity space of each copy; Acquire the initial capacity space of the memory cache area; determine the actual remaining space based on the initial capacity space and the occupied capacity space; and update the remaining space of the memory cache area based on the actual remaining space.
[0014] According to the optical fiber communication data interactive processing device of the present invention, the updating of the read address offset in the read channel management module of the target program according to the second target number of copies and the capacity space of each copy specifically includes: Obtaining an initial read address offset recorded in a read channel management module in the target program; Determining a reduced read address offset according to the second target number of copies and the capacity space of each copy; A target read address offset is determined according to the initial read address offset and the reduced write address offset, and based on the target read address offset, the read address offset recorded in the read channel management module in the target program is updated, and the target read address offset is used as the updated read address offset.
[0015] According to the optical fiber communication data interactive processing device of the present invention, when the optical fiber communication data is written into the memory cache area, before triggering the running of the preset target program in the programmable array logic, the first data is written into the management unit, and is further used for: Query whether the remaining space of the memory cache area meets the writing condition of the optical fiber communication data. If the remaining space of the memory cache area meets the writing condition of the optical fiber communication data, query and obtain the current write address offset from the write channel management module in the target program of the programmable array logic; write the optical fiber communication data to the memory cache area according to the current write address offset, and after the writing is completed, pre-configure the data packet length information of the optical fiber communication data to the write channel management module.
[0016] According to the optical fiber communication data interactive processing device of the present invention, before querying whether the remaining space of the memory buffer area meets the writing condition of the optical fiber communication data, it also includes: The capacity space allocation configuration management unit is used to: Preliminarily dividing the capacity space of the memory cache area into preset equal parts, obtaining a target number of parts corresponding to the memory cache area and the capacity space of each part; The target number of copies corresponding to the memory cache area and the capacity space of each copy are synchronized to the target program preset in the programmable array logic.
[0017] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the optical fiber communication data interaction processing method as described in any one of the above items is implemented.
[0018] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the optical fiber communication data interaction processing method as described in any one of the above items is implemented.
[0019] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the optical fiber communication data interaction processing method as described in any one of the above items is implemented.
[0020] The optical fiber communication data interaction processing method provided by the present invention triggers the operation of a preset target program in a programmable array logic when writing optical fiber communication data to a memory cache area, so as to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and update the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and use the write channel management module to save the data packet length information; when the target program is used to detect that there is a data packet in the state information of the memory cache area, according to the data packet length information and the read address offset, the data packet in the memory cache area is read and processed by using the data moving module in the target program, and the second target number of copies of the memory cache area occupied by the current read data packet is determined according to the read data packet length of the optical fiber communication data; according to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area; the interaction process is simple and can effectively improve the efficiency of optical fiber communication data interaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 This is one of the flow charts of the optical fiber communication data interaction processing method provided by the present invention.
[0023] Figure 2 It is a schematic diagram of hardware structure connection corresponding to the optical fiber communication data interaction processing method provided by the present invention.
[0024] Figure 3 This is the second flow chart of the optical fiber communication data interaction processing method provided by the present invention.
[0025] Figure 4 This is the third flow chart of the optical fiber communication data interaction processing method provided by the present invention.
[0026] Figure 5 It is a structural schematic diagram of the optical fiber communication data interaction processing device provided by the present invention.
[0027] Figure 6 It is a structural schematic diagram of the computer device provided by the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0029] Combine the following Figure 1-Figure 6 The optical fiber communication data interaction processing method and device of the present invention are described, and the embodiments thereof are described in detail.
[0030] The following is a detailed description of an embodiment of the optical fiber communication data interaction processing method according to the present invention. Figure 1 As shown, it is a flow chart of the optical fiber communication data interaction processing method provided by the present invention, and the specific implementation process includes the following steps: Step 101, when writing fiber optic communication data to the memory cache area, trigger the running of a preset target program in the programmable array logic to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the fiber optic communication data, and update the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and use the write channel management module to save the data packet length information.
[0031] In an embodiment of the present invention, when the software of the computer device writes the optical fiber communication data into the memory cache area, before triggering the operation of the preset target program in the programmable array logic (i.e., Field Programmable Gate Array, FPGA), it is also necessary to query whether the remaining space of the memory cache area meets the write condition of the optical fiber communication data. When the remaining space of the memory cache area meets the write condition of the optical fiber communication data, the current write address offset is queried from the write channel management module in the target program of the programmable array logic; according to the current write address offset, the optical fiber communication data is written into the memory cache area, and after the writing is completed, the data packet length information of the optical fiber communication data is pre-configured to the write channel management module. The software is a computer program product running in a computer device (i.e., a computer device). It should be noted that before querying whether the remaining space of the memory cache area meets the write condition of the optical fiber communication data, it is also necessary to pre-divide the capacity space of the memory cache area into preset equal parts, obtain the target number of copies corresponding to the memory cache area and the capacity space of each copy, and synchronize the target number of copies corresponding to the memory cache area and the capacity space of each copy to the preset target program in the programmable array logic. The software refers to a program running on a PC or various processors. The target program preset in the programmable array logic is a program running in the FPGA or a data logic circuit inside the FPGA. The optical fiber communication data is data exchanged in an optical fiber bus communication system.
[0032] In this step, when the optical fiber communication data is written into the memory cache area, the target program preset in the programmable array logic is triggered to run, so as to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data and the capacity space of each pre-divided portion, such as dividing the write data packet length of the optical fiber communication data by the capacity space of each pre-divided portion, so as to obtain the number of copies of the memory cache area occupied by the current write data packet as the first target number of copies; the initial write address offset recorded in the write channel management module in the target program is obtained; Determine the increased write address offset according to the first target number of copies and the capacity space of each copy, such as determining the increased write address offset according to the product of the first target number of copies and the capacity space of each copy; determine the target write address offset according to the initial write address offset and the increased write address offset, such as summing the initial write address offset and the increased write address offset to obtain the target write address offset; based on the target write address offset, update the write address offset recorded in the write channel management module in the target program, and use the target write address offset as the updated write address offset; determine the occupied capacity space according to the first target number of copies and the capacity space of each copy, such as multiplying the first target number of copies and the capacity space of each copy to obtain the occupied capacity space; obtain the initial capacity space of the memory cache area; determine the actual remaining space based on the initial capacity space and the occupied capacity space, such as subtracting the initial capacity space from the occupied capacity space; and update the remaining space of the memory cache area based on the actual remaining space.
[0033] Step 102: When the target program detects the presence of data packets in the status information of the memory cache area, the data packets in the memory cache area are read and processed according to the data packet length information and the read address offset and using the data movement module in the target program, and the second target number of copies of the memory cache area occupied by the current read data packet is determined according to the read data packet length of the optical fiber communication data; according to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area.
[0034] In an embodiment of the present invention, when the target program is used to detect the presence of a data packet in the status information of the memory cache area, the data packet in the memory cache area is read and processed according to the data packet length information and the read address offset, and the data movement module in the target program is used to determine the second target number of copies of the memory cache area occupied by the current read data packet according to the read data packet length of the optical fiber communication data; the initial read address offset recorded in the read channel management module in the target program is obtained; the reduced read address offset is determined according to the second target number of copies and the capacity space of each copy, such as multiplying the second target number of copies and the capacity space of each copy to obtain the reduced read address offset; the target read address offset is determined according to the initial read address offset and the reduced write address offset, such as subtracting the initial read address offset from the reduced write address offset to obtain the target read address offset; based on the target read address offset, the read address offset recorded in the read channel management module in the target program is updated, and the target read address offset is used as the updated read address offset.
[0035] The software logic optical fiber communication data interaction processing implementation process proposed by the present invention is as follows Figure 2 As shown, the following takes the software running on Windows PC, the logic running on FPGA, and the communication based on PCIE interface as an example, the specific description is as follows: During the initialization process, the software is powered on and runs the driver program, and requests two buffers (i.e., memory caches) from the optical fiber bus communication system, one buffer for sending and the other for receiving. The buffer capacity can be 1MB, the starting addresses are buffer_addr_tx and buffer_addr_rx, and the two addresses are configured to the logic side; the logic side divides the buffer into 4096 equal parts (i.e., the target number of parts), each with a capacity of 256B (i.e., the capacity space of each part), and the remaining space of the two buffers is initially 4096, and the write address offset is , read address offset .
[0036] Specifically, during the process of software sending data, (a) the software running in the computer device executes a query to see if the remaining buffer space is 4096 and can be written to data; (b) the software executes a query to see if the write address offset ; (c) Software from The address is used to write data, and the length of the written data is 700B (selected according to actual needs); (d) After the software executes the data writing, the written data length (700B) is configured to the logical write address management channel; (e) The logic executes the update write address offset , the remaining space of the Buffer is 4093; (f) When the logic execution detects that there is data in the Buffer status information, it obtains the read address from the read channel and data length (700B), start DAM to read data from the corresponding position of Buffer to logic; (g) After the logic executes the read data, it updates the write address offset to , the remaining space of the Buffer is 4096, and the corresponding message length information in the fifo is cleared. The computer device is a server. The above process is the completion process of the software sending a message to the logic. In the whole process, the software repeats the first 4 processes in sequence; the logic repeats the last 4 processes in sequence. As long as the remaining space of the Buffer queried by the software is sufficient, the software can keep writing data, and the logic will continuously move data when it detects that there is data. As long as the DMA rate is fast enough, the remaining space of the Buffer will not be exhausted, and the software can send data continuously and uninterruptedly, and finally achieve a huge data throughput with high efficiency. From the above process, it can be seen that, except for DMA moving data, the logic software only has parameter transmission in the three processes of steps (a), (b) and (d), which is very concise and easy to implement.
[0037] In addition, in an embodiment of the present invention, the optical fiber communication data interaction processing method also includes a process in which the software of the computer device receives the logic to report the optical fiber communication data interaction. Wherein, the logic is the target program in the programmable array logic, that is, the target program in the FPGA. The software of the computer device is software running in a Windows PC. Specifically, by running the target program in the programmable array logic, it is queried whether the remaining space of the memory cache area meets the writing condition of the optical fiber communication data. When it is queried that the remaining space of the memory cache area meets the writing condition of the optical fiber communication data, the current write address offset is obtained from the write channel management module of the target program; according to the current write address offset, the data moving module of the target program is triggered to write the optical fiber communication data to the memory cache area through the target program in the programmable array logic, and the data packet length information of the optical fiber communication data is configured to the write channel management module and the read channel management module of the target program. When an interrupt signal sent by the target program in the programmable array logic is obtained, the data packet length information and the read address offset are obtained from the read channel management module of the target program, and the optical fiber communication data is processed according to the read address offset and the data packet length information. After the data processing is completed, the read address offset in the read channel management module is updated, and the capacity space corresponding to the memory cache area is released. That is, Figure 3As shown, the program running in the FPGA queries whether the remaining space in the memory cache area meets the optical fiber communication data writing condition. If so, the current write address offset is obtained from the write channel management module of the FPGA; according to the current write address offset, the data migration module is triggered to write the optical fiber communication data into the memory cache area, and the data packet length information of the optical fiber communication data is written into the write channel management module; in the case of obtaining an interrupt signal sent by the program running in the FPGA, the data packet length information and the read address offset are obtained from the read channel management module, and the optical fiber communication data is processed according to the read address offset and the data packet length information. After the data processing is completed, the read channel management module is notified to update the read address offset and release the capacity space corresponding to the memory cache area.
[0038] Specifically, during the process of receiving data, (a) the remaining buffer space is 4096 (sufficient remaining space) and data can be written through logical execution query; (b) the write address offset is queried logically ; (c) Logic execution starts DMA to The address is written with data, and the length of the written data is 7.5KB; (d) After the logic executes DMA writing, the written data length (7.5KB) is passed to the write address management channel to update the write address offset to , the remaining buffer space is 4066; (e) The logic execution generates an interrupt to notify the software that there is data to report; (f) The software detects whether the interrupt is received; (g) After receiving the interrupt reported by the logic, the software reads the read channel to obtain the read address The state management module obtains the data length (7.5KB) from (h) After the software completes the data processing, it notifies the logic to update the read channel address , the remaining space of the buffer is 4096 and the corresponding message length information in the fifo is cleared; The above process is the completion process of the software receiving a message reported by the logic. In the whole process, the logic repeats the first 5 processes in sequence; the software repeats the last 3 processes in sequence. As long as the remaining space of the buffer queried by the logic is sufficient, data can be written continuously. When the software detects that there is data, it can process the data continuously. As long as the DMA rate is fast enough, the remaining space of the buffer will not be exhausted, and the logic can report data continuously and uninterruptedly to achieve a huge data throughput with high efficiency. From the above process, it can be seen that in addition to DMA moving data, the logic software only has parameter transmission in steps (g) and (h), which is very concise and easy to implement.
[0039] In the present invention, in order to solve the technical problem described in the present invention, the following is adopted: Figure 2The hardware architecture shown is implemented. The driver on the software side of the computer device is responsible for reading, writing and processing data (i.e., optical fiber communication data); the DMA (Direct Memory Access) on the logic side of the FPGA is responsible for moving data between the software and the logic, where DMA can also be replaced by other existing data movement modules, which are not specifically limited here. The memory buffer (i.e., memory cache area) is provided by the software side, and both the logic and the software have read and write permissions to the memory cache area. During the operation of the optical fiber bus communication system, the management of the memory cache area is completed by the logic alone, and the software side no longer needs to undertake the corresponding management work, but can obtain the status of the memory cache area in real time from the logic side (remaining space, whether there is data, and the number of data packets to be processed, etc.).
[0040] The present invention discloses a method for managing a memory cache area on the software side and a method for data interaction between software and logic using optical fiber communication based on the method. In the present invention, the logic divides the buffer with a total capacity of S used for data interaction on the software side into N equal parts for management (N can be configured by agreement in advance between the software and the logic, and the larger N is, the more refined the management of the buffer is), and the capacity of each part is M=S / N, that is, the capacity space of each part. The logic divides the management of the buffer into a write channel management module, a read channel management module, and a status maintenance module (that is, a buffer status management module). The write channel management module is responsible for maintaining the write address offset of the buffer (that is, ) and records the length of the written data packet; the read channel management module is responsible for maintaining the read address offset of the Buffer and clear the packet length information; the status maintenance module is responsible for controlling the remaining space in the maintenance buffer, whether there is data included, and the number of packets. and The initial value is 0.
[0041] When the fiber communication data is written into the Buffer (memory cache area), the number of Buffer copies P (i.e. the first target number) occupied by the current write data packet is calculated based on the write data packet length (wpkg_len) through logic. If it is less than one copy, it will be processed as one copy. Then the write address offset (waddr_offset) is updated and the write data packet length (wpkg_len) is saved. When waddr_offset exceeds the Buffer address range, the high-order overflow is discarded and the address is rolled back. The write address offset update calculation formula is as follows:
[0042] That is, the initial write address offset recorded in the write channel management module in the target program is obtained ( ); According to the first target number of copies (ie, P) and the capacity space of each copy (ie, M), determine the increased write address offset (ie ); According to the initial write address offset and the increased write address offset, determine the target write address offset, based on the target write address offset (i.e. ), the write address offset recorded in the write channel management module in the target program is updated, and the target write address offset is used as the updated write address offset.
[0043] When the computer device finishes reading the optical fiber communication data from the Buffer, it calculates the number of Buffer copies L (i.e., the second target number) occupied by the currently read data packet through logic based on the read data length (rpkg_len). If it is less than one copy, it will be processed as one copy. Then, the read address offset (raddr_offset) is updated and the packet length information is cleared. When raddr_offset exceeds the Buffer address range, the high-order overflow is discarded and the address is rolled back. The calculation formula for updating the read address offset is as follows:
[0044] That is, the initial read address offset recorded in the read channel management module in the target program (i.e. ); According to the second target number of copies (ie, L) and the capacity space of each copy (ie, M), determine the reduced read address offset (ie ); According to the initial read address offset and the reduced write address offset, determine the target read address offset (ie ), based on the target read address offset, the read address offset recorded in the read channel management module in the target program is updated, and the target read address offset is used as the updated read address offset.
[0045] The buffer status management module includes: buffer remaining space, whether there are packets in the buffer, and the number of buffered packets. The initial value of the buffer remaining space is N. When a packet that occupies P buffers is written, the buffer remaining space is reduced by P; when a packet that occupies L buffers is read, the buffer remaining space is increased by L. Whether there are packets in the buffer and how many packets there are are obtained from the packet length information fifo.
[0046] Figure 3The figure shows the interactive mode of sending data from software to logic, which is divided into 8 steps. Among them, steps 1 to 4 are completed by software, and steps 5 to 8 are completed by logic. Only steps 1, 2 and 4 involve software and logic interaction, and the content of the interaction is the acquisition of status and configuration of parameters. The operation is very simple and error-prone. When the software transmits data to the logic, it only needs to focus on steps 1 to 4. As long as there is enough remaining space in the buffer in step 1, the software can continue to send data, which can effectively improve the efficiency of the software sending data.
[0047] Figure 4 The figure shows the interactive mode of software receiving logic reporting data, which is also divided into 8 steps. Among them, steps 1 to 5 are completed by logic, and steps 6 to 8 are completed by software. Only steps 6, 7 and 8 involve software and logic interaction. Step 6 is the interrupt signal generated by the software receiving logic. Steps 7 and 8 involve software and logic interaction, and the content of the interaction is also the acquisition of status and configuration of parameters. The operation is also simple and not prone to errors. To transmit data from logic to software, you only need to pay attention to steps 1 to 5. As long as there is enough remaining space in the buffer in step 1, the logic can continue to report data to the software, which can effectively improve the efficiency of logic reporting data.
[0048] In the traditional software logic interaction mode, the software and logic need to maintain a set of pointers to manage the buffer, which is cumbersome to design and has low interaction efficiency. The software logic data interaction mode designed based on the present invention is simple to implement, concise to interact, not prone to errors and has high interaction efficiency. At the same time, the running status of the buffer (remaining space, whether there is data, how many packets of data) can be clearly obtained, which is convenient for monitoring the operation of the system and locating bugs.
[0049] In order to solve the problems of complex software logic interaction mode, low efficiency, and great difficulty in implementation and maintenance in the FC-AE communication system, the present invention proposes a new software logic data interaction mode for the FC-AE communication system. The optical fiber communication data interaction processing method provided by the present invention triggers the operation of a preset target program in a programmable array logic when writing optical fiber communication data to a memory cache area, so as to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and update the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and use the write channel management module to save the data packet length information; when the target program is used to detect that there is a data packet in the state information of the memory cache area, according to the data packet length information and the read address offset, the data packet in the memory cache area is read and processed by using the data moving module in the target program, and the second target number of copies of the memory cache area occupied by the current read data packet is determined according to the read data packet length of the optical fiber communication data; according to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area; the interaction process is simple and can effectively improve the efficiency of optical fiber communication data interaction. This method adopts the idea of dividing the memory buffer into blocks and managing it separately by logic. Based on this design, the memory management work can be effectively simplified, making the software logic interaction process concise and easy to implement. The software logic data interaction method proposed by the present invention greatly simplifies the interaction process while ensuring sufficiently high communication efficiency. In addition, the memory management idea in this interaction method is also suitable for many systems that need to manage memory.
[0050] The optical fiber communication data interaction processing device provided by the present invention is described below. The optical fiber communication data interaction processing device described below and the optical fiber communication data interaction processing method described above can be referred to each other. Figure 5 As shown, it is a schematic diagram of the structure of the optical fiber communication data interaction processing device provided by the present invention. The optical fiber communication data interaction processing device of the present invention specifically includes the following parts: The first data write management unit 501 is used to trigger the running of a preset target program in the programmable array logic when writing optical fiber communication data to the memory cache area, so as to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and update the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and use the write channel management module to save the data packet length information.
[0051] The data reading management unit 502 is used to read and process the data packets in the memory cache area according to the data packet length information and the read address offset and by using the data movement module in the target program when the target program detects the presence of data packets in the status information of the memory cache area, and determine the second target number of copies of the memory cache area occupied by the current read data packet according to the read data packet length of the optical fiber communication data; based on the second target number of copies and the capacity space of each copy, update the read address offset in the read channel management module of the target program to release the capacity space corresponding to the data packet in the memory cache area.
[0052] The optical fiber communication data interaction processing device according to the present invention further includes: a second data write management unit, configured to query whether the remaining space of the memory cache area meets the write condition of the optical fiber communication data by running the target program in the programmable array logic, and obtain the current write address offset from the write channel management module of the target program when it is found that the remaining space of the memory cache area meets the write condition of the optical fiber communication data; trigger the data migration module of the target program according to the current write address offset, so as to write the optical fiber communication data into the memory cache area through the target program in the programmable array logic, and configure the data packet length information of the optical fiber communication data to the write channel management module and the read channel management module of the target program; A data processing unit is used to obtain data packet length information and a read address offset from a read channel management module of the target program when an interrupt signal sent by the target program in the programmable array logic is obtained, and to process the optical fiber communication data according to the read address offset and the data packet length information. After the data processing is completed, the read address offset in the read channel management module is updated, and the capacity space corresponding to the memory cache area is released.
[0053] According to the optical fiber communication data interactive processing device of the present invention, the first target number of copies of the memory cache area occupied by the current write data packet is determined according to the write data packet length of the optical fiber communication data, and the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area are updated according to the first target number of copies and the capacity space of each copy, which specifically includes: Determine the first target number of copies of the memory cache area occupied by the current write data packet according to the length of the write data packet of the optical fiber communication data and the capacity space of each copy pre-divided; Obtaining an initial write address offset recorded in a write channel management module in the target program; Determine an increased write address offset according to the first target number of copies and the capacity space of each copy; Determine a target write address offset according to the initial write address offset and the increased write address offset, update the write address offset recorded in the write channel management module in the target program based on the target write address offset, and use the target write address offset as the updated write address offset; Determine the occupied capacity space according to the first target number of copies and the capacity space of each copy; Acquire the initial capacity space of the memory cache area; determine the actual remaining space based on the initial capacity space and the occupied capacity space; and update the remaining space of the memory cache area based on the actual remaining space.
[0054] According to the optical fiber communication data interactive processing device of the present invention, the updating of the read address offset in the read channel management module of the target program according to the second target number of copies and the capacity space of each copy specifically includes: Obtaining an initial read address offset recorded in a read channel management module in the target program; Determining a reduced read address offset according to the second target number of copies and the capacity space of each copy; A target read address offset is determined according to the initial read address offset and the reduced write address offset, and based on the target read address offset, the read address offset recorded in the read channel management module in the target program is updated, and the target read address offset is used as the updated read address offset.
[0055] According to the optical fiber communication data interactive processing device of the present invention, when the optical fiber communication data is written into the memory cache area, before triggering the running of the preset target program in the programmable array logic, the first data is written into the management unit, and is further used for: Query whether the remaining space of the memory cache area meets the writing condition of the optical fiber communication data. If the remaining space of the memory cache area meets the writing condition of the optical fiber communication data, query and obtain the current write address offset from the write channel management module in the target program of the programmable array logic; write the optical fiber communication data to the memory cache area according to the current write address offset, and after the writing is completed, pre-configure the data packet length information of the optical fiber communication data to the write channel management module.
[0056] According to the optical fiber communication data interactive processing device of the present invention, before querying whether the remaining space of the memory buffer area meets the writing condition of the optical fiber communication data, it also includes: The capacity space allocation configuration management unit is used to: Preliminarily dividing the capacity space of the memory cache area into preset equal parts, obtaining a target number of parts corresponding to the memory cache area and the capacity space of each part; The target number of copies corresponding to the memory cache area and the capacity space of each copy are synchronized to the target program preset in the programmable array logic.
[0057] The optical fiber communication data interaction processing device provided by the present invention triggers the operation of a preset target program in a programmable array logic when writing optical fiber communication data into a memory cache area, so as to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and update the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and use the write channel management module to save the data packet length information; when the target program is used to detect that there is a data packet in the state information of the memory cache area, according to the data packet length information and the read address offset, and using the data moving module in the target program, read and process the data packet in the memory cache area, and determine the second target number of copies of the memory cache area occupied by the current read data packet according to the read data packet length of the optical fiber communication data; according to the second target number of copies and the capacity space of each copy, update the read address offset in the read channel management module of the target program, and release the capacity space corresponding to the data packet in the memory cache area; its interaction process is simple and can effectively improve the efficiency of optical fiber communication data interaction.
[0058] Figure 6 The following is a schematic diagram of the physical structure of a computer device, such as Figure 6As shown, the computer device (ie, electronic device) may include: a processor (processor) 601, a communications interface (Communications Interface) 604, a memory (memory) 602 and a communication bus 603, wherein the processor 601, the communications interface 604, and the memory 602 communicate with each other via the communication bus 603. The processor 601 can call the logic instructions in the memory 602 to execute the fiber optic communication data interaction processing method, which includes: when writing the fiber optic communication data to the memory cache area, triggering the operation of the preset target program in the programmable array logic to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the fiber optic communication data, and updating the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and using the write channel management module to save the data packet length information; when the target program is used to detect that there is a data packet in the status information of the memory cache area, according to the data packet length information and the read address offset, and using the data moving module in the target program to read and process the data packet in the memory cache area, and determine the second target number of copies of the memory cache area occupied by the current read data packet according to the read data packet length of the fiber optic communication data; according to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area.
[0059] In addition, the logic instructions in the above-mentioned memory 602 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0060] On the other hand, the present application also provides a computer program product, which includes a computer program. The computer program can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the optical fiber communication data interaction processing method provided by the above methods. The method includes: when the optical fiber communication data is written to the memory cache area, triggering the operation of a preset target program in the programmable array logic to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and updating the write address offset recorded in the write channel management module in the target program according to the first target number of copies and the capacity space of each copy. The target program detects the existence of a data packet in the status information of the memory cache area, reads and processes the data packet in the memory cache area according to the data packet length information and the read address offset, and determines the second target number of copies of the memory cache area occupied by the current read data packet according to the read data packet length of the optical fiber communication data; updates the read address offset in the read channel management module of the target program according to the second target number of copies and the capacity space of each copy, and releases the capacity space corresponding to the data packet in the memory cache area.
[0061] On the other hand, the present application also provides a computer-readable storage medium, the computer-readable storage medium includes a stored program, wherein the program executes the optical fiber communication data interaction processing method provided by the above methods when it is running, the method comprising: when the optical fiber communication data is written to the memory cache area, triggering the operation of a preset target program in the programmable array logic to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and updating the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy. and using the write channel management module to save the data packet length information; in the case where the target program detects that there is a data packet in the status information of the memory cache area, according to the data packet length information and the read address offset, and using the data movement module in the target program, the data packet in the memory cache area is read and processed, and according to the read data packet length of the optical fiber communication data, the second target number of copies of the memory cache area occupied by the current read data packet is determined; according to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area.
[0062] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0063] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0064] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for interactive processing of optical fiber communication data, characterized in that: include: In the case of writing optical fiber communication data to the memory cache area, triggering the running of a preset target program in the programmable array logic to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and updating the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and using the write channel management module to save the data packet length information; In the case where the target program detects that there is a data packet in the state information of the memory cache area, the data packet in the memory cache area is read and processed by using a data moving module in the target program according to the data packet length information and the read address offset, and the second target number of copies of the memory cache area occupied by the current read data packet is determined according to the read data packet length of the optical fiber communication data; According to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area.
2. The optical fiber communication data interaction processing method according to claim 1, characterized in that: Also includes: querying whether the remaining space of the memory cache area meets the writing condition of the optical fiber communication data by running the target program in the programmable array logic, and obtaining the current write address offset from the write channel management module of the target program when it is found that the remaining space of the memory cache area meets the writing condition of the optical fiber communication data; According to the current write address offset, trigger the data moving module of the target program to write the optical fiber communication data into the memory cache area through the target program in the programmable array logic, and configure the data packet length information of the optical fiber communication data to the write channel management module and the read channel management module of the target program; In the case of obtaining an interrupt signal sent by the target program in the programmable array logic, obtaining data packet length information and a read address offset from a read channel management module of the target program, processing the optical fiber communication data according to the read address offset and the data packet length information, and after the data processing is completed, updating the read address offset in the read channel management module and releasing the capacity space corresponding to the memory cache area.
3. The optical fiber communication data interaction processing method according to claim 1, characterized in that: The determining, according to the length of the write data packet of the optical fiber communication data, the first target number of copies of the memory cache area occupied by the current write data packet, and updating the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, specifically includes: Determine the first target number of copies of the memory cache area occupied by the current write data packet according to the length of the write data packet of the optical fiber communication data and the capacity space of each copy pre-divided; Obtaining an initial write address offset recorded in a write channel management module in the target program; Determine an increased write address offset according to the first target number of copies and the capacity space of each copy; Determine a target write address offset according to the initial write address offset and the increased write address offset, update the write address offset recorded in the write channel management module in the target program based on the target write address offset, and use the target write address offset as the updated write address offset; Determine the occupied capacity space according to the first target number of copies and the capacity space of each copy; Acquire the initial capacity space of the memory cache area; determine the actual remaining space based on the initial capacity space and the occupied capacity space; and update the remaining space of the memory cache area based on the actual remaining space.
4. The optical fiber communication data interaction processing method according to claim 1, characterized in that: The updating of the read address offset in the read channel management module of the target program according to the second target number of copies and the capacity space of each copy specifically includes: Obtaining an initial read address offset recorded in a read channel management module in the target program; Determining a reduced read address offset according to the second target number of copies and the capacity space of each copy; A target read address offset is determined according to the initial read address offset and the reduced write address offset, and based on the target read address offset, the read address offset recorded in the read channel management module in the target program is updated, and the target read address offset is used as the updated read address offset.
5. The optical fiber communication data interaction processing method according to claim 1, characterized in that: In the case of writing the optical fiber communication data into the memory cache area, before triggering the running of the preset target program in the programmable array logic, it also includes: querying whether the remaining space of the memory cache area meets the writing condition of the optical fiber communication data, and in the case that the remaining space of the memory cache area meets the writing condition of the optical fiber communication data, querying and obtaining the current write address offset from the write channel management module in the target program of the programmable array logic; according to the current write address offset, writing the optical fiber communication data into the memory cache area, and after the writing is completed, pre-configuring the data packet length information of the optical fiber communication data to the write channel management module.
6. The optical fiber communication data interaction processing method according to claim 5, characterized in that: Before querying whether the remaining space of the memory buffer area meets the writing condition of the optical fiber communication data, the method further includes: Preliminarily dividing the capacity space of the memory cache area into preset equal parts, obtaining a target number of parts corresponding to the memory cache area and the capacity space of each part; The target number of copies corresponding to the memory cache area and the capacity space of each copy are synchronized to the target program preset in the programmable array logic.
7. An optical fiber communication data interaction processing device, characterized in that: include: A first data write management unit is used to trigger the running of a preset target program in the programmable array logic when writing optical fiber communication data to the memory cache area, so as to determine the first target number of copies of the memory cache area occupied by the current write data packet according to the write data packet length of the optical fiber communication data, and to update the write address offset recorded in the write channel management module in the target program and the remaining space of the memory cache area according to the first target number of copies and the capacity space of each copy, and to save the data packet length information by using the write channel management module; a data reading management unit, configured to read and process the data packets in the memory cache area according to the data packet length information and the read address offset and by using a data moving module in the target program when the target program detects the existence of a data packet in the state information of the memory cache area, and determine the second target number of copies of the memory cache area occupied by the current read data packet according to the read data packet length of the optical fiber communication data; According to the second target number of copies and the capacity space of each copy, the read address offset in the read channel management module of the target program is updated to release the capacity space corresponding to the data packet in the memory cache area.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the optical fiber communication data interaction processing method as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the optical fiber communication data interaction processing method as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the optical fiber communication data interaction processing method as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data caching method and device
CN106372008A
Optical fiber network communication system, method and device
CN113259006A
PCIE DMA data transmission method and system based on FPGA
CN118427135A
Write request processing method, device, and data center
WO2018094961A1
FPGA-based DMA device and DMA data migration method
WO2022156370A1