STP link layer state machine optimization method

文档序号:809186 发布日期:2021-03-26 浏览:23次 中文

阅读说明:本技术 Stp链路层状态机优化方法 (STP link layer state machine optimization method ) 是由 宫晓渊 赵新宇 张辅云 李兵 于 2020-12-22 设计创作,主要内容包括:本发明提供了一种STP链路层状态机优化方法,检测STP链路层状态机是否处于HL-SendChkRdy状态,如果所述STP链路层状态机处于所述HL-SendChkRdy状态,则确定STP链路层是否出现冲突事件,当出现所述冲突事件时,将所述STP链路层状态机迁移至L-SyncEscape状态,在所述L-SyncEscape状态下执行状态机跳转和后续业务处理。本发明改善了链路层状态机运转机制,解决了STP场景中链路层状态机的死循环问题,完善了SATA链路层对STP场景的支持。(The invention provides an STP link layer state machine optimization method, which comprises the steps of detecting whether an STP link layer state machine is in an HL _ SendChkRdy state or not, if the STP link layer state machine is in the HL _ SendChkRdy state, determining whether a conflict event occurs in the STP link layer or not, when the conflict event occurs, migrating the STP link layer state machine to an L _ SyncEscape state, and executing state machine jumping and subsequent service processing in the L _ SyncEscape state. The invention improves the running mechanism of the state machine of the link layer, solves the problem of endless loop of the state machine of the link layer in the STP scene, and perfects the support of the SATA link layer to the STP scene.)

1. An STP link layer state machine optimization method, comprising:

it is detected whether the STP link layer state machine is in the HL _ SendChkRdy state,

if the STP link layer state machine is in the HL _ SendChkRdy state, determining whether a collision event occurs at the STP link layer,

and when the conflict event occurs, migrating the STP link layer state machine to an L _ SyncEscape state, and executing state machine jumping and subsequent service processing in the L _ SyncEscape state.

2. The STP link layer state machine optimization method of claim 1, wherein the determining whether a collision event occurs at the STP link layer further comprises:

it is determined whether a connection close message is received by the STP link layer.

3. The STP link layer state machine optimization method of claim 2, wherein the determining whether the STP link layer receives the connection close message further comprises:

determining whether a transport layer of the SAS controller requests an STP connection to be closed.

4. The STP link layer state machine optimization method of claim 2, wherein the determining whether the STP link layer receives the connection close message further comprises:

it is determined whether the CLOSE primitive is received by the link layer of the SAS.

5. The STP link layer state machine optimization method of claim 4, wherein the determining whether the link layer of the SAS receives a CLOSE primitive further comprises:

whether the CLOSE primitive is received is determined by judging whether the GOT _ CLOSE signal is pulled high.

6. The STP link layer state machine optimization method of claim 4, wherein the determining whether the link layer of the SAS receives a CLOSE primitive further comprises:

when the transport layer requests to SEND FIS data, if the SEND _ X _ RDY signal is pulled high, requesting the physical layer to SEND an X _ RDY primitive, then determining that the STP link layer state machine is in the HL _ SendChkRdy state.

7. The STP link layer state machine optimization method of claim 1, wherein the performing state machine hopping and subsequent traffic processing in an L _ SyncEscape state further comprises:

and the STP link layer terminates the transmission of the current data request and reports the corresponding event to the transmission layer of the SAS controller to implement the abnormal transmission termination treatment.

8. The STP link layer state machine optimization method of claim 1, wherein the performing state machine hopping and subsequent traffic processing in an L _ SyncEscape state further comprises:

and if the STP link layer receives the SNYC primitive, returning to an L _ IDLE IDLE state of the STP link layer, and continuously sending the SYNC primitive by the SAS controller.

9. The STP link layer state machine optimization method of claim 1, wherein the performing state machine hopping and subsequent traffic processing in an L _ SyncEscape state further comprises:

the SEND X _ RDY primitive is stopped by pulling the SEND _ X _ RDY signal low.

10. The STP link layer state machine optimization method of claim 1, wherein the performing state machine hopping and subsequent traffic processing in an L _ SyncEscape state further comprises:

and if the physical link is abnormal, migrating the STP link layer state machine to an L _ NoCommErr state, and entering physical link abnormal processing.

Technical Field

The invention belongs to the technical field of disk connection, and particularly relates to an STP link layer state machine optimization method.

Background

Sata (serial ata) is a high-speed serial bus, which adopts a point-to-point transmission mode, has a built-in data/command verification unit, is strong in error correction capability, supports hot plug, has the characteristics of small pin number, high data transmission rate, high reliability, good compatibility, and the like, and is widely used in the industry for a main I/O interface between a storage device and a host.

