CN114500329A - Method and device for detecting lost frame - Google Patents

Method and device for detecting lost frame Download PDF

Info

Publication number
CN114500329A
CN114500329A CN202111519503.6A CN202111519503A CN114500329A CN 114500329 A CN114500329 A CN 114500329A CN 202111519503 A CN202111519503 A CN 202111519503A CN 114500329 A CN114500329 A CN 114500329A
Authority
CN
China
Prior art keywords
frame
target
time
loss
header
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202111519503.6A
Other languages
Chinese (zh)
Inventor
胡磊
陈奇强
吴双
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Chenxiao Technology Co ltd
Shenzhen Genew Technologies Co Ltd
Original Assignee
Hangzhou Chenxiao Technology Co ltd
Shenzhen Genew Technologies Co Ltd
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
Application filed by Hangzhou Chenxiao Technology Co ltd, Shenzhen Genew Technologies Co Ltd filed Critical Hangzhou Chenxiao Technology Co ltd
Priority to CN202111519503.6A priority Critical patent/CN114500329A/en
Publication of CN114500329A publication Critical patent/CN114500329A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • H04L43/0829Packet loss

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请公开了一种检测失帧的方法和装置,属于通信领域。所述检测失帧方法由具有多个接口的网络设备执行,所述方法包括:获取待由所述多个接口中的目标接口传输的目标帧;确定所述目标帧的帧头中是否存在指定帧头标记;在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。

Figure 202111519503

The present application discloses a method and device for detecting frame loss, belonging to the field of communications. The method for detecting frame loss is performed by a network device having multiple interfaces, and the method includes: acquiring a target frame to be transmitted by a target interface in the multiple interfaces; determining whether there is a designated frame in the frame header of the target frame frame header mark; in the case where the specified frame header mark does not exist in the frame header of the target frame, determine whether the time during which the target frame is not transmitted through the target port is greater than a first threshold through a clock counter; It is determined that a frame loss is detected when the target port does not transmit the target frame for a time greater than a first threshold.

Figure 202111519503

Description

检测失帧的方法和装置Method and apparatus for detecting frame loss

技术领域technical field

本申请属于通信领域,具体涉及一种检测失帧方法和装置。The present application belongs to the field of communications, and in particular relates to a method and device for detecting frame loss.

背景技术Background technique

众所周知,良好的网络同步性能对用户体验感影响大,由于受传输条件的影响,在传输数据的过程中,有时会出现失帧的情况。It is well known that good network synchronization performance has a great impact on user experience. Due to the influence of transmission conditions, frame loss sometimes occurs during data transmission.

相关技术在检测失帧的过程中,需要调用各种资源进行失帧监测,这种失帧检测方式存在占用的资源较多的问题。In the related art, in the process of detecting frame loss, various resources need to be invoked to monitor frame loss, and this method of frame loss detection has the problem of occupying many resources.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种检测失帧方法和装置,能够解决相关技术中检测失帧的方式所用的资源较多的问题。The embodiments of the present application provide a method and apparatus for detecting frame loss, which can solve the problem that the method for detecting frame loss in the related art uses more resources.

第一方面,本申请实施例提供了一种检测失帧的方法,由具有多个接口的网络设备执行,所述方法包括:In a first aspect, an embodiment of the present application provides a method for detecting frame loss, which is performed by a network device having multiple interfaces, and the method includes:

获取待由所述多个接口中的目标接口传输的目标帧;obtaining a target frame to be transmitted by a target interface in the plurality of interfaces;

确定所述目标帧的帧头中是否存在指定帧头标记;Determine whether there is a specified frame header mark in the frame header of the target frame;

在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;In the case that the specified frame header mark does not exist in the frame header of the target frame, determine whether the time during which the target frame is not transmitted through the target port is greater than a first threshold through a clock counter;

在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。In a case where it is determined that the time for which the target frame is not transmitted through the target port is greater than a first threshold, it is determined that a frame loss is detected.

第二方面,本申请实施例提供了一种检测失帧的装置,所述装置包括:In a second aspect, an embodiment of the present application provides an apparatus for detecting frame loss, the apparatus comprising:

获取模块,用于获取待由多个接口中的目标接口传输的目标帧;an acquisition module for acquiring the target frame to be transmitted by the target interface in the multiple interfaces;

处理模块,用于确定所述目标帧的帧头中是否存在指定帧头标记;在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。The processing module is used to determine whether there is a specified frame header mark in the frame header of the target frame; in the case where the specified frame header mark does not exist in the frame header of the target frame, it is determined by a clock counter to pass the target frame. Whether the time when the port does not transmit the target frame is greater than a first threshold; in the case where it is determined that the time when the target frame is not transmitted through the target port is greater than the first threshold, it is determined that a frame loss is detected.

第三方面,本申请实施例提供了一种电子设备,该电子设备包括处理器和存储器,所述存储器存储在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面所述的方法的步骤。In a third aspect, an embodiment of the present application provides an electronic device, the electronic device includes a processor and a memory, the memory stores a program or an instruction that runs on the processor, and the program or instruction is executed by the processor When executed, the steps of the method as described in the first aspect are implemented.

第四方面,本申请实施例提供了一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如第一方面所述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, the steps of the method according to the first aspect are implemented .

第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所述的方法。In a fifth aspect, an embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction, and implement the first aspect the method described.

第六方面,本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如第一方面所述的方法。In a sixth aspect, an embodiment of the present application provides a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the method according to the first aspect.

在本申请实施例中,获取待由所述多个接口中的目标接口传输的目标帧;确定所述目标帧的帧头中是否存在指定帧头标记;在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。如此,可通过钟表计数器直接确定是否失帧,相较于传统的失帧检测方式,所用到的资源更少,因而能够解决相关技术中检测失帧的方式所用的资源较多的问题。In this embodiment of the present application, acquire a target frame to be transmitted by a target interface among the multiple interfaces; determine whether a specified frame header mark exists in the frame header of the target frame; In the presence of the specified frame header mark, it is determined by a clock counter whether the time when the target frame is not transmitted through the target port is greater than a first threshold; when it is determined that the time when the target frame is not transmitted through the target port is greater than In the case of the first threshold, it is determined that a dropped frame is detected. In this way, whether the frame is lost can be directly determined through the clock counter. Compared with the traditional frame loss detection method, fewer resources are used, so the problem of the related art method of detecting lost frame using more resources can be solved.

附图说明Description of drawings

本申请的上述和/或附加的方面和优点从结合下面附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and readily understood from the following description of embodiments in conjunction with the accompanying drawings, wherein:

图1是本申请实施例提供的一种检测失帧的方法的流程图;1 is a flowchart of a method for detecting frame loss provided by an embodiment of the present application;

图2是本申请实施例提供的另一种检测失帧的方法的流程图;2 is a flowchart of another method for detecting frame loss provided by an embodiment of the present application;

图3是本申请实施例提供的另一种检测失帧的方法的流程图;3 is a flowchart of another method for detecting frame loss provided by an embodiment of the present application;

图4是本申请实施例提供的另一种检测失帧的方法的流程图;4 is a flowchart of another method for detecting frame loss provided by an embodiment of the present application;

图5是本申请提供的一种检测失帧装置的结构框图;5 is a structural block diagram of a device for detecting frame loss provided by the present application;

图6是本申请提供的一种网络设备结构框图。FIG. 6 is a structural block diagram of a network device provided by the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art fall within the protection scope of this application.

本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second" and the like in the description and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances so that the embodiments of the present application can be practiced in sequences other than those illustrated or described herein, and distinguish between "first", "second", etc. The objects are usually of one type, and the number of objects is not limited. For example, the first object may be one or more than one. In addition, "and/or" in the description and claims indicates at least one of the connected objects, and the character "/" generally indicates that the associated objects are in an "or" relationship.

下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的检测失帧的方法进行详细地说明。The method for detecting frame loss provided by the embodiments of the present application will be described in detail below through specific embodiments and application scenarios with reference to the accompanying drawings.

图1是本申请实施例提供的一种检测失帧的方法的流程图。参照图1,本申请实施例提供的检测失帧的方法,可以由具有多个接口的网络设备执行。在本申请实施例中,具有所述多个接口的网络设备可以为交换机、路由器、光猫等设备。所述多个接口可以为4口、8口、16口等。FIG. 1 is a flowchart of a method for detecting frame loss provided by an embodiment of the present application. Referring to FIG. 1 , the method for detecting frame loss provided by the embodiment of the present application may be executed by a network device having multiple interfaces. In this embodiment of the present application, the network device having the multiple interfaces may be devices such as switches, routers, and optical modems. The multiple ports may be 4 ports, 8 ports, 16 ports, and the like.

本申请实施例提供的检测失帧的方法可包括:The method for detecting frame loss provided by the embodiment of the present application may include:

步骤110,获取待由所述多个接口中的目标接口传输的目标帧。Step 110: Acquire a target frame to be transmitted by a target interface among the multiple interfaces.

在本步骤中,多个接口可为网络设备上可插入光纤的接口。In this step, the multiple interfaces may be interfaces on the network device that can be inserted into optical fibers.

本申请实施例中的目标帧可以为目标接口接收到的数据帧,所述目标帧可以为本申请实施例提供的检测失帧的方法所针对的数据帧。The target frame in the embodiment of the present application may be a data frame received by the target interface, and the target frame may be the data frame targeted by the method for detecting frame loss provided by the embodiment of the present application.

在本步骤110之后,还可存储每一次接收到所述目标帧时钟表计数器记录的时间。After this step 110, the time recorded by the clock table counter of each time the target frame is received may also be stored.

步骤120,确定所述目标帧的帧头中是否存在指定帧头标记。Step 120: Determine whether a specified frame header mark exists in the frame header of the target frame.

在本步骤中,所述目标帧为传输中的数据,所述指定帧头标记可以为F628(十六进制)。当然,在本申请实施例中,所述指定帧头标记也可以为其他自定义的标记。这些自定义的标记可以为二进制、十进制或者十六进制。In this step, the target frame is data in transmission, and the specified frame header mark may be F628 (hexadecimal). Certainly, in this embodiment of the present application, the specified frame header mark may also be other self-defined marks. These custom tokens can be binary, decimal or hexadecimal.

步骤130,在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值。Step 130: In the case that the specified frame header mark does not exist in the frame header of the target frame, determine whether the time during which the target frame is not transmitted through the target port is greater than a first threshold through a clock counter.

在本申请实施例中,在所述目标帧的帧头中不存在所述指定帧头标记的情况下,可记录当前的时间。同时可以在每一次接收到目标帧的情况下记录接收到目标帧时的时间。这样,在所述目标帧的帧头中不存在所述指定帧头标记的情况下,可以将记录的当前时间与上一次记录的接收到目标帧时的时间作差,将此差值的绝对值作为通过所述目标端口未传输所述目标帧的时间。进而,可进一步计算通过所述目标端口未传输所述目标帧的时间与第一阈值的大小关系。In this embodiment of the present application, if the specified frame header mark does not exist in the frame header of the target frame, the current time may be recorded. At the same time, the time when the target frame is received can be recorded every time the target frame is received. In this way, in the case where the specified frame header mark does not exist in the frame header of the target frame, the recorded current time and the last recorded time when the target frame was received can be made difference, and the absolute value of this difference can be calculated as the difference. value as the time when the target frame was not transmitted through the target port. Furthermore, the relationship between the time when the target frame is not transmitted through the target port and the first threshold may be further calculated.

在网络设备已存储每一次接收到所述目标帧时所述钟表计数器记录的时间的情况下,本步骤130可包括:所述通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值包括:通过所述钟表计数器获取当前时间;获取所述目标端口上一次接收到所述目标帧时的指定时间;确定所述当前时间与所述指定时间之间的差值是否大于第一阈值。如此,可以便捷地得到所述目标端口未传输所述目标帧的时间,并将此时间与第一阈值进行比较。进而,可以有助于后续基于此确定是否失帧。In the case that the network device has stored the time recorded by the clock counter each time the target frame is received, this step 130 may include: determining the time when the target frame is not transmitted through the target port through the clock counter Whether it is greater than the first threshold includes: obtaining the current time through the clock counter; obtaining the specified time when the target port received the target frame last time; determining whether the difference between the current time and the specified time is greater than the first threshold. In this way, the time when the target port does not transmit the target frame can be conveniently obtained, and the time can be compared with the first threshold. Further, it may be helpful to subsequently determine whether to drop frames based on this.

步骤140,在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。Step 140 , when it is determined that the time when the target frame is not transmitted through the target port is greater than a first threshold, determine that a frame loss is detected.

在本申请实施例中,在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。所述第一阈值可以根据需要来设定,例如第一阈值为3帧、4帧或5帧等。也就是说,在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。所述第一阈值越小,检测到失帧的时间越短,第一阈值越大,检测到失帧的时间越长。In this embodiment of the present application, it is determined that a frame loss is detected when it is determined that the time during which the target frame is not transmitted through the target port is greater than a first threshold. The first threshold can be set as required, for example, the first threshold is 3 frames, 4 frames, or 5 frames. That is, in a case where it is determined that the time during which the target frame is not transmitted through the target port is greater than a first threshold, it is determined that a frame loss is detected. The smaller the first threshold is, the shorter the time for detecting frame loss is, and the larger the first threshold is, the longer the time for detecting frame loss is.

在本申请实施例中,钟表计数器可不受外界影响,可由石英晶体振荡器触发,按照设定的周期计时。例如,采用640MHz(兆赫兹)的钟表计数器,所述640MHz(兆赫兹)=640*1000KHZ(千赫兹),即在单位时间内完成振动的次数,单位为赫兹(1赫兹=1次/秒);采用640MHz(兆赫兹)的钟表计数器,先计数一个0~511的8位的二进制钟表计数器,记做count512[8:0],则所述钟表计数器count512[8:0]的一个周期是0.8μs(微秒),计算过程为512/(640MHz)=0.8μs。再计数一个从0到9999、周期为8ms(毫秒)的13位的二进制钟表计数器,记做count8ms[13:0],所述钟表计数器count8ms[13:0]是在所述钟表计数器count512[8:0]等于511时累加1,则钟表计数器cnt8ms[13:0]的一个周期是8ms(毫秒)。由所述钟表计数器count8ms[13:0]对目标端口传输目标帧的时间进行计时。In this embodiment of the present application, the timepiece counter may not be affected by the outside world, and may be triggered by a quartz crystal oscillator to count time according to a set period. For example, if a 640MHz (megahertz) watch counter is used, the 640MHz (megahertz) = 640*1000KHZ (kilohertz), that is, the number of times the vibration is completed in a unit time, the unit is Hertz (1 Hz = 1 time/second) ; Using a clock counter of 640MHz (megahertz), first count an 8-bit binary clock counter from 0 to 511, denoted as count512[8:0], then a period of the clock counter count512[8:0] is 0.8 μs (microseconds), the calculation process is 512/(640MHz)=0.8μs. Then count a 13-bit binary clock counter from 0 to 9999 with a period of 8ms (milliseconds), denoted as count8ms[13:0], the clock counter count8ms[13:0] is in the clock counter count512[8 When :0] is equal to 511, 1 is accumulated, and one cycle of the clock counter cnt8ms[13:0] is 8ms (milliseconds). The time for the target port to transmit the target frame is timed by the clock counter count8ms[13:0].

在本申请的一个实施例中,也可以采用其它频率的钟表计数器,例如采用100MHz(兆赫兹)的钟表计数器,100MHz(兆赫兹)的钟表计数器的频次低于640MHz(兆赫兹)的时钟频次,钟表计数器频次越低,计数器越大,代表钟表计数器计时周期越长。In an embodiment of the present application, a clock counter of other frequencies may also be used, for example, a clock counter of 100 MHz (megahertz) is used, and the frequency of the clock counter of 100 MHz (megahertz) is lower than the clock frequency of 640 MHz (megahertz). The lower the frequency of the clock counter, the larger the counter, which means the longer the time period of the clock counter.

在本申请实施例中失帧可以为帧丢失的意思。通信中没有收到帧信息或者帧信息没有同步都可以视为失帧。In this embodiment of the present application, frame loss may mean frame loss. If the frame information is not received in the communication or the frame information is not synchronized, it can be regarded as a lost frame.

在本申请实施例中,获取待由所述多个接口中的目标接口传输的目标帧;确定所述目标帧的帧头中是否存在指定帧头标记;在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。如此,可通过钟表计数器直接确定是否失帧,相较于传统的失帧检测方式,所用到的资源更少,因而能够解决相关技术中检测失帧的方式所用的资源较多的问题。In this embodiment of the present application, acquire a target frame to be transmitted by a target interface among the multiple interfaces; determine whether a specified frame header mark exists in the frame header of the target frame; In the presence of the specified frame header mark, determine whether the time when the target frame is not transmitted through the target port is greater than a first threshold through a clock counter; when it is determined that the time when the target frame is not transmitted through the target port is greater than In the case of the first threshold, it is determined that a dropped frame is detected. In this way, whether the frame is lost can be directly determined through the clock counter. Compared with the traditional frame loss detection method, fewer resources are used, so the problem of the related art method of detecting lost frame using more resources can be solved.

还需要说明的是,所述目标端口检测到未失帧时,目标帧的传输可通过工作路径信道传输,保护路径信道可处于关闭状态。所述目标端口检测到失帧时,目标帧的传输信道能从工作路径信道倒换到保护路径信道。It should also be noted that when the target port detects that no frame is lost, the transmission of the target frame may be transmitted through the working path channel, and the protection path channel may be in a closed state. When the target port detects frame loss, the transmission channel of the target frame can be switched from the working path channel to the protection path channel.

还需要说明的是,所述多个接口的网络设备可在插电后运行。在网络设备通电时,所述钟表计时器可以提供针对目标帧的各种时间,例如目标端口传输目标帧的时间。It should also be noted that the network devices of the multiple interfaces can run after being plugged in. When the network device is powered on, the clock timer can provide various times for the target frame, such as the time at which the target port transmits the target frame.

图2是本申请实施例提供的另一种检测失帧的方法的流程框图。参照图2,本申请实施例提供的另一种检测失帧的方法可由具有多个接口的网络设备执行,且可包括:FIG. 2 is a flowchart of another method for detecting frame loss provided by an embodiment of the present application. Referring to FIG. 2 , another method for detecting frame loss provided by an embodiment of the present application may be performed by a network device having multiple interfaces, and may include:

步骤210,获取待由所述多个接口中的目标接口传输的目标帧。Step 210: Acquire a target frame to be transmitted by a target interface among the multiple interfaces.

在本步骤中,多个接口可为网络设备上插入光纤的接口。In this step, the multiple interfaces may be the interfaces on the network device into which optical fibers are inserted.

步骤220,确定所述目标帧的帧头中是否存在指定帧头标记。Step 220: Determine whether a specified frame header mark exists in the frame header of the target frame.

在本步骤中,所述目标帧为传输中的数据,所述指定帧头标记可为F628(十六进制)。In this step, the target frame is data in transmission, and the specified frame header mark may be F628 (hexadecimal).

步骤230,在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值。Step 230: In the case that the specified frame header mark does not exist in the frame header of the target frame, determine whether the time during which the target frame is not transmitted through the target port is greater than a first threshold through a clock counter.

