CN108667545B - Serial port bandwidth synchronization method and device - Google Patents

Serial port bandwidth synchronization method and device Download PDF

Info

Publication number
CN108667545B
CN108667545B CN201810344468.0A CN201810344468A CN108667545B CN 108667545 B CN108667545 B CN 108667545B CN 201810344468 A CN201810344468 A CN 201810344468A CN 108667545 B CN108667545 B CN 108667545B
Authority
CN
China
Prior art keywords
clock frequency
data terminal
terminal equipment
data communication
bandwidth
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.)
Active
Application number
CN201810344468.0A
Other languages
Chinese (zh)
Other versions
CN108667545A (en
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.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication Technology 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 Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201810344468.0A priority Critical patent/CN108667545B/en
Publication of CN108667545A publication Critical patent/CN108667545A/en
Application granted granted Critical
Publication of CN108667545B publication Critical patent/CN108667545B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0685Clock or time synchronisation in a node; Intranode synchronisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/22Traffic shaping
    • H04L47/225Determination of shaping rate, e.g. using a moving window

Abstract

The data terminal equipment acquires an interactive message which is sent by the data communication equipment and carries clock frequency information; the data terminal equipment acquires the current clock frequency of the data communication equipment according to the clock frequency information; and the data terminal equipment realizes the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm. Because the negotiation message exists in the link establishment stage; the interactive message exists in a communication protocol of the data terminal equipment and the data communication equipment, and is sent periodically, so that the current clock frequency and subsequent changes can be obtained in time by obtaining the clock frequency through the negotiation message and the interactive message, and the occupation of bandwidth is not increased.

Description

Serial port bandwidth synchronization method and device
Technical Field
The application relates to the technical field of communication, in particular to a serial port bandwidth synchronization method and device.
Background
The synchronous serial port can support Point-to-Point Protocol (PPP), High-Level Data Link Control (HDLC), Frame-relay (Frame-relay) and other Link layer protocols in the wide area network router. The synchronous serial port is widely applied to remote connection, private networks and private lines.
In the prior art, a data communication device such as a router usually determines a transmission rate by a cable type of a synchronous serial port, however, this method of acquiring the transmission rate cannot be updated in time, and even if the transmission rate changes, the router still mistakens the transmission rate acquired by the cable type as the current transmission rate. The router can also obtain the update of the transmission rate by receiving the flow control message sent by another router, however, the flow control message is sent in real time, the resource consumption rate is higher, and the flow control message itself also occupies partial bandwidth, which affects the transmission rate.
Disclosure of Invention
In view of this, the embodiment of the present application provides a serial port bandwidth synchronization method and apparatus.
In a first aspect, an embodiment of the present application provides a serial port bandwidth synchronization method, where the method includes: the data terminal equipment acquires an interactive message which is sent by the data communication equipment and carries clock frequency information; the data terminal equipment acquires the current clock frequency of the data communication equipment according to the clock frequency information; and the data terminal equipment realizes the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm.
The data terminal equipment acquires an interactive message, the interactive message carries clock frequency information, the data terminal equipment acquires the current clock frequency of the data communication equipment according to the clock frequency information, and the data terminal equipment combines the clock frequency with a preset algorithm, so that the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment are adjusted synchronously. The interactive messages comprise negotiation messages during link establishment and keep-alive messages after the link is established, and the negotiation messages exist in a link establishment stage; the keep-alive messages exist in a communication protocol of the data terminal equipment and the data communication equipment, and the interactive messages are sent periodically, so that the change of the current clock frequency can be obtained in time by obtaining the clock frequency through the interactive messages, and the occupation of the bandwidth is not increased.
In one possible design, the data terminal device includes a token sending module and a token receiving module, and the token sending module sends tokens to the token receiving module according to a token passing rate; the data terminal equipment realizes the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm, and the synchronization comprises the following steps: the data terminal equipment acquires the current clock frequency and takes the current clock frequency as a new token transmission frequency; the data terminal equipment receives communication information of a preset byte number sent by the data communication equipment; the data terminal equipment acquires the number of tokens in a token receiving module and judges whether the number of the preset bytes is greater than the number of the tokens or not; and if the number of the preset bytes is not greater than the number of the tokens, the data terminal equipment deletes the number of the tokens with the number of the preset bytes from the token receiving module and completes the transmission of the communication information.
The data terminal equipment determines whether to finish the transmission of the communication information according to the number of tokens in the token receiving module and the number of bytes of the communication information to be transmitted, so that when the token transmission frequency is changed, the transmission frequency for transmitting the communication information is changed, and the current clock frequency is used as a new token transmission frequency, thereby realizing the change of the transmission frequency of the communication information.
In one possible design, after determining whether the preset number of bytes is greater than the number of tokens, the method further includes: and if the number of the preset bytes is larger than the number of the tokens, stopping the transmission of the communication information.
And when the number of the preset bytes is larger than the number of the tokens, stopping the transmission of the communication information, thereby avoiding the congestion of the communication information.
In a second aspect, an embodiment of the present application provides a serial port bandwidth synchronization method, where the method includes: when the data communication equipment is connected with the data terminal equipment, the data communication equipment sends an interactive message carrying clock frequency information to the data terminal equipment, so that the data terminal equipment realizes the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm.
When the data communication device is connected with the data terminal device, the data communication device can send the interactive message carrying the clock frequency to the data terminal device, and after the data communication device is connected with the data terminal device, the data terminal device can receive communication information by taking the clock frequency sent by the data communication device as a token transmission rate. At this time, the interactive message sent by the data communication device to the data terminal device may no longer carry clock frequency information, so that the influence on the communication bandwidth caused by excessive information may be avoided.
In one possible design, the method further includes: the data communication equipment judges whether the clock frequency of the data communication equipment changes or not; and if the clock frequency of the data communication equipment changes, the data communication equipment sends an interactive message carrying clock frequency information to the data terminal equipment.
The data communication equipment can also detect whether the clock frequency of the data communication equipment changes, and if the clock frequency changes, the data communication equipment carries the clock frequency when sending the interactive message to the data terminal equipment next time, so that the data terminal equipment can realize the synchronization of the bandwidth of the data communication equipment in time, and the occurrence of information congestion is avoided.
In one possible design, after the data communication device determines whether the clock frequency of the data communication device changes, the method further includes: and if the clock frequency of the data communication equipment is not changed, the data communication equipment sends an interactive message which does not carry clock frequency information to the data terminal equipment.
If the clock frequency of the data communication equipment is not changed, the interactive message sent to the data terminal equipment by the data communication equipment does not need to carry clock frequency information, so that the influence of excessive information on communication bandwidth is avoided.
In a third aspect, an embodiment of the present application provides a serial port bandwidth synchronization apparatus, which is applied to a data terminal device, and the apparatus includes: the interactive message acquisition module is used for acquiring an interactive message which is sent by the data communication equipment and carries clock frequency information; the clock frequency acquisition module is used for acquiring the current clock frequency of the data communication equipment according to the clock frequency information; and the bandwidth synchronization module is used for realizing the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm.
The data terminal equipment acquires an interactive message, the interactive message carries clock frequency information, the data terminal equipment acquires the current clock frequency of the data communication equipment according to the clock frequency information, and the data terminal equipment combines the clock frequency with a preset algorithm, so that the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment are adjusted synchronously. Because the interactive message exists in the communication protocol of the data terminal equipment and the data communication equipment, and the interactive message is sent periodically, the clock frequency can be obtained through the interactive message, so that the change of the clock frequency can be obtained in time, and the occupation of the bandwidth can be reduced.
In one possible design, the bandwidth synchronization module includes: a transmission frequency updating submodule for acquiring the current clock frequency and using the current clock frequency as a new token transmission frequency; the communication information receiving submodule is used for receiving communication information of the preset byte quantity sent by the data communication equipment; the byte quantity judging submodule is used for acquiring the number of tokens in the token receiving module and judging whether the preset byte quantity is greater than the number of tokens or not; and the communication completion submodule is used for deleting the token number of the preset byte number from the token receiving module and completing the transmission of the communication information by the data terminal equipment if the preset byte number is not greater than the token number.
The data terminal equipment determines whether to finish the transmission of the communication information according to the number of tokens in the token receiving module and the number of bytes of the communication information to be transmitted, so that when the token transmission frequency is changed, the transmission frequency for transmitting the communication information is changed, and the current clock frequency is used as a new token transmission frequency, thereby realizing the change of the transmission frequency of the communication information.
In one possible design, the bandwidth synchronization module further includes: and the communication stopping submodule is used for stopping the transmission of the communication information if the number of the preset bytes is larger than the number of the tokens.
And when the number of the preset bytes is larger than the number of the tokens, stopping the transmission of the communication information, thereby avoiding the congestion of the communication information.
In a fourth aspect, an embodiment of the present application provides a serial port bandwidth synchronization apparatus, which is applied to a data communication device, and the apparatus includes: the first carrying and sending module is used for sending an interactive message carrying clock frequency information to the data terminal equipment when the data communication equipment is connected with the data terminal equipment.
When the data communication device is connected with the data terminal device, the data communication device can send the interactive message carrying the clock frequency to the data terminal device, and after the data communication device is connected with the data terminal device, the data terminal device can receive communication information by taking the clock frequency sent by the data communication device as a token transmission rate. At this time, the interactive message sent by the data communication device to the data terminal device may no longer carry clock frequency information, so that the influence on the communication bandwidth caused by excessive information may be avoided.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
For a clearer explanation of the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a serial port bandwidth synchronization method according to a first embodiment of the present application;
FIG. 2 is a schematic diagram illustrating the detailed step of step S130 in FIG. 1;
fig. 3 is a flowchart of a serial port bandwidth synchronization method according to a first embodiment of the present application;
fig. 4 is a block diagram of a serial port bandwidth synchronization apparatus according to a second embodiment of the present application.
Detailed Description
In the prior art, the transmission rates of synchronous serial ports are different under different cable types, the highest rate of the synchronous serial ports is 128Kbps under the condition of V.24 cable connection, and the highest rate of the synchronous serial ports is 2Mbps under the condition of V.35 cable connection. However, in a conventional wan router, the synchronous serial port is only a part of the router for data transmission. Data is generally imported through an Ethernet link port and then transferred to a synchronous serial port, wherein the lowest rate of the Ethernet port is 10 Mbps. Because the rate of the synchronous serial port is far lower than the transmission rate of the ethernet port, when data is transmitted from the ethernet port to the synchronous serial port, the situation of network congestion caused by rate mismatch may occur.
In the prior art, a router usually determines a fixed highest rate supported by a cable by determining a cable type of a serial interface, for example, if the cable type is v.24, the router correspondingly limits a transmission rate to 128Kbps, but when the cable is replaced with a v.35 cable, since the transmission rate of the router is not adjusted, data transmission is still performed at 128Kbps, which may cause data congestion. The other way is that the router at the opposite end of the router sends the flow control message to the router to control the transmission rate of the whole message, but the flow control message is often transmitted in real time, so the efficiency is low, and the flow control message needs an ethernet port to support the flow control function, thereby improving the hardware cost and occupying more transmission bandwidth.
The above-mentioned drawbacks of the prior art are considered by the applicant to be the result of the practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solution proposed by the following embodiments of the present invention to the above-mentioned problems should be the contribution of the inventor to the present invention in the course of the present invention.
In order to solve the above technical problem, embodiments of the present application provide a serial port bandwidth synchronization method and apparatus, which will be described in detail below with reference to the accompanying drawings.
First embodiment
Referring to fig. 1, fig. 1 shows a schematic flow chart of a serial port bandwidth synchronization method according to a first embodiment of the present application, which specifically includes the following steps:
step S110, the data terminal device obtains an interactive packet carrying clock frequency information sent by the data communication device.
The interactive packet is a packet carried by the data communication device in a link layer protocol, and the data communication device (DCE for short) may carry clock frequency information in the interactive packet and send the interactive packet carrying the clock frequency information to the data terminal device. The Link layer Protocol includes a Point-to-Point Protocol (PPP), a High-Level Data Link Control (HDLC), a Frame-relay (Frame-relay), and the like. The interactive message comprises a negotiation message when the link is established and a keep-alive message after the link is established.
For the point-to-point Protocol, a Link Control Protocol (LCP) may be multiplexed, and the clock frequency information is sent to a Data Terminal Equipment (DTE) by the Data communication Equipment.
Specifically, it can be realized by the following three ways:
first, a new data content corresponding to an unused option id is added to an option field in the LCP configuration-Request configuration Request message (the option field includes 6 fields, wherein, the option id is 1 byte, the field length is 1 byte, and the data content is 4 bytes) to fill in the related clock frequency information. For example, the option id is defined as 0x1F, and since the length of the option field is 6 bytes (the field length corresponds to 0x06), the clock frequency information is filled with 4 bytes in the option data content, and the value range is [1000,2000000 ]. And the data terminal equipment receives the Configure-Request sent by the data communication equipment and analyzes the clock frequency information carried in the Configure-Request, and then the data terminal equipment sends a Configure-Ack configuration response message to the data communication equipment. For example, if the clock frequency of the data communication device is 1000, the content of 6 bytes of the additional option field of the configuration-Request is 1F 06000003E 8. Namely option content: 1F 06000003E 8 corresponds to a clock frequency of 1000. The LCP Configure-Request configuration Request message may be included in the link negotiation message.
Secondly, the data communication equipment can use a reservation protocol of LCP protocol, so that the reservation protocol contains clock frequency information; a protocol type may also be newly defined such that the newly defined protocol includes clock frequency information.
For example, for the reservation protocol, the protocol content of the reservation protocol corresponding to the clock frequency of 1000 is: 0C xx (identifier) 08000003E 8 xx xx xx xx xx (magic number), namely the protocol content received by the data terminal equipment is: the reserved protocol packet of 0C xx (identifier) 08000003E 8 xx xx xx xx (magic number) can acquire corresponding clock frequency information according to the reserved protocol packet. The reservation protocol may be included in the link negotiation messages.
For the newly defined protocol packet, the protocol content of the newly defined protocol corresponding to the clock frequency of 1000 is: 1Fxx (identifier) 08000003E 8 xx xx xx xx xx (magic number), namely the protocol content received by the data terminal equipment is: the newly defined protocol of 1F xx (identifier) 08000003E 8 xx xx xx xx (magic number) can acquire corresponding clock frequency information according to the newly defined protocol message.
Thirdly, the data communication device includes clock frequency information in an LCP Echo-Request reply Request message, and the reply Request message may specifically include a value range of 1 byte of length information and 4 bytes of clock frequency information [1000,2000000 ]. And after receiving the Echo-Request Reply Request message sent by the data communication equipment, the data terminal equipment sends an Echo-Reply message. The reply request message may be included in the link keep-alive message.
For example, when the clock frequency of the data communication device is configured to be 1000, the contents of the LCP Echo-Request protocol are: 09xx (identifier) 000D xx xx xx xx xx xx xx (magic number) 04000003E 8. Namely, the contents of LCP Echo-Request protocol are as follows: the clock frequency of the data communication device corresponding to 09xx (identifier) 000D xx xx xx xx xx xx (magic number) 04000003E 8 is 1000.
The first and second types can be applied to the interaction of negotiation messages in the link initialization process of a Point-to-Point Protocol (PPP), and the third type can be applied to the interaction of keep-alive messages after the Point-to-Point Protocol is established successfully, and the data communication device reconfigures the clock frequency.
For HDLC, the control packet (keep-alive packet 0x8035) has 4 bytes following the protocol field to identify the type of the control packet, for example, the existing packet types include three types, i.e., interactive packet (0x0002), address request packet (0x0001), and address response packet (0x 0000). In the embodiment of the present application, a new clock synchronization packet may be added, where the new clock synchronization packet includes related clock frequency information, for example, the type of the clock synchronization packet is 0x001F, and if the clock frequency of the data communication device is 1000, the content of the clock synchronization packet is: 8035001F 04000003E 8. Namely, the content is: 8035001F 04000003E 8 shows that the clock frequency of the data communication device corresponding to the clock synchronization message is 1000. The data communication device may send a clock synchronization message: 8035001F 04000003E 8 to the data terminal equipment to enable the data terminal equipment to acquire clock frequency information.
For Frame-relay, the present application uses a specific Network Layer Protocol ID (NLPID) with a value of 0x80, and an unused SNAP clock synchronization protocol type may be added to carry clock frequency information, for example, the Organization Unique Identifier (OUI) is 0x 000000, the Protocol ID (PID) is 0x001F, the protocol data includes 1 byte of length information and 4 bytes of clock frequency information, and the value of the clock frequency information is [1000,2000000 ]. If the clock frequency is 1000, the contents of the Frame-relay newly-added SNAP protocol types are as follows:
03 00 80 00 00 00 00 1F 04 00 00 03 E8
namely, the data communication device sends the following contents: 030080000000001F 04000003E 8 Frame-relay SNAP message to data terminal equipment, the data terminal equipment analyzes 030080000000001F 04000003E 8, thereby obtaining clock frequency information of the data communication equipment.
The embodiment of the application can carry the clock frequency information in the existing PPP, HDLC, Frame-relay and other link protocol messages, so that the data terminal equipment can timely acquire the clock frequency of the data communication equipment, and compared with other schemes, the embodiment of the application occupies less resources and has high bandwidth control accuracy.
Step S120, the data terminal device obtains the current clock frequency of the data communication device according to the clock frequency information.
The clock frequency information may specifically be the frequency of the current clock, for example, the frequency of the current clock may be set to 1000, and may also be set to other values, and the specific value of the frequency of the current clock should not be construed as a limitation to the present application.
The data terminal equipment can adjust the bandwidth synchronization of the data communication equipment and the data terminal equipment according to the current clock frequency of the data communication equipment after acquiring the current clock frequency of the data communication equipment.
Step S130, the data terminal device synchronizes the bandwidth of the serial port of the data terminal device with the bandwidth of the serial port of the data communication device according to the current clock frequency and a preset algorithm.
The preset algorithm may specifically be a token bucket algorithm, the data terminal device includes a token sending module and a token receiving module, and the token sending module sends the token to the token receiving module according to the token passing rate.
For example, if the token transmission rate is 500, that is, the token sending module sends 500 tokens to the token receiving module within 1 second, when the data terminal device receives the communication information sent by the data communication device, the data terminal device first obtains the byte number of the communication information, and compares the byte number with the number of tokens in the token receiving module. And if the byte number of the communication information is less than or equal to the number of the tokens in the token receiving module, deleting the tokens with the same number as the byte number from the token receiving module and finishing the communication information transmission at the same time.
Specifically, for example, if the number of bytes of the communication information is 15 bytes and the number of tokens in the token receiving module is 20, the 15 tokens in the token receiving module are deleted, and the communication information having the number of bytes of 15 bytes is transferred.
And if the byte number of a communication message is larger than the number of tokens in the token receiving module, stopping the communication message from being transmitted. Specifically, for example, if the number of bytes of the communication information is 7 bytes and the number of tokens in the token receiving module is 5, the transmission of the communication information having the number of bytes of 7 bytes is stopped.
For communication information which is stopped being transmitted because the number of bytes is greater than the number of tokens, the following method can be used for processing:
can be discarded;
may be queued for transmission when the token receiving module accumulates sufficient tokens;
can continue to be sent, but needs to be specially marked, and when the network is overloaded, the packets with the special marks are discarded.
The data terminal equipment acquires an interactive message, the interactive message carries clock frequency information, the data terminal equipment acquires the current clock frequency of the data communication equipment according to the clock frequency information, and the data terminal equipment combines the clock frequency with a preset algorithm, so that the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment are adjusted synchronously. Because the interactive message exists in the communication protocol of the data terminal equipment and the data communication equipment, and the interactive message is sent periodically, the clock frequency can be obtained through the interactive message, so that the change of the clock frequency can be obtained in time, and the occupation of the bandwidth can be reduced.
Referring to fig. 2, fig. 2 shows a schematic diagram of specific steps of step S130, which specifically includes the following steps:
step S131, the data terminal device obtains the current clock frequency, and uses the current clock frequency as a new token passing frequency.
After the data terminal device obtains the current clock frequency, the current clock frequency can be used as a new token transmission frequency, and after the data terminal device receives communication information with a certain number of bytes, the data terminal device must delete the same number of tokens in the token receiving module to complete transmission of the communication information with the certain number of bytes. Therefore, after the clock frequency is synchronized with the token transmission frequency, when the data communication equipment sends communication information to the data terminal equipment according to the clock frequency, the same number of tokens can be received in the token receiving module of the data terminal equipment in the same time period, and the non-delay transmission of the communication information can be realized.
Step S132, the data terminal device receives the communication information with the preset number of bytes sent by the data communication device.
The data terminal device receives the communication information with the preset byte number sent by the data communication device, wherein the preset byte number is a specific number value, for example, the communication information with 7 bytes or the communication information with 10 bytes.
Step S133, the data terminal device obtains the number of tokens, and judges whether the number of the preset bytes is greater than the number of the tokens, if so, step S135 is executed; if not, go to step S134.
The data terminal equipment acquires the number of tokens in the token receiving module, then compares the number of tokens with the number of preset bytes, and if the number of the preset bytes is larger than the number of the tokens, the step S135 is executed; if the number of the predetermined bytes is not greater than the number of the tokens, step S134 is executed.
Step S134, the data terminal device deletes the token number of the preset number of bytes from the token receiving module, and completes the transmission of the communication information.
And if the byte number of the communication information is less than or equal to the number of the tokens in the token receiving module, deleting the tokens with the same number as the byte number from the token receiving module and finishing the communication information transmission at the same time.
Specifically, for example, if the number of bytes of the communication information is 15 bytes and the number of tokens in the token receiving module is 20, the 15 tokens in the token receiving module are deleted, and the communication information having the number of bytes of 15 bytes is transferred.
The data terminal equipment determines whether to finish the transmission of the communication information according to the number of tokens in the token receiving module and the number of bytes of the communication information to be transmitted, so that when the token transmission frequency is changed, the transmission frequency for transmitting the communication information is changed, and the current clock frequency is used as a new token transmission frequency, thereby realizing the change of the transmission frequency of the communication information.
Step S135, the communication information is stopped from being transmitted.
And if the byte number of a communication message is larger than the number of tokens in the token receiving module, stopping the communication message from being transmitted. Specifically, for example, if the number of bytes of the communication information is 7 bytes and the number of tokens in the token receiving module is 5, the transmission of the communication information having the number of bytes of 7 bytes is stopped.
And when the number of the preset bytes is larger than the number of the tokens, stopping the transmission of the communication information, thereby avoiding the congestion of the communication information.
Referring to fig. 3, fig. 3 shows a specific implementation manner of a serial port bandwidth synchronization method provided in a first embodiment of the present application, which specifically includes the following steps:
step S210, when the data communication device establishes a connection with the data terminal device, the data communication device sends an interaction packet carrying the first clock frequency information to the data terminal device.
When the data communication device establishes a connection with the data terminal device, the data communication device may send an interaction message with clock frequency information to the data terminal device. The data communication equipment and the data terminal equipment are connected, namely, the data communication equipment and the data terminal equipment perform link negotiation, and at the moment, the token transmission frequency in the data terminal equipment is synchronized with the current clock frequency, so that the synchronization of the serial port bandwidth can be better realized.
Taking the point-to-point protocol as an example, when the physical layer is available, a connection establishment (establishment) negotiation phase is performed. The point-to-point protocol link carries out LCP negotiation in an Establish stage, and after the negotiation is successful, the LCP enters an open state, namely a bottom link is established.
After the data communication device is connected with the data terminal device, the data terminal device can receive communication information by using the clock frequency sent by the data communication device as a token passing rate. At this time, the interactive message sent by the data communication device to the data terminal device may no longer carry clock frequency information, so that the influence on the communication bandwidth caused by excessive information may be avoided.
Step S220, the data communication device determines whether its clock frequency changes, if so, step S240 is executed; if not, go to step S230.
If the clock frequency of the data communication device itself changes, in order to avoid data congestion caused by inconsistency between the clock frequency and the token passing frequency, the data communication device should take corresponding measures, that is, execute step S240; if the clock frequency of the data communication apparatus itself has not changed, step S230 is executed.
Step S230, the data communication device sends an interaction packet that does not carry clock frequency information to the data terminal device.
The interactive message sent to the data terminal equipment by the data communication equipment can not carry clock frequency information any more, so that the influence on the communication bandwidth caused by excessive information can be avoided.
If the clock frequency of the data communication equipment is not changed, the interactive message sent to the data terminal equipment by the data communication equipment does not need to carry clock frequency information, so that the influence of excessive information on communication bandwidth is avoided.
Step S240, the data communication device sends an interaction packet carrying second clock frequency information to the data terminal device.
In order to avoid information congestion, the data communication device sends the changed current clock frequency to the data terminal device, and the data terminal device can receive communication information by using the clock frequency sent by the data communication device as a token passing rate.
The data communication equipment can also detect whether the clock frequency of the data communication equipment changes, and if the clock frequency changes, the data communication equipment carries the clock frequency when sending the interactive message to the data terminal equipment next time, so that the data terminal equipment can realize the synchronization of the bandwidth of the data communication equipment in time, and the occurrence of information congestion is avoided.
Second embodiment
Referring to fig. 4, fig. 4 shows a serial port bandwidth synchronization apparatus provided in a second embodiment of the present application, where the apparatus 300 includes:
an interactive packet obtaining module 310, configured to obtain an interactive packet that is sent by the data communication device and carries clock frequency information.
A clock frequency obtaining module 320, configured to obtain a current clock frequency of the data communication device according to the clock frequency information.
And the bandwidth synchronization module 330 is configured to implement synchronization between the bandwidth of the serial port of the data terminal device and the bandwidth of the serial port of the data communication device according to the current clock frequency and a preset algorithm.
The bandwidth synchronization module includes: and the transmission frequency updating submodule is used for acquiring the current clock frequency and taking the current clock frequency as the new token transmission frequency. And the communication information receiving submodule is used for receiving the communication information of the preset byte number sent by the data communication equipment. And the byte quantity judging submodule is used for acquiring the number of tokens in the token receiving module and judging whether the preset byte quantity is greater than the number of tokens or not. And the communication completion submodule is used for deleting the token number of the preset byte number from the token receiving module and completing the transmission of the communication information by the data terminal equipment if the preset byte number is not greater than the token number. And the communication stopping submodule is used for stopping the transmission of the communication information if the number of the preset bytes is larger than the number of the tokens.
The second embodiment of the present application further provides a serial port bandwidth synchronization device, which is applied to a data communication device, and the device includes: the first carrying and sending module is used for sending an interactive message carrying clock frequency information to the data terminal equipment when the data communication equipment is connected with the data terminal equipment.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method, and will not be described in too much detail herein.
The data terminal equipment acquires an interactive message, the interactive message carries clock frequency information, the data terminal equipment acquires the current clock frequency of the data communication equipment according to the clock frequency information, and the data terminal equipment combines the clock frequency with a preset algorithm, so that the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment are adjusted synchronously. Because the interactive message exists in the communication protocol of the data terminal equipment and the data communication equipment, and the interactive message is sent periodically, the clock frequency can be obtained through the interactive message, so that the change of the clock frequency can be obtained in time, and the occupation of the bandwidth can be reduced.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the 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.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.

Claims (10)

1. A serial port bandwidth synchronization method is characterized by comprising the following steps:
the data terminal equipment acquires an interactive message which is sent by the data communication equipment and carries clock frequency information;
the data terminal equipment acquires the current clock frequency of the data communication equipment according to the clock frequency information;
and the data terminal equipment realizes the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm, wherein the preset algorithm is a token bucket algorithm.
2. The method of claim 1,
the data terminal equipment realizes the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm, and the synchronization comprises the following steps:
the data terminal equipment acquires the current clock frequency and takes the current clock frequency as a new token transmission frequency;
the data terminal equipment receives communication information of a preset byte number sent by the data communication equipment;
the data terminal equipment acquires the number of tokens in a token receiving module and judges whether the number of the preset bytes is greater than the number of the tokens or not;
and if the number of the preset bytes is not greater than the number of the tokens, the data terminal equipment deletes the number of the tokens with the number of the preset bytes from the token receiving module and completes the transmission of the communication information.
3. The method of claim 2, wherein after determining whether the predetermined number of bytes is greater than the number of tokens, the method further comprises:
and if the number of the preset bytes is larger than the number of the tokens, stopping the transmission of the communication information.
4. A serial port bandwidth synchronization method is characterized by comprising the following steps:
when the data communication equipment is connected with the data terminal equipment, the data communication equipment sends an interactive message carrying current clock frequency information to the data terminal equipment, so that the data terminal equipment realizes synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm, wherein the preset algorithm is a token bucket algorithm.
5. The method of claim 4, further comprising:
the data communication equipment judges whether the clock frequency of the data communication equipment changes or not;
and if the clock frequency of the data communication equipment changes, the data communication equipment sends an interactive message carrying second clock frequency information to the data terminal equipment.
6. The method of claim 5, wherein after the data communication device determines whether the clock frequency of the data communication device changes, the method further comprises:
and if the clock frequency of the data communication equipment is not changed, the data communication equipment sends an interactive message which does not carry clock frequency information to the data terminal equipment.
7. A serial port bandwidth synchronizer is characterized in that the serial port bandwidth synchronizer is applied to data terminal equipment and comprises the following components:
the interactive message acquisition module is used for acquiring an interactive message which is sent by the data communication equipment and carries clock frequency information;
the clock frequency acquisition module is used for acquiring the current clock frequency of the data communication equipment according to the clock frequency information;
and the bandwidth synchronization module is used for realizing the synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm, wherein the preset algorithm is a token bucket algorithm.
8. The apparatus of claim 7, wherein the bandwidth synchronization module comprises:
the transmission frequency updating submodule is used for acquiring the current clock frequency and taking the current clock frequency as a new token transmission frequency;
the communication information receiving submodule is used for receiving communication information of the preset byte quantity sent by the data communication equipment;
the byte quantity judging submodule is used for acquiring the number of tokens in the token receiving module and judging whether the preset byte quantity is greater than the number of tokens or not;
and the communication completion submodule is used for deleting the token number of the preset byte number from the token receiving module and completing the transmission of the communication information by the data terminal equipment if the preset byte number is not greater than the token number.
9. The apparatus of claim 8, wherein the bandwidth synchronization module further comprises:
and the communication stopping submodule is used for stopping the transmission of the communication information if the number of the preset bytes is larger than the number of the tokens.
10. A serial port bandwidth synchronization device is applied to data communication equipment, and the device comprises:
the first carrying and sending module is used for sending an interactive message carrying current clock frequency information to the data terminal equipment when the data communication equipment is connected with the data terminal equipment, so that the data terminal equipment realizes synchronization of the bandwidth of the serial port of the data terminal equipment and the bandwidth of the serial port of the data communication equipment according to the current clock frequency and a preset algorithm, wherein the preset algorithm is a token bucket algorithm.
CN201810344468.0A 2018-04-17 2018-04-17 Serial port bandwidth synchronization method and device Active CN108667545B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810344468.0A CN108667545B (en) 2018-04-17 2018-04-17 Serial port bandwidth synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810344468.0A CN108667545B (en) 2018-04-17 2018-04-17 Serial port bandwidth synchronization method and device

Publications (2)

Publication Number Publication Date
CN108667545A CN108667545A (en) 2018-10-16
CN108667545B true CN108667545B (en) 2020-06-02

Family

ID=63783578

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810344468.0A Active CN108667545B (en) 2018-04-17 2018-04-17 Serial port bandwidth synchronization method and device

Country Status (1)

Country Link
CN (1) CN108667545B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7245630B1 (en) * 1998-09-30 2007-07-17 Cisco Technology, Inc. Method and apparatus for routing integrated data, voice, and video traffic
CN101799678A (en) * 2009-12-30 2010-08-11 北京宇航系统工程研究所 Three-way asynchronous serial-port data real-time synchronous transmitting system
CN102916903A (en) * 2012-10-25 2013-02-06 华为技术有限公司 Cache adjusting method and device
CN106357362A (en) * 2016-11-07 2017-01-25 瑞斯康达科技发展股份有限公司 Time synchronization method and device and PTP system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7809953B2 (en) * 2002-12-09 2010-10-05 Research In Motion Limited System and method of secure authentication information distribution
CN103763208B (en) * 2014-01-29 2017-08-29 华为技术有限公司 Data traffic method for limiting and device
CN105763542A (en) * 2016-02-02 2016-07-13 国家电网公司 Device and method of encryption and authentication for distribution terminal serial port communication
CN107896197A (en) * 2017-10-23 2018-04-10 深圳市楠菲微电子有限公司 Method and apparatus, the storage medium of forwarding rate are measured in communication equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7245630B1 (en) * 1998-09-30 2007-07-17 Cisco Technology, Inc. Method and apparatus for routing integrated data, voice, and video traffic
CN101799678A (en) * 2009-12-30 2010-08-11 北京宇航系统工程研究所 Three-way asynchronous serial-port data real-time synchronous transmitting system
CN102916903A (en) * 2012-10-25 2013-02-06 华为技术有限公司 Cache adjusting method and device
CN106357362A (en) * 2016-11-07 2017-01-25 瑞斯康达科技发展股份有限公司 Time synchronization method and device and PTP system

Also Published As

Publication number Publication date
CN108667545A (en) 2018-10-16

Similar Documents

Publication Publication Date Title
CN109218047B (en) Network slice processing method and device, communication system and storage medium
RU2684192C1 (en) Method and apparatus for transmitting service stream in flexible ethernet
US7460509B2 (en) Method and apparatus for isochronous datagram delivery over contention-based data link
CN111698725A (en) Method for dynamically determining network slice and electronic equipment
EP1161042B1 (en) Radio communication method and radio station
US9973427B2 (en) Method for determining management domain, network device, and virtual cluster
CN110943933A (en) Method, device and system for realizing data transmission
US20120147744A1 (en) Time and data rate policing
US20140010231A1 (en) Method and Apparatus for the Fast Detection of Connectivity Loss Between Devices in a Network
EP3370387B1 (en) Two-sided acceleration transmission method and system for wireless network
CN114615154A (en) Method and device for managing service quality and communication system
WO2005076851A2 (en) A method and system for creating, deleting, and maintaining logical networks
CN102668508B (en) Quality parameters negotiation by specific URI
CN108667545B (en) Serial port bandwidth synchronization method and device
WO2014127635A1 (en) Method and device for transmitting enhanced transmission selection standard configuration information
KR20040102083A (en) Scheduling a shared resource among synchronous and asynchronous packet flows
CN112314003A (en) Cellular telecommunications network comprising a plurality of network slices
JP2021534672A (en) Frame shield unit, serial bus system subscriber station, and communication method in the serial bus system
US20050174958A1 (en) Method and system for prioritazation and dynamic channel allocation within a communication system
KR20040017364A (en) Method for supporting a number of checksum algorithms in a network node
JP2007505588A (en) UPNP terminal for ad hoc wireless network
CN108574615A (en) A kind of content transmission method, equipment and system based on multipath MPTCP
Cisco Cisco IOS Release 11.1 CA Release Note and Update to Configuration Guides and Command References
US8542701B2 (en) Method and device for determining timeslot configuration in TDM transmission
JP7101816B2 (en) Service signal transmission method and equipment

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
GR01 Patent grant
GR01 Patent grant