Flow control anomaly optimization method and device, Bluetooth equipment and transmission system
Patent Information
- Application Number
- CN202411344725.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-03
AI Technical Summary
In the DLC flow control mechanism based on credit point, CRC verification errors lead to the loss of credit points, affecting the data transmission rate.
The receiving device analyzes the data packet and determines whether it is abnormal. If it is abnormal, it directly feedbacks the credit point to avoid the loss of credit points caused by CRC verification errors, ensures that the total number of credit points does not decrease, thereby maintaining the data transmission rate.
It effectively reduces the impact of CRC verification errors on data transmission rate, ensures that credit points are not reduced due to verification errors, and avoids the decline in data transmission rate caused by the reduction of credit points.
Smart Images

Figure CN119070954A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and more specifically, to a flow control exception optimization method, apparatus, Bluetooth device, and transmission system. Background Art
[0002] In the credit-based DLC (Data Link Control) flow control mechanism, the number of credits is used to control the speed of data transmission and ensure that data is not lost when interacting between different devices.
[0003] However, in the credit-based DLC flow control mechanism, the sending device will configure a credit for a data packet when sending the data packet. After receiving the data packet, the receiving device will return the credit of the data packet to the sending device. In this way, the receiving device and the sending device can keep the total number of credits fixed.
[0004] However, some receiving devices will use CRC (Cyclic Redundancy Check) to calibrate the data packets when receiving them. The CRC may make errors, which will prevent the data packets from reaching the designated location of the receiving device. The receiving device will not return the credit to the sending device, which will cause the credit to be lost permanently. The credit-based DLC flow control mechanism regulates the rate of sending and receiving data packets based on the number of credits. When the number of credits decreases, the number of data packets that the sending device can send at one time will decrease, and even when the credit is 0, data cannot be sent. Summary of the invention
[0005] In view of this, the present application aims to provide a flow control exception optimization method, apparatus, Bluetooth device and transmission system to reduce the impact of CRC check errors on the data transmission rate of a credit-based flow control mechanism.
[0006] In the first aspect, an embodiment of the present application provides a flow control anomaly optimization method, which is applied to a receiving device, wherein the receiving device is communicatively connected to a sending device, and the transmission of data packets between the receiving device and the sending device is controlled based on credit points; the sending device verifies the sent data packets based on a cyclic redundancy check CRC; the flow control anomaly optimization method comprises: obtaining a target data packet that has passed the CRC check; parsing the target data packet to determine whether the target data packet is abnormal; and if the target data packet is abnormal, feeding back the credit points to the sending device.
[0007] In the case of a CRC check error, the data packet cannot reach the destination, and accordingly, the receiving device will not feedback credit points to the sending device. Therefore, in an embodiment of the present application, for a target data packet that passes the CRC check, it can be analyzed to determine whether the target data packet may be a data packet with a CRC check error. When it is determined that the target data packet has an abnormality caused by a check error, credit points are directly fed back to the sending device. As a result, the credit points of the sending device can be replenished, and the total number of credit points will not be reduced due to the check error and the inability to feed back credit points, thereby reducing or avoiding the situation where the data transmission rate decreases due to the reduction in credit points.
[0008] In one embodiment, parsing the target data packet and determining whether the target data packet is abnormal includes: performing an overall analysis on the target data packet; the overall analysis is used to determine whether parameter values in the target data packet comply with the specifications of the Bluetooth communication protocol; if the result of the overall analysis indicates that the target data packet does not comply with the specifications of the Bluetooth communication protocol and cannot be transmitted backward, determining that the overall analysis of the target data packet has failed, and determining that the target data packet is abnormal.
[0009] In the embodiment of the present application, the overall analysis is used to determine whether the parameter value in the target data packet complies with the specification of the Bluetooth communication protocol, that is, to determine whether the parameter value exceeds the allowable range of the Bluetooth communication protocol. Through the overall analysis, obviously abnormal parameters can be determined, and then it can be determined whether the data packet can be transmitted backward to reach the destination, effectively reducing the loss of credit points due to CRC check errors. For some abnormal parameters, they may not affect the data packet reaching the destination. At this time, they are not determined as abnormal, which can avoid the situation of additional feedback of credit points due to the overall analysis.
[0010] In one embodiment, the target data packet is received after passing through multiple protocol layers after the CRC check is passed, and each protocol layer is configured with a corresponding communication protocol; the target data packet includes sub-data packets corresponding to each protocol layer; the overall parsing of the target data packet includes: for each protocol layer passed by the target data packet, the overall parsing of the sub-data packets corresponding to the protocol layer is performed based on the Bluetooth communication protocol corresponding to the protocol layer; wherein, if the overall parsing of the sub-data corresponding to any protocol layer fails, it indicates that the target data packet does not comply with the specification of the Bluetooth communication protocol and cannot be transmitted backward.
[0011] In the embodiment of the present application, overall parsing is performed at different protocol layers respectively, and each protocol layer only needs to detect the sub-packets related to the current protocol in the target data packet based on the Bluetooth communication protocol of the protocol layer, without obtaining the protocols of other protocol layers for detection, which can effectively improve the efficiency of the overall parsing. At the same time, through the hierarchical parsing of different protocol layers, if the overall parsing of the previous protocol layer fails, since the target data packet will not be able to be transmitted backward, in the hierarchical parsing method, the subsequent protocol layers do not need to be parsed, and each protocol layer can determine whether there are abnormal data packets, so as to avoid the situation where the data packet has been lost when the abnormality of the data packet is not determined, thereby improving the effectiveness of the feedback credit points.
[0012] In one embodiment, for each of the protocol layers passed by the target data packet, the overall parsing of the sub-data packet corresponding to the protocol layer is performed based on the Bluetooth communication protocol corresponding to the protocol layer, including: obtaining the preset data packet requirements corresponding to the protocol layer; the preset data packet requirements include the specifications of the parameters in the sub-data packet corresponding to the protocol layer by the Bluetooth communication protocol corresponding to the protocol layer; comparing the sub-data packet corresponding to the protocol layer with the preset data packet requirements; determining that the overall parsing of the target data packet by the protocol layer is passed if the sub-data packet corresponding to the protocol layer meets the preset data packet requirements or allows backward transmission; determining that the overall parsing of the target data packet by the protocol layer is failed if the sub-data packet corresponding to the protocol layer does not meet the preset data packet requirements.
[0013] In the embodiment of the present application, the preset data packet requirements corresponding to the protocol layer include the specification requirements of the Bluetooth communication protocol of the protocol layer for the structure and parameters of the data packet. If the sub-data packet meets the corresponding preset data packet requirements, it indicates that the sub-data packet is normal and can be transmitted backward normally. For some minor errors, if they do not affect the backward transmission, they are also determined as the overall parsing passed. On the contrary, only when the target data packet cannot be transmitted backward, it is determined as the overall parsing failed. In this way, the occurrence of additional feedback credit points due to the correct feedback credit points of the data packet can be reduced.
[0014] In one embodiment, the sending device and the receiving device transmit data packets based on a session; after the target data packet is analyzed as a whole, the method further includes: when the overall analysis of any of the protocol layers passes, locally analyzing the sub-data packet corresponding to the protocol layer based on the characteristic requirements of the session corresponding to the target data packet; when the local analysis of the sub-data packet corresponding to the protocol layer fails, determining that the target data packet is abnormal; wherein the local analysis is used to determine whether the characteristics of the sub-data packet corresponding to the protocol layer match the characteristic requirements of the corresponding session; when they match, determining that the local analysis of the sub-data packet corresponding to the protocol layer passes; when they do not match, determining that the local analysis of the sub-data packet corresponding to the protocol layer fails.
[0015] In the embodiment of the present application, the overall analysis is used to determine whether the parameters in the target data packet meet the specifications, such as whether they exceed the numerical range specified by the protocol, but not to determine whether the parameters meet the characteristic requirements of the current protocol layer for the parameters, for example, whether the parameters are specific values required by the current protocol layer. Therefore, if the overall analysis is passed, further local analysis is performed to determine whether the characteristics of the sub-data packet match the characteristic requirements of the corresponding session. Different sessions have different characteristic requirements. Through local analysis, it can be determined whether the target data packet can reach the corresponding session, and then determine whether it can feedback credit points. As a result, the loss of credit points due to CRC check errors can be further reduced, and credit points can be fed back more accurately, reducing the impact on the data transmission rate.
[0016] In one embodiment, the feature requirement based on the protocol layer requires local parsing of the sub-packet corresponding to the protocol layer, including: when the local parsing of the sub-packet corresponding to the protocol layer fails, obtaining the number of sessions between the sending device and the receiving device; when the number of sessions is 1, re-determining whether the local parsing of the sub-packet corresponding to the protocol layer passes.
[0017] In the embodiment of the present application, when the number of sessions is only 1, the data packet can only be transmitted to the session, and there is no situation where it cannot reach the specified session and thus cannot feedback the credit points. Therefore, when the number of sessions is 1, even if some parameters of the data packet do not meet the feature requirements or there are errors, the local resolution can be re-determined. Thus, the occurrence of an abnormal number of credit points due to feedback credit points when the flow control abnormality optimization method can transmit data packets normally can be reduced.
[0018] In one embodiment, the characteristics of the sub-packet in the target data packet include a session sequence number and multiple other characteristics except the session sequence number; the local parsing of the sub-packet corresponding to the protocol layer based on the characteristic requirements of the protocol layer includes: when the other target characteristics in the sub-packet do not match the characteristic requirements of the protocol layer, obtaining the number of sessions established between the sending device and the receiving device; the other target characteristics are any other characteristics among the multiple other characteristics; if the number of sessions is greater than 1, determining the target sequence number based on the other characteristics in the sub-packet except the other target characteristics; judging whether the target sequence number is the same as the session sequence number recorded in the sub-packet; and if they are the same, re-determining whether the local parsing of the sub-packet corresponding to the protocol layer is passed.
[0019] In the case of multiple sessions, the target data packet may have some errors or some parameters that do not meet the feature requirements, but the data packet can actually reach the session it needs to reach. In this case, the receiving device can normally feedback credit points, so it is impossible to feedback credit points through the flow control exception optimization method. Therefore, in the embodiment of the present application, during local analysis, the session number can be determined by other features and compared with the session number that the data packet needs to reach to determine whether it can reach it. If it can reach it, it is re-determined that the local analysis is passed, so that no additional credit points are fed back to avoid affecting the normal transmission of data.
[0020] In the second aspect, an embodiment of the present application provides a flow control anomaly optimization device, which is applied to a receiving device, wherein the receiving device is communicatively connected to a sending device, and the transmission of data packets between the receiving device and the sending device is controlled based on credit points; the sending device verifies the sent data packets based on a cyclic redundancy check CRC; the flow control anomaly optimization device comprises: an acquisition module, which acquires a target data packet that has passed the CRC check; a parsing module, which parses the target data packet and determines whether the target data packet is abnormal; and a feedback module, which feeds back the credit points to the sending device when the target data packet is abnormal.
[0021] In a third aspect, an embodiment of the present application provides a Bluetooth device, comprising: a Bluetooth module, used to execute the flow control exception optimization method as described in any one of the first aspects.
[0022] In a fourth aspect, an embodiment of the present application provides a Bluetooth transmission system, comprising: a sending device; a receiving device, which is communicatively connected to the sending device and transmits data with the sending device based on credit points, and the receiving device verifies the received data packet based on CRC; the receiving device is also used to execute the flow control anomaly optimization method as described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 A flow chart of a method for optimizing flow control anomalies provided in one embodiment of the present application;
[0025] Figure 2 A schematic diagram of the transmission of a data packet within a device provided in an embodiment of the present application;
[0026] Figure 3 A schematic diagram of the structure of a sub-data packet corresponding to the RFCOMM layer provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of analyzing the optimization of flow control anomalies provided in an embodiment of the present application;
[0028] Figure 5 A schematic diagram of a flow control abnormality optimization device provided in one embodiment of the present application;
[0029] Figure 6 A schematic diagram of a Bluetooth transmission system provided in an embodiment of the present application.
[0030] Icons: flow control anomaly optimization device 200; acquisition module 210; analysis module 220; feedback module 230; Bluetooth transmission system 300; sending device 310; receiving device 320. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present application more clear, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
[0032] First, an embodiment of the present application provides a flow control exception optimization method, which can be applied to a receiving device, where the receiving device is communicatively connected to a sending device, wherein the receiving device and the sending device can be communicatively connected via Bluetooth.
[0033] In an embodiment of the present application, the transmission of data packets between the receiving device and the sending device is controlled based on credit points. For example, the sending device is configured with 10 credits. When the sending device sends a data packet to the receiving device, each data packet sent will carry a credit. After the data packet is sent, the number of credits of the sending device decreases. The receiving device receives credits while receiving the data packet. For example, in Bluetooth communication, after the receiving device receives the data packet, it will pass through the HCI layer, I2cap layer, RFCOMM layer in sequence, and finally reach the RFCOMM session. After the RFCOMM session receives the data packet, it will feed back the credit points to the sending device, so that the credit points of the sending device are restored, and the total number of credit points between the receiving device and the sending device remains unchanged, thereby controlling the data transmission rate.
[0034] Thus, the rate of data transmission can be controlled by credit. For example, when the sending device has more credits remaining and the receiving device has less credits that have not been fed back, a higher rate can be used for data transmission; when the sending device has less credits remaining and the receiving device has more credits that have not been fed back, a lower rate can be used for data transmission. The above can refer to the existing credit-based flow control mechanism, which will not be elaborated here.
[0035] In the embodiment of the present application, the sending device verifies the received data packets based on the cyclic redundancy check CRC. Through simulation tests, it is found that the average probability of a 16-bit CRC check error is about 1 / 57700. In actual tests, when the CRC ratio is 5%, it can be expected that a check error will occur in about 1.25 million data packets, and as the communication environment deteriorates, the probability of a CRC check error will change.
[0036] When the CRC check fails, the data packet will not be able to reach the specified location. For example, for Bluetooth communication based on session data transmission, the data packet will not be able to reach the RFCOMM session. When there are multiple sessions, it may not reach the correct session. Accordingly, the receiving device cannot feedback the credit, which will cause the credit to be permanently reduced, affecting the data transmission rate between devices. When the credit is 0, the sending device will not be able to send data.
[0037] Based on this, the flow control exception optimization method provided in the present application can parse the received data packet after CRC verification to determine whether it is abnormal. If the data packet is abnormal and cannot reach the session, the credit points are directly fed back to the sending device. Therefore, even if the credit points of the data packet are lost, the credit points can be replenished to maintain the total number unchanged.
[0038] See also Figure 1 , Figure 1 A flow chart of a flow control exception optimization method provided in an embodiment of the present application, the flow control exception optimization method comprising:
[0039] S110, obtaining a target data packet that has passed the CRC check.
[0040] The receiving device can receive the data packet sent by the sending device. In the embodiment of the present application, the target device is the data packet sent by the sending device, which has been checked and passed by CRC, and the receiving device can receive the target data packet.
[0041] S120, parsing the target data packet to determine whether the target data packet is abnormal.
[0042] In the embodiment of the present application, it is possible to determine whether the target data packet can reach the specified session, and then determine whether it can feedback credit points. For the target data packet, if the target data packet has an abnormality, it is likely that it cannot reach the specified session. Therefore, the target data packet can be parsed to determine whether the target data packet has an abnormality.
[0043] In one embodiment of the present application, the target data packet can be parsed as a whole; if the result of the overall parsing indicates that the target data packet does not comply with the specification of the Bluetooth communication protocol, it is determined that the overall parsing of the target data packet fails and cannot be transmitted backward, and the target data packet is determined to be abnormal.
[0044] In the embodiment of the present application, the overall analysis is used to determine whether the parameter values in the target data packet comply with the specifications of the Bluetooth communication protocol, including but not limited to the definition and value of each parameter in the target data packet. For example, in the specification of the Bluetooth communication protocol, the value range of a certain parameter is 1 to 10. If the value of the parameter in the target data packet is 9999, the value is obviously no longer in the specification of the Bluetooth communication protocol. On this basis, it can be determined that the target data packet does not comply with the specification of the Bluetooth communication protocol.
[0045] In actual transmission, the abnormality of some parameters does not affect the normal transmission of the data packet, and the data packet can even reach the session normally and feedback credit points. For example, in the RFCOMM layer of Bluetooth communication, the address (address, or session address) and control (control mode) parameters are required to meet the specifications, while there are no requirements for the parameters in the payload. When the parameters in address and control meet the specifications, the target data packet can be transmitted backward and output to the session.
[0046] Therefore, in an embodiment of the present application, if the parameters of the target data packet do not meet the specifications and cannot be transmitted backward and cannot reach the session, it can be determined that the overall parsing of the target data packet fails and the target data packet is determined to be abnormal.
[0047] See also Figure 2 , Figure 2 A schematic diagram of the transmission of a data packet within a device provided in an embodiment of the present application, wherein HCI, I2CAP and RFCOMM are different protocol layers, configured with corresponding Bluetooth communication protocols, DLCI 2, DLCI 3, and DLCI n are different sessions, and different sessions are established in the RFCOMM layer. Among them, one of device A and device B is a receiving device, and the other is a sending device.
[0048] When Bluetooth receives a data packet, it passes through multiple protocol layers, such as the HCI layer, I2CAP layer, and RFCOMM layer, and receives the data packet through the RFCOMM session established by the RFCOMM layer, and feedbacks the credit points. The data packet includes the parameters required by different protocol layers, and the data packet is transmitted backwards layer by layer by each protocol layer. Each protocol layer will detect the parameters of the current protocol layer in the data packet to determine whether it meets the requirements. For example, the HCI layer is configured with the HCI protocol, and the I2CAP is configured with the I2CAP protocol. If it meets the requirements of the current protocol layer, the data packet is allowed to be transmitted backwards. If the target data packet is abnormal, the data packet will not be able to be transmitted backwards. For example, if a data packet abnormality is detected at the HCI layer, the data packet may not be transmitted to the I2CAP layer.
[0049] Therefore, in an embodiment of the present application, the overall analysis can be the analysis and detection process of the data packet at each protocol layer. Thus, the overall analysis is configured at each protocol layer passed by the target data packet to perform overall analysis on the sub-data packets corresponding to each protocol layer based on the Bluetooth communication protocol corresponding to each protocol layer.
[0050] In this embodiment, the sub-data packet corresponding to the protocol layer is the data about the protocol layer in the target data packet. If the sub-data corresponding to any protocol layer fails to pass the overall parsing, it indicates that the target data packet does not comply with the specification of the Bluetooth communication protocol and cannot be transmitted backward.
[0051] Through the overall analysis of each protocol layer, each protocol layer only needs to analyze the sub-packets corresponding to the current protocol layer as a whole, reducing the workload required by each protocol layer. At the same time, when it is impossible to transmit backward, the subsequent protocol layer will not need to parse the packet, further reducing the workload required for the subsequent protocol layer. In addition, configuring overall analysis for each protocol layer can avoid the situation where the packet has been lost before reaching the protocol layer that can be analyzed as a whole and it is impossible to determine whether it is abnormal.
[0052] In one embodiment of the present application, the process of overall parsing of each protocol layer may include: obtaining the preset data packet requirements corresponding to the protocol layer; comparing the sub-data packet corresponding to the protocol layer with the preset data packet requirements; determining that the overall parsing of the target data packet by the protocol layer is passed when the sub-data packet corresponding to the protocol layer meets the preset data packet requirements or allows backward transmission; determining that the overall parsing of the target data packet by the protocol layer is not passed when the sub-data packet corresponding to the protocol layer does not meet the preset data packet requirements and the parameters in the sub-data packet that do not meet the preset data packet requirements make it impossible for the target data packet to be transmitted backward.
[0053] In this embodiment, the preset data packet requirements include the specifications of the Bluetooth communication protocol corresponding to the protocol layer for the parameters in the sub-data packet corresponding to the protocol layer, including but not limited to the requirements for the data structure in the data packet, such as the parameter type required in the sub-data packet, and the value range of each parameter in the data packet.
[0054] For example, see Figure 3 , Figure 3 A schematic diagram of the structure of a sub-data packet corresponding to the RFCOMM layer provided in an embodiment of the present application. The sub-data packet corresponding to the RFCOMM layer includes four parts: address, control, payload and FCS (Frame check sequence). If a sub-data packet lacks one of the four parts, the target data packet is determined to be abnormal.
[0055] exist Figure 3 In the example, DLCI represents a session, and DLCI:2 represents a session with a sequence number of 2. Assuming that the maximum number of sessions allowed to be established is 10, if the value of DLCI is 9999, it indicates that the value of the parameter is abnormal, and it can be determined that the preset data packet requirement is not met.
[0056] Similarly, for the RFCOMM protocol layer, all data except the payload must comply with the specification, that is, no omissions and parameter values are within the range specified by the protocol, otherwise it will not be able to be transmitted backwards. Correspondingly, if there are errors in the payload data, it will not affect the backward transmission of the target data packet.
[0057] The same is true for other protocol layers, except that each protocol layer has different requirements for data structure and parameters, which can be adjusted according to actual conditions. The above is only an example. In addition, the specific implementation of the overall analysis can also refer to the existing technology, which will not be expanded here.
[0058] As mentioned above, overall analysis is used to determine whether the data packet complies with the specifications of the Bluetooth communication protocol and whether it can be transmitted backward. In actual scenarios, there are some parameters that do not comply with the specifications of the Bluetooth communication protocol, but they can still be transmitted backward. At this time, it can be further determined whether the data packet can reach the session. If not, credit points can be fed back in time, and subsequent data packets will no longer be parsed excessively, thereby improving parsing efficiency and reducing the impact on data transmission rate.
[0059] Therefore, in one embodiment of the present application, after the target data packet is parsed as a whole, it may also include: if the overall parsing of any protocol layer passes, locally parsing the sub-data packet corresponding to the protocol layer based on the session corresponding to the target data packet; if the local parsing of the sub-data packet corresponding to the protocol layer fails, determining that the target data packet is abnormal.
[0060] First, the difference between overall parsing and local parsing is explained. Overall parsing refers to protocol integrity parsing, which has nothing to do with the protocol layer. It is more of a description of parsing details. For example, an overall parsing exception at the HCI layer refers to an parsing exception in the standard protocol parsing method of the HCI layer, which is related to the legitimacy of the protocol and the matching of the business at the time. From the perspective of overall parsing, it is inevitable that the next step of the overall parsing of the next layer cannot be performed, such as the overall parsing of the L2CAP layer. However, local parsing is different. For example, if the overall parsing of the HCI layer fails, an exception will be thrown, and then local parsing will be performed at the HCI layer. The final goal of local parsing is to identify whether the current data with overall parsing exceptions conforms to the data of a specific RFCOMM session. Although the overall parsing exception is found, the credit itself can be saved after local parsing identifies that it is RFCOMM data, but the data carrier content or data packet of RFCOMM itself cannot be saved.
[0061] For Bluetooth communication, the destination location that the target data packet needs to reach is the session recorded in the address information in the target data packet. In this embodiment, local resolution is used to determine whether the characteristics of the sub-data packet corresponding to the protocol layer match the characteristic requirements of the corresponding session; if they match, it is determined that the local resolution of the sub-data packet corresponding to the protocol layer has passed; if they do not match, it is determined that the local resolution of the sub-data packet corresponding to the protocol layer has failed.
[0062] Different sessions may have different requirements for parameter values in different protocol layers. For example, if a target data packet needs to be transmitted to session 2, that is, the DLCI value is 2, and other features indicate that the target data packet will be transmitted to session 3, then the two do not match, and the target data packet will not be transmitted to the correct session, and credit points cannot be fed back. Among them, the feature requirements of the corresponding session can be determined based on the session sequence number in the target data packet. Therefore, when performing local resolution, the address of the session will be defaulted to be correct and legal.
[0063] In this embodiment, the characteristics of the session to which the target data packet needs to be transmitted can be determined, including but not limited to the parameter values of the address and other parameters, that is, the parameter values of each characteristic are defined differently in different sessions. For example, the parameter value of a certain characteristic in session 2 is defined as A, and the parameter value of the same characteristic in session 3 is defined as C.
[0064] Therefore, in the embodiment of the present application, local analysis can be used to determine whether the characteristics of the sub-data packet match the characteristic requirements of the current session, and then determine whether it can reach the correct session and feedback credit points.
[0065] In addition, there are some special cases. For example, when the number of sessions is 1, even if the features other than the address in the data packet do not match the features required by the session, the data packet can only be transmitted to the session and credit points can be correctly fed back. Therefore, in the embodiments of the present application, some scenarios where credit points can be correctly fed back can also be distinguished to avoid additional feedback of credit points in scenarios where credit points can be fed back as much as possible.
[0066] In one embodiment, when local parsing of a sub-packet corresponding to a protocol layer fails, the number of sessions between a sending device and a receiving device may be obtained; when the number of sessions is 1, it is re-determined whether local parsing of a sub-packet corresponding to the protocol layer passes.
[0067] In this embodiment, even if there is an abnormality in the parameters of any sub-packet in the target data packet, the session described by its address is inconsistent with the session corresponding to other features, because when the number of sessions is 1, there is only one session to which the target data packet can be transmitted. In this case, the target data packet will correctly reach the session and feedback credit points. Therefore, its local resolution can be re-determined to avoid the processing of additional feedback credit points.
[0068] Similarly, in some scenarios, there may be a small number of feature errors other than the session sequence number, and the session sequence number determined based on the remaining other features is the same as the session sequence number in the sub-packet. In this case, the target data packet can also reach the session correctly.
[0069] Therefore, in other embodiments of the present application, the number of sessions established between the sending device and the receiving device can be obtained when other target features in the sub-packet do not match the feature requirements of the corresponding session; the target other features are any other features among multiple other features; if the number of sessions is greater than 1, the target sequence number is determined based on other features in the sub-packet except the target other features; it is determined whether the target sequence number is the same as the session sequence number recorded in the sub-packet; if they are the same, it is determined that the local parsing of the sub-packet corresponding to the protocol layer is passed.
[0070] Other features refer to feature values other than the session sequence number. The target feature is a feature that does not match the feature of the session corresponding to the target data packet, that is, an abnormal feature. The target feature is not the session sequence number.
[0071] When there are multiple sessions, different sessions have different feature requirements for the target data packet at the same protocol layer. Therefore, it is possible to determine which session's feature requirements at the protocol layer match the sub-data corresponding to the current protocol layer in the target data packet, and then determine the session to which the sub-data packet may be sent, that is, the target sequence number of the session to which it needs to be sent.
[0072] Therefore, even if there are abnormal target features that are different from the features corresponding to the session recorded in the data packet, it is possible to further determine other features of the sub-packet corresponding to the target data packet at the current protocol layer. If all features except the target feature are the same as the features of the session corresponding to the target data packet, it can still be determined that the target data packet can continue to be issued or sent to the corresponding session. Therefore, it can be determined that the local resolution has passed when the target sequence number is the same as the session sequence number recorded in the sub-packet.
[0073] In the above embodiment, the target data packet includes sub-data packets corresponding to each protocol layer. Therefore, when describing it as a whole, the target data packet is used, and when making judgments at each protocol layer, the sub-data packet corresponding to the protocol layer is actually used, which is explained here.
[0074] S130, when the target data packet is abnormal, feeding back credit points to the sending device.
[0075] In this embodiment, due to the abnormality of the target data packet, it will not be able to reach the specified session, and thus the credit points cannot be fed back normally. Therefore, in this case, the receiving device can directly feed back the credit points to the sending device so that the credit points can be replenished, and the number of credit points will not be permanently reduced due to CRC check errors or data packets failing to reach the execution session.
[0076] For ease of understanding, an example is provided here to illustrate the flow control exception optimization method provided in the present application.
[0077] See also Figure 4 , Figure 4 The schematic diagram of the analysis of the flow control exception optimization provided in an embodiment of the present application is shown in FIG. In this embodiment, after receiving a data packet, the receiving device sequentially passes through the HCI layer, the I2cap layer, the RFCOMM layer, and finally reaches the RFCOMM session of DLCI2.
[0078] In this embodiment, the data packet is a target data packet that has passed the CRC check.
[0079] First, the target data packet is analyzed as a whole at the HCI layer to determine whether it can be normally transmitted back to the I2cap layer. If the I2cap analysis is normal, it can be transmitted normally, and the overall analysis at the HCI layer passes. On the contrary, if the overall analysis of the HCI fails, an abnormal callback is performed to determine whether there is a CRC abnormality, and then a local analysis is performed to determine whether the characteristics of the sub-data packet corresponding to the target data packet at the HCI layer match the characteristics of session 1. If they match, the credit points are fed back to the sending device.
[0080] Next, if the overall HCI analysis passes, the target data packet is sent to the I2cap layer, which performs analysis to determine whether it can be normally transmitted back to the rfcomm layer. If the rfcomm analysis is normal, it can be transmitted normally, and the overall analysis at the I2cap layer passes. On the contrary, if the overall analysis is abnormal, an abnormal callback is performed to determine whether there is a CRC abnormality, and then a local analysis is performed to determine whether the characteristics of the sub-data packet corresponding to the target data packet in the I2cap layer match the characteristics of session 1. If they match, credit points are fed back to the sending device. If the I2cap layer characteristics in the target data packet do not match, it is determined whether there is only one session at present. If there is only one session, at this time, the target data packet can be transmitted normally to the session, and credit points are also fed back to the sending device.
[0081] Finally, if the overall analysis of I2cap passes, the target data packet is sent to the rfcomm layer, which performs analysis to determine whether it can be normally transmitted backward to rfcomm session 1. If the session analysis is normal, it can be transmitted normally, and the overall analysis of the rfcomm layer passes. On the contrary, if the overall analysis is abnormal, an abnormal callback is performed to determine whether there is a CRC abnormality, and then a local analysis is performed to determine whether the characteristics of the sub-data packet corresponding to the target data packet in the rfcomm layer match the characteristics of session 1. If they match, credit points are fed back to the sending device. If the rfcomm layer characteristics in the target data packet do not match, it is determined whether there is only one session at present. If there is only one session, at this time, the target data packet can be transmitted normally to the session, and credit points are also fed back to the sending device.
[0082] Based on the same inventive concept, an embodiment of the present application also provides a flow control anomaly optimization device, which can be applied to the communication connection between a receiving device and a device, and the transmission of data packets between the receiving device and the sending device is controlled based on credit points; the sending device checks the sent data packets based on a cyclic redundancy check CRC.
[0083] See also Figure 5 , Figure 5 This is a schematic diagram of a flow control anomaly optimization device provided in an embodiment of the present application. The flow control anomaly optimization device 200 includes: an acquisition module 210, a parsing module 220 and a feedback module 230.
[0084] The acquisition module 210 acquires the target data packet that has passed the CRC check.
[0085] The parsing module 220 is used to parse the target data packet and determine whether the target data packet is abnormal.
[0086] The feedback module 230 feeds back the credit points to the sending device when the target data packet is abnormal.
[0087] The parsing module 220 is used to perform an overall parsing of the target data packet; the overall parsing is used to determine whether the parameter values in the target data packet comply with the specifications of the Bluetooth communication protocol; if the result of the overall parsing indicates that the target data packet does not comply with the specifications of the Bluetooth communication protocol and cannot be transmitted backward, it is determined that the overall parsing of the target data packet has failed, and the target data packet is determined to be abnormal.
[0088] The target data packet is received after passing through multiple protocol layers after the CRC check is passed, and each protocol layer is configured with a corresponding communication protocol; the target data packet includes sub-data packets corresponding to each protocol layer, and the parsing module 220 is used to: for each protocol layer passed by the target data packet, perform the overall parsing on the sub-data packet corresponding to the protocol layer based on the Bluetooth communication protocol corresponding to the protocol layer; wherein, if the overall parsing of the sub-data corresponding to any protocol layer fails, it indicates that the target data packet does not comply with the specification of the Bluetooth communication protocol and cannot be transmitted backward.
[0089] For each of the protocol layers passed by the target data packet, the parsing module 220 is used to obtain the preset data packet requirements corresponding to the protocol layer; the preset data packet requirements include the specifications of the parameters in the sub-data packet corresponding to the protocol layer by the Bluetooth communication protocol corresponding to the protocol layer; the sub-data packet corresponding to the protocol layer is compared with the preset data packet requirements; when the sub-data packet corresponding to the protocol layer meets the preset data packet requirements or allows backward transmission, it is determined that the overall parsing of the target data packet by the protocol layer is passed; when the sub-data packet corresponding to the protocol layer does not meet the preset data packet requirements, and the parameters in the sub-data packet that do not meet the preset data packet requirements make it impossible for the target data packet to be transmitted backward, it is determined that the overall parsing of the target data packet by the protocol layer has failed.
[0090] In one embodiment, the parsing module 220 is also used to perform local parsing of the sub-packet corresponding to the protocol layer based on the characteristic requirements of the protocol layer when the overall parsing of any of the protocol layers passes; and determine that the target data packet is abnormal when the local parsing of the sub-packet corresponding to the protocol layer fails; wherein the local parsing is used to determine whether the characteristics of the sub-packet corresponding to the protocol layer match the characteristic requirements of the current corresponding session; if they match, it is determined that the local parsing of the sub-packet corresponding to the protocol layer passes; if they do not match, it is determined that the local parsing of the sub-packet corresponding to the protocol layer fails.
[0091] The sending device and the receiving device transmit data packets based on the session. In one embodiment, the parsing module 220 is also used to obtain the number of sessions between the sending device and the receiving device when the local parsing of the sub-data packet corresponding to the protocol layer fails; when the number of sessions is 1, re-determine whether the local parsing of the sub-data packet corresponding to the protocol layer passes.
[0092] The sending device and the receiving device transmit data packets based on a session, and the characteristics of the sub-data packet in the target data packet include a session sequence number and multiple other characteristics except the session sequence number. In one embodiment, the parsing module 220 is also used to obtain the number of sessions established between the sending device and the receiving device when the other target characteristics in the sub-data packet do not match the characteristic requirements of the corresponding session; the other target characteristics are any other characteristics among the multiple other characteristics; if the number of sessions is greater than 1, the target sequence number is determined based on the other characteristics in the sub-data packet except the other target characteristics; it is determined whether the target sequence number is the same as the session sequence number recorded in the sub-data packet; if they are the same, it is determined that the local parsing of the sub-data packet corresponding to the protocol layer is passed.
[0093] An embodiment of the present application also provides a Bluetooth device, which includes a Bluetooth module. The Bluetooth module can use the Bluetooth device as a receiving device to execute the aforementioned flow control exception optimization method.
[0094] In one embodiment of the present application, the Bluetooth device may be a headset.
[0095] Based on the same inventive concept, the present application embodiment also provides a Bluetooth transmission system 300, see Figure 6 , Figure 6 This is a schematic diagram of a Bluetooth transmission system 300 provided in accordance with an embodiment of the present application. The Bluetooth transmission system 300 includes a sending device 310 and a receiving device 320 .
[0096] The sending device 310 and the receiving device 320 are connected in communication, and data is transmitted between the sending device based on credit points.
[0097] The sending device 310 checks the sent data packet based on CRC before sending the data packet. The receiving device 320 can execute the flow control exception optimization method provided by any of the above embodiments.
[0098] In the embodiments provided in the present application, it should be understood that the disclosed methods and devices may also be implemented in other ways. The functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0099] The above embodiments can be freely combined without conflict, and the embodiments obtained by the combination are included in the protection scope of this application.
[0100] The above detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0101] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0102] In the description of this application, it is also necessary to explain that, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0103] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A flow control exception optimization method, It is characterized in that Applied to a receiving device, the receiving device is in communication connection with a sending device, and the transmission of data packets between the receiving device and the sending device is controlled based on credit points; The sending device checks the sent data packet based on a cyclic redundancy check CRC; Flow control exception optimization methods include: Acquire a target data packet that passes the CRC check; Parsing the target data packet to determine whether the target data packet is abnormal; In the case where the target data packet is abnormal, the credit points are fed back to the sending device.
2. The flow control abnormality optimization method according to claim 1, It is characterized in that The step of parsing the target data packet and determining whether the target data packet is abnormal includes: Performing an overall analysis on the target data packet; the overall analysis is used to determine whether the parameter values in the target data packet comply with the specification of the Bluetooth communication protocol; If the result of the overall analysis indicates that the target data packet does not comply with the specification of the Bluetooth communication protocol and cannot be transmitted backward, it is determined that the overall analysis of the target data packet fails and the target data packet is determined to be abnormal.
3. The flow control abnormality optimization method according to claim 2, It is characterized in that The target data packet is received after passing through multiple protocol layers after the CRC check, and each protocol layer is configured with a corresponding communication protocol; The target data packet includes sub-data packets corresponding to each protocol layer; The overall parsing of the target data packet includes: For each of the protocol layers passed by the target data packet, performing the overall parsing of the sub-data packet corresponding to the protocol layer based on the Bluetooth communication protocol corresponding to the protocol layer; If the sub-data corresponding to any protocol layer fails to be parsed as a whole, it indicates that the target data packet does not comply with the specification of the Bluetooth communication protocol and cannot be transmitted backward.
4. The flow control abnormality optimization method according to claim 3, It is characterized in that For each of the protocol layers passed by the target data packet, performing the overall parsing of the sub-data packet corresponding to the protocol layer based on the Bluetooth communication protocol corresponding to the protocol layer includes: Obtaining a preset data packet requirement corresponding to the protocol layer; the preset data packet requirement includes the specification of parameters in a sub-data packet corresponding to the protocol layer by the Bluetooth communication protocol corresponding to the protocol layer; Comparing the sub-data packet corresponding to the protocol layer with the preset data packet requirement; When the sub-data packet corresponding to the protocol layer meets the preset data packet requirement or allows backward transmission, determining that the protocol layer passes the overall parsing of the target data packet; When the sub-packet corresponding to the protocol layer does not meet the preset packet requirements, and the parameters in the sub-packet that do not meet the preset packet requirements make the target packet unable to be transmitted backward, it is determined that the protocol layer fails the overall parsing of the target packet.
5. The flow control abnormality optimization method according to claim 3, It is characterized in that The sending device and the receiving device transmit data packets based on a session; After parsing the target data packet as a whole, the method further includes: When the overall parsing of any of the protocol layers is passed, locally parse the sub-data packet corresponding to the protocol layer based on the session corresponding to the target data packet; In the case that the local parsing of the sub-packet corresponding to the protocol layer fails, determining that the target data packet is abnormal; Among them, the local analysis is used to determine whether the characteristics of the sub-packet corresponding to the protocol layer match the characteristic requirements of the corresponding session; if they match, it is determined that the local analysis of the sub-packet corresponding to the protocol layer passes; if they do not match, it is determined that the local analysis of the sub-packet corresponding to the protocol layer fails.
6. The flow control abnormality optimization method according to claim 5, It is characterized in that The locally parsing the sub-data packet corresponding to the protocol layer based on the feature requirement of the protocol layer includes: When the local parsing of the sub-data packet corresponding to the protocol layer fails, obtaining the number of sessions between the sending device and the receiving device; When the number of sessions is 1, the local parsing of the sub-data packet corresponding to the protocol layer is re-determined.
7. The flow control abnormality optimization method according to claim 5, It is characterized in that The characteristics of the sub-data packets in the target data packet include a session sequence number and a plurality of other characteristics except the session sequence number; The locally parsing the sub-data packet corresponding to the protocol layer based on the feature requirement of the protocol layer includes: When the target other feature in the sub-data packet does not match the feature requirement of the corresponding session, obtaining the number of sessions established between the sending device and the receiving device; the target other feature is any other feature among the multiple other features; If the number of sessions is greater than 1, determining the target sequence number based on the other features in the sub-data packet except the other features of the target; Determining whether the target sequence number is the same as the session sequence number recorded in the sub-data packet; Under the same circumstances, it is determined that the local parsing of the sub-data packet corresponding to the protocol layer is passed.
8. A flow control abnormality optimization device, It is characterized in that Applied to a receiving device, the receiving device is in communication connection with a sending device, and the transmission of data packets between the receiving device and the sending device is controlled based on credit points; The sending device checks the sent data packet based on a cyclic redundancy check CRC; The flow control abnormality optimization device includes: An acquisition module is used to acquire a target data packet that has passed the CRC check; A parsing module, for parsing the target data packet and determining whether the target data packet is abnormal; A feedback module is configured to feedback the credit points to the sending device when the target data packet is abnormal.
9. A Bluetooth device, It is characterized in that include: A Bluetooth module is used to execute the flow control exception optimization method as described in any one of claims 1 to 7.
10. A Bluetooth transmission system, It is characterized in that include: Sending equipment; A receiving device, connected to the sending device for communication, and performing data transmission with the sending device based on credit points; The sending device checks the output data packet based on a cyclic redundancy check CRC; The receiving device is also used to execute the flow control exception optimization method as described in any one of claims 1-7.