在本步骤中,钟表计数器不受外界影响,可由石英晶体振荡器触发,按照设定的周期计时。例如,采用640MHz(兆赫兹)的钟表计数器可获取所述目标端口未传输所述目标帧的时间。In this step, the clock counter is not affected by the outside world, and can be triggered by a quartz crystal oscillator to time the clock according to a set period. For example, using a 640MHz (megahertz) watch counter can obtain the time when the target port is not transmitting the target frame.

步骤240,在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。Step 240, when it is determined that the time for which the target frame is not transmitted through the target port is greater than a first threshold, determine that a frame loss is detected.

在本申请实施例中,在所述目标帧的帧头中不存在所述指定帧头标记的情况下,可记录当前的时间。同时可以在每一次接收到目标帧的情况下记录接收到目标帧时的时间。这样,在所述目标帧的帧头中不存在所述指定帧头标记的情况下,可以将记录的当前时间与上一次记录的接收到目标帧时的时间作差,将此差值的绝对值作为通过所述目标端口未传输所述目标帧的时间。进而,可进一步计算通过所述目标端口未传输所述目标帧的时间与第一阈值的大小关系。In this embodiment of the present application, if the specified frame header mark does not exist in the frame header of the target frame, the current time may be recorded. At the same time, the time when the target frame is received can be recorded every time the target frame is received. In this way, in the case where the specified frame header mark does not exist in the frame header of the target frame, the recorded current time and the last recorded time when the target frame was received can be made difference, and the absolute value of this difference can be calculated as the difference. value as the time when the target frame was not transmitted through the target port. Furthermore, the relationship between the time when the target frame is not transmitted through the target port and the first threshold may be further calculated.

步骤250,在确定检测到失帧之后,在接收到数据帧的情况下,向所述数据帧中插入指定标识,所述指定标识用于指示失帧状态。Step 250 , after it is determined that the frame loss is detected, in the case of receiving the data frame, insert a designated identifier into the data frame, where the designated identifier is used to indicate the frame loss state.

在本步骤中,所述指定标识可以为各种用于指示失帧状态的标识,例如为1或0等。以所述指定标识为1为例,可以在目标端口接收到数据帧中插入指定标识全1,这样可以指示处于是失帧状态。In this step, the specified identifier may be various identifiers used to indicate the frame loss status, such as 1 or 0. Taking the designated identifier as 1 as an example, all designated identifiers of 1 may be inserted into the data frame received by the target port, which may indicate that the frame is in a lost frame state.

需了解的是,本申请的数据帧可以为前文提到的目标帧。It should be understood that the data frame of the present application may be the target frame mentioned above.

在本申请实施例提供的检测失帧的方法中,在确定检测到失帧之后,在接收到数据帧的情况下,向所述数据帧中插入指定标识,所述指定标识用于指示失帧状态。如此,在确定检测到失帧之后,可以通过在数据帧中插入用于指示失帧状态的指定标识,后续数据帧的接收方即可根据此指定标识获知处于失帧状态,从而更有利于后续操作。In the method for detecting frame loss provided by the embodiment of the present application, after it is determined that the frame loss is detected, in the case of receiving a data frame, a specified identifier is inserted into the data frame, and the specified identifier is used to indicate the frame loss. state. In this way, after it is determined that the frame loss is detected, a designated identifier for indicating the frame loss state can be inserted into the data frame, and the receiver of the subsequent data frame can know that the frame loss state is in accordance with this designated identifier, which is more conducive to the follow-up. operate.

图3是本申请实施例提供的另一种检测失帧的方法流程框图。参照图3,本申请实施例提供的检测失帧的方法可由多个接口的网络设备执行。本申请实施例提供的检测失帧的方法可包括:FIG. 3 is a flowchart of another method for detecting frame loss provided by an embodiment of the present application. Referring to FIG. 3 , the method for detecting frame loss provided by this embodiment of the present application may be executed by a network device with multiple interfaces. The method for detecting frame loss provided by the embodiment of the present application may include:

步骤310,获取待由所述多个接口中的目标接口传输的目标帧;Step 310, acquiring the target frame to be transmitted by the target interface in the multiple interfaces;

步骤320,确定所述目标帧的帧头中是否存在指定帧头标记;Step 320, determine whether there is a designated frame header mark in the frame header of the target frame;

步骤330,在所述目标帧的帧头中存在所述指定帧头标记的情况下,判断所述目标帧的帧头是否正确;Step 330, in the case where the specified frame header mark exists in the frame header of the target frame, determine whether the frame header of the target frame is correct;

在本步骤中,目标帧的帧头可为F628(十六进制)。In this step, the frame header of the target frame may be F628 (hexadecimal).

步骤340,在所述目标帧的帧头错误的情况下,将帧错误计数器的取值加1;Step 340, in the case that the frame header of the target frame is wrong, add 1 to the value of the frame error counter;

步骤350,在所述帧错误计数器的取值达到预设值的情况下,确定检测到失帧。Step 350, when the value of the frame error counter reaches a preset value, determine that a frame loss is detected.

在本步骤中,所述帧头错误计数器的取值未达到预设值的情况下,确定检测到未失帧。所述预设值可以根据需要来设定,例如所述预设值为3帧、4帧或5帧等。也就是说,在所述帧头错误计数器的取值达到预设值的情况下,确定检测到失帧。所述预设值越小,检测到失帧所用的时间越短,所述预设值越大,检测到失帧的时间越长。In this step, if the value of the frame header error counter does not reach the preset value, it is determined that no frame loss is detected. The preset value can be set as required, for example, the preset value is 3 frames, 4 frames, or 5 frames. That is, when the value of the frame header error counter reaches a preset value, it is determined that a frame loss is detected. The smaller the preset value is, the shorter the time taken to detect the frame loss is, and the larger the preset value is, the longer the time to detect the frame loss is.

在本申请实施例中,在所述目标帧的帧头中存在所述指定帧头标记的情况下,在所述目标帧的帧头错误的情况下,将帧错误计数器的取值加1,在所述帧错误计数器的取值达到预设值的情况下,确定检测到失帧。此种检测失帧的方式,在所述目标帧的帧头中存在所述指定帧头标记的情况下,通过统计所述目标帧的帧头出现错误的数目,并在出现错误的数目达到一定次数的情况下,确定失帧。如此可以将失帧检测的方式适用于所述目标帧的帧头中存在所述指定帧头标记的情况,可以扩大失帧的检测范围,避免在一些可能出现失帧的情况下无法检测到失帧的问题。In the embodiment of the present application, in the case that the specified frame header mark exists in the frame header of the target frame, in the case of an error in the frame header of the target frame, the value of the frame error counter is increased by 1, When the value of the frame error counter reaches a preset value, it is determined that a frame loss is detected. In this way of detecting frame loss, in the case where the specified frame header mark exists in the frame header of the target frame, the number of errors in the frame header of the target frame is counted, and when the number of errors reaches a certain level. In the case of the number of times, it is determined that the frame is dropped. In this way, the method of frame loss detection can be applied to the situation where the specified frame header mark exists in the frame header of the target frame, and the detection range of frame loss can be expanded to avoid failure to detect frame loss in some cases where frame loss may occur. frame problem.

