Patent ID: 6954425

Claim:
A method for compensating for clock signal difference between a switch and a peripheral device, the switch comprising a memory, a first counter and a second counter, the switch being used for receiving and transmitting a plurality of packets, the memory receiving the packets for temporary storage and being read for transmission of the packets, wherein each of the packets corresponds to a queue link node, an N-th packet corresponds to an N-th queue link node QLN(N) and an M-th packet corresponds to an M-th queue link node QLN(M), where N and M are integers, the method comprising: a receiving process, the receiving process comprising the steps of: (a) receiving the N-th packet; (b) triggering the first counter; (c) performing a counting operation by the first counter; (d) proceeding to step (e) when an (N+1)-th packet is inputted to the switch, otherwise proceeding to said step (c); (e) stopping the first counter and then recording an inter-packet gap IPG(N, N+1) between the N-th packet and the (N+1)-th packet into the (N+1)-th queue link node QLN(N+1) according to a counting value by the first counter; and (f) increasing N by one and then repeating from said step (b) to said step (f); and a transmitting process, the transmitting process comprising the steps of: (a1) reading the M-th queue link node QLN(M) corresponding to the M-th packet for obtaining an inter-packet gap IPG(M−1, M), and then transmitting the M-th packet; (b1) triggering the second counter; (c1) performing counting operation by the second counter; (d1) stopping th counting operation of the second counter when a counted value by the second counter is equal to a clock cycle value corresponding to the inter-packet gap IPG(M−1, M), otherwise repeating said step (c1); (e1) reading an (M+1)-th queue link node QLN(M+1) corresponding to an (M+1)-th packet for obtaining inter-packet gap IPG(M, M+1), and then transmitting the (M+1)-th packet; and (f1) increasing M by one and then repeating from said step (c1) to said step (f1); wherein when the M-th and (M+1)-th packets are transmitted respectfully, an inter-packet gap between the transmitted M-th and (M+1)-th packets is based on the inter-packet gap IPG(M−1, M), which is the inter-packet gap between the received (M−1)-th and M-th packets and is recorded into the M-th QLN(M) by the receiving process, so that congestion of the memory of the switch is reduced.