1. Field of the Invention
The present invention relates to a method and system for managing temporary. storage of data by a host of a computer system; more particularly, the present invention relates to the use of buffer queues in a computer system for temporary data storage.
2. Description of Related Art
The server 12 communicates via a peripheral component interconnect (PCI or PCIX) host bus interface 22 to a host bus adaptor (HBA) 24, which handles the I/O operations for transmitting and receiving data to and from remote Fibre Channel disk storage devices 28 via a Fibre Channel fabric 26. Host bus adapters (HBAs) are well-known peripheral devices that handle data input/output (I/O) operations for host devices and systems (e.g., servers). In simple terms, a HBA provides I/O processing and physical connectivity between a host device and external data storage devices. The external storage devices may be connected using a variety of known “direct attached” or storage networking technologies, including Fibre Channel, iSCSI, VI/IP, FICON, or SCSI. HBAs provide critical server CPU off-load, freeing servers to perform application processing. HBAs also provide a critical link between the storage area networks and the operating system and application software residing within the server. In this role the HBA enables a range of high-availability and storage management capabilities, including load balancing, SAN administration, and storage management.
Other host systems 30 may also be operatively coupled to the Fibre Channel fabric 26 via respective HBAs 32 in a similar fashion. The server 12 may communicate with other devices 36 and/or clients or users (not shown) via an Ethernet port/interface 38, for example, which can communicate data and information in accordance with well-known Ethernet protocols. Various other types of communication ports, interfaces and protocols are also known in the art that may be used by the server 12. The server 12 may also be connected to the Internet 40 via communication port/interface 38 so that remote computers (not shown) can communicate with the server 12 using well-known TCP/IP protocols. Additionally, the server 12 may be connected to local area networks (LANS) (not shown) and/or wide area networks (WANs) (not shown) in accordance with known computer networking techniques and protocols.
A schematic representation of a portion of the memory configuration of the server 12 and the HBA 24 is illustrated in
The command ring 108 stores command representations such as command I/O control blocks (IOCBs) 148 that are to be presented to the HBA 24. A command IOCB 148 contains all of the information needed by the HBA 24 to carry out a Input/Output command to another device. The information may include the destination device, a pointer to the address of the data being transferred and the length of the data that can be stored (e.g., data buffer descriptor).
When the server 12 writes a command IOCB 148 into the command ring 108, it also increments a put pointer 144 to indicate that a new command IOCB 148 has been placed into the command ring 108. When the HBA 24 reads a command IOCB 148 from the command ring 108, it increments a get pointer 146 to indicate that a command IOCB 148 has been read from the command ring 108. In general (excluding for the moment the fact that the command ring 108 is a circular ring that wraps around), if the put pointer 144 is equal to the get pointer 146, the command ring 108 is empty. If the put pointer 144 is ahead of the get pointer 146, there are commands 148 in the command ring 108 to be read by the HBA 24. If the put pointer 144 is one less than the get pointer 146, the command ring 108 is full.
The response ring 110 stores response indicators such as response IOCBs 156 of asynchronous events written by the HBA 24, including notifications of unsolicited events such as incoming data from a remote system. Response IOCBs 156 contain all of the information needed by the server 12 to carry out the command. For example, one such response IOCB 156 may require that the server 12 initiate a new command. When the HBA 24 writes a response IOCB 156 into the response ring 110, it also increments a put pointer 150 to indicate that a new response IOCB 156 has been placed into the response ring 110. When the server 12 reads a response IOCB 156 from the response ring 110, it increments a get pointer 152 to indicate that a response IOCB 156 has been read from the response ring 110.
The server 12 also includes a collection of pointers such as a port pointer array 106 that reside in the main memory 132. The port pointer array 106 contains a list of pointers that can be updated by the HBA 24. These pointers are entry indexes into the command ring 108, response ring 110, and other rings in the server 12. For example, the port pointer array 106 contains the get pointer 146 for the command ring 108 and the put pointer 150 for the response ring 110. When updated, these pointers indicate to the server 12 that a command IOCB 148 has been read from the command ring 108 by the HBA 24, or that a response IOCB 156 has been written into the response ring 110 by the HBA 24.
The HBA memory 50 includes a host bus configuration area 126 that contains information for allowing the host system 10 to identify the type of HBA 24 and what its characteristics are, and to assign base addresses to the HBA 24 so that programs can talk to the HBA 24. The HBA memory 50 further stores hardware execution program instructions and processing data to be processed by the microprocessor. The HBA memory 50 typically also includes a collection of pointers such as a host pointer array 128. The host pointer array 128 contains a list of pointers that can be updated by the server 12. These pointers are entry indexes into the command ring 108, response ring 110, and other rings in the server 12. For example, the host pointer array 128 contains the put pointer 144 for the command ring 108 and the get pointer 152 for the response ring 110. When updated, these pointers indicate to the HBA 24 that a command IOCB 148 has been written into the command ring 108 by the server 12, or that a response IOCB 156 has been read from the response ring 110 by the server 12.
When the HBA 24 has completed the processing of a command from the server 12, the HBA 24 first examines the get pointer 152 for the response ring 110 stored in the host pointer array 128 and compares it to the known put pointer 150 for the response ring 110 in order to determine if there is space available in the response ring 110 to write a response entry 156. If there is space available, the HBA 24 becomes master of the host bus interface 22 and performs a direct memory access (DMA) operation to write a response IOCB 156 into the response ring 110, and performs another DMA operation to update the put pointer 150 in the port pointer array 106, indicating that there is a new response IOCB 156 to be processed in the response ring 110. The HBA 24 then writes the appropriate attention conditions into a host attention register (not shown), and triggers the generation of an interrupt.
In the event that a remote system sends an I/O command to the server 12, the HBA's function is to transfer the unsolicited/incoming data to the appropriate processor device in order to process the incoming data. Before the incoming data can be processed, the HBA must place the incoming data into a buffer memory for safe storage until the data can be processed by the server 12. In a conventional host system 10, the incoming data is stored at a location within main memory 132, the location being specified by a specialized IOCB (also referred to as a buffer descriptor IOCB) delivered via the command ring 108. A buffer descriptor IOCB contains information that specifies an address within main memory 132 at which unsolicited/incoming data may be temporarily stored, and the amount of data that may be stored at that location. In anticipation of unsolicited/incoming data, the server 12 periodically places buffer descriptor IOCBs into the command ring 108 to be read by the HBA 24, which stores the buffer descriptor IOCBs in the HBA memory 50 in a link-list fashion (commonly referred to as the queue ring buffer). Whenever unsolicited/incoming data is received by the HBA 24 from the Fibre Channel fabric 26, the HBA 24 stores the incoming data into a memory location within the main memory 132 that is specified by one or more of the stored buffer descriptors.
Because the host system 10 does not know of the exact frequency or the size of data that may be received by the HBA 24 at any given time, the host system 10 needs to be configured to provide sufficient number of buffer descriptor IOCBs to the HBA 24 so as to properly anticipate the incoming/unsolicited data. In the event HBA 24 receives incoming data but does not have any stored buffer descriptor IOCBs due to lack of proper anticipation by the host system 10, then the HBA 24 will request to the server 12 via an interrupt to request that additional buffer descriptor IOCBs be sent to the HBA 24. If no additional buffer descriptor IOCB is sent to the HBA 24, or if the buffer descriptor IOCB is sent untimely, then the incoming data would be dropped from the HBA 24. On the other hand, if the host system 10 overly anticipates the incoming data traffic and sends to the HBA 24 an excess number of buffer descriptor IOCBs, then such a condition results in inefficient use of memory space in main memory 132 as portions of the memory may be unnecessarily dedicated to the queue ring buffer, as well as in HBA memory 50 to store excessive buffer descriptors.
It is an object of the present invention to provide a new method and apparatus for managing temporary storage of incoming/unsolicited data received by the HBA 24 so as to make more efficient use of the host main memory 132, to reduce bus transactions related to the processing of buffer descriptor IOCBs from the command ring, to reduce the usage of HBA memory 50 in storing the buffer descriptors, and to ensure. that incoming/unsolicited data would not be dropped for reasons of unavailable storage buffer. Specifically, the preferred embodiments of the present invention provides separate data structure (hereinafter referred to as a host buffer queue or HBQ) to serve as a memory location or a separate memory device that is dedicated for handling incoming/unsolicited data received by the HBA 24. In accordance with an alternative embodiment, a plurality of host buffer queues may be provided, each configured to be dedicated to different types of data or data of different lengths. Details of the HBQ and its operation are described in detail below.
The preferred embodiments of the present invention will now be described with references to
Associated with the HBQ 240 is a HBQ put pointer 243 and a HBQ get pointer 244; the mechanics of adding and removing buffer queue entries to and from HBQ 240, and the use of the get and the put pointers, are identical to the adding and removing of the IOCB commands from the IOCB ring 108 as described above. As shown in
Similar to the operations of the get/put pointers of the command ring, if the put pointer 243 is equal to the get pointer 244, then the HBQ is empty. If the put pointer 243 is ahead of the get pointer 244, and if the put pointer is one less than the get pointer 244, then the HBQ 240 is full (i.e., there are no additional memory storage spaces available).
In accordance with the preferred embodiment, the HBA has the ability to, via a direct memory access operation, read more than one buffer descriptor at a time from the HBQ, and can temporarily store these buffer descriptors in the HBA memory until they are needed for the incoming/unsolicited data. By reading multiple buffer descriptors from the HBQ at a time, the preferred embodiment can further reduce bus transactions.
In accordance with an alternative embodiment of the present invention, as shown in
For instance, a host running a Fibre Channel Protocol (“FCP”) Target can configure the IOCB response ring 320 to receive both the FCP command IU and first burst data. The host can then configure HBQ 340 for providing buffer descriptors for storing command IU type data, and HBQ 341 for providing buffer descriptors for storing all other types of data, such as burst data. In a Fibre Channel system, incoming data can be identified as either Command IU or burst data by examining the R_CTL/Type fields in the header of the data frame. Accordingly, the host can direct the HBA 360 to examine the R_CTL/Type of the incoming data, and direct any data identified as Command IU data to a buffer described by a buffer descriptor from HBQ 340, and direct any data identified, as burst data to a buffer described by a buffer descriptor from HBQ 341. In such an instance, when a Command IU is received, the HBA 360 can post an IOCB using the buffer entries stored in HBQ 340. Thereafter, a first burst data can be returned in a subsequent IOCB response using the HBQ 341 buffer entries. Because there are different HBQs that may be used, different sizes of buffers can be used for storing the command IU and the first burst data, resulting in more efficient allocation of memory space.
In accordance with another alternative embodiment of the present invention, where a host system is configured to maintain multiple HBQs with different profile selection criteria, one of the HBQs is preferably configured to be a default HBQ for storing data of any type. The configuration of a default HBQ provides a failsafe for situations where the incoming data received may not match the selection profile of any of the HBQs. Accordingly, if the HBA 360 cannot match the data type of an incoming data, the HBA can direct that unidentified data to buffer entries from the default HBQ for storage and processing.
In accordance with yet another alternative embodiment of the present invention, where a host system is configured to maintain multiple HBQs with different profile selection criteria, the host system can be configured to provide the user with an optional “on/off” option for activating or deactivating the profile selection criteria. If the user chooses to deactivate the profile selection criteria, then all of the HBQs will be available to the HBA 360 for storing data of any type.
In an environment where a host system is configured to maintain multiple IOCB command rings, for each IOCB response ring, one or more HBQs may be associated with that particular IOCB response ring and be dedicated to service incoming data that are associated with that particular IOCB ring. In situations where multiple HBQs are associated with one particular IOCB response ring, further differentiation amongst the HBQs can be made using different profile selection criteria in the manner described above. The distinction amongst the HBQs for different IOCB command rings, and for different types of data, allows for the host system to be configured to maximize the memory use efficiency of the host bus system.
In accordance with yet another embodiment of the present invention, where multiple HBQs are employed to service an IOCB command ring, in addition to distinguishing the HBQs using selection profile such as different R_CTL/Type data profile, HBQs can be further distinguished by data length characteristics. Specifically, in instance where multiple HBQs are used, and in instances where two or more HBQs may share the same data-type selection profile, the host system can be configured to further distinguish amongst the two or more HBQs by configuring the HBQs to accept data of specific length.
It should be noted that the present invention may be embodied in forms other than the preferred embodiments described above without departing from the spirit or essential characteristics thereof. The specification contained herein provides sufficient disclosure for one skilled in the art to implement the various embodiments of the present invention, including the preferred embodiment, which should be considered in all aspect as illustrative and not restrictive; all changes or alternatives that fall within the meaning and range or equivalency of the claim are intended to be embraced within. For instance, if a user wishes to further distinguish between multiple HBQs beyond R_CTL/Type and data length selection profile, such as using the command code characteristics of the data or header information of the data, the user may configure the selection profiles of the HBQs to include further selection restrictions based on additional distinguishable characteristics of incoming data frames.