在本申请的一个实施例中,可选地,在图3步骤330之后,即在所述目标帧的帧头中存在所述指定帧头标记的情况下,还可判断所述目标帧的帧头是否正确之后,若所述目标帧的帧头正确,则本申请实施例提供的检测失帧的方法还可包括:在所述目标帧的帧头正确的情况下,将所述帧错误计数器的取值置为0,并确定检测到未失帧。In an embodiment of the present application, optionally, after step 330 in FIG. 3 , that is, in the case where the specified frame header mark exists in the frame header of the target frame, the frame of the target frame can also be judged After whether the header is correct, if the frame header of the target frame is correct, the method for detecting frame loss provided by the embodiment of the present application may further include: if the frame header of the target frame is correct, setting the frame error counter The value of is set to 0, and it is determined that no frame loss is detected.

在本申请实施例中,在所述目标帧的帧头中存在所述指定帧头标记的情况下,判断所述目标帧的帧头是否正确;在所述目标帧的帧头正确的情况下,将所述帧错误计数器的取值置为0,并确定检测到未失帧。如此,在所述目标帧的帧头正确的情况下,通过将帧错误计数器的取值置为0,可以方便后续在出现失帧的情况下,利用所述帧错误计数器重新开始计时,保证失帧统计的准确性。In the embodiment of the present application, in the case that the specified frame header mark exists in the frame header of the target frame, it is judged whether the frame header of the target frame is correct; in the case that the frame header of the target frame is correct , the value of the frame error counter is set to 0, and it is determined that no frame loss is detected. In this way, in the case that the frame header of the target frame is correct, by setting the value of the frame error counter to 0, it is convenient to use the frame error counter to restart the timing in the case of missing frames in the future, so as to ensure the missing frame. Accuracy of frame statistics.

图4是本申请实施例提供的另一种检测失帧的方法的流程框图。参照图4,另一种检测失帧的方法可包括:FIG. 4 is a flowchart of another method for detecting frame loss provided by an embodiment of the present application. Referring to FIG. 4, another method for detecting frame loss may include:

步骤410,获取待由所述多个接口中的目标接口传输的目标帧。Step 410: Acquire a target frame to be transmitted by a target interface among the multiple interfaces.

步骤420,存储每一次接收到所述目标帧时钟表计数器记录的时间。Step 420: Store the time recorded by the clock table counter each time the target frame is received.

步骤430,确定所述目标帧的帧头中是否存在指定帧头标记。Step 430: Determine whether a specified frame header mark exists in the frame header of the target frame.

在所述目标帧的帧头中存在指定帧头标记的情况下,执行步骤440;在所述目标帧的帧头中不存在指定帧头标记的情况下,执行步骤450。If there is a designated frame header mark in the frame header of the target frame, step 440 is performed; if there is no designated frame header mark in the frame header of the target frame, step 450 is performed.

步骤440,在所述目标帧的帧头中存在所述指定帧头标记的情况下,判断所述目标帧的帧头是否正确。在所述目标帧的帧头错误的情况下,执行步骤442。在所述目标帧的帧头正确的情况下,执行步骤444。Step 440: In the case that the specified frame header mark exists in the frame header of the target frame, determine whether the frame header of the target frame is correct. In the case that the frame header of the target frame is wrong, step 442 is executed. If the frame header of the target frame is correct, step 444 is performed.

步骤442,在所述目标帧的帧头错误的情况下,将帧错误计数器的取值加1;在所述帧错误计数器的取值达到预设值的情况下,确定检测到失帧。Step 442, in the case that the frame header of the target frame is incorrect, add 1 to the value of the frame error counter; in the case that the value of the frame error counter reaches a preset value, determine that a frame loss is detected.

步骤444,在所述目标帧的帧头正确的情况下,将所述帧错误计数器的取值置为0,并确定检测到未失帧。Step 444, in the case that the frame header of the target frame is correct, set the value of the frame error counter to 0, and determine that no missing frames are detected.

步骤450,在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过所述钟表计数器获取当前时间;获取所述目标端口上一次接收到所述目标帧时的指定时间。Step 450, in the case where the specified frame header mark does not exist in the frame header of the target frame, obtain the current time through the clock counter; obtain the specified time when the target port received the target frame last time .

步骤460,确定所述当前时间与所述指定时间之间的差值是否大于第一阈值。Step 460: Determine whether the difference between the current time and the specified time is greater than a first threshold.

步骤470,在所述当前时间与所述指定时间之间的差值大于第一阈值的情况下,确定检测到失帧。Step 470, in the case that the difference between the current time and the specified time is greater than a first threshold, determine that frame loss is detected.

步骤480,在确定检测到失帧之后,在接收到数据帧的情况下,向所述数据帧中插入指定标识,所述指定标识用于指示失帧状态。Step 480, after it is determined that the frame loss is detected, in the case of receiving the data frame, insert a designated identifier into the data frame, where the designated identifier is used to indicate the frame loss state.

在本申请实施例提供的检测失帧的方法中,可通过钟表计数器直接确定是否失帧,相较于传统的失帧检测方式,所用到的资源更少,因而能够解决相关技术中检测失帧的方式所用的资源较多的问题。同时,在确定检测到失帧之后,可以通过在数据帧中插入用于指示失帧状态的指定标识,后续数据帧的接收方即可根据此指定标识获知处于失帧状态,从而更有利于后续操作。例如,在检测到失帧的情况下,可以将目标帧的传输信道从工作路径信道倒换到保护路径信道,从而保证传输的目标帧不中断。In the method for detecting frame loss provided by the embodiment of the present application, whether the frame is lost can be directly determined through a clock counter. Compared with the traditional frame loss detection method, fewer resources are used, so it can solve the problem of detecting frame loss in the related art. way to use more resources. At the same time, after it is determined that the frame loss is detected, a designated identifier for indicating the frame loss state can be inserted into the data frame, and the receiver of the subsequent data frame can know that the frame loss state is in accordance with the designated identifier, which is more conducive to the follow-up. operate. For example, in the case of detection of frame loss, the transmission channel of the target frame can be switched from the working path channel to the protection path channel, thereby ensuring that the transmitted target frame is not interrupted.