SAS (serial attached SCSI) is a new generation SCSI technology, and like SATA technology, serial interfaces are also used to achieve higher transmission speeds. Meanwhile, the SAS design considers the downward compatibility of SATA technology, and the interconnection and data transmission between the SAS controller and SATA devices are realized by STP protocol (SATA channel protocol). The STP protocol specification in the SAS protocol standard defines the details of the communication technology of the SAS system and SATA equipment, wherein the link layer of STP is realized on the basis of the link layer defined by the SATA standard protocol.

In a typical SAS data storage topology, a SAS controller supports large-scale disk management via one or more stages of Expander(s). The SAS Expander usually integrates STP/SATA bridge to complete the conversion from SAS protocol to SATA protocol, so as to be compatible with SATA disk device connection. As described in fig. 1, the SAS controller C1 manages the topology of the entire storage system as an initiator of control commands and data read/write commands, issues disk data read/write commands, and receives device responses. The SAS Expander C2 is connected to the SAS controller C1 via a SAS standard physical connection L1 for extending the topology of the storage system, with its internal integration of STP/SATA bridges for SATA device connection compatibility. And the STP/SATA bridge C2.1 completes the conversion from the STP protocol to the SATA protocol in the SAS standard and helps the SATA equipment to access the SAS system. SATA storage device C3 is connected to the STP/SATA bridge C2.1 via a SATA standard physical connection L2 for storing business data.

However, the SATA standard protocol is not fully considered to support SAS application scenarios at the beginning of its formulation, and in a specific STP application scenario, the link layer of the SATA standard protocol cannot complete an expected data communication process, resulting in a data communication failure.

On the other hand, compared with the standard SATA link layer, the STP link layer of the SAS needs to cooperate with a link layer (SAS link layer) of the SAS to complete link connection management. The following description, in conjunction with a typical scenario of STP link layer message interaction of SAS, points out a problem existing in the current SATA standard link layer when supporting an STP application scenario.

Referring to fig. 2, after the FIS (Frame Information Structure, SATA transport layer data Structure) of the SAS transport layer is sent, the STP link layer sends a WTRM primitive to prompt completion of the transmission of the FIS; the STP/SATA bridge of the SAS Expander forwards the WTRM primitive of the STP link layer of the SAS controller to the SATA device; the SATA device link layer sends R _ OK to indicate that the FIS is successfully received; the STP/SATA bridge forwards the R _ OK primitive of the SATA device to the SAS controller; the SAS controller temporarily has no FIS to wait for transmission, and the STP link layer transmits SYNC primitive to indicate that the link is idle; the SATA equipment is idle, no FIS is sent, and a link layer sends SYNC primitive; the STP/SATA bridge forwards SYNC primitives received by the port to the SAS controller or the SATA device; detecting that the STP port and the SATA port simultaneously receive SYNC primitives by the SAS Expander, starting a connection management process when the SAS controllers and the SATA equipment at two ends of the link are both in an idle state, and continuously sending a CLOSE primitive request for 3 times to CLOSE the STP link; meanwhile, a transmission layer of the SAS controller generates a FIS transmission request, and an STP link layer of the SAS controller transmits an X _ RDY primitive request link to request to transmit data again; detecting a CLOSE primitive sent by the Expander by the SAS controller link layer, replying the CLOSE primitive for 3 times, and closing STP connection; after STP connection is closed, the SAS controller and Expander link are IDLE, IDLE DWORD IDLE data is continuously sent, and the physical link is kept active.

Wherein the link layer sends an X _ RDY primitive in the HL _ SendChkRdy state, and if the R _ RDY primitive is received, the state is transferred to the L _ SendSOF state; if the X _ RDY primitive is received, the state is migrated to the L _ RcvWaitFifo state; if it is other data than R _ RDY or X _ RDY, the state persists in HL _ SendChkRdy. It can be seen that if the SAS controller STP link layer does not receive the expected X _ RDY or R _ RDY primitive from the device end after sending X _ RDY, the state machine of the STP link layer may stay in the HL _ sendchkddy state continuously, and an endless loop may occur, so that subsequent traffic processing cannot be continued.

Disclosure of Invention

The invention aims to provide an improved scheme under a typical STP application scene aiming at the defects existing in the link layer of the current SATA standard protocol, and the correct support to the STP scene is completed.

The invention provides an STP link layer state machine optimization method in a first aspect, which comprises the following steps:

it is detected whether the STP link layer state machine is in the HL _ SendChkRdy state,

