Patent ID: 7986630

Claim:
A method of dynamic credit management in a fiber channel target device comprising: receiving data in the form of frames by a fiber channel target device, the frames being of a first and second type and sent by a host; storing the received frames in a buffer having a buffer size; processing the frames using a microprocessor; and dynamically issuing credit for receipt of further frames being of the first or second type, wherein credit is provided for those types of frames that are desirable to the host as soon as such a frame type is received with no possibility of the host to send frames when no buffer space is available and to store more of one type of frame than the other types, the dynamically issuing credit including the steps of, initializing a first counter to a value M, representing a maximum queue size, initializing a second counter to a value N, representing a maximum credit size, and initializing a third counter to a value K, representing the difference between N and M; determining if a command frame has been received and if so, issuing a credit if M is bigger than or equal to N and setting M equal to M minus one; if no command frame is determined to have been received, determining if a non-command frame has been received and if so, setting N equal to N minus one, avoiding issuing credit when a non-command frame is received from the host; after having received a certain number of command or non-command frames, processing the received frames; upon processing the received frames, releasing the space in the buffer where the received frames are stored, the number of released spaces being represented by the value ‘J’, and wherein for non-command frames, K=K+J and N=N+J; if M is greater than N, granting K credits and setting K to ‘0’; and when J spaces are released, for command frames, setting M=M+J and granting K credits and then setting K to ‘0’.