图5是本申请提供的一种检测失帧的装置的结构框图。参照图5,所述检测失帧的装置包括:获取模块510和处理模块520。FIG. 5 is a structural block diagram of an apparatus for detecting frame loss provided by the present application. Referring to FIG. 5 , the apparatus for detecting frame loss includes: an acquisition module 510 and a processing module 520 .

其中,获取模块510,用于获取待由多个接口中的目标接口传输的目标帧。处理模块520,用于确定所述目标帧的帧头中是否存在指定帧头标记;在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。如此,通过钟表计数器直接确定是否失帧,相较于传统的失帧检测方式,所用到的资源更少,因而能够解决相关技术中检测失帧的方式所用的资源较多的问题。Wherein, the obtaining module 510 is configured to obtain the target frame to be transmitted by the target interface among the multiple interfaces. The processing module 520 is configured to determine whether there is a specified frame header mark in the frame header of the target frame; in the case that the specified frame header mark does not exist in the frame header of the target frame, determine through the clock counter Whether the time when the target port does not transmit the target frame is greater than a first threshold; in the case where it is determined that the time when the target frame is not transmitted through the target port is greater than the first threshold, it is determined that a frame loss is detected. In this way, using the clock counter to directly determine whether the frame is lost, compared with the traditional frame loss detection method, less resources are used, and thus the problem of the related art method of detecting the lost frame using more resources can be solved.

可选地,在本申请的一个实施例中,所述处理模块520可用于在确定检测到失帧之后,在接收到数据帧的情况下,向所述数据帧中插入指定标识,所述指定标识用于指示失帧状态。如此,在确定检测到失帧之后,可以通过在数据帧中插入用于指示失帧状态的指定标识,后续数据帧的接收方即可根据此指定标识获知处于失帧状态,从而更有利于后续操作。Optionally, in an embodiment of the present application, the processing module 520 may be configured to insert a specified identifier into the data frame after it is determined that a frame loss is detected, and the specified identifier is The flag is used to indicate the drop frame status. In this way, after it is determined that the frame loss is detected, a designated identifier for indicating the frame loss state can be inserted into the data frame, and the receiver of the subsequent data frame can know that the frame loss state is in accordance with this designated identifier, which is more conducive to the follow-up. operate.

可选地,在本申请的一个实施例中,所述处理模块520还用于在所述目标帧的帧头中存在所述指定帧头标记的情况下,判断所述目标帧的帧头是否正确,在所述目标帧的帧头错误的情况下,将帧错误计数器的取值加1。在所述帧错误计数器的取值达到预设值的情况下,确定检测到失帧。如此,此种检测失帧的方式,在所述目标帧的帧头中存在所述指定帧头标记的情况下,通过统计所述目标帧的帧头出现错误的数目,并在出现错误的数目达到一定次数的情况下,确定失帧。如此可以将失帧检测的方式适用于所述目标帧的帧头中存在所述指定帧头标记的情况,可以扩大失帧的检测范围,避免在一些可能出现失帧的情况下无法检测到失帧的问题。Optionally, in an embodiment of the present application, the processing module 520 is further configured to determine whether the frame header of the target frame is not Correct, in the case that the frame header of the target frame is incorrect, the value of the frame error counter is incremented by 1. When the value of the frame error counter reaches a preset value, it is determined that a frame loss is detected. In this way, in this way of detecting frame loss, in the case where the specified frame header mark exists in the frame header of the target frame, the number of errors in the frame header of the target frame is counted, and the number of errors that occur in the frame header of the target frame. When a certain number of times is reached, it is determined that the frame is dropped. In this way, the method of frame loss detection can be applied to the situation where the specified frame header mark exists in the frame header of the target frame, and the detection range of frame loss can be expanded to avoid failure to detect frame loss in some cases where frame loss may occur. frame problem.

可选地,在本申请的一个实施例中,所述处理模块520还用于在所述目标帧的帧头中存在所述指定帧头标记的情况下,判断所述目标帧的帧头是否正确,在所述目标帧的帧头正确的情况下,将所述帧错误计数器的取值置为0,并确定检测到未失帧。如此,在所述目标帧的帧头正确的情况下,通过将帧错误计数器的取值置为0,可以方便后续在出现失帧的情况下,利用所述帧错误计数器重新开始计时,保证失帧统计的准确性。Optionally, in an embodiment of the present application, the processing module 520 is further configured to determine whether the frame header of the target frame is not Correct, if the frame header of the target frame is correct, the value of the frame error counter is set to 0, and it is determined that no frame loss is detected. In this way, in the case that the frame header of the target frame is correct, by setting the value of the frame error counter to 0, it is convenient to use the frame error counter to restart the timing in the case of missing frames in the future, so as to ensure the missing frame. Accuracy of frame statistics.

可选地,在本申请的一个实施例中,所述装置还包括:存储模块,用于存储每一次接收到所述目标帧时所述钟表计数器记录的时间。在通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值的过程中,所述处理模块具体用于:通过所述钟表计数器获取当前时间;获取所述目标端口上一次接收到所述目标帧时的指定时间;确定所述当前时间与所述指定时间之间的差值是否大于第一阈值。如此,可以便捷地得到所述目标端口未传输所述目标帧的时间,并将此时间与第一阈值进行比较。进而,可以有助于后续基于此确定是否失帧。Optionally, in an embodiment of the present application, the apparatus further includes: a storage module configured to store the time recorded by the clock counter each time the target frame is received. In the process of determining whether the time during which the target frame is not transmitted through the target port is greater than a first threshold through the clock counter, the processing module is specifically configured to: obtain the current time through the clock counter; A designated time when the target frame is received once; determining whether the difference between the current time and the designated time is greater than a first threshold. In this way, the time when the target port does not transmit the target frame can be conveniently obtained, and the time can be compared with the first threshold. Further, it may be helpful for subsequent determination of whether to drop frames based on this.

图6是本申请提供的一种网络设备的示意图;本申请实施例提供的网络设备可包括:处理器610和存储器620。其中,所述存储器存储在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现本申请实施例提供的任一种检测失帧的方法的步骤。FIG. 6 is a schematic diagram of a network device provided by the present application; the network device provided by this embodiment of the present application may include: a processor 610 and a memory 620 . Wherein, the memory stores a program or an instruction running on the processor, and when the program or instruction is executed by the processor, the steps of any of the methods for detecting frame loss provided in the embodiments of the present application are implemented.

本申请实施例提供的网络设备,获取待由所述多个接口中的目标接口传输的目标帧;确定所述目标帧的帧头中是否存在指定帧头标记;在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。如此,可通过钟表计数器直接确定是否失帧,相较于传统的失帧检测方式,所用到的资源更少,因而能够解决相关技术中检测失帧的方式所用的资源较多的问题。The network device provided in the embodiment of the present application acquires a target frame to be transmitted by a target interface among the multiple interfaces; determines whether a specified frame header mark exists in the frame header of the target frame; In the case where the specified frame header mark does not exist in the frame, determine whether the time when the target frame is not transmitted through the target port is greater than the first threshold through a clock counter; when it is determined that the target frame is not transmitted through the target port When the time is greater than the first threshold, it is determined that a frame loss is detected. In this way, whether the frame is lost can be directly determined through the clock counter. Compared with the traditional frame loss detection method, fewer resources are used, so the problem of the related art method of detecting lost frame using more resources can be solved.

本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述检测失帧的方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Embodiments of the present application further provide a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, each process of the foregoing method for detecting frame loss is implemented, and can To achieve the same technical effect, in order to avoid repetition, details are not repeated here.

其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器ROM、随机存取存储器RAM、磁碟或者光盘等。Wherein, the processor is the processor in the electronic device described in the foregoing embodiments. The readable storage medium includes a computer-readable storage medium, such as computer read-only memory ROM, random access memory RAM, magnetic disk or optical disk, and the like.

本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述检测失帧的方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。An embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement the above method for detecting frame loss In order to avoid repetition, the details are not repeated here.

应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, a system-on-chip, a system-on-a-chip, or a system-on-a-chip, or the like.

本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如上述检测失帧的方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。An embodiment of the present application provides a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the various processes of the foregoing method embodiments for detecting frame loss, and can achieve the same The technical effect, in order to avoid repetition, will not be repeated here.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in the reverse order depending on the functions involved. To perform functions, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to some examples may be combined in other examples.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course hardware can also be used, but in many cases the former is better implementation. Based on this understanding, the technical solutions of the present application can be embodied in the form of computer software products that are essentially or contribute to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM, magnetic disk , CD), including several instructions to make a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) execute the methods described in the various embodiments of the present application.

上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific embodiments, which are merely illustrative rather than restrictive. Under the inspiration of this application, without departing from the scope of protection of the purpose of this application and the claims, many forms can be made, which all fall within the protection of this application.

Claims (10)

1.一种检测失帧的方法,其特征在于,由具有多个接口的网络设备执行,所述方法包括:1. A method for detecting frame loss, characterized in that, being performed by a network device having a plurality of interfaces, the method comprising: 获取待由所述多个接口中的目标接口传输的目标帧;obtaining a target frame to be transmitted by a target interface in the plurality of interfaces; 确定所述目标帧的帧头中是否存在指定帧头标记;Determine whether there is a specified frame header mark in the frame header of the target frame; 在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;In the case that the specified frame header mark does not exist in the frame header of the target frame, determine whether the time during which the target frame is not transmitted through the target port is greater than a first threshold through a clock counter; 在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。In a case where it is determined that the time for which the target frame is not transmitted through the target port is greater than a first threshold, it is determined that a frame loss is detected. 2.根据权利要求1所述的方法,其特征在于,在所述确定检测到失帧之后,所述方法还包括:2. The method according to claim 1, characterized in that after said determining that a frame loss is detected, the method further comprises: 在接收到数据帧的情况下,向所述数据帧中插入指定标识,所述指定标识用于指示失帧状态。In the case of receiving a data frame, insert a designated identifier into the data frame, where the designated identifier is used to indicate a frame loss state. 3.根据权利要求1所述的方法,其特征在于,所述方法还包括:3. The method according to claim 1, wherein the method further comprises: 在所述目标帧的帧头中存在所述指定帧头标记的情况下,判断所述目标帧的帧头是否正确;In the case where the specified frame header mark exists in the frame header of the target frame, determine whether the frame header of the target frame is correct; 在所述目标帧的帧头错误的情况下,将帧错误计数器的取值加1;In the case that the frame header of the target frame is wrong, add 1 to the value of the frame error counter; 在所述帧错误计数器的取值达到预设值的情况下,确定检测到失帧。When the value of the frame error counter reaches a preset value, it is determined that a frame loss is detected. 4.根据权利要求3所述的方法,其特征在于,所述方法还包括:4. The method according to claim 3, wherein the method further comprises: 在所述目标帧的帧头正确的情况下,将所述帧错误计数器的取值置为0,并确定检测到未失帧。In the case that the frame header of the target frame is correct, the value of the frame error counter is set to 0, and it is determined that no frame loss is detected. 5.根据权利要求1所述的方法,其特征在于,所述方法还包括:存储每一次接收到所述目标帧时所述钟表计数器记录的时间;5. The method according to claim 1, wherein the method further comprises: storing the time recorded by the timepiece counter each time the target frame is received; 所述通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值包括:The determining by the clock counter whether the time during which the target frame is not transmitted through the target port is greater than a first threshold includes: 通过所述钟表计数器获取当前时间;Obtain the current time through the clock counter; 获取所述目标端口上一次接收到所述目标帧时的指定时间;Obtain the specified time when the target port received the target frame last time; 确定所述当前时间与所述指定时间之间的差值是否大于第一阈值。It is determined whether the difference between the current time and the specified time is greater than a first threshold. 6.一种检测失帧的装置,其特征在于,所述装置包括:6. A device for detecting frame loss, wherein the device comprises: 获取模块,用于获取待由多个接口中的目标接口传输的目标帧;an acquisition module for acquiring the target frame to be transmitted by the target interface in the multiple interfaces; 处理模块,用于确定所述目标帧的帧头中是否存在指定帧头标记;在所述目标帧的帧头中不存在所述指定帧头标记的情况下,通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值;在确定通过所述目标端口未传输所述目标帧的时间大于第一阈值的情况下,确定检测到失帧。The processing module is used to determine whether there is a specified frame header mark in the frame header of the target frame; in the case where the specified frame header mark does not exist in the frame header of the target frame, it is determined by a clock counter to pass the target frame. Whether the time when the port does not transmit the target frame is greater than a first threshold; in the case where it is determined that the time when the target frame is not transmitted through the target port is greater than the first threshold, it is determined that a frame loss is detected. 7.根据权利要求6所述的装置,其特征在于,所述处理模块还用于:在确定检测到失帧之后,在接收到数据帧的情况下,向所述数据帧中插入指定标识,所述指定标识用于指示失帧状态。7. The apparatus according to claim 6, wherein the processing module is further configured to: after it is determined that a frame loss is detected, in the case of receiving a data frame, insert a designated identifier into the data frame, The specified identifier is used to indicate a frame loss state. 8.根据权利要求6所述的装置,其特征在于,所述处理模块还用于:8. The apparatus according to claim 6, wherein the processing module is further configured to: 在所述目标帧的帧头中存在所述指定帧头标记的情况下,判断所述目标帧的帧头是否正确;In the case where the specified frame header mark exists in the frame header of the target frame, determine whether the frame header of the target frame is correct; 在所述目标帧的帧头错误的情况下,将帧错误计数器的取值加1;In the case that the frame header of the target frame is wrong, add 1 to the value of the frame error counter; 在所述帧错误计数器的取值达到预设值的情况下,确定检测到失帧。When the value of the frame error counter reaches a preset value, it is determined that a frame loss is detected. 9.根据权利要求8所述的装置,其特征在于,所述处理模块还用于:9. The apparatus according to claim 8, wherein the processing module is further configured to: 在所述目标帧的帧头正确的情况下,将所述帧错误计数器的取值置为0,并确定检测到未失帧。In the case that the frame header of the target frame is correct, the value of the frame error counter is set to 0, and it is determined that no frame loss is detected. 10.根据权利要求6所述的装置,其特征在于,所述装置还包括:存储模块,用于存储每一次接收到所述目标帧时所述钟表计数器记录的时间;10. The device according to claim 6, wherein the device further comprises: a storage module for storing the time recorded by the clock counter each time the target frame is received; 在通过钟表计数器确定通过所述目标端口未传输所述目标帧的时间是否大于第一阈值的过程中,所述处理模块具体用于:In the process of determining whether the time during which the target frame is not transmitted through the target port is greater than a first threshold by using a clock counter, the processing module is specifically configured to: 通过所述钟表计数器获取当前时间;Obtain the current time through the clock counter; 获取所述目标端口上一次接收到所述目标帧时的指定时间;Obtain the specified time when the target port received the target frame last time; 确定所述当前时间与所述指定时间之间的差值是否大于第一阈值。It is determined whether the difference between the current time and the specified time is greater than a first threshold.
CN202111519503.6A 2021-12-13 2021-12-13 Method and device for detecting lost frame Pending CN114500329A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111519503.6A CN114500329A (en) 2021-12-13 2021-12-13 Method and device for detecting lost frame

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111519503.6A CN114500329A (en) 2021-12-13 2021-12-13 Method and device for detecting lost frame

Publications (1)

Publication Number Publication Date
CN114500329A true CN114500329A (en) 2022-05-13

Family

ID=81492103

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111519503.6A Pending CN114500329A (en) 2021-12-13 2021-12-13 Method and device for detecting lost frame

Country Status (1)

Country Link
CN (1) CN114500329A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001217767A (en) * 2000-01-28 2001-08-10 Matsushita Electric Ind Co Ltd Device and method for detecting out-of-step
CN1411198A (en) * 2001-09-25 2003-04-16 义隆电子股份有限公司 Method and system for detecting and recovering data loss in wireless communication
CN1964292A (en) * 2006-09-29 2007-05-16 Ut斯达康通讯有限公司 A method used to detect and feedback frame loss ratio of lub FP frame based on IP transmission
CN101217339A (en) * 2007-12-29 2008-07-09 华为技术有限公司 A method, device and base station for frame dropping detection
CN106209496A (en) * 2016-06-23 2016-12-07 珠海格力电器股份有限公司 Communication abnormity detection device and method
CN112422253A (en) * 2020-10-27 2021-02-26 北京邮电大学 Real-time co-frequency simultaneous full duplex reliable transmission method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001217767A (en) * 2000-01-28 2001-08-10 Matsushita Electric Ind Co Ltd Device and method for detecting out-of-step
CN1411198A (en) * 2001-09-25 2003-04-16 义隆电子股份有限公司 Method and system for detecting and recovering data loss in wireless communication
CN1964292A (en) * 2006-09-29 2007-05-16 Ut斯达康通讯有限公司 A method used to detect and feedback frame loss ratio of lub FP frame based on IP transmission
CN101217339A (en) * 2007-12-29 2008-07-09 华为技术有限公司 A method, device and base station for frame dropping detection
CN106209496A (en) * 2016-06-23 2016-12-07 珠海格力电器股份有限公司 Communication abnormity detection device and method
CN112422253A (en) * 2020-10-27 2021-02-26 北京邮电大学 Real-time co-frequency simultaneous full duplex reliable transmission method and device

Similar Documents

Publication Publication Date Title
CN109669899B (en) Method for adaptively adjusting serial port communication baud rate and serial port device
CN109921915B (en) Method and device for testing wake-up function of real-time clock module and electronic equipment
CN108683482B (en) Method and device for estimating timing position
CN107566088B (en) A kind of method of adjustment and charging adapter of baud rate
CN110139355B (en) Method, device and equipment for managing threshold pair change
CN111177060B (en) Serial port data sending method, receiving method, corresponding device and terminal equipment
US20160065358A1 (en) Synchronization method, intermediate node, and slave node of communication network system
US10778281B2 (en) Method and device for controlling frequency hopping, transmitter and receiver
CN114500329A (en) Method and device for detecting lost frame
CN110535621B (en) Serial port communication baud rate correction device and correction method thereof
CN111819891B (en) Time synchronization and broadcast setting method, chip, electronic device, and storage medium
CN113868180A (en) Control method and device for single bus communication and in-vitro shock wave equipment
WO2018072091A1 (en) Data processing method and base station device
WO2016000324A1 (en) Method and apparatus for implementing time synchronization
CN112636825A (en) Method, device and system for measuring time delay in optical transport network
RU2675213C2 (en) Method of identifying optical module status in optical network unit, optical network unit and storage medium
CN105681016A (en) Time synchronization method and device
CN102355317A (en) Processing method of phase jump and apparatus thereof
TWI772574B (en) Universal serial bus device and operation method thereof
CN113726595A (en) Detection method and device of timeout client, electronic equipment and storage medium
Sharma et al. An empirical study of clock skew behavior in modern mobile and hand-held devices
RU2020100213A (en) METHOD FOR DETERMINING THE QUALITY OF COMMUNICATION CHANNEL AND TERMINAL DEVICE
KR20050006396A (en) Apparatus and Method for detecting synchronization signal
CN114362910B (en) Ethernet clock adjusting method and device
CN106130822B (en) Uniformly send the method and system of CCM message

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20220513