if the STP link layer state machine is in the HL _ SendChkRdy state, determining whether a collision event occurs at the STP link layer,

and when the conflict event occurs, migrating the STP link layer state machine to an L _ SyncEscape state, and executing state machine jumping and subsequent service processing in the L _ SyncEscape state.

Preferably, the determining whether the STP link layer has a collision event further comprises determining whether the STP link layer has received a connection close message.

Preferably, the determining whether the STP link layer receives the connection close message further includes:

determining whether a transport layer of the SAS controller requests an STP connection to be closed.

Preferably, the determining whether the STP link layer receives the connection close message further includes:

it is determined whether the CLOSE primitive is received by the link layer of the SAS.

Preferably, the determining whether the CLOSE primitive is received by the link layer of the SAS further includes:

whether the CLOSE primitive is received is determined by judging whether the GOT _ CLOSE signal is pulled high.

Preferably, the determining whether the CLOSE primitive is received by the link layer of the SAS further includes:

when the transport layer requests to SEND FIS data, if the SEND _ X _ RDY signal is pulled high, requesting the physical layer to SEND an X _ RDY primitive, then determining that the STP link layer state machine is in the HL _ SendChkRdy state.

Preferably, the executing the state machine jump and the subsequent service processing in the L _ SyncEscape state further includes:

and the STP link layer terminates the transmission of the current data request and reports the corresponding event to the transmission layer of the SAS controller to implement the abnormal transmission termination treatment.

Preferably, the executing the state machine jump and the subsequent service processing in the L _ SyncEscape state further includes:

and if the STP link layer receives the SNYC primitive, returning to an L _ IDLE IDLE state of the STP link layer, and continuously sending the SYNC primitive by the SAS controller.

Preferably, the executing the state machine jump and the subsequent service processing in the L _ SyncEscape state further includes:

the SEND X _ RDY primitive is stopped by pulling the SEND _ X _ RDY signal low.

Preferably, the executing the state machine jump and the subsequent service processing in the L _ SyncEscape state further includes:

and if the physical link is abnormal, migrating the STP link layer state machine to an L _ NoCommErr state, and entering physical link abnormal processing.

Compared with the prior art, the invention has the following advantages:

the invention improves the running mechanism of the state machine of the link layer with the minimum cost, solves the problem of endless loop of the state machine of the link layer in the STP scene, perfects the support of the SATA link layer to the STP scene and provides effective support for improving the reliability of the SATA protocol.

Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

Drawings

In order to more clearly illustrate the embodiments of the present invention 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, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.

Fig. 1 shows a block diagram of a SAS controller and SATA device connection according to the prior art.

Fig. 2 shows a STP link layer communication flow diagram according to the SAS standard protocol according to the prior art.

FIG. 3 illustrates a SATA link layer state machine state migration flow diagram in accordance with a preferred embodiment of the present invention

Figures 4-1 and 4-2 show a comparison timing diagram of the effects of the STP link layer state machine optimization method of the present invention before and after application, respectively.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

In the STP link layer state machine optimization method, the running mechanism of the link layer state machine is improved by defining the new SATA link layer state machine migration condition and the target state, the problem that the state machine is in HL _ SendChkRdy dead cycle in the scene shown in figure 2 is solved, correct support for the STP scene is provided, and normal operation of the service is ensured.

In the preferred embodiment of the present invention, based on the SATA standard protocol, an L _ SyncEscape state (item 3) is added to the state transition table of HL _ SendChkRdy, and optimization is performed for a change in the connection state of the STP link.

When the STP link layer receives a connection closing message of the transmission layer or the SAS link layer (namely a conditional transport layer or an SAS link layer indication connection close), the state is transferred to an L _ SyncEscape state, the subsequent state machine skipping and service processing are continued, and the state machine endless loop is prevented.

Therein, the L _ SyncEscape state transition table is described as follows.

FIG. 3 depicts the state transition process of the present invention after the scenario optimization based on FIG. 2:

1. state S1: l _ IDLE, i.e., STP link layer IDLE state, in which the SAS controller continues to send SYNC primitives;

2. event T1: the transmission layer of the SAS controller requests to send FIS to the SATA device, and enters a state S2 after the event is finished;

3. state S2: HL _ SendChkRdy, the STP link layer sends an X _ RDY primitive request link in the state to prepare for sending data;

4. event T2: upon receiving the R _ RDY primitive, the SAS controller initiates FIS transmission and enters state S3;

