Method and system for checking frame-length in a Fiber Channel frames is provided. The method includes extracting a R_CTL value from a Fiber Channel frame; comparing the extracted R_CTL value of the Fiber Channel frame with R_CTL values stored in a Content Addressable Memory Table; determining a maximum frame-length and a minimum frame-length of the Fiber Channel frame for the extracted R_CTL value from the Content Addressable Memory Table; and marking the Fiber Channel frame so that it can be discarded if the frame-length is less than the minimum frame-length of the Fiber Channel frame or greater than the maximum frame-length of the Fiber Channel frame. The system includes a processor that accesses a CAM stored in memory; and a receive port that extracts and compares a R_CTL value of the Fiber Channel frame.
1. A method for a port that receives Fibre Channel frames, comprising:
(a) storing a maximum frame length value and a minimum frame length value for each of a plurality of Fibre Channel frame type; wherein the maximum frame length value and the minimum frame length value for each of the plurality of Fibre Channel frame type are associated with a R_CTL value, a field of a Fibre Channel frame header used for routing Fibre Channel frames; (b) extracting a R_CTL value from a frame header of a Fibre Channel frame received at the port; (c) comparing the extracted R_CTL value of the Fibre Channel frame with stored R_CTL values in step (a); (d) if the extracted R_CTL value matches with a stored R_CTL value in step (c), then comparing a frame length of the received Fibre Channel frame with a maximum frame-length and a minimum frame-length associated with the extracted and matched R_CTL value; (e) if the extracted R_CTL does not match with any stored R_CTL value in step (c), then comparing the frame length of the received Fibre Channel frame with a default maximum frame length value and a default minimum frame length value; (f) based on the comparison in step (d) and step (e), determining if the received Fibre Channel frame is a long frame or a short frame; wherein the received Fibre Channel frame is a long frame if the frame length of the received Fibre Channel frame is greater than the maximum frame length from step (d), if there was a match in step (c), or greater than the default maximum frame length from step (e), if there was no match in step (c); and the received Fibre Channel frame is a short frame if the frame length of the received Fibre Channel frame is less than the minimum frame length from step (d), if there was a match in step (c), or less than the default minimum frame length from step (e), if there was no match in step (c); and (g) discarding the received Fibre Channel frame if the frame is a long frame or a short frame. 2. The method of 3. The method of 4. The method of 5. The method of 6. The method of 7. The method of 8. A Fibre Channel device element for receiving Fibre Channel frames, comprising:
a memory for storing a maximum frame length value and a minimum frame length value for each of a plurality of Fibre Channel frame type; wherein the maximum frame length value and the minimum frame length value for each of the plurality of Fibre Channel frame type are associated with a R_CTL value, a field of a Fibre Channel frame header used for routing Fibre Channel frames; and a receive port that:
(a) receives a Fibre Channel frame; (b) extracts a R_CTL value from the Fibre Channel frame; (c) compares the extracted R_CTL value of the Fibre Channel frame with R_CTL values stored in the memory; (d) if the extracted R_CTL value matches with a stored R_CTL value in (c), then compares a frame length of the received Fibre Channel frame with a maximum frame-length and a minimum frame-length associated with the extracted and matched R_CTL value; (e) if the extracted R_CTL does not match with any stored R_CTL value in (c), then compares the frame length of the received Fibre Channel frame with a default maximum frame length value and a default minimum frame length value; (f) based on the comparison in (d) and (e), determines if the received Fibre Channel frame is a long frame or a short frame; wherein the received Fibre Channel frame is a long frame if the frame length of the received Fibre Channel frame is greater than the maximum frame length from (d), if there was a match in (c), or greater than the default maximum frame length from (e), if there was no match in (c); and the received Fibre Channel frame is a short frame if the frame length of the received Fibre Channel frame is less than the minimum frame length from (d), if there was a match in (c), or less than the default minimum frame length from (e), if there was no match in (c); and (g) discards the received Fibre Channel frame if the frame is a long frame or a short frame. 9. The Fibre Channel device element of 10. The Fibre Channel device element of 11. The Fibre Channel device element of 12. The Fibre Channel device element of 13. The Fibre Channel device element of 14. The Fibre Channel device element of 15. The Fibre Channel device element of 16. The Fibre Channel device element of 17. A method for a network port for receiving and transmitting frames, comprising:
(a) storing a maximum frame length value and a minimum frame length value for each of a plurality of frame type; wherein the maximum frame length value and the minimum frame length value for each of the frame type are associated with a field value used for routing frames received by the port; (b) extracting the field value from a frame header of a frame received at the port; (c) comparing the field value of the frame with stored field values in step (a); (d) if the extracted field value matches with a stored value in step (c), then comparing a frame length of the received frame with a maximum frame length and a minimum frame length associated with the extracted and matched field value; (e) if the extracted field value does not match with any stored field value in step (c), then comparing the frame length of the received frame with a default maximum frame length value and a default minimum frame length value; (f) based on the comparison in step (d) and step (e), determining if the received frame is a long frame or a short frame; wherein the received frame is a long frame if the frame length of the received frame is greater than the maximum frame length from step (d), if there was a match in step (c), or greater than the default maximum frame length from step (e) if there was match in step (c); and the received frame is a short frame if the frame length of the received frame is less than the minimum frame length from step (d), if there was a match in step (c), or less than the default minimum frame length from step (e), if there was no match in step (c); and (g) discarding the received frame if the received frame is a long frame or a short frame. 18. The method of 19. The method of 20. The method of 21. The method of 22. The method of 23. The method of 24. The method of
This patent application is related to the following US Patent Applications: Ser. No. 10/894,627 filed on Jul. 20, 2004, entitled “Method and System for Programmable Data Dependent Network Routing”; and Ser. No. 10/894,547, filed on Jul. 20, 2004, entitled “Method and System for Using Extended Fabric Features with Fibre Channel Switch Elements”; the disclosure of the foregoing applications is incorporated herein by reference in their entirety. 1. Field of the Invention The present invention relates to Fibre Channel network systems, and more particularly, to checking frame-length in Fibre Channel frames. 2. Background of the Invention Fibre Channel is a set of American National Standard Institute (ANSI) standards, which provide a serial transmission protocol for storage and network protocols such as HIPPI, SCSI, IP, ATM and others. Fibre Channel provides an input/output interface to meet the requirements of both channel and network users. Fibre Channel supports three different topologies: point-to-point, arbitrated loop and Fibre Channel fabric. The point-to-point topology attaches two devices directly. The arbitrated loop topology attaches devices in a loop. The Fibre Channel fabric topology attaches host systems directly to a fabric, which are then connected to multiple devices. The Fibre Channel fabric topology allows several media types to be interconnected. Fibre Channel fabric devices include a node port or “N_Port” that manages fabric connections. The N_port establishes a connection to a fabric element (e.g., a switch) having a fabric port or “F_port”. A Fibre Channel switch is a multi-port device where each port manages a point-to-point connection between itself and its attached system. Each port can be attached to a server, peripheral, I/O subsystem, bridge, hub, router, or even another switch. A switch receives messages from one port and routes it to another port. Fibre Channel frames carry information between Fibre Channel Devices which include Host Bus Adapters, Switches and Disk Drives. The components of a Fibre Channel Frame include SOF, Frame Header, Payload, CRC and EOF. Typically, the minimum frame-length of a Fibre frame is 36 bytes and the maximum frame-length of a Fibre Channel frame is 2148 bytes. Typically, a Fibre Channel device receives an incoming Fibre Channel frame when it detects a Start-Of-Frame (SOF) delimiter. The receive port detects an end of the Fibre Channel frame when it detects an End-Of-Frame (EOF) delimiter or if the maximum frame-length is reached. The receive port of the Fibre Channel device keeps a count of the frame-length of the Fibre Channel frame. The frame-length includes the summation of the length of SOF (4 bytes), Frame Header (24 bytes), Payload (0-2112 bytes), CRC (4 bytes) and EOF (4 bytes). The receive port then determines if the frame-length of the received Fibre Channel frame is within the minimum and maximum frame-length as specified in the Fibre Channel specification. If a violation of the frame-length occurs, then the frame is discarded and an error is reported to a processor. With the addition of new routing features for example, Virtual Fabric and Inter-Fabric routing, the length of the Frame Header has changed. This addition caused the total frame-length of the Fibre Channel frame to be different than the current maximum and minimum frame-length. When a switch that was designed before these features were introduced receives a Fibre Channel frame, data is corrupted if the EOF is not detected due to the varying lengths of the frame. Furthermore, the current frame-length checking mechanism causes erroneous errors. Therefore, there is a need for a method and system for efficiently checking the frame-length of a Fibre Channel frame with varying frame lengths. In one aspect of the present invention, a method for checking frame-length in a Fibre Channel frames is provided. The method includes extracting a R_CTL value from a Fibre Channel frame; comparing the extracted R_CTL value of the Fibre Channel frame with R_CTL values stored in a Content Addressable Memory Table; determining a maximum frame-length and minimum frame-length of the Fibre Channel frame for the extracted R_CTL value from the Content Addressable Memory Table; and marking the Fibre Channel frame so that it can be discarded, if the frame-length is less than the minimum frame-length of the Fibre Channel frame or greater than the maximum frame-length of the Fibre Channel frame. This brief summary has been provided so that the nature of the invention may be understood quickly. A more complete understanding of the invention can be obtained by reference to the following detailed description of the preferred embodiments thereof concerning the attached drawings. The foregoing features and other features of the present invention will now be described with reference to the drawings of a preferred embodiment. In the drawings, the same components have the same reference numerals. The illustrated embodiment is intended to illustrate, but not to limit the invention. The drawings include the following Figures: FIG. 1E-1/1E-2 shows a top-level block diagram of a switch element used according to one aspect of the present invention; Definitions: The following definitions are provided for convenience as they are typically (but not exclusively) used in the Fibre Channel environment, implementing the various adaptive aspects of the present invention. “CRC” (cyclic redundancy code): A 4 byte value used for checking the data integrity of a Fibre Channel frame. “D_ID”: A 24-bit Fibre Channel header field that contains the destination address for a frame. “Dword: A 4 byte Fibre Channel Data Word. “EOF”: End-Of-Frame (EOF) delimiter that is the last Data Word of a Fibre Channel frame. “EOFa”: A frame whose EOF is marked so that the frame is discarded by a destination port, N_Port or NL_Port. “E_Port”: An expansion port that is used to connect Fibre Channel Switch elements in a Fabric. “Fabric”: The structure or organization of a group of switches, target and host devices (NL_Port, N_ports etc.). “F_Port”: A port to which non-loop N_Ports are attached to a fabric and does not include FL_ports. “Fibre Channel ANSI Standard” (“FC-FS-2”): The standard (incorporated herein by reference in its entirety) describes the physical interface, transmission and signaling protocol of a high performance serial link for support of other high level protocols associated with IPI, SCSI, IP, ATM and others. “Inter Fabric Header”: The Inter Fabric Routing Extended Header (IFR_Header) is used for routing Fibre Channel frames from one fabric to another. It provides the fabric identifier of the destination fabric, the fabric identifier of the source fabric and information to determine hop count. “N_Port”: A direct fabric attached port, for example, a disk drive or a HBA. “NL_Port”: A L_Port that can perform the function of a N_Port. “R_CTL”: A 8 bit value containing routing information used to route Fibre Channel Frames. “Switch”: A fabric element conforming to the Fibre Channel Switch standards. “SOF”: Start_of_Frame (SOF) delimiter that is the first Data Word of a Fibre Channel frame. “Virtual Fabric” (“VSAN”): As defined by FC-FS-2, Fibre Channel standard, incorporated herein by reference in its entirety, is a Fabric composed of partitions and N_ports having the properties of a single Fabric management domain and Generic Services; and independent from other Virtual Fabrics (e.g. an independent address space). “Virtual Fabric Header” (VFT_Header): This is a header used for tagging Fibre Channel frames with a Virtual Fabric Identifier (VF_ID) of Virtual Fabric to which the frame belongs. “Virtual Fabric Identifier” (“VF_ID”): A value that uniquely identifies a Virtual Fabric among plural Virtual Fabrics that shares a set of Switches and N_ports. To facilitate an understanding of the preferred embodiment, the general architecture and operation of a Fibre channel System and a Fibre Channel switch element will be described. The specific architecture and operation of the preferred embodiment will then be described with reference to the general architecture. Fibre Channel System The devices of Fibre Channel Switch Element FIB. 1B is a block diagram of a 20-port ASIC fabric element according to one aspect of the present invention. The fabric element of the present invention is presently implemented as a single CMOS ASIC, and for this reason the term “fabric element” and ASIC are used interchangeably to refer to the preferred embodiments in this specification. Although ASIC 20 has 20 ports numbered in For illustration purposes only, all GL ports are drawn on the same side of ASIC 20 in Each port GL0-GL19 is comprised of transmit and receive connections to switch crossbar 50. Within each port, one connection is through receive buffer 52, which functions to receive and temporarily hold a frame during a routing operation. The other connection is through a transmit buffer 54. Switch crossbar 50 includes a number of switch crossbars for handling specific types of data and data flow control information. For illustration purposes only, switch crossbar 50 is shown as a single crossbar. Switch crossbar 50 is a connectionless crossbar (packet switch) of known conventional design, sized to connect 21×21 paths. This is to accommodate 20 GL ports plus a port for connection to a fabric controller, which may be external to ASIC 20. In the preferred embodiments of switch chassis described herein, the fabric controller is a firmware-programmed microprocessor, also referred to as the input/output processor (“IOP”). As seen in Control register 62 receives and holds control information from IOP 66, so that IOP 66 can change characteristics or operating configuration of ASIC 20 by placing certain control words in register 62. IOP 66 can read status of ASIC 20 by monitoring various codes that are placed in status register 64 by monitoring circuits (not shown). Each GL_Port may have an optical-electric converter, designated as OE0-OE19 connected with its SERDES through serial lines, for providing fibre optic input/output connections, as is well known in the high performance switch design. The converters connect to switch channels C0-C19. It is noteworthy that the ports can connect through copper paths or other means instead of optical-electric converters. CAM table 80 is stored in memory 80A that is accessible to IOP 66 and other logic. CAM table 80 is a master copy for the switch element. As described below, each port can have its own CAM table with values that pertain to that particular port. Furthermore, plural ports can share a CAM Table that is located at one of the ports. FIGS. 1E-1/1E-2 (jointly referred to as Control port module 62A includes control buffers 62B and 62D for transmit and receive sides, respectively. Module 62A also includes a PCI interface module 62C that allows interface with IOP 66 via a PCI bus 66A. XG_Port (for example 74B) includes RPORT 72 with RBUF 71 similar to RPORT 69 and RBUF 69A and a TBUF 74B and TPORT 74A similar to TBUF 70A and TPORT 70. Protocol module 73 interfaces with SERDES to handle protocol based functionality. Incoming frames are received by RPORT 69 via SERDES 68 and then transmitted using TPORT 70. Buffers 69A and 70A are used to stage frames in the receive and the transmit path. CAM Table 80C can be loaded with different values for each port. It is noteworthy that each port may have its own table 80C or table 80C can be shared between plural ports. In contrast, CAM table 80 is the master copy and includes information regarding all the ports. It is also noteworthy that receive port 69 includes various other components that are described in co-pending patent application Ser. No. 10/894,627, filed on Jul. 20, 200, the disclosure of which is incorporated herein by reference. VSAN #1 is the first Virtual Fabric that includes ports 0-3 for Switch #1. VSAN #2 includes Switch #1, ports 4-7; Switch #2, ports 0-3; and Switch #3, ports 0-3. VSAN #3 includes Switch #1, ports 4-7 and Switch #3, ports 0-3. VSAN #4 includes Switch #2, ports 4-7. Fabric 2 includes Switch 4, 5 and 6. Fabric 3 includes Switch 5 and Switch 7, while Fabric 4 includes Switch 6 and Switch 8. The extended headers are used to route frames between the plural Fabrics, for example, between Fabric 1 and Fabric 4. It is noteworthy that the present invention is not limited to any particular number of Fabrics or switches. Fibre Channel Frame Receive port 69 detects a frame when a SOF 220 is received. SOF 220 is 4 bytes long and indicates the start of a frame. Receive port 69 starts counting frame-length when it detects a SOF 220. Frame header 221, which contains routing and control information follow SOF 220. Frame header 221 comprises 6 header Dwords or 24 bytes. In a standard frame, these include R_CTL field 222, D_ID (3 bytes), CS_CTL (3 bytes), S_ID (3 bytes) and reserved bytes. R_CTL field 222 identifies the type of frame. New routing features have added additional header words 226 to the frame header 221. The additional frame header (32 bytes) is shown in Frame header 228 uses two R_CTL values. R_CTL value of 50hor 51h(shown as 227, Payload or data field 223 follows the frame header 221 (or 228, CRC 224, which is 4 bytes long, follows the payload 223. This field is used to check the data integrity of the frame. EOF 225, which is 4 bytes long, follows the CRC 224. EOF indicates the end of a frame. When an EOF 225 is detected, receive port 69 stops counting frame-length and stores the value for future comparison and/or frame processing. Process Flow for Checking Frame-Length Turning in detail to In step S202, receive port 69 parses the frame and R_CTL value 222 (or 227) is extracted from the frame header 221. In step S203, R_CTL value 222 (or 227) is compared with the R_CTL values stored in a CAM Table 80 (or 80C). CAM Table 80, which maintains information regarding R_CTL and frame-length values, is described below with respect to In step S204, a maximum frame-length and a minimum frame-length is determined from the fields corresponding to the matched R_CTL value. If none of the values match the R_CTL value then the default (or programmed) maximum frame-length (for example, 2148 bytes) and minimum frame-length (for example, 36 bytes) are used. The maximum frame-length and minimum frame-length values from the Frame length CAM are stored for future comparison. In step S205, receive port 69 stops incrementing the received frame-length value when it detects an EOF or error condition. In step S206, the received frame-length is compared with the stored maximum and minimum frame-length values to determine if the received Fibre Channel frame is a long or short frame. A Fibre Channel frame is a long frame if the received frame-length is greater than the maximum frame-length and a Fibre Channel frame is a short frame if the frame-length is less than the minimum frame-length. It is noteworthy that the present invention is not limited to any particular format for the maximum and/or minimum frame length comparison. For example, frame length value when compared could be the actual frame length value or as an offset value. If the Fibre Channel frame is determined to be a long or short frame in step S206, then in step S207, the Fibre Channel frame is marked for discarding. For example, the EOF value may be set to EOFa, which denotes that the frame should be discarded. When the frame is marked then it is discarded by a destination, for example, a host bus adapter or a storage device. In another aspect of the present invention, the frame that is too long or short is discarded in step S207. In the alternative, a long frame is truncated to a maximum length and a short frame is padded to the minimum length and the EOF value is replaced by an EOFa (as stated above, this denotes EOF abort). Thereafter, the receive port 69 optionally notifies IOP 66 of the error and records the error statistics for the port. In step S208, receive port 69 processes the received Fibre Channel frame if the frame is not a long or short frame in step S206. Content Addressable Memory (CAM) Table Each entry in CAM Table has a R_CTL value and the associated maximum frame-length and minimum frame-length. CAM Table 80 is comprised of a column 300 that includes the R_CTL value, a column 301 that has the corresponding maximum frame-length information and a column 302 that has the minimum frame-length information. Firmware adds the entries in the CAM table 80 (and also for CAM 80C, It is noteworthy that R_CTL values can be stored in any format in Random Access Memory and the term “table” is not to be construed as a limitation. In one aspect of the present invention, R_CTL values are used to determine the maximum and minimum frame-length values of the received Fibre Channel frame. These values allows a receive port to check for frame length without causing data corruption. It is noteworthy that different values for the minimum frame-length and/or maximum frame-length are used for different R_CTL values. Also CAM Table 80C provides default values for minimum frame-length and/or maximum frame-length if the extracted R_CTL values do not match stored R_CTL values. It is also noteworthy that the present invention is not limited to any particular R_CTL, maximum/minimum frame length values. Switch element firmware operating under IOP 66 can program these values. Frame Length Control Module It is noteworthy that although various bit values are shown in Incoming frames information (or fields) (R_CTL 222/227) is compared by logic 30E with entry 30B. A valid/control bit 30A is set for a valid control word entry. Logic 30E generates a command/signal (output 30E1) based on the comparison. Output 30E1 is sent to logic 30F that generates a hit signal 30F1. Output 30F1 is sent to an encoder module 30G, whose output 30H is sent to MUX 30K. Maximum frame-length 30C and minimum frame-length 30D are also sent to MUX 30K. MUX 30K selects maximum frame-length 30J and a minimum frame-length 30I depending on the input signal 30H. The selected maximum frame-length 30J and a minimum frame-length 30I values are shown as the entries in column 301 and 302 respectively in The present invention is not limited to CAM table 80C as described above. A hashing table could also be used to implement the adaptive aspects of the present invention. In one aspect of the present invention, frame length is checked efficiently and in real time. The foregoing process/system can accommodate the new standard Virtual Fabric and Inter-Fabric headers in previous Fibre Channel switch elements, without expensive upgrades. Although the present invention has been described with reference to specific embodiments, these embodiments are illustrative only and not limiting. Many other applications and embodiments of the present invention will be apparent in light of this disclosure and the following claims.CROSS REFERENCE TO RELATED APPLICATIONS
BACKGROUND
SUMMARY OF THE INVENTION
BRIEF DESCRIPTION OF THE DRAWINGS
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS