Disclosure of Invention
In view of this, the present application provides a data transmission method and apparatus, so as to solve the problem that a data transmission manner in the related art causes that an SAS device needs to execute a search process for each received service response.
According to a first aspect of embodiments of the present application, there is provided a data transmission method, which is applied to an SAS device including a wide port, where the wide port includes a plurality of transceiver PHYs, and each PHY is preconfigured with a different SAS address, and the method includes:
establishing a link with the opposite-end SAS equipment by using the SAS address of each PHY;
when receiving an externally input service request, allocating a PHY (physical layer) for the service request, and marking the service type carried by the service request for the PHY;
the service request is sent to the opposite-end SAS equipment through the link corresponding to the PHY;
when a service response is received through the PHY, the service response is processed according to the service type marked for the PHY.
According to a second aspect of the embodiments of the present application, there is provided a data transmission apparatus, which is applied to an SAS device including a wide port, where the wide port includes a plurality of transceiver PHYs, and each PHY is preconfigured with a different SAS address, the apparatus including:
the link establishing module is used for establishing a link with the opposite-end SAS equipment by utilizing the SAS address of each PHY;
the system comprises an allocation module, a service request processing module and a service processing module, wherein the allocation module is used for allocating a PHY (physical layer) for the service request when receiving an externally input service request and marking the service type carried by the service request for the PHY;
the sending module is used for sending the service request to the opposite-end SAS equipment through the link corresponding to the PHY;
and the processing module is used for processing the service response according to the service type marked for the PHY when the service response is received through the PHY.
According to a third aspect of embodiments herein, there is provided a SAS device comprising a readable storage medium and a processor;
wherein the readable storage medium is configured to store machine executable instructions;
the processor is configured to read the machine executable instructions on the readable storage medium and execute the instructions to implement the steps of the first aspect described above.
By applying the embodiment of the application, different SAS addresses are configured for each PHY included in the wide port in advance, so that the SAS addresses between the links established by using the SAS addresses of each PHY and the SAS device of the opposite end cannot be shared, and the process of transmitting data through the wide port is as follows: when a service request input from the outside is received, a PHY can be allocated to the service request, the service type carried by the service request is marked for the PHY, the service request is sent to an SAS device at the opposite end through a link corresponding to the PHY, when the service response is received through the link corresponding to the PHY, the service response can be directly processed according to the service type marked for the PHY, a search process is not required to be executed, and therefore the processing performance of the SAS device can be improved.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Fig. 1 is a link structure diagram of a wide port of a current SAS device shown in an exemplary embodiment of the present application, where a wide port included in an SAS device a and a wide port included in an SAS device B in fig. 1 both include 4 PHYs, the 4 PHYs included in the wide port in the SAS device a share an SAS address a and the 4 PHYs included in the wide port in the SAS device B share an SAS address of the address B. Among them, the wide link consists of link 1 between PHY a1 and PHY B1, link 2 between PHY a2 and PHY B2, link 3 between PHY A3 and PHY B3, and link 4 between PHY a4 and PHY B4.
Those skilled in the art will appreciate that fig. 1 is merely exemplary and that in practical applications, each SAS device may include a plurality of wide ports, each wide port including an even number of PHYs.
Based on the above link structure shown in fig. 1, when SAS device a sends a service request to SAS device B through link 1 between PHY a1 and PHY B1, if SAS device B finds that PHY B1 is busy, and PHYB3 is idle, and PHYB3 shares a SAS address with link 1 for link 3, SAS device B generates a service response to the service request, and adds the PHY identifier of PHY B1 to the service response, and then returns the service response to SAS device a through link 3. When receiving the service response, the SAS device a needs to search for a corresponding link 1 from which the service request is sent according to the PHY identifier carried in the service response, and then process the service response according to the ongoing service corresponding to the link 1. However, the SAS device needs to perform a lookup procedure for each received service response for further service processing, thereby reducing the processing performance of the SAS device.
Based on this, different SAS addresses are configured for each PHY included in the wide port in advance, so that the SAS addresses of the PHYs cannot be shared with SAS addresses between links established by the opposite SAS device, and the process of transmitting data through the wide port is as follows: when a service request input from the outside is received, a PHY can be allocated to the service request, the service type carried by the service request is marked for the PHY, the service request is sent to an SAS device at the opposite end through a link corresponding to the PHY, when the service response is received through the link corresponding to the PHY, the service response can be directly processed according to the service type marked for the PHY, a search process is not required to be executed, and therefore the processing performance of the SAS device can be improved.
Fig. 2A is a flowchart of an embodiment of a data transmission method according to an exemplary embodiment of the present application, which may be applied to an SAS device including a wide port, where the wide port includes a plurality of PHYs, and each PHY is preconfigured with a different SAS address. As shown in fig. 2A, the data transmission method includes a process of establishing a link for the wide port in advance and a process of transmitting data through the wide port, and specifically includes the following steps:
step 201: and establishing a link with the opposite-end SAS equipment by using the SAS address of each PHY.
In an embodiment, an IDENTIFY frame including the SAS address of the PHY may be sent to the peer SAS device through each PHY, for each PHY, when a response frame to the IDENTIFY frame sent by the PHY and returned by the peer SAS device is received, an OPEN frame is sent to the peer SAS device by using the SAS address of the PHY in the peer SAS device carried in the response frame, and when a response frame to the OPEN frame sent by the PHY and returned by the peer SAS device is received, it is determined that the link establishment of the PHY is successful.
Wherein, in order to improve link establishment efficiency, the PHYs may perform the link establishment process in parallel. The IDENTIFY frame is a handshake frame, the OPEN frame is a connection establishment frame, and the wide port of the SAS device is realized through an Expander, so the OPEN frame can also carry the Expander address of the Expander where the PHY is located. Since the SAS address of each PHY included in the wide port is different, the SAS address between the established links is not shared.
In an exemplary scenario, as shown in fig. 2B, the wide port included in the SAS device a and the wide port included in the SAS device B in fig. 2B both include 4 PHYs, and SAS addresses of the 4 PHYs included in the wide port in the SAS device a are: the SAS addresses of 4 PHYs included in the wide port of the SAS device B are respectively: address B1, Address B2, Address B3, Address B4. In the process of establishing a link, the PHYA1 sends an IDENTIFY frame containing the address 1 to the SAS device B, when a response frame of the IDENTIFY frame is received through the PHYA1, the SAS address of the PHY in the SAS device B carried by the response frame is used, assuming that the response frame is the address B1, the OPEN frame is sent to the SAS device B, when the response frame of the OPEN frame is received through the PHYA1, the link establishment of the PHYA1 is determined to be successful, and the principle of establishing the link for the PHYA2, the PHYA3 and the PHYA4 is similar to that of the PHYA 1. Finally, 4 PHYs included in the wide port of the SAS device a and 4 links established by the SAS device B at the opposite end are different in SAS address used by each link.
Step 202: when receiving an externally input service request, allocating a PHY to the service request, and marking the service type carried by the service request for the PHY.
The externally input service request may be a write request or a read request, which may be triggered and generated by a user. A PHY in an idle state may be allocated from PHYs included in the wide port, and if the identifier of the service type carried in the service request is a write identifier, the allocated PHY is marked with the write identifier, and if the identifier of the service type carried in the service request is a read identifier, the allocated PHY is marked with the read identifier.
Step 203: and sending the service request to the opposite-end SAS device through the link corresponding to the PHY.
In an embodiment, the SAS address of the PHY in the opposite-end SAS device corresponding to the link corresponding to the PHY may be added to the service request, and then the service request is sent to the PHY in the opposite-end SAS device through the link corresponding to the PHY.
Step 204: when a service response is received through the PHY, the service response is processed according to the service type marked for the PHY.
Because the SAS addresses between the links included in the wide port are not shared, when receiving a service request through a certain link, the opposite-end SAS device can only return the corresponding service response through the original path, but cannot return the service response through other links of the wide port, and then receives the service response from which PHY, so that the service response can be processed by directly using the service type corresponding to which PHY, without executing a search process.
For the foregoing processes of step 202 to step 204, in an exemplary scenario, as further shown in fig. 2B, after the SAS device a receives a write request input from outside, the PHY allocated to the SAS device a is PHYA1, so that the SAS device a sends the write request to PHYB1 in the SAS device B through the link 1 corresponding to PHYA1, and simultaneously marks PHYA1 with a write identifier, when a service response is received through PHYA1, the service response may be processed directly according to the write identifier marked as PHYA 1.
In the embodiment of the present application, different SAS addresses are configured for each PHY included in the wide port in advance, so that an SAS address between links established by using the SAS address of each PHY and an SAS address between links established by the opposite-end SAS device cannot be shared, and a process of transmitting data through the wide port is as follows: when a service request input from the outside is received, a PHY can be allocated to the service request, the service type carried by the service request is marked for the PHY, the service request is sent to an SAS device at the opposite end through a link corresponding to the PHY, when the service response is received through the link corresponding to the PHY, the service response can be directly processed according to the service type marked for the PHY, a search process is not required to be executed, and therefore the processing performance of the SAS device can be improved.
Fig. 3 is a hardware structure diagram of a SAS device according to an exemplary embodiment of the present application, where the SAS device includes: a communication interface 301, a processor 302, a machine-readable storage medium 303, and a bus 304; wherein the communication interface 301, the processor 302, and the machine-readable storage medium 303 communicate with each other via a bus 304. The processor 302 may execute the data transmission method described above by reading and executing machine executable instructions corresponding to the control logic of the data transmission method in the machine readable storage medium 302, and the specific content of the method is referred to the above embodiments, which will not be described herein again.
The machine-readable storage medium 303 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: volatile memory, non-volatile memory, or similar storage media. In particular, the machine-readable storage medium 303 may be a RAM (random Access Memory), a flash Memory, a storage drive (e.g., a hard drive), any type of storage disk (e.g., an optical disk, a DVD, etc.), or similar storage medium, or a combination thereof.
Fig. 4 is a block diagram of an embodiment of a data transmission apparatus according to an exemplary embodiment of the present application, which may be applied to an SAS device including a wide port including a plurality of PHYs, wherein each PHY is preconfigured with a different SAS address. As shown in fig. 4, the data transmission apparatus includes:
a link establishing module 410, configured to establish a link with an opposite-end SAS device using the SAS address of each PHY;
an allocating module 420, configured to allocate a PHY to a service request when the service request input from the outside is received, and mark a service type carried by the service request for the PHY;
a sending module 430, configured to send the service request to an opposite-end SAS device through a link corresponding to the PHY;
a processing module 440, configured to process the service response according to the service type marked for the PHY when the service response is received through the PHY.
In an optional implementation manner, the link establishing module 410 is specifically configured to send an IDENTIFY frame including the SAS address of the PHY to the peer SAS device through each PHY; for each PHY, when a response frame aiming at an IDENTIFY frame sent by the PHY and returned by the opposite-end SAS equipment is received, an OPEN frame is sent to the opposite-end SAS equipment by using the SAS address of the PHY in the opposite-end SAS equipment carried by the response frame, and when the response frame aiming at the OPEN frame sent by the PHY and returned by the opposite-end SAS equipment is received, the successful link establishment of the PHY is determined; wherein SAS addresses between each link are not shared.
In an optional implementation manner, the sending module 430 is specifically configured to add the SAS address of the PHY in the opposite-end SAS device corresponding to the link corresponding to the PHY to the service request; and sending the service request to the PHY in the opposite-end SAS equipment through the link corresponding to the PHY.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It should also be noted that 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 like elements in a process, method, article, or apparatus that comprises the element.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.