5. state S3: l _ SendSOF, the STP link layer sends SOF primitive at this time, the transmission layer starts the FIS sending process, the FIS returns to the state S1 after the FIS sending is finished, namely L _ IDLE state;

6. event T3: receiving the X _ RDY primitive, the SATA device requests to send FIS at the same time, and enters a state S5;

7. state S5: the SAS controller gives the data transmission right to the SATA device, prepares to receive FIS and returns to an L _ IDLE state after receiving;

8. event T4: the transmission layer of the SAS controller requests the STP connection to be closed, or the SAS link layer detects a CLOSE primitive and enters a state S4;

9. state S4: l _ SyncEscape, stopping sending the X _ RDY when the STP link layer terminates the current FIS sending request, continuously sending SYNC primitive by the SAS controller, reporting an event to a transmission layer of the SAS controller to implement sending termination exception processing;

10. event T7: the STP link layer receives the SNYC primitive and returns to the state S1;

11. events T5, T6: when the physical link is abnormal, entering a state S6;

12. state S6: l _ NoCommErr, enter physical link exception handling.

In the above embodiment, the introduction of the event T4 and the state S4(L _ SyncEscape) effectively prevents the dead loop of the state machine caused by the link shutdown after the link layer sends X _ RDY. When a conflict scene occurs, the STP link layer state machine exits from an HL _ SendChkRdy state and is successfully migrated to an L _ IDLE initial IDLE state through an L _ SyncEscape state, and the problem of dead loop is avoided because the state machine realizes closed-loop operation.

It should be noted that the state machine migration process shown in fig. 3 is only for illustrating and not limiting the technical solution of the present invention. It will be understood by those skilled in the art that any conceivable adjustment of the structural features of the disk array and the number of events, states, etc. of the state machine may be made according to actual needs based on the present invention, and the present invention should not be limited to the specific structures or parameters illustrated above.

The optimization process described above is further described in connection with an example implementation of a link CLOSE scenario. The signal timing diagrams of figures 4-1 and 4-2 compare the effect before and after the optimization of the STP link layer state machine.

As shown in fig. 4-1, the STP link layer standard state machine starts in an L _ IDLE state, and at this time, the STP link layer is in an IDLE state and continues to send SYNC primitives; when a pull-up event occurs in a TX _ START _ FRAME signal of the SAS controller, the transport layer requests to send FIS data; if the SEND _ X _ RDY signal of the SAS controller is pulled high at the moment to request the physical layer to SEND the X _ RDY primitive, the state of HL _ SendChkRdy is entered, and the STP link layer continuously SENDs the X _ RDY primitive to request the link to prepare for sending data; in the HL _ SendChkRdy state, if the GOT _ CLOSE signal of the SAS controller is pulled up, the link layer of the SAS receives the CLOSE primitive; thereafter, the STP link layer state will still remain in the HL _ SendChkRdy state continuously, failing to form a closed loop back to the state L _ IDLE.

As shown in fig. 4-2, in the state machine of the STP link layer optimized in the present invention, also in the above HL _ SendChkRdy state, if the GOT _ CLOSE signal is pulled high again, the link layer of the SAS receives the CLOSE primitive; pulling down a SEND _ X _ RDY signal of the SAS controller to enter an L _ SyncEscape state, wherein at the moment, the STP link layer terminates the current FIS sending request, stops sending the X _ RDY request and continuously SENDs SYNC primitives; and waiting for an event of a signal TX _ GOT _ SYNC of the SAS controller, closing the link when the TX _ GOT _ SYNC is pulled up, receiving a SYNC primitive reported by the SAS link layer, and returning the STP link layer state machine to an L _ IDLE state, namely keeping the STP link layer IDLE, continuously sending the state of the SYNC primitive, so as to prevent the occurrence of dead cycle.

Therefore, the optimized STP link layer state machine overcomes the defect that the state machine can not jump out of the HL _ SendChkRdy state, and ensures the correct operation of subsequent services. The method of the invention utilizes the existing L _ SyncEscape state, effectively solves the problem of the state deadlock of the STP link layer with the minimum cost on the basis of not introducing a new state, perfects the support of the SATA link layer to the STP scene, and provides effective support for improving the reliability of the SATA protocol.

Furthermore, those skilled in the art will appreciate that the timing in the link CLOSE scenario shown in FIGS. 4-1 and 4-2 is for illustration only and does not constitute a limitation on the timing of the signals of the present invention. Those skilled in the art will appreciate that the essential aspects of the present invention are equally applicable to similar scenarios, such as X _ RDY and other link management exception conflicting scenarios, in addition to the link CLOSE scenario.

Although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种主板及其信号转接系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!