CN101873257B - Method and system for receiving messages - Google Patents

Method and system for receiving messages Download PDF

Info

Publication number
CN101873257B
CN101873257B CN 201010191914 CN201010191914A CN101873257B CN 101873257 B CN101873257 B CN 101873257B CN 201010191914 CN201010191914 CN 201010191914 CN 201010191914 A CN201010191914 A CN 201010191914A CN 101873257 B CN101873257 B CN 101873257B
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
memory
packet
memory segment
segment
message
Prior art date
Application number
CN 201010191914
Other languages
Chinese (zh)
Other versions
CN101873257A (en )
Inventor
杜欣
黄久松
李中华
谭亚中
宋奇刚
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Grant date

Links

Abstract

本发明实施例公开了一种接收报文的方法及系统,涉及数据通信技术领域,为减少向内存单元写入报文的等待时间,提高报文接收的操作效率而设计。 Example discloses a method and system for receiving packets according to the present invention, relates to a technical field of data communication, is written to the memory cell to reduce the waiting time packets, packets received improve operational efficiency of the design. 本发明实施例公开的接收报文的方法,包括:向内存单元的第一内存段中写入报文;当向所述第一内存段写入报文结束时,根据第二内存段的段起始地址,向所述第二内存段中写入报文;在向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 Embodiment disclosed a method of receiving packets embodiment of the present invention, comprising: a first write packets to the memory segment of the memory cell; when the writing of the first memory segment to the message, the second memory section according to section start address, write packet to said second memory segment; in writing to the first memory segment end packet, the packet has been written is read from the first memory section. 本发明实施例还提供了与所述方法相对应的接收报文的系统包括内存单元、内存申请及配置单元、报文写入单元和报文读取单元。 Embodiments of the invention also provides a method corresponding to the received message system includes a memory unit, the memory configuration unit and the application, the packet writing unit and the reading unit packets. 本发明实施例用于通信系统中接收报文。 Example for a communication system receiving packet embodiment of the present invention.

Description

