Abstract:
A detecting method for the consistency of a link scrambling configuration, comprises: setting the first threshold of the data packet error rate received by the receiving end; when the receiving end receiving date from the link, counting the received data packet error rate; judging whether the error rate is above the set first threshold; if yes, determining that the link scrambling configurations between transmitting end and receiving end are inconsistent; if not, determining that the link scrambling configurations between transmitting end and receiving end are consistent. The invention provides that the ports could detect the consistency of the link scrambling configuration automatically when configuring the link scrambling code, thereby enables the receive device to adjust the configuration of scrambling code to achieve the consistency of scrambling code between both ends of the link, and improves the maintenance of devices.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
     This application is a continuation of International Patent Application No. PCT/CN2006/002000, filed Aug. 8, 2006, which claims priority to Chinese Patent Application No. 200510101346.1, filed on Nov. 16, 2005, both of which are hereby incorporated by referenced in their entirety. 
    
    
     FIELD OF THE INVENTION 
     The present invention relates to the field of transmission, and in particular to a method and a system for detecting consistency of link scrambling configurations. 
     BACKGROUND OF THE INVENTION 
     In Synchronous Optical Network (SONET) technologies and Synchronous Digital Hierarchy (SDH) technologies in the field of transmission, according to requirements of physical layer protocols, consecutive all zeros or ones should not occur in a data transmission signal because no synchronous clock can be extracted from the consecutive all zeros or ones. In order to prevent occurrence of such phenomena in the signal, a scrambling code technology has been adopted in the industry, which principle is to randomize digit bits in the signal to prevent consecutive all zeros or ones from occurring in the signal. 
     Currently, the International Telecommunication Union (ITU) specifies two scrambling code technologies which adopt two respective scrambling code algorithms. 
     One algorithm is a scrambling code technology specified in the GR-253 standards, in which digit bits in a synchronous head of a data frame are scrambled in accordance with an algorithm of 1+x6+x7. In this technology, the scrambling function takes effect all the time and may not be disabled, so the scrambling configurations of the two ends are consistent all the time. 
     The other algorithm is a scrambling code technology specified in the I.432 standards, in which a scrambling formula of the type of Asynchronous Transfer Mode (ATM) is specified and digit bits in a synchronous head of a data frame are scrambled in accordance with a polynomial algorithm of 1+x43. In this technology, it is not necessary for a transmitting end to inform a receiving end about whether a scrambling is required. The scrambling function is configurable, that is, it can be enabled or disabled through configuration, and therefore the scrambling configurations of both parties of a link connection using this technology may possibly be inconsistent. 
     In order to ensure a correct transmission and reception of data, it is required in a link using the scrambling code technology that the scrambling configurations of the transmitting end and the receiving end should be consistent, that is, when one of two parities connected through the link configures the scrambling function as “Enabled”, the other shall also configure the scrambling as “Enabled”, otherwise, when all data sent from the transmitting end is scrambled, if the receiving end does not configure the scrambling function as “Enabled”, it can not identify received data, or if the transmitting end does not configure the scrambling function as “Enabled” while the receiving end does, the receiving end can not identify the received date either. Consequently, in practical applications, the use of the above scrambling technology in the I.432 standards may be faced with the issue of detecting consistency of link scrambling configurations. 
     At present, the above scrambling configurations at the transmitting end and the receiving end are generally accomplished manually, and the consistency of scrambling configurations at both ends of a link is also detected manually. That is, the receiving end has to manually obtain the scrambling configurations of devices at the opposite ends to determine consistency of the scrambling configurations at the two ends. This may give rise to certain problems in practical applications. For example, when devices from two operators are docked, in order for the receiving end to learn about the scrambling configuration at the opposite end, it is required to manually detect whether the scrambling configurations of both parties are consistent, which is not convenient in terms of operations and maintenance. Furthermore, when the device at one end modifies its scrambling configuration during normal operation without informing a device at the opposite end, the device at the opposite end can not receive correct data packets, and therefore normal communications are affected, and if consistency of the scrambling configurations at the two ends is detected through human intervention, operations and maintenance are still time consuming, laborious and inconvenient. 
     SUMMARY OF THE INVENTION 
     The technical problem of the present invention is how to provide a method for detecting consistency of link scrambling configurations of a transmitting end and a receiving end in a link, so as to implement convenient and rapid operations and link maintenance. 
     In order to solve the above problem, the invention provides a method for detecting consistency of link scrambling configurations, which includes the steps of: 
     a) setting a first threshold of an error ratio of data packets received by the receiving end; 
     b) counting an error ratio of received data packets; and 
     c) determining whether the error ratio is above the first set threshold, and if yes, determining that the link scrambling configurations of the transmitting end and the receiving end of the link are inconsistent; otherwise, determining that the link scrambling configurations of the transmitting end and the receiving end of the link are consistent. 
     Optionally, if the error ratio is above the first set threshold: 
     c1) counting an error ratio of received data packets during further one or at least two periods; and 
     c2) determining whether the error ratio of the data packets in each of the periods is above a second set threshold, and if the error ratio of the data packets in each of the periods is above a second set threshold, determining that the link scrambling configurations of the transmitting end and the receiving end of the link are inconsistent; otherwise, returning to step b) for a new determination. 
     If the error ratio of the data packets in each of the periods is above the seconds set threshold, it is determined whether the link scrambling configurations of the transmitting end and the receiving end of the link have been determined previously as inconsistent, and if yes, alarm information is generated; otherwise it is determined that the link scrambling configurations of the transmitting end and the receiving end of the link are inconsistent. 
     The first threshold and the second threshold are the same. 
     Optionally, if the error ratio is above the first set threshold, it is determined whether the link scrambling configurations of the transmitting end and the receiving end of the link have been determined previously as inconsistent, and if yes, alarm information is generated; otherwise it is determined that the link scrambling configurations of the transmitting end and the receiving end of the link are inconsistent. 
     The alarm information includes host alarm information and network administrator alarm information. 
     The error ratio of data packets is the ratio of received data packets having a CRC error to all received data packets during a period of time. 
     Compared with the prior arts, the present invention has the following advantages: 
     In the present invention, thresholds are preset for an error ratio of data packets received by the receiving end at the time when the scrambling configurations of the link of the transmitting end and the receiving end are inconsistent. When data are received practically, consistency of the scrambling configurations of the transmitting end and the receiving end can be determined automatically in accordance with relationships between an error ratio of data packets received by the receiving end and the thresholds, without need of human intervention in obtaining the scrambling configuration at the opposite end to determine their consistency. With the inventive method, a device at the receiving end is able to adjust its scrambling configuration (by enabling or disabling the scrambling configuration function) in accordance with a determination result, thereby facilitating the operations and maintenance of the device. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  is a flow diagram of a method according to a first embodiment of the present invention; and 
         FIG. 2  is a flow diagram of a method according to a second embodiment of the present invention. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Exemplary embodiments of the invention are described in details as follows with reference to the drawings. 
     In the present invention, a link may be a packet over SONET or IP over SONET/SDH (POS) link or other links with scrambling configurations. When the scrambling configurations of a transmitting end and a receiving end are inconsistent during transmission of data over the link, received data packets having a Cyclic Redundancy Check (CRC) error will be increased because the receiving end can not descramble received data packets. In view of this situation, a CRC error ratio of the data packets received at the receiving end can be counted when data are received at the receiving end to determine correctness of contents of the received data packets, and further determine whether the current scrambling configuration is the same with that of the transmitting end, and in accordance with the determination result, decide whether needs to adjust the link scrambling configurations. 
     With reference to  FIG. 1 , it is a flow diagram of a method according to a first embodiment of the present invention. 
     Firstly, a threshold (referred to as a first threshold to be distinguished from a second threshold below in the embodiment) is preset for an error ratio of data packets received at the receiving end when the link scrambling configurations of the transmitting end and the receiving end are inconsistent (step  11 ), and the error ratio of data packets as mentioned in the present invention refers to the ratio of received data packets having a Cyclic Redundancy Check (CRC) error to all received data packets during a period of time. In a specific detection, when data packets are received via a port of the receiving device, a CRC error ratio of received data packets is counted firstly (step  12 ); it is determined whether the error ratio of the data packets received by the receiving end is above the first preset threshold (step  13 ). When the CRC error ratio of the data packets received via the port is relatively high (for example above the first preset threshold), it is determined that the current configuration is inconsistent with that of the opposite end and the current scrambling configuration needs to be modified (step  14 ); and when the CRC error ratio of the data packets received via the port is relatively low (for example below or equal to the first preset threshold), it is determined that the current scrambling configuration is consistent with that of the opposite end, and there is no need to modify the current scrambling configuration (step  15 ). 
     In a specific implementation, in order to ensure the reliability of a detection result, an error ratio of data packets received during further one or at least two continuous periods may also be counted before it is determined that the link scrambling configurations of the transmitting end and the receiving end of the link are inconsistent, and then it is determined whether the error ratio of the data packets during each of the periods is above a second preset threshold. If the determination result is YES, it can be determined that the link scrambling configurations of the transmitting end and the receiving end of the link are inconsistent, or if the determination result is NO, a new determination may be reinitiated. The second threshold may be the same as or different from the first threshold dependent upon practical situations. 
     It needs to be noted that in a specific situation, if a CRC error ratio of data packets previously received via the port is above the first preset threshold, the scrambling configuration of the port needs to be modified, but if the CRC error ratio of data packets currently received is still above the first preset threshold, it can be determined that the problem is caused due to other reasons (e.g., the link is not stable, the optical power has problem, etc.) instead of the scrambling configuration, and at this time, alarm information may be generated, including host alarm information, network administrator alarm information, and etc. 
     The thresholds may be preset at a relatively reasonable value, e.g., 50%, dependent upon practical requirements, which will not described any more here. 
     In accordance with the above thoughts, as illustrated in  FIG. 2 , when a port of a device operates normally, the received data is processed in the following flow. 
     a: A timer T 1  and a flag bit FLAG are reset at zero upon initialization of a port. The flag bit FLAG indicates whether the scrambling configuration has been modified once. 
     b: Determine whether the timer T 1  times out; if the timer T 1  times out, a CRC error ratio of data packets received via the port during the present period of the timer is counted and the flow goes to step c; otherwise, the flow waits until the timer T 1  times out. 
     c: Determine whether the counted CRC error ratio of the data packets is above 50%; and if the counted CRC error ratio of the data packets is above 50%, a CRC error ratio of data packets received via the port during each of further continuous periods T 2  is counted during respective period T 2 , and the flow goes to step d; otherwise, it is determined that the current scrambling configuration of the receiving end is consistent with that of the transmitting end, and the flag bit FLAG is reset at zero, the timer T 1  is reset, and the flow returns to step b for a new determination. 
     d: Determine whether each of the counted CRC error ratios is above 50%; if each of the counted CRC error ratios is above 50%, it is determined that the current scrambling configuration of the receiving end is inconsistent with the transmitting end, and the current scrambling configuration is modified and the flow goes to step e; otherwise, the error rate is considered as a false one, the timer T 1  is reset, and the flow returns to step b for a new determination 
     e: Determine whether the flag bit FLAG is zero; if the flag bit FLAG is zero, it is indicated that the scrambling configuration has not been modified prior to the present modification or the scrambling configuration of the port is correct prior to the present modification. In such a situation, the flag bit FLAG is set at one, the timer T 1  is reset, a next period T 1  starts, and the flow returns to step b to further determine whether the configuration modification is successful. If the flag bit FLAG is not zero, it is indicated that the scrambling configuration has been modified once, but the modification is not successful. In such a situation, it is believed that the problem is not caused due to the scrambling configurations, and alarm information is generated, the flag bit is reset at zero, the timer T 1  is reset, a next period T 1  starts and the flow returns to step b for next determination. 
     In accordance with the above preferred embodiment of the invention, the determination of the current scrambling configuration of the port has three results, i.e., the scrambling configuration of the receiving end is consistent with that of the transmitting end; the scrambling configuration of the receiving end is inconsistent with that of the transmitting end; or there is a link failure, which correspond to three flows in which steps are performed respectively. 
     Particularly in the present invention, the first flow is as follows when the scrambling configuration of the receiving end is consistent with that of the transmitting end: 
     s 11 : The timer T 1  and the flag bit FLAG are reset at zero upon initialization of a port. The flag bit FLAG indicates whether the scrambling configuration has been modified once. 
     s 12 : Determine whether the timer T 1  times out; if the timer T 1  times out, a CRC error ratio of data packets received via the port during the present period of the timer is counted, and the flow goes to step s 13 ; otherwise, the flow waits until the timer T 1  times out. 
     s 13 : The counted CRC error ratio of the data packets is below 50%; the current scrambling configuration of the receiving end is consistent with that of the transmitting end; the flag bit FLAG is reset at zero and the timer T 1  is reset, and the flow returns to step s 13  for next determination. 
     Particularly in the present invention, the second flow is as follows when the scrambling configuration of the receiving end is inconsistent with that of the transmitting end: 
     s 21 : The timer T 1  and the flag bit FLAG are reset at zero upon initialization of the port. The flag bit FLAG indicates whether the scrambling configuration has been modified once. 
     s 22 : Determine whether the timer T 1  times out; if the timer T 1  times out, a CRC error ratio of data packets received via the port during the present period of the timer is counted, and the flow goes to step s 23 ; otherwise, the flow waits until the timer T 1  times out. 
     s 23 : The counted CRC error ratio of the data packets is above 50%; a CRC error ratio of data packets received via the port during each of continuous periods T 2  is further counted, and the flow goes to step s 24 . 
     s 24 : Each of the counted CRC error ratios is above 50%; it is determined that the current scrambling configuration of the receiving end is inconsistent with that of the transmitting end; the current scrambling configuration is modified, and the flow goes to step s 25 . 
     s 25 : The flag bit FLAG is zero, which indicates that the scrambling configuration has not been modified prior to the present modification or the scrambling configuration of the port is correct prior to the present modification; the flag bit FLAG is set at one, the timer T 1  is reset, a next period T 1  starts and the flow returns to step s 22  for further determination. 
     s 22 : Determine whether the timer T 1  times out; if the timer T 1  times out, a CRC error ratio of data packets received via the port during the present period of the timer is counted, and the flow goes to step s 23 ; otherwise, the flow waits until the timer T 1  times out. 
     s 23 : The counted CRC error ratio of the data packets is below 50%; the scrambling configuration of the receiving end is consistent with that of the transmitting end; the flag bit FLAG is reset at zero, the timer T 1  is reset, and the flow returns to the step s 22  for next determination. 
     Particularly in the present invention, the third flow is as follows when there is a link failure: 
     s 31 : The timer T 1  and the flag bit FLAG are reset at zero upon initialization of the port. The flag bit FLAG indicates whether the scrambling configuration has been modified once. 
     s 32 : Determine whether the timer T 1  times out; if the timer T 1  times out, a CRC error ratio of data packets received via the port during the present period of the timer is counted, and the flow goes to step s 33 ; otherwise, the flow waits until the timer T 1  times out. 
     s 33 : The counted CRC error ratio of the data packets is above 50%, and a CRC error ratio of data packets received via the port during each of continuous periods T 2  is counted, and the flow goes to step s 34 . 
     s 34 : Each of the counted CRC error ratios is above 50%; the current scrambling configuration of the receiving end is inconsistent with that of the transmitting end; the current scrambling configuration is modified, and the flow goes to step s 35 . 
     s 35 : The flag bit FLAG is zero, which indicates that the scrambling configuration has not been modified prior to the present modification or the scrambling configuration of the port is correct prior to the present modification; the flag bit FLAG is set at one, the timer T 1  is reset, a next period T 1  starts and the flow returns to step s 22  for further determination. 
     s 32 : Determine whether the timer T 1  times out; if the timer T 1  times out, a CRC error ratio of data packets received via the port during the present period of the timer is counted, and the flow goes to the step s 33 ; otherwise, the flow waits until the timer T 1  times out. 
     s 33 : The counted CRC error ratio of the data packets is above 50%, and a CRC error ratio of data packets received via the port during each of continuous periods T 2  is counted, and the flow goes to step s 34 . 
     s 34 : Each of the counted CRC error ratios is above 50%; the current scrambling configuration of the receiving end is considered as incorrect and is modified, and the flow goes to step s 35 . 
     S 35 : The flag bit FLAG is one, which indicates that the scrambling configuration has been modified once and the modification is not successful. In such a situation, it is considered that the problem is not caused due to the scrambling configuration, and alarm information is generated; the flag bit is reset at zero, the timer T 1  is reset, a next period T 1  starts and the flow returns to step s 32  for next determination. 
     The foregoing descriptions are merely illustrative of the exemplary embodiments of the invention. It shall be noted that those ordinarily skilled in the art can make numerous modifications and variations without departing from the spirit of the invention, and these modifications and variations shall be considered as coming into the scope of the invention as defined in the appended claims.