一种接收报文的方法及系统技术领域[0001] 本发明涉及数据通信技术领域,尤其涉及一种接收报文的方法及系统。 A receiving method of packets and TECHNICAL FIELD [0001] The present invention relates to the technical field of data communications, and particularly relates to a method and system for receiving packets. 背景技术[0002] 在大多数通讯系统中,都存在报文写入单元和报文读取单元之间的报文交互过程,报文写入单元将报文写入内存单元,然后报文读取单元从所述内存单元读取写入内存单元的所述报文,这个过程即为接收报文的过程,称为收包。 [0002] In most communications systems, there are written the message packets exchange between the cell and the packet reading unit, the writing unit message packets written to the memory unit, and then reads the packet fetch unit read from the memory cell of the message written to memory cells, and this process is the process of receiving a message, called received packet. [0003] 在现有技术一中,实现一次收包的过程如下:如图1所示,首先,报文读取单元向报文写入单元配置“包起始地址”,然后启动接收报文功能,报文写入单元每次向内存单元写完一个报文后,会向报文读取单元指示“包结束”,以便报文读取单元从内存单元读取已写入的所述报文进行处理。 [0003] In a prior art, the realization of a packet receiving process is as follows: 1, First, the packet read unit writing unit configured "packet start address" the message, and then starts receiving packets function, each finished packet writing unit after a packet, the packet reading unit to indicate "end of packet" to the memory cell, so that the packet reading unit reads packets from the memory cell has been written text processing. 这样,对于一次接收报文过程实现很简单,但如果遇到大批量报文需要接收的情况时,报文读取单元就要连续向报文写入单元配置“包起始地址”,然后启动报文接收功能,并且要连续响应“包结束”来处理写入内存单元的报文数据,这样报文读取单元不停地在停止与响应状态中切换,非常耗费报文读取单元的资源。 Thus, for a received packet process it is simple to achieve, but if the situation encountered in large quantities need to receive the message, the message will read unit writing unit configured successive "packet start address" the message, and then start packet receiving function, and in response to continuous "package end" message data write processing to the memory cell, so that the packet reading unit kept in the stop state in response to the switching, resource-intensive packet reading unit . [0004] 现有技术二中,还存在另一种接收报文的方法,即实现报文读取单元在处理过程中的中断结合(interrupt coalescing)。 [0004] The second prior art, there is also another method for receiving a packet, i.e. to achieve binding unit interrupt (interrupt coalescing) during processing packets read. 具体做法为,为内存单元配置最大接收报文数量或最大延时,当内存单元收到的报文达到配置的最大接收数量,或者从收到第一个报文开始计时,达到配置的最大毫秒延时后,向报文读取单元发出中断信号,此时等待报文读取单元处理写入内存单元的数据,这样,极大地减少了接收报文过程中对报文读取单元的中断次数。 Specifically, for the configuration message, or the maximum number of packets received for the maximum delay memory unit, the memory unit when the received packet reaches the maximum number of the received configuration, or the first packet received from the start time, reaches the configured maximum ms after the delay, the packet sent an interrupt signal to the reading unit, when the data written to the memory unit processing unit reads packets waiting, so greatly reducing the received message is read during the interrupt number of packets unit . 若报文读取单元能实时处理内存单元的报文,则下一次向内存单元写入报文的等待时间为报文读取单元处理内存单元内报文所需要的时间。 If the message is read in real time the packet processing unit of the memory cell, the next time the waiting time to the memory cell write time packets for the packet within the packet processing unit memory cells required to read text. 如果报文读取单元工作负载突然很大,无法实时响应中断信号,那么下一次向内存单元写入报文的等待时间为,在处理报文所需要的时间基础上还需增加一个报文读取单元处理完其它操作再处理内存单元报文的等待时间。 If the message reading unit workload suddenly great, can not respond to interrupt signals in real time, then the next time a message is written to the memory cells of waiting time, the need to increase the basis of processing time required for messages on a message to read After processing latency fetch unit other operating reprocessing memory cell packets. [0005] 综上,现有技术二的技术方案,虽然减少了现有技术一中对报文读取单元的资源耗费,但是还存在如下问题:在下一次向内存单元写入报文的等待时间内,报文写入单元的工作必须暂停,降低了系统的操作效率。 [0005] In summary, the prior art two technical solutions, the prior art while reducing a cell in the resource reads packets consuming, but there is a problem: a memory unit to write the next packet latency the packet writing unit of work must be suspended, reduced operating efficiency of the system. 发明内容[0006] 本发明实施例提供一种接收报文的方法及系统,能够减少向内存单元写入报文的等待时间,提高报文接收的操作效率。 SUMMARY Embodiments [0006] The present invention provides a method and system for receiving packets, writing to memory cells is possible to reduce packet latency, improving operational efficiency of received packets. [0007] 为达到上述目的,本发明的实施例采用如下技术方案:[0008] 一种接收报文的方法, 包括:[0009] 向内存单元的第一内存段中写入报文;[0010] 当向所述第一内存段写入报文结束时,根据第二内存段的段起始地址,向所述第二内存段中写入报文;[0011] 在向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 [0007] To achieve the above object, embodiments of the present invention adopts the following technical solutions: [0008] A packet receiving method, comprising: [0009] The write packet to a first memory segment of the memory cell; [0010 ] when the first memory segment to write the end of the packet, depending on the starting segment address of the second memory segment, a message is written into said second memory segment; [0011] in the first memory to after the end of message segment is written, the written message is read from the first memory segment. [0012] 一种接收报文的系统,包括:[0013] 内存单元,用于暂存报文;[0014] 内存申请及配置单元,用于向所述内存单元申请第一内存段和第二内存段,配置所述第一内存单元和所述第二内存单元的段起始地址;[0015] 报文写入单元,用于向所述内存单元的所述第一内存段和所述第二内存段中写入报文;其中,当向所述第一内存段写入报文结束时,根据所述第二内存段的段起始地址,向所述第二内存段中写入报文;[0016] 报文读取单元,用于在所述报文写入单元向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 [0012] A received message, comprising: [0013] memory means for temporarily storing the packet; [0014] Application and configuration memory unit, a first memory section to the second memory unit and to apply memory segment, configuring the first memory cell and said second memory segment start address of the cell; [0015] packet writing unit, for the first memory section to the second memory unit and the write memory segment in two packets; wherein when writing to the first memory segment end packet, the start address of the second segment according to the segment, the writing of the message to said second memory segment paper; [0016] packet reading unit configured to, after the end of the message packet to the writing unit writes the first memory segment has been written to the first memory segment is read from the packet . [0017] 本发明实施例提供的接收报文的方法及系统,基于至少两个逻辑相连的内存段, 使报文的写入和读取顺序是按照内存单元的分段来进行。 [0017] The present invention is a method and system for receiving a packet according to an embodiment, the memory section based on at least two logically connected, so that writing and reading sequential packets is segmented according to the memory cell. 接收报文时,向第一内存段写入报文;所述第一内存段写入报文结束后,便接着跳转至第二内存段的起始地址,向所述第二内存段写入报文,这时,所述第一内存段内已写入的数据等待读取;读取所述第一内存段内的数据可以与所述第二内存段写入报文同时进行也可以有一定延时进行,从而使写入内存单元的报文能够按照分段来进行处理,而对于每个内存段内的报文是批量进行处理的。 Upon receiving the packet, the packet is written into the first memory segment; the first memory section after the end of writing the message, then it jumps to the start address of the second memory segment, writing to the second memory segment inbound packets, this time, the data in the first memory segment has been written to the read latency; reading the data in the first segment of memory can be written to the packet in the second memory segments may be performed simultaneously for a certain time delay, so that the writing of the memory cell packets can be processed in segments, and for each of the packets in the memory segment is batch processed. 此过程中一直向内存单元写入报文,内存单元写入报文的间断时间仅为一个内存段写完后向另一个内存段跳转所需的时间,提高了报文接收的操作效率。 This procedure has been written to the message memory cells, the memory cell write time is only intermittently packet memory segments after writing a time required for the jump to another memory segment, improving the operational efficiency of the received packet. 附图说明[0018] 为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。 BRIEF DESCRIPTION [0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings are briefly introduced as required for use in the embodiments describing the embodiments. Apparently, the drawings described below are merely present invention Some embodiments of the present art ordinary skill, without creative efforts, can derive from these drawings other drawings. [0019] 图1为现有技术一报文接收示意图;[0020] 图2为本发明实施例一接收报文的方法流程图;[0021] 图3为本发明实施例二接收报文的方法对应的系统;[0022] 图4为本发明实施例二接收报文的方法流程图;[0023] 图5为本发明实施例二内存段为4的接收报文状态转移图; [0024] 图6为本发明实施例四内存段为4的接收报文状态转移图;[0025] 图7为本发明实施例五接收报文的系统示意图;[0026] 图8为本发明实施例六报文写入单元框图。 [0019] FIG. 1 is a prior art schematic diagram of a received message; [0020] FIG 2 is a flowchart of a method of receiving packets invention; [0021] FIG 3 a method of receiving packets according to a second embodiment of the present invention. corresponding system; [0022] FIG 4 is a flowchart of a method of receiving packets according to a second embodiment of the invention; [0023] FIG. 5 is a section according to the second memory for the text message received state transition diagram of the embodiment of the invention 4; [0024] FIG. 6 according to a fourth embodiment of the present invention, memory segments to receive the message of the state transition of FIG. 4; [0025] Figure 7 a schematic view of the system receives the packet according to a fifth embodiment of the present invention; [0026] FIG. 8 according to a sixth embodiment of the present invention the packet writing unit block diagram. 具体实施方式[0027] 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。 DETAILED DESCRIPTION [0027] below in conjunction with the present invention in the accompanying drawings, technical solutions of embodiments of the present invention are clearly and completely described, obviously, the described embodiments are merely part of embodiments of the present invention, rather than all embodiments. 基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 Based on the embodiments of the present invention, all other embodiments of ordinary skill in the art without any creative effort shall fall within the scope of the present invention. [0028] 实施例一[0029] 如图2所示,本发明实施例一接收报文的方法,包括:[0030] S11、向内存单元的第一内存段中写入报文。 [0028] Example a [0029] shown in FIG. 2, a method of receiving packets embodiment of the present invention, comprising: [0030] S11, the first memory segment to the memory cell write packet. [0031] 内存单元可根据申请划分为至少两个内存段,内存段之间逻辑相连,所述至少两个内存段中任意两个逻辑相连的内存段均可称为第一内存段与第二内存段。 [0031] The memory unit may be a logical connection between the at least two memory segments, memory segment divided according to the application is connected, said at least two memory segments in the memory segments can be connected to any two logic called a first memory section and the second memory segment. 内存段之间不以物理地址的相连作为连接判断标准,而是采用状态机,将这些内存段通过转移条件有机的衔接在一起,即当一个内存段满足特定的转移条件时,转向另一个内存段。 When not connected to a physical address as the connection between the criterion memory segment, instead of using the state machine, the transition condition by such an organic adapter memory segments together, i.e., when a memory segment meet certain transition condition, move on to another memory segment. 这个转移条件可以为每个内存段设定的最大容量,或是每个内存段的接收报文时间等等。 The transition condition may be the maximum capacity of each memory segment set, each memory segment or packet reception time and the like. 而内存段的逻辑相连表现为对内存段执行操作的执行顺序,例如,当所述至少两个内存段中的其中一个内存段满足一定转移条件后,转向另一个内存段执行操作,这种执行操作的顺序为内存段逻辑相连的顺序。 And the logic memory segment is connected to the performance of the execution order of the memory segment performing the operations, e.g., when the at least two memory segments of a memory segment in which the transition to meet certain conditions, performing the steering operation of another memory segment, such execution order of operation is logically connected to the memory segment. [0032]启动接收报文后,向所述第一内存段写入报文时,依照第一内存段的地址顺序,依次写入报文。 When [0032] After receiving the start message, a message is written to the first memory section, in accordance with the order of the addresses of the first memory segment, a message is written sequentially. [0033] S12、当向所述第一内存段写入报文结束时,根据第二内存段的段起始地址,向所述第二内存段中写入报文。 [0033] S12, when the end of message is written to the first memory segment, segment start address in accordance with a second memory segment, and writes the packet into the second memory segment. [0034] 当所述第一内存段写入报文结束时,跳转至第二内存段的段起始地址,按照所述第二内存段的地址顺序向所述第二内存段写入报文。 [0034] When the writing of the first memory segment end packet, jump to the start address of the second section of the segment, the writing of the message to the second memory segment address order of the second memory segment Wen. 所述第一内存段写入报文结束是向所述第二内存段写入报文的转移条件,其写入结束可以以内存段的容量或是向内存段写入时间作为判定标准。 The first memory segment end packet is a write packet transfer conditions writing to the second memory segment, which may be the end of the writing period memory capacity or time as the criteria to write the memory segment. [0035] S13、在向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 [0035] S13, after completion of the first memory segment to write the message, read from the first memory segment has been written to the packet. [0036] 向所述第一内存段写入结束后,该内存段内的报文等待处理,读取所述第一内存段内的报文。 [0036] After waiting to write the first memory segment, the packets in the memory segment, the reading of the packets in the first memory segment. 若报文读取单元能够及时响应第一内存段中等待处理的报文,那么读取所述第一内存段内的报文可以与向所述第二内存段写入报文同时进行;若报文读取单元暂时无法响应读取所述第一内存段内的报文,则读取所述第一内存段内的报文也可以延迟于向第二内存段写入报文进行。 If the packet read unit able to respond to messages pending in a first memory segment, a message is read in the first memory segment may be performed simultaneously with the writing of the message to the second memory segment; if the packet reading unit reads the packet is temporarily unable to respond within the first memory segment, the packet is read in the first memory segment may be a delay in writing to the second memory segment packets. [0037] 重复步骤Sll至S13,按照内存段之间的逻辑连接顺序,向内存段写入报文,并按照内存段之间的逻辑连接顺序,从内存段读取已写入的报文。 [0037] Repeat steps Sll to S13, the logical order of connection between the memory segment, a message is written to the memory segment, and in accordance with the order of the logical connection between the memory segment, the message is read from the memory segment has been written. 从系统角度而言,在同一时刻,向内存单元写入报文和从内存区读取报文是并行操作的。 From the system point of view, at the same time, reading and writing of the message packet from the memory area to the memory cell are operated in parallel. [0038] 本发明实施例提供的接收报文的方法,基于至少两个逻辑相连的内存段,使报文的写入和读取顺序是按照内存单元的分段来进行。 [0038] The method provided by the received packets embodiment of the present invention, based on the at least two memory segments of logically connected, the writing and reading sequence of packets is segmented according to the memory cell. 接收报文时,按照第一内存段的地址顺序,向第一内存段写入报文;所述第一内存段写入报文结束后,便接着跳转至第二内存段的段起始地址,向所述第二内存段写入报文,这时,所述第一内存段内已写入的数据等待读取;读取所述第一内存段内的数据可以与所述第二内存段写入报文同时进行也可以有一定延时进行,从而使写入内存单元的报文和读取内存单元的报文能够按照分段来进行处理, 而对于每个内存段内的报文是批量进行处理的。 Upon receiving the packet, the order of addresses of the first memory segment, a message is written to the first memory segment; the first memory section after the end of writing the message, will then jump to the starting section of a second memory segment address, writing to the second memory segment of a new message, the data in the first memory segment has been written to the read latency; reading the data in the first memory segment may be associated with the second write memory segment packets may be simultaneously performed with a certain delay, so that data written to memory cells and reading the memory cell packets packets can be processed in segments, and for each memory segment packets Wen batch is processed. 此过程中一直向内存单元写入报文,内存单元写入报文的间断时间仅为一个内存段写完后向另一个内存段跳转所需的时间,提高了报文接收的操作效率。 This procedure has been written to the message memory cells, the memory cell write time is only intermittently packet memory segments after writing a time required for the jump to another memory segment, improving the operational efficiency of the received packet. [0039] 实施例二[0040] 本发明实施例二基于实施例一,以图3由报文写入单元、内存单元和报文读取单元组成的系统为例对本发明的实施方式作进一步详细说明。 [0039] Second Embodiment [0040] Example 2 A embodiment of the present invention, the packet write system unit, a memory unit, and a message consisting of the reading unit in FIG. 3 embodiment is based on an example embodiment of the present invention in further detail instructions. 如图4所示,本发明实施例包括如下内容:[0041] S21、向内存单元申请至少两个内存段(即所述第一内存段和所述第二内存段), 向报文写入单元配置每个所述内存段的段起始地址。 It is shown, including the following Example 4 of the present invention: [0041] S21, the application memory segment to the at least two memory cells (i.e., the first memory segment and said second memory segment), writing to the packet unit configuration section of said memory start address of each segment. 其中,所述至少两个内存段逻辑相接, 组成环形缓冲区。 Wherein said at least two logic memory segments joined to form a ring buffer. [0042] 进一步地,本发明实施例还包括:配置所述第一内存段和所述第二内存段可以写入报文的最大报文数量,即每个内存段可以写入的最大报文数量。 The maximum packet configuring the first memory segment and said second memory segment can be written to the maximum number of message packets packets, i.e. each memory segment can be written: [0042] Further, embodiments of the present invention further comprises number. [0043] 每段地址空间即为一个内存段。 [0043] each segment of address space that is a memory segment. 每个内存段内地址是连续的,但是内存段之间的地址可能是连续的,也可能是离散的。 Each address within the memory segment is continuous, but the address between the memory segments may be continuous, it may be discrete. 这是因为内存单元可能会因其他数据或业务的存在, 使可写入报文的内存地址不再是连续的,而是不相邻的、离散的。 This is because the memory cells may be due to the presence of other data or services, so that the message can be written to the memory address is no longer continuous, but not adjacent, discrete. [0044] 申请内存段成功之后,向报文写入单元配置每个所述内存段的段起始地址和每个所述内存段接收的最大报文数量segN_len,N代表第N段内存段。 [0044] After the application memory segment successfully, set the maximum number of packets segN_len start address of each segment of said memory segments and each memory segment of the received packet to the writing unit, N for N-th memory segment. [0045] 为每个内存段配置段起始地址和接收的最大报文数量,则每个内存段的存储容量等于每段配置的最大报文数量乘以最大报文长度。 [0045] The maximum number of packets and a start address of each memory segment receiving section configuration, the storage capacity of each memory segment of each segment is equal to the maximum number of packets arranged multiplied by the maximum packet length. 其中,所述最大报文长度表示内存接收报文的能力,即能够接收的报文最大长度,而非实际进入内存单元的报文的最大长度,一般情况下,内存单元能够接收最大为2千字节的报文,而实际的报文长度一般为1. 5千字节左右。 Wherein said maximum packet length of the received message indicates a memory ability, i.e. the maximum length of the packet can be received, rather than the actual maximum length of the memory cell into the packet, in general, a memory unit capable of receiving up to 2,000 byte packet, while the actual packet length is generally about 1.5 kilobytes. 例如本发明实施例中,配置内存段SegO的起始地址为9000_A000,配置内存段SegO接收最大报文数量为1000,则内存段SegO的存储容量=配置的最大报文数量*最大报文长度=1000*2千字节=2兆字节。 For example embodiments of the present invention, the starting address of the configuration memory segment SegO 9000_A000, configuration memory segment SegO receiving a maximum number of packets is 1000, the storage capacity of the memory segment SegO = Maximum Number of packets configured maximum packet length * = 1000 * 2 = 2 kilobytes megabytes. 其它内存段的存储容量类似计算。 Other storage capacity of memory segments similar calculations. [0046] 本发明实施例在接收报文过程中,可以将前述不相邻的地址空间利用起来,采用状态机的设计方式,将这些不相邻的、离散的内存段有机的衔接在一起,组成环形缓冲区(Ring Buffer),即向内存段写入或读取报文是按段循环的。 [0046] Embodiments of the invention address space in the message receiving process, may be utilized not adjacent to the used state machine design approach, these non-adjacent, discrete organic convergence memory segments together, composition ring buffer (ring buffer), ie reading or writing memory segments is based on segment packet cycle. 对于本发明实施例来说,每个内存段设定一定的转移条件,当满足所述转移条件时,按照状态机设计的跳转顺序,跳转至下一内存段执行操作,这种跳转顺序即为内存段的逻辑连接顺序,本发明实施例中,内存段之间的跳转顺序是循环的。 For the embodiment of the present invention, each memory segment set a certain transition condition, when the transition condition is satisfied, according to the hopping sequence of the state machine, the operation jumps to perform the next memory segment, this jump is the sequential order of logical connection memory segment, in the embodiment, the hopping sequence between the memory segments embodiment of the present invention is cyclic. 本发明实施例中的转移条件为当内存段写入的报文数量达到该内存段的最大容量时,则进行跳转。 Examples of the transition condition for the embodiment of the present invention, when the number of packets written to memory segments of the maximum capacity of the memory segment, the jump. 与写入报文相对应地,报文读取单元按照内存段的逻辑连接顺序,从内存单元读取报文。 Writing the message corresponding to packet read unit in accordance with a logical connection sequence memory section, reads the packets from the memory unit. 如图3,报文读取单元向内存单元申请了n+1个段区间,内存段之间的箭头指示顺序表示了内存段之间的逻辑连接顺序。 3, a request packet read unit arrows between the segment n + 1 intervals, indicating the memory cell to the memory segment sequence represented by the sequence of the logical connection between the memory segment. [0047] 图5举例说明了4个内存段之间的状态转移图,IDLE为状态机的初始状态,SegN 代表第N段内存段(N为0、1、2或3),内存段之间的箭头指示表示内存段写入的报文数量达到配置的本段最大数量时,跳转至下一个内存段执行操作,内存段SegN指向初始状态的箭头表示时间到达时,报文写入单元停止写入操作,回到初始状态,故本发明还应包括步骤S22。 [0047] FIG. 5 illustrates a state transition diagram between a memory section 4, the IDLE state is the initial state machine, SEGn representative of the N-th memory segment (N is 2 or 3), between the memory segments the arrows indicate the time indicates the number of packets written to memory segments reaches the maximum configuration of the present paragraph, skip to the next segment performs a memory operation, memory segments SegN pointing arrow represents the initial state when the time arrives, the packet writing unit stops write operation, it returns to the initial state, so the present invention also comprises a step S22. [0048] S22、设置接收报文的总时间。 [0048] S22, to set the total time of the received packets. [0049] 该总时间,可以决定本发明实施例接收报文的持续时间,可以根据报文读取单元对于报文分析的需求而得。 [0049] The total time, can determine the duration of a reception packet embodiment of the present invention, the packet reading unit needs to be derived by the packet analysis. 该总时间的计时到达,为该系统接收报文的停止条件。 Timing of the total arrival time for the system to receive messages stop condition. 设置接收报文的总时间,报文写入单元开始计时,进入接收报文状态。 Set the total time of the received packet, the packet writing unit to start timing, the received message into the state. 例如,本发明实施例中,配置接收报文的总时间为2分钟,然后开始计时,进行接收报文,到达2分钟时,停止向内存单元写入报文。 For example, embodiments of the present invention, the total time of receiving the configuration packet was 2 minutes, and then start timing, a received message, 2 minutes to stop the writing of the message to the memory unit. 定时时间是O.1毫秒的整数倍,可以从O.1毫秒至分钟级别计时,甚至可以以小时级别计时。 O.1 ms timer time is an integral multiple, from milliseconds to minutes level timing O.1, in hours or even level timing. [0050] S23、向所述至少两个内存段的第一内存段写入报文。 [0050] S23, the first memory segment to write two memory segment message to the least. [0051] 开始计时,报文写入单元可以对报文采取筛选措施,该筛选措施取决于报文读取单元具体的报文分析需求,例如,报文读取单元根据处理任务设定报文需要满足的特定条件,则将所述特定条件作为筛选措施,将符合筛选措施的报文写入内存段。 [0051] start timing, packet writing unit may take measures against packet filtering, screening measures depend on the specific message read message needs analysis unit, for example, a message reading unit is set according to the packet processing tasks specific conditions need to be met, the specific conditions will be as a screening measures, screening measures will be in line with the message written in the memory segment. [0052] 进一步地,在向内存段写入报文时,本发明实施例还包括,指示当前正在写入的所述内存段内已写入的报文数量。 [0052] Further, when a message is written to the memory segment, embodiments of the present invention further comprises, indicating the number of packets in said memory segment currently being written has been written. [0053] 通过设置于报文写入单元的计数模块精确指示每个内存段写入了多少个报文,当达到该内存段的最大报文数量时,则向下一内存段进行跳转。 [0053] By providing modules in an accurate indication of the count of packets each memory writing unit writes the segment number of the packet, when the packet reaches the maximum number of memory segments, memory segment is a jump down. 特别是对于时间到达时正在写入报文的内存段,则报文读取单元还可以通过该内存段的计数模块指示的报文数量,精确读取所写入的报文数量(因内存段上可能存在基于本发明实施例写入的报文之外,因报文读取单元执行其他业务产生的依然在该内存段暂存的数据,而该数据对于报文读取单元处理本发明实施例所指的处理任务没有意义),计数模块可以指示针对本发明实施例所指的任务处理写入了多少个报文,当报文读取单元进行读取时,只读取指示数量的报文,该内存段的报文(包括其他业务产生的)不会全被读取,从而避免了报文读取单元的资源浪费。 Especially for the number of packets being written when the packet arrival time of the memory segment, the packet reading unit by counting module may also indicate the memory segment, the number of accurate reading of the written message (due to memory segments there may be based on other than writing packets embodiment of the present invention embodiment, since the packet reading unit is still performed in the temporary memory segment data generated by other services, and the data processing unit for reading packets embodiment of the present invention processing task within the meaning of no significance), the count may indicate a task processing module within the meaning of the number of packets is written for the embodiment of the present invention, when the packet reading unit reads, reads only indicate the number of packets Wen, the packet memory segment (including other services produced) is not full read, thus avoiding packet reading unit waste of resources. [0054] S24、向所述第一内存段写入报文结束时,根据第二内存段的段起始地址,向所述第二内存段中写入报文。 [0054] S24, the end of the write packet, the start address of the second memory section according to the section, and writes the packet to the second memory section to the first memory segment. 更为具体地,本步骤包括如下步骤:[0055] S241、当向所述第一内存段写入的报文数量达到本段预先配置的最大报文数量时,指示所述第一内存段写入结束并发送中断请求,同时跳转至第二内存段的段起始地址。 More specifically, the present step includes the steps of: [0055] S241, when the number of messages written to the first memory segment packet reaches the maximum pre-configured in this paragraph, indicating that the first memory segment to write and the end of an interrupt request, while the jump to the start address of the second memory section segment. [0056] 本发明实施例中,通过定义报文写入单元内寄存器其中一个标志位为段结束标志位来标记该段是否写入结束,即通过改变该标志位的二进制状态,来标记是否写入结束,每个内存段均设置一个段结束标志位。 [0056] The embodiments of the present invention as a flag to mark the end of the segment if the segment write end message is defined by the write unit wherein a flag register, i.e., by changing the binary state of the flag, whether the flag written to the end of each segment are set to a memory segment flag. 当一个内存段被标记已写入结束时,同时向报文读取单元发送一个中断请求,请求读取该内存段内的报文。 When the marker is a written memory segment, while the reading unit transmits packets to an interrupt request, the read request packet in the memory segment. [0057] 例如图3和图5,本发明实施例中内存段SegO写入的报文个数等于配置的最大报文数量1000时,即满足rev_cnt0 = seg0_len时,基于设计的内存段跳转顺序,跳转至内存段Segl的起始地址,同时指示所述内存段SegO写入结束和发送中断请求,具体措施可以通过在报文写入单元的寄存器的段结束标志位上标记“第O段结束”,同时向报文读取单元上报中断请求,来指示报文读取单元该内存段已写入结束且已写入的报文等待读取,报文读取单元收到该中断请求后,进行读取报文。 [0057] FIG. 3 and FIG. 5 for example, the maximum number of packets when the number of packets embodiment SegO write memory segment 1000 is equal to the configuration, i.e. rev_cnt0 = seg0_len satisfied, the hopping sequence of memory segments based on the design of the embodiment of the present invention jump to the starting address of the memory segments Segl, while indicating the memory segment SegO transmit interrupt request and the write end, specific measures can be end labeled by the flag writing unit segment in the message registers "paragraph O after the "interrupt request also reported to indicate that the packet reading unit is written into memory segment ends and the written message waiting to read, the packet reading unit receives the interrupt request to the packet reading unit , reads the message. [0058] S242、向所述第二内存段写入报文。 [0058] S242, a message is written to the second memory segment. [0059] 本发明实施例中跳转至内存段Segl的起始地址后,按照内存段Segl的地址顺序向内存段Segl写入报文。 [0059] After the jump to the starting address of the memory segments Segl embodiment of the present invention, a message is written to the memory segments Segl order of addresses of memory segments Segl. [0060] S25、在向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 [0060] S25, after the end of message is written to the first memory section, reads the packet has been written from the first memory section. [0061] 例如本发明实施例中写入内存段SegO的报文数量为1000时,报文写入单元在寄存器的一个段结束标志位上标记“第O段结束”且向报文读取单元发送中断请求,即表示内存段SegO内的报文等待处理。 When [0061] such as number of packets written to the memory segment SegO embodiment of the present invention is 1000, the packet writing unit flag marks the end of a segment register "end of paragraph O" and the packet reading unit sending an interrupt request, it means that packets in the memory segment SegO pending. 若报文读取单元立即响应该中断请求,在向所述第二内存段写入报文时,从所述第一内存段中读取所述已写入的报文。 If the packet reading unit immediately respond to the interrupt request, when a message is written to the second memory segment, the reading of the written packet from said first memory segment. 那么内存段SegO内的报文可以立即被报文读取单元读取和处理,即与向内存段Segl写入报文同时进行,则系统角度来看上,接收报文的过程中,报文写入单元向内存单元写入报文和报文读取单元从内存单元读取报文是并行操作的。 Then the packets in the memory segment SegO packets can be immediately read and process the reading unit, i.e., simultaneously with the writing of the message to the memory segments Segl, then the system point of view, the process of receiving the message, the message writing unit writes to the memory cells and packets from the packet reading unit reads the packet memory cells are operated in parallel. 但是若报文读取单元没能及时响应该中断请求,则报文读取单元会滞后于报文写入单元向第二内存段写入报文,但该过程中,一直保持向内存单元写入报文, 提高了报文接收效率。 However, if the message reading unit failed to timely respond to the interrupt request, the packet reading unit will lag behind the writing unit writes the message packet to the second memory segment, but in the process, keep writing to the memory unit inbound packets, improving the efficiency of receiving the message. [0062] 需要说明的是,本发明所说的第一内存段和第二内存段,仅指两个内存段之间的相对顺序,并不特指所有内存段顺序编号中的第一个内存段和第二个内存段,同理本发明实施例所提到的内存段也并不限于仅有两个内存段。 [0062] Incidentally, the present invention said first memory section and a second memory segment, refers only to the relative order between two memory segments, not specific to the sequence number in all the memory segments of a memory section and a second memory segment, similarly mentioned embodiments of the invention is not limited to the memory segment only two memory segments. [0063] 按照内存段逻辑相接的顺序,重复步骤S23至步骤S25,本发明实施例中,所有内存段是循环相接的,即:[0064] 当向所述第二内存段写入报文结束时,根据所述第一内存段的段起始地址,向所述第一内存段中写入报文;[0065] 在向所述第二内存段写入报文结束后,从所述第二内存段中读取已写入的报文。 [0063] The order of contact in accordance with a logical memory segment, repeating step S23 to step S25, the embodiments of the present invention, all the memory segments is cyclic contact, namely: [0064] when writing to the second memory segment packets at the end of the text, according to the starting segment address of the first memory segment, a message is written into said first memory segment; [0065] at the end of packet writing to the second memory segment, from the said second memory section to read the written message. [0066] 其中,所述第二内存段和所述第一内存段分别表示一次循环顺序中的最后一个内存段和第一个内存段,且该循环顺序可以以任意一个内存段作为起始顺序。 [0066] wherein said first and said second memory segment memory segments each memory segment is the last segment and the first memory cycle of the sequence, and the cycle order may be any order of a memory segment as a starting . [0067]当最后一个内存段写入完毕后,跳转至第一个内存段,再次向第一个内存段写入报文。 [0067] When the last section of a memory write is completed, the jump to the first memory segment, again written message to the first memory segment. 对于本发明实施例来说,还可能存在另外一种情况,即若读取所述第一内存段内已写入的报文延迟于向所述第二内存段写入报文的时间过长,则再次跳转至所述第一内存段时,该内存段内之前写入的报文还未处理,此种情况可以等待报文读取单元处理完已经写入的报文,然后再将新的报文写入内存段,或者可以进入步骤S26。 For the embodiment of this invention, there may be another case, i.e. when the packet is read in said first memory segment has been written to delay writing to the second memory segment for too long packets then again jump to the first memory segment previously written in the packet memory segment not been processed yet, in which case the message may wait for the reading means completed processing the message has been written, then the new message is written to memory segment, or may proceed to step S26. [0068] S26、向所述第一内存段再次写入报文,覆盖该内存段已写入的报文,并标记所述第一内存段报文已被覆盖。 [0068] S26, a message is written again to the first memory segment, covering the packet has been written in the memory segment, said first memory segment and marking packets has been covered. [0069] 重复步骤S23-S25,直至所述至少两个内存段全部写入结束后,若第一个内存段上一次写入的数据还未被报文读取单元读取走,则向该内存段重复写入报文,覆盖上次写入报文,对于其他内存段,若上次报文还未被读取也同样采取覆盖措施。 [0069] Repeat steps S23-S25, until all of said at least two memory segments after writing, if the data on the first memory segment has not yet been write-once message reading unit down, it is to rewritable memory segment packet, covering the last written message for other memory segments, if the previous message has not been read are also covered measures taken. [0070] 本发明实施例中,通过定义报文写入单元内寄存器其中一个标志位为报文覆盖标志位来标记报文已被覆盖或未被覆盖,即通过改变该标志位的二进制状态,来改变已被覆盖或未被覆盖状态,每个内存段均设置一个报文覆盖标志位。 [0070] The embodiments of the present invention, wherein a unit register to flag the message flag to mark the coverage message has been covered or not covered by the definition of the write packet, i.e., by changing the binary state of the flag, to change has been covered or uncovered state, each memory segment are set to cover flag a message. [0071] 例如,本发明实施例中,当内存段Seg3写入的报文个数等于配置的接收最大报文数量,则循环跳转写内存段SegO,同时在寄存器的段结束标志位上标记“第3段结束”,以便后续处理。 [0071] For example, embodiments of the present invention, when receiving the maximum number of packets the number of packets written to the memory segment is equal Seg3 configuration, the cycle skip sego write memory segment, while the flag marks the end of the segment register "end of paragraph 3", for subsequent processing. 此时,如报文读取单元还未能处理内存段SegO段上次写入的批量报文,那么报文写入单元在寄存器的报文覆盖标志位通过改变状态来标记“第O段已覆盖”,表明内存段SegO已经被新的报文覆盖了。 At this time, as the packet reading unit also failed batch processing packet segments SegO last write memory segments, then the message is written in the packet unit is covered flags register by changing state flag "is para O coverage "that the memory segment SegO new message has been covered. 其他内存段覆盖标志以此类推。 Other memory segment covering sign and so on. [0072] S27、当接收报文的时间达到配置的所述总时间,指示时间到达和指示当前正在写入的当前内存段写入结束,报文写入单元停止向所述当前内存段写入`报文,已写入所述当前内存段的报文等待读取。 [0072] S27, when the current memory segments received packets reaches the total configuration time, indicating the arrival time indicates the current write end being written, the writing means stops writing the message to the current memory segment `packet has been written into the packet memory segments currently waiting to read. [0073] 当配置的接收报文的总时间到达后,认为报文读取单元已经读取到了对报文进行分析所要的报文数量,则正在写入的内存段即使没有完成配置的最大报文数量,也会停止写入,标记“段结束”,同时向报文读取单元指示总时间到达,报文写入单元停止向当前内存段写入报文,报文读取单元接收到总时间到达指示后,读取完所述当前内存段的报文后,停止读取报文,接收报文过程结束。 [0073] After a total time of receiving a configuration packet arrives, the packet reading unit that has read the number of packets to the packets to be analyzed, the memory segment is being written is not completed even if the configured maximum packet the number of packets, will stop writing flag "segment end", at the same time indicates the total time to reach the reading unit to the packet, the packet writing means stops writing to this memory segment packet, the packet reading unit to a received after the indicated time is reached, the current packet has been read to the memory segment, stop reading the message, the message receiving process ends. [0074] 本发明实施例中,当配置接收报文的定时时间到达2分钟后,若正在向内存段Seg2写入报文,则内存段Seg2即使没有写完配置的最大报文数量,也会标记“段结束”,同时向报文读取单元指示定时时间到达,报文写入单元停止向任何内存段写入报文,报文读取单元读取完内存段Seg2写入的报文后,停止向任何内存段读取操作。 [0074] The maximum number of packets embodiment of the present invention, when the timer time reaches configured to receive packets 2 minutes, when the packet is being written to the memory segment Seg2, even without the memory segment Seg2 finished configuration, will after labeling "segment end", while indicating the timing time is reached, stops writing unit writing the message packet to any memory segment, the reading unit has finished reading the message memory segment Seg2 packets written to the reading unit , the read operation is stopped in any memory segment. [0075] 本发明实施例提供的接收报文的方法,向内存单元申请至少两个逻辑相连且循环相接的内存段,内存段组成环形缓冲区,从系统角度上向内存写入报文和从内存中读取报文可以同时进行,报文读取单元能够分段处理、批量处理报文。 [0075] A method for receiving a packet according to an embodiment of the present invention, the at least two application logic to the memory cells connected to the contact loop and memory segment, ring buffer memory segments, from the perspective of the system memory is written to the packet and packets read from memory may be performed simultaneously, the message can be read unit segmentation process, batch processing packet. 本发明实施例还给出了再次跳转至某个内存段进行写入时,上次向该内存段写入的报文还未处理,这种特殊情况的解决办法。 Embodiments of the present invention also gives the jump to a memory segment when writing again, the last packet has not been written to the memory segment process, the solution of this special case. 本发明实施例使向内存单元写入报文时,除跳转所需时间外,时间上保持连续向内存单元写入报文,同时也可以时刻使内存单元保持有可供报文读取单元读取的报文。 Example embodiments of the present invention that the packet is written to the memory unit, in addition to the time required for the jump, the holding time of continuous writing packets to the memory unit, but also can make the time for holding the memory cell packet reading unit the message read. 本发明实施例还给出了报文接收过程的一种停止条件,即时间到达时,停止接收报文。 Embodiments of the invention also presents a message reception process is stopped condition, i.e. when the time is reached, to stop receiving packets. 本发明实施例提高了报文接收的效率。 Embodiment improves the efficiency of received packets of the present invention. [0076] 实施例三[0077] 实施例三与实施例二技术方案大致相同,与实施例一不同的是在步骤S26后停止接收报文的条件,本发明实施例,在步骤S26后,包括:[0078] 确定从内存单元所读取出来的报文数量满足报文处理的数量需求,停止向内存段写入和从内存段读取报文。 [0076] Third Embodiment [0077] The third embodiment with two technical solutions of the embodiment is substantially the same as the first embodiment except that the stop condition received packets after the step S26, the embodiments of the present invention, after the step S26, the comprising : [0078] determining a number of packets read out from the memory cell to meet the needs of the number of packets to be processed, to stop the writing and reading packets from the memory segments to the memory segment. [0079] 本发明实施例报文读取单元基于已从内存单元读取到的大批量报文,进行统计判断,若认为大批量从内存单元读取的报文已满足报文读取单元处理数据过程中对数据数量的需求或者批量计算的需求,报文读取单元便可向报文写入单元发出停止指令,停止向某一内存段写入或从某一内存段读取报文,完成接收报文过程,但是报文写入单元不在标志位标记“段结束”,也不向报文读取单元指示时间到达。 [0079] Example packet reading unit to a memory cell based on large quantities from the packet embodiment of the present invention, a statistical judgment, if the packet that is read from the mass memory unit of the packets that have been read processing unit the number of data during the data needs or needs calculated quantities, the reading means can write the packet to the packet unit issues a stop command to stop writing or reading packets from one memory segment to a memory segment, packet receiving process is completed, but the unit does not write the message flag marked "end of block", the reading unit do not indicate the packet arrival time. [0080] 本发明实施例提供了另一种接收报文的停止条件,当接收到的报文数量满足处理需求时,停止接收报文。 [0080] The embodiment provides a further stop condition received packets of the present invention, when the number of received packets to meet the processing demand, stop receiving the packets. 本发明实施例基于与实施例二相同的解释,能够提高报文接收的效率。 Embodiments of the invention based on the same interpretation of the second embodiment, it is possible to improve the efficiency of received packets. [0081] 需要说明的是,对于接收过程来说,定时时间到达和判断接收到的报文数量满足处理需求,均是接收过程可停止的条件,满足停止条件中的任一条,便可停止接收报文,使接收报文过程更为灵活。 [0081] Incidentally, the process for receiving, the timer time reaches the number of packets received and determined to meet the processing requirements are to stop the receiving process condition satisfying any one of conditions a stop, you can stop receiving message, the received message process more flexible. [0082] 实施例四[0083] 本发明实施例相对于实施例二和三的不同之处在于,所述至少两个内存段之间的逻辑连接方式为顺序相接,但是不进行循环,即当最后一个内存段满足转移条件时,回到状态机的初始状态。 [0082] Fourth Embodiment [0083] embodiment of the present invention with respect to Example II and III except that the logical connection between the at least two memory segments is sequentially connected, but not cyclic, i.e., when the last memory segment transition conditions are satisfied, the state machine returns to the initial state. [0084] 相应的,在重复实施例二步骤S23至S25之后,若最后一个内存段写入的报文数量等于配置的最大报文数量,报文写入单元指示“段结束”后,即使定时总时间未到达,报文写入单元也停止向内存单元再次写入报文,已写入内存单元的报文等待报文读取单元读取。 After [0084] Accordingly, after the steps S23 to S25 according to the second embodiment is repeated, the maximum number of packets if the number of the last segment of memory write packets equal to the configured packet writing unit indicates "end of block", even if the timing the total time does not arrive, the packet writing unit also stops writing the message again to the memory unit, the memory cell has been written message waiting message reading unit. [0085] 例如图6,以四个内存段为例,举例说明内存段之间的状态转移,当内存段Seg3写入的报文数量等于配置的接收最大报文数量,则标记“第3段结束”,同时向报文读取单元发出中断请求。 [0085] FIG. 6 for example, to four memory segment as an example, to illustrate the state transfer between the memory segments, when receiving the maximum number of packets the number of packets written to memory segments of equal configuration Seg3, the symbol "Paragraph 3 end ", and issues an interrupt request to the packet reading unit. 此时,即使定时时间未到达,也停止向内存单元写入报文,已写入内存单元的报文等待报文读取单元读取。 In this case, even if the timing time does not reach, but also to stop writing to the packet memory cell, the memory cell written message waiting packet reading unit. [0086] 本发明实施例作为实施例二和实施例三的简化方案,同样能够提高接收报文的效率。 Two embodiment examples and simplified scheme III Example Example [0086] The present invention is also possible to improve the efficiency of the received packet. [0087] 实施例五[0088] 如图7所示,本发明实施例还提供了一种接收报文的系统1,包括:内存单元2,用于暂存报文;内存申请及配置单元5,用于向所述内存单元申请第一内存段和第二内存段, 配置所述第一内存单元和所述第二内存单元的段起始地址;报文写入单元3,用于向所述内存单元的所述第一内存段和所述第二内存段中写入报文;其中,当向所述第一内存段写入报文结束时,根据所述第二内存段的段起始地址,向所述第二内存段中写入报文;报文读取单元4,用于在所述报文写入单元向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 [0087] Fifth Embodiment [0088] FIG 7, an embodiment of the present invention further provides a system for receiving a message, comprising: a memory unit 2, for temporarily storing the packet; memory allocation and configuration unit 5 for application to the memory cells of the first memory section and a second memory segment, configuring the segment start address of the first memory cell and said second memory means; packet writing unit 3, a to the the memory cell of said first memory segment and said second segment of memory write packet; wherein, when the first memory segment to the end of the write packet, according to a second segment of the memory segment from start address, write packet to said second memory segment; packet reading unit 4, after the end of message for the packet write unit writing to said first memory segment, from the the first memory section to read the message has been written. [0089] 内存申请及配置单元通过调用函数向内存单元发起申请,申请至少两段地址空间,每段地址空间即为一个内存段。 [0089] The memory unit initiates the application and arrangement by calling the function to the memory cell applications for at least two address spaces, each address space that is a memory segment. 每个内存段内地址是连续的,但是内存段之间的地址可能是连续的,也可能是离散的。 Each address within the memory segment is continuous, but the address between the memory segments may be continuous, it may be discrete. 这是因为内存单元可能会因其他数据或业务的存在,使可写入报文的内存地址不再是连续的,而是不相邻的、离散的。 This is because the memory cells may be due to the presence of other data or services, so that the message can be written to the memory address is no longer continuous, but not adjacent, discrete. 内存申请及配置单元申请内存段成功之后,向报文写入单元配置每个所述内存段的段起始地址。 After application and configuration memory unit for memory segment successfully, configuration section start address of said memory segments to each packet writing unit. [0090] 内存段之间不以物理地址的相连作为连接判断标准,而是以状态机方式,将这些内存段通过转移条件有机的衔接在一起,即当一个内存段满足特定的转移条件时,转向另一个内存段。 [0090] between the memory segment is not connected to the physical address as a connection criterion, but the manner of a state machine, the transition condition by such an organic adapter memory segments together, i.e., when a memory segment meet certain transition condition, switch to another memory segment. 这个转移条件可以为每个内存段设定的最大容量,或是每个内存段的接收报文时间等等。 The transition condition may be the maximum capacity of each memory segment set, each memory segment or packet reception time and the like. 而内存段的逻辑相连表现为对内存段执行操作的执行顺序,例如,当所述至少两个内存段中的其中一个内存段满足一定转移条件后,转向另一个内存段执行操作,这种执行操作的顺序为内存段逻辑相连的顺序。 And the logic memory segment is connected to the performance of the execution order of the memory segment performing the operations, e.g., when the at least two memory segments of a memory segment in which the transition to meet certain conditions, performing the steering operation of another memory segment, such execution order of operation is logically connected to the memory segment. [0091]启动接收报文后,报文写入单元向所述第一内存段写入报文时,依照第一内存段的地址顺序,依次写入报文。 When [0091] After receiving the start packet, the write unit writes the message packet to said first memory segment, in accordance with the order of the addresses of the first memory segment, a message is written sequentially. 当报文写入单元向所述第一内存段写入报文结束时,跳转至所述至少两个内存段的第二内存段的起始地址,按照所述第二内存段的地址顺序向所述第二内存段写入报文。 When the end of message packets to the writing unit writes the first memory segment, to jump to the start address of the second memory segment at least two memory segments, memory segment address order in accordance with the second write message to the second memory segment. 所述第一内存段写入报文结束是向所述第二内存段写入报文的转移条件,其写入结束可以以内存段的容量或是向内存段写入时间作为判定标准。 The first memory segment end packet is a write packet transfer conditions writing to the second memory segment, which may be the end of the writing period memory capacity or time as the criteria to write the memory segment. 若报文读取单元能够及时响应第一内存段中等待处理的报文,那么报文读取单元读取所述第一内存段内的报文可以与报文写入单元向所述第二内存段写入报文同时进行;若报文读取单元暂时无法响应所述第一内存段内的报文,则读取所述第一内存段内的报文也可以延迟于向第二内存段写入报文进行。 If the packet read unit able to respond to messages pending in a first memory segment, then the packet reading unit reads the packet in the first memory segment can be written to the packet unit to the second write memory segment packets simultaneously; if the packet reading unit is temporarily unable to respond to the first message within the memory segment, the packet is read in the first memory segment may be a delay in the second memory segment write packets. [0092] 本发明实施例提供的接收报文的系统,基于至少两个逻辑相连的内存段,使报文的写入和读取顺序是按照内存单元的分段来进行。 Embodiment [0092] The present invention receives the packet system provided, based on at least two logic memory segment connected, the writing and reading sequence of packets is segmented according to the memory cell. 接收报文时,内存申请及配置单元向所述内存单元申请地址空间,之后向报文写入单元配置所述第一内存单元和所述第二内存单元的段起始地址;报文写入单元向第一内存段写入报文;报文写入单元向所述第一内存段写入报文结束后,便接着跳转至第二内存段的起始地址,向所述第二内存段写入报文,这时,所述第一内存段内已写入的数据等待读取;报文读取单元读取所述第一内存段内的数据可以与报文写入单元向所述第二内存段写入报文同时进行也可以有一定延时进行, 从而使写入内存单元的报文能够按照分段来进行处理,而对于每个内存段内的报文是批量进行处理的。 Upon receiving the message, and the memory allocation unit arranged to apply to the memory means address space, after writing the first memory cell unit is disposed and said second memory means to the segment start address of the packet; packet writing unit writes a first memory segment to the packet; packet write unit writing to the first memory section after the end of the message, then it jumps to the start address of the second memory section to the second memory write segment of a new message, the data written in the first memory segment has been read latency; packet reading unit reads the data in the first memory segment may be the packets to the writing unit said second memory segment write packets but can also be a certain time delay, so that the message can be written to the memory cell segment in accordance with the processing, while for each memory segment for processing packets bulk of. 此过程中报文写入单元一直向内存单元写入报文,内存单元写入报文的间断时间仅为一个内存段写完后向另一个内存段跳转所需的时间,提高了报文接收的操作效率。 This process has the writing unit to write the message packet to the memory cell, the memory cell write packets only intermittent time period after writing memory segment to another memory segment required for a jump, increase the packet receiving operational efficiency. [0093] 实施例六[0094] 实施例六基于实施例五,在实施例五接收报文的系统所包含的单兀基础上做进一步详细说明。 [0093] Sixth Embodiment [0094] The sixth embodiment according to a fifth embodiment based, described in further detail on the basis of a single embodiment Wu received packets included in the system of five. [0095] 进一步地,所述内存申请及配置单元配置每个所述内存段接收的最大报文数量SegN_len,N代表第N段内存段。 [0095] Further, the memory cell configuration of each application and the configuration of the memory segment of the maximum number of packets received SegN_len, N representative of the N-th memory segment. 则每个内存段的存储容量等于每段配置的最大报文数量乘以最大报文长度。 The storage capacity of each memory segment of each segment is equal to the maximum number of packets arranged multiplied by the maximum packet length. 其中,所述最大报文长度表示内存接收报文的能力,即能够接收的报文最大长度,而非实际进入内存的报文的最大长度,一般情况下,内存能够接收最大为2千字节的报文,而实际的报文长度一般为1. 5千字节左右。 Wherein said maximum packet length of the received message indicates a memory ability, i.e. the maximum length of the packet can be received, rather than the actual maximum length of the packet into the memory, in general, a memory capable of receiving up to 2 kilobytes packets, while the actual packet length is generally about 1.5 kilobytes. 例如本发明实施例中,配置第O内存段SegO的起始地址为9000_A000,配置第O内存段SegO接收最大报文数量为1000,则第O内存段的存储容量=配置的最大报文数量*最大报文长度=1000*2千字节=2兆字节。 The maximum number of packets, for example, embodiments of the invention, the configuration of the starting address memory segment SegO is O 9000_A000, configure the first memory segment O SegO the maximum number of packets received is 1000, then the first memory segment O configuration memory capacity = * maximum packet size = 1000 = 2 * 2 kilobytes megabytes. 其它内存段的存储容量类似计算。 Other storage capacity of memory segments similar calculations. [0096] 本发明实施例在接收报文过程中,可以将前述不相邻的地址空间利用起来,采用状态机的设计方式,将这些不相邻的、离散的地址空间有机的衔接在一起,组成环形缓冲区(Ring Buffer),即向内存段写入或读取报文是按段循环的。 [0096] Embodiments of the invention address space in the message receiving process, may be utilized not adjacent to the used state machine design approach, these non-adjacent, discrete address space convergence organic together, composition ring buffer (ring buffer), ie reading or writing memory segments is based on segment packet cycle.对于本发明实施例来说,每个内存段设定一定的转移条件,当满足所述转移条件时,按照状态机设计的跳转顺序,跳转至下一内存段执行操作,这种跳转顺序即为内存段的逻辑连接顺序,本发明实施例中,内存段之间的跳转顺序是循环的,即组成环形缓冲区。本发明实施例中的转移条件为当内存段写入的报文数量达到该内存段的最大容量时,则进行跳转。与写入报文相对应地,报文读取单元按照内存段的逻辑连接顺序,从内存单元读取报文。 [0097] 如图8所示,进一步地,所述报文写入单元3包括计时模块31,用于设置所述系统接收报文的总时间。 [0098] 该总时间,可以决定本发明实施例接收报文的持续时间,可以根据报文读取单元对于报文分析的需求而得。该总时间的计时到达,为该系统接收报文的停止条件。计时模块开始计时,触发报文接收功能,进入接收报文状态。 [0099] 进一步地,所述报文写入单元还包括计数模块32,用于指示当前正在写入的所述内存段内已写入的报文数量。 [0100] 报文写入单元能通过计数模块精确指示每个内存段写入了多少个报文,当达到该内存段的最大报文数量时,则向下一内存段进行跳转。特别是对于时间到达时正在写入报文的内存段,则报文读取单元还可以通过该内存段的计数模块指示的报文数量,精确读取所写入的报文数量。 [0101] 进一步地,所述报文写入单元3还包括段结束及中断模块33,用于当向所述第一内存段或第二内存段写入的报文数量达到该内存段预先配置的最大报文数量时,指示所述内存段的报文写入结束,并向所述报文读取单元上报中断请求。 [0102] 本发明实施例中,可以通过定义寄存器其中一个标志位为段结束标志位来标记该段是否写入结束,即通过改变该标志位的二进制状态,来标记是否写入结束,每个内存段均设置一个段结束标志位。当内存段被标记已写入结束时,段结束及中断模块同时向报文读取单元发`送一个中断请求,请求读取该内存段内的报文。 [0103] 本发明实施例中,所有内存段是循环相接的,当最后一个内存段写入完毕后,跳转至第一个内存段,再次向第一个内存段写入报文。对于本发明实施例来说,还可能存在另外一种情况,即若报文读取单元读取所述第一内存段内的报文延迟于向所述第二内存段写入报文的时间过长,则再次跳转至所述第二内存段进行写入时,可能该内存段内之前写入的报文还未处理。 [0104] 针对此种情况,本发明实施例所述报文写入单元,还用于向所述第一内存段再次写入报文,覆盖该内存段已写入的报文;所述报文写入单元3还包括覆盖指示模块34,用于当所述第一内存段已写入的报文被覆盖时,标记所述第一内存段报文已被覆盖。 [0105] 本发明实施例中,所述覆盖指示模块可以通过定义寄存器其中一个标志位来实现,具体做法为通过改变该标志位的二进制状态,来改变已被覆盖或未被覆盖状态,每个内存段均设置一个报文覆盖标志位。 [0106] 进一步地,所述段结束及中断模块33,还用于当所述内存单元接收报文的时间达到配置的总时间时,指示当前正在写入的内存段写入结束,并向所述报文读取单元上报时间到达。 [0107] 当计时模块开始计时后达到设置的总时间时,认为报文读取单元已经读取到了对报文进行分析所要的报文数量,则正在写入的内存段即使没有完成配置的最大报文数量, 段结束及中断模块也会对正在写入的当前内存段标记“段结束”,同时向报文读取单元指示总时间到达,报文读取单元接收到总时间到达指示后,读取完所述当前内存段的报文后,停止读取报文,接收报文过程结束。 [0108] 作为本发明实施例进一步地完善方案,本发明实施例报文读取单元4包括指示停止模块42,用于确定从所述内存单元所读取出来的报文数量满足报文处理的数量需求,指示停止向所述内存单元写入和从所述内存单元读取报文[0109] 如果在定时时间到达之前,处理模块基于已读取到的所有报文,进行统计判断,若认为大批量写入内存的报文已满足处理过程中对报文数量的需求,便可停止接收报文,完成接收报文过程,但是报文写入单元不指示“段结束”,也不指示时间到达。 [0110] 作为本发明实施例的一种简化方案,所述至少两个内存段之间的状态机采用顺序相接的形式,即当最后一个内存段满足转移条件时,回到状态机的初始状态。内存段之间若最后一个内存段写入的报文数量等于配置的最大报文数量,段结束及中断模块标记“段结束”后,即使定时总时间未到达,也停止向内存再次写入报文,已写入内存的报文等待报文读取单元读取。 [0111] 本发明实施例提供的接收报文的系统,报文读取单元和内存申请及配置单元可以为网络中的CPU (Central Processing Unit)子系统,报文写入单元由ASIC(专用集成电路,Application SpecificIntegrated Circuit)子系统或者现场可编程门阵列(FPGA, Field-Programmable Gate Array)子系统构成。 [0112] 本发明实施例提供的接收报文的系统,向内存单元申请至少两个内存段,宏观上向内存写入报文和从内存中读取报文可以同时进行。本发明实施例针对内存段写入报文循环的情况,给出了再次向一个内存段写入报文时,上次写入的报文还未处理,这种特殊情况的解决办法;以及内存段间不存在循环关系,最后一个内存段写入结束后的解决办法。本发明实施例使向内存写入报文时,除跳转所需时间外保持连续写入,同时也可以时刻使内存保持可读取报文,从而能够进行分段处理、批量处理报文。本发明实施例还给出了报文接收过程的两种停止条件,即时间到达时,停止接收报文和读取的报文数量满足处理需求,停止接收接文。本发明实施例提高了报文接收的效率。 [0113] 通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本发明可以通过硬件实现,也可以借助软件加必要的通用硬件平台的方式来实现。基于这样的理解,本发明的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是⑶-R0M,U盘,移动硬盘等)中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例上述的方法。 [0114] 本领域技术人员可以理解附图只是一个优选实施例的示意图,附图中的模块或流程并不一定是实施本发明所必须的。 [0115] 本领域技术人员可以理解实施例中的装置中的模块可以按照实施例描述进行分布于实施例的装置中,也可以进行相应变化位于不同于本实施例的一个或多个装置中。 上述实施例的模块可以合并为一个模块,也可以进一步拆分成多个子模块。 Modules of the embodiments may be combined into one module, or split into multiple submodules. [0116] 上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。 [0117] 以上公开的仅为本发明的几个具体实施例,但是,本发明并非局限于此,任何本领域的技术人员能思之的变化都应落入本发明的保护范围。

Claims (11)

  1. 1. 一种接收报文的方法,其特征在于,该方法包括:向内存单元的第一内存段中写入报文;当向所述第一内存段写入报文结束时,根据第二内存段的段起始地址,向所述第二内存段中写入报文,其中,所述第二内存段与所述第一内存段采用状态机通过转移条件衔接在一起;在向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 1. A method for receiving packets, wherein the method comprises: a write packet to a first memory segment of the memory cell; when the writing of the first memory segment to the packet, according to a second section start address of the memory segment, a message is written into said second memory segment, wherein said second memory section to the first memory section together by the convergence state machine transition conditions; in to the after writing the first memory segment end packet, the written reading the first memory segment from the message.
  2. 2.按照权利要求1所述的接收报文的方法,其特征在于,在所述向内存单元的第一内存段中写入报文之前,所述方法还包括:向所述内存单元申请所述第一内存段和所述第二内存段,配置每个所述内存段的段起始地址。 2. The method according to the received packet according to claim 1, characterized in that, prior to writing the packet into a first memory segment of the memory cell, the method further comprising: application to the memory unit said first memory segment and said second memory segment, the start address of each segment arranged to the memory segment.
  3. 3.按照权利要求2所述的接收报文的方法,其特征在于,所述方法还包括:配置所述第一内存段和所述第二内存段可以写入报文的最大报文数量。 3. A method for receiving packets according to claim 2, wherein said method further comprises: configuring the first memory segment and said second memory segment Maximum Number of packets packets can be written.
  4. 4.按照权利要求3所述的接收报文的方法,其特征在于,所述当向所述第一内存段写入报文结束时,根据第二内存段的段起始地址,向所述第二内存段中写入报文,包括:当向所述第一内存段写入的报文数量达到预先配置的最大报文数量时,根据所述第二内存段的段起始地址,向所述第二内存段中写入报文。 4. A method for receiving a message according to claim 3, wherein, when the writing of the first memory segment to the packet, the start address of the second memory section according to the section, to the a second memory segment to write packets, comprising: when the number of messages written to the first memory segment packets reaches the maximum number of pre-configured message, according to a second segment of the start address of the memory segment, the the second memory segment to write the message.
  5. 5.按照权利要求1所述的接收报文的方法,其特征在于,所述方法还包括:当向所述第二内存段写入报文结束时,根据所述第一内存段的段起始地址,向所述第一内存段中写入报文;在向所述第二内存段写入报文结束后,从所述第二内存段中读取已写入的报文。 The method according to the received packet according to claim 1, wherein said method further comprises: when the writing to the second memory segment end packet, the first segment of the memory segment or depending on the start address, write packet to said first memory segment; after the second packet is written to the memory segment is read from the packet written in the second memory segment.
  6. 6.按照权利要求1所述的接收报文的方法,其特征在于,所述在向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文,包括:在向所述第二内存段写入报文时,从所述第一内存段中读取所述已写入的报文。 6. A method for receiving a message according to claim 1, characterized in that, after the end of the message packet is read from the first memory segment has been written in the writing to the first memory segment text, comprising: when a message is written to the second memory segment, the reading of the written packet from said first memory segment.
  7. 7. 一种接收报文的系统,其特征在于,所述系统包括:内存单元,用于暂存报文;内存申请及配置单元,用于向所述内存单元申请第一内存段和第二内存段,配置所述第一内存单元和所述第二内存单元的段起始地址;报文写入单元,用于向所述内存单元的所述第一内存段和所述第二内存段中写入报文;其中,当向所述第一内存段写入报文结束时,根据所述第二内存段的段起始地址,向所述第二内存段中写入报文,所述第二内存段与所述第一内存段采用状态机通过转移条件衔接在一起;报文读取单元,用于在所述报文写入单元向所述第一内存段写入报文结束后,从所述第一内存段读取已写入的报文。 A message receiving system, characterized in that, the system comprising: a memory unit for temporarily storing the packet; application and configuration memory unit, a first memory section to the second memory unit and to apply memory segment, configuring the first memory cell and said second memory segment start address of the cell; packet writing unit to said memory unit to said first memory segment and said second memory segment write packet; wherein, when the first memory segment to the end of the write packet, in accordance with the segment start address of the second memory segment, a message is written into said second memory segment, the said second memory segment to the first memory section together by the convergence state machine transition conditions; packet reading unit, for the packet write unit writing to the first memory segment end packet after reading the packet has been written from the first memory section.
  8. 8.按照权利要求7所述的接收报文的系统,其特征在于:所述报文写入单元包括段结束及中断模块,用于当向所述第一内存段或第二内存段写入的报文数量达到该内存段预先配置的最大报文数量时,指示所述内存段的报文写入结束,并向所述报文读取单元上报中断请求。 8. The receiver of claim 7, the message system, characterized in that: said packet writing unit includes an end section and an interrupt module configured to, when writing to the first memory section or the second memory segment when the packet reaches the maximum number of packets number of packets in the pre-configured memory segments, memory segment indicating the write end message, and the interrupt request reporting unit read packet.
  9. 9.按照权利要求8所述的接收报文的系统,其特征在于:所述段结束及中断模块,还用于当所述内存单元接收报文的时间达到配置的总时间时,指示当前正在写入的内存段写入结束,并向所述报文读取单元上报时间到达。 The receiving of the message system according to claim 8, wherein: said end sections and the interrupt module is further configured to, when the received packet to the memory unit time reaches the total time of configuration, indicating that the current is memory segment to be written, the end of the reading unit and the reporting time of the packet reaches.
  10. 10.按照权利要求7所述的接收报文的系统,其特征在于:所述报文读取单元包括指示停止模块,用于确定从所述内存单元所读取出来的报文数量满足报文处理的数量需求,指示停止向所述内存单元写入和从所述内存单元读取报文。 10. The receiver of claim 7, the message system, characterized in that: said packet reading unit includes a stop indication means for determining the number of packets read out from the memory unit satisfies a packet the number of processing needs, instructing to stop writing to the memory cells and reading packets from the memory unit.
  11. 11.按照权利要求7所述的接收报文的系统,其特征在于:所述报文写入单元还包括计数模块,用于指示当前正在写入的所述内存段内已写入的报文数量。 11. The receiver of claim message system of claim 7, wherein: said write means further comprises a packet counting means for indicating the packet currently being written to the memory segment has been written number.
CN 201010191914 2010-06-04 2010-06-04 Method and system for receiving messages CN101873257B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010191914 CN101873257B (en) 2010-06-04 2010-06-04 Method and system for receiving messages

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010191914 CN101873257B (en) 2010-06-04 2010-06-04 Method and system for receiving messages

Publications (2)

Publication Number Publication Date
CN101873257A true CN101873257A (en) 2010-10-27
CN101873257B true CN101873257B (en) 2013-04-17

Family

ID=42997928

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010191914 CN101873257B (en) 2010-06-04 2010-06-04 Method and system for receiving messages

Country Status (1)

Country Link
CN (1) CN101873257B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102006615A (en) * 2010-11-25 2011-04-06 中兴通讯股份有限公司 Method and device for processing massage
CN102348237B (en) * 2011-10-28 2014-07-16 重庆邮电大学 Data queuing method in broadband wireless communication system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101150485A (en) 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A management method for network data transmission of zero copy buffer queue
CN101178694A (en) 2006-11-07 2008-05-14 莱克斯信息技术(北京)有限公司 Intel e1000 zero copy method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7177941B2 (en) * 2003-12-11 2007-02-13 International Business Machines Corporation Increasing TCP re-transmission process speed
CN101702326B (en) * 2009-10-30 2012-08-29 曙光信息产业(北京)有限公司 Memory controller

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178694A (en) 2006-11-07 2008-05-14 莱克斯信息技术(北京)有限公司 Intel e1000 zero copy method
CN101150485A (en) 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A management method for network data transmission of zero copy buffer queue

Also Published As

Publication number Publication date Type
CN101873257A (en) 2010-10-27 application

Similar Documents

Publication Publication Date Title
US6195688B1 (en) Computer system, program product and method of communicating internetworking data over a master-slave communication link
US20030188054A1 (en) Data transfer apparatus and method
US6003060A (en) Method and apparatus to share resources while processing multiple priority data flows
US20050060705A1 (en) Optimizing critical section microblocks by controlling thread execution
US4914653A (en) Inter-processor communication protocol
US20060031643A1 (en) Implementing FIFOs in shared memory using linked lists and interleaved linked lists
US20070244972A1 (en) Method and system for an OS virtualization-aware network interface card
US20040047361A1 (en) Method and system for TCP/IP using generic buffers for non-posting TCP applications
US7843919B2 (en) Ethernet virtualization using a network packet alteration
US7631313B2 (en) System and method for transferring data
US20080104296A1 (en) Interrupt handling using simultaneous multi-threading
US20040125751A1 (en) Network protocol off-load engines
US20060069821A1 (en) Capture of data in a computer network
GB2377138A (en) Ring Bus Structure For System On Chip Integrated Circuits
US5930261A (en) Bus protocol
CN102279753A (en) Reconfigurable configuration management method and system for a reconfigurable system configuration management unit
CN101122886A (en) Method and device for dispensing cache room and cache controller
CN101135981A (en) Method and device for realizing batch report generation
US20110206051A1 (en) I/o bus system
US20080095193A1 (en) Method and Apparatus for Dynamically Adjusting the Number of Packets in a Packet Train to Avoid Timeouts
US20060256796A1 (en) Independent source read and destination write enhanced DMA
CN103778013A (en) Multi-channel Nand Flash controller and control method for same
US20110173289A1 (en) Network support for system initiated checkpoints
US7451454B2 (en) Event handling mechanism
WO2010123140A1 (en) Packet communication system, packet communication device, packet communication method, and computer-readable storage medium having packet communication program recorded therein

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted