# Fibre Channel network protocols

Communication between devices in a fibre channel network uses different elements of Fibre Channel standards.

## Transmission words and ordered sets

All Fibre Channel communication is done in units of four 10-bit codes. This group of 4 codes is called a transmission word.
An ordered set is a transmission word that includes some combination of control (K) codes and data (D) codes.

## AL_PAs

Each device has an Arbitrated Loop Physical Address (AL_PA). These addresses are defined by an 8-bit field but must have neutral disparity as defined in the 8b/10b coding scheme. That reduces the number of possible values from 256 to 134. The 134 possible values have been divided between the fabric, FC_AL ports, and other special purposes as follows:
| AL_PA | Quantity | Purpose |
| 00 | 1 | FL (fabric) port |
| 01-7E | 126 | NL (normal) ports |
| F0 | 1 | Used during LIP and ARB |
| F7 | 1 | Used during LIP |
| F8 | 1 | Used during LIP |
| F9-FE | 3 | Reserved |
| FF | 1 | Used for broadcasts |

## Meta-data

In addition to the transfer of data, it is necessary for Fibre Channel communication to include some metadata. This allows for the setting up of links, sequence management, and other control functions. The meta-data falls into two types, primitives which consist of a 4 character transmission word and non-data frames which are more complex structures.

## Primitives

All primitives are four characters in length. They begin with the control character K28.5, followed by three data characters. In some primitives the three data characters are fixed, in others they can be varied to change the meaning or to act as parameters for the primitive. In some cases the last two parameter characters are identical.
Parameters are shown in the table below in the form of their hexadecimal 8-bit values. This is clearer than their full 10-bit (Dxx.x) form as shown in the Fibre Channel standards:
| Mnemonic | Meaning | Parameters | Comments |
| ARB | Arbitrate | 94F0F0 | Request fairness |
| ARB | Arbitrate | 94FFFF | Fill word |
| ARB | Arbitrate | 94yyyy | Request arbitration for AL_PA=yy |
| CLS | Close | 85B5B5 | Ends communication, cancelling previous OPN commands. |
| DHD | Dynamic Half-Duplex | 8AB5B5 | |
| EOF | End of frame | See note 1 | |
| IDLE | Idle | 95B5B5 | |
| LIP | Loop Initialization | 15F7F7 | Request AL_PA |
| LIP | Loop Initialization | 15F7xx | Reinitialise AL_PA=xx |
| LIP | Loop Initialization | 15F8F7 | Loop failure at unknown AL_PA |
| LIP | Loop Initialization | 15F8xx | Loop failure at AL_PA=xx |
| LIP | Loop Initialization | 15FFxx | Reset all, originating AL_PA=xx |
| LIP | Loop Initialization | 15yyxx | Reset AL_PA=yy, originating AL_PA=xx |
| LPB | Loop Port Bypass | 09yyxx | Bypass AL_PA=yy, originating AL_PA=xx |
| LPB | Loop Port Bypass | 09FFxx | Bypass all, originating AL_PA=xx |
| LPE | Loop Port Enable | 05yyxx | Enable AL_PA=yy, originating AL_PA=xx |
| LPE | Loop Port Enable | 05FFxx | Enable all, originating AL_PA=xx |
| LR | Link Reset | 49BF49 | |
| LRR | Link Reset Response | 35BF49 | |
| MRK | Mark | 5Fxxxx | Vendor unique - clock sync, spindle sync etc. |
| NOS | Not Operational | 55BF45 | Link has failed |
| OLS | Offline | 358A55 | Going offline (due to received NOS or other event) |
| OPN | Open | 91FFFF | Open broadcast replicate (see note 2) |
| OPN | Open | 91yyFF | Open selective replicate (see note 2) |
| OPN | Open | 91yyxx | Open full duplex between AL_PA=xx and AL_PA=yy |
| OPN | Open | 91yyyy | Open half duplex to AL_PA=yy |
| R_RDY | Receiver_Ready | 954949 | |
| SOF | Start of frame | B5cccc | See note 3 |
| SYN | Synchronise | 7Fxxxx | Clock Synchronization word X |
| SYN | Synchronise | BFyyyy | Clock Synchronization word Y |
| SYN | Synchronise | DFzzzz | Clock Synchronization word Z |
| VC_RDY | Virtual Circuit Ready | F5vvvv | Where vv is the virtual circuit ID |
Note 1: The first parameter byte of the EOF primitive can have one of four different values (8A, 95, AA, or B5). This is done so that the EOF primitive can rebalance the disparity of the whole frame. The remaining two parameter bytes define whether the frame is ending normally, terminating the transfer, or is to be aborted due to an error.
Note 2: The Open selective replicate variant can be repeated a number of times in order to communicate with more than one destination port simultaneously. The Open broadcast replicate variant will allow communication with all ports simultaneously.
Note 3: The SOF primitive contains a pair of control bytes (shown as cccc in the table) to designate the type of frame.

## Frames

The Fibre Channel protocol transmits data in frames each of which can contain up to 2112 bytes of payload data. The structure of a frame is shown in this table:
| Field | Length |
| SOF - Start Of Frame | 4 |
| Extended header(s) | 0 or more |
| Routing Control | 1 |
| Destination ID | 3 |
| Class-Specific Control / Priority | 1 |
| Source ID | 3 |
| Data Structure Type | 1 |
| Frame Control | 3 |
| Sequence ID | 1 |
| Data Field Control | 1 |
| Sequence Count | 2 |
| Originator Exchange ID | 2 |
| Responder Exchange ID | 2 |
| Parameter | 4 |
| Data field | 0 to 2112 |
| CRC - cyclic redundancy check | 4 |
| EOF - End of Frame | 4 |
In addition to data frames, there are non-data frames that are used for setup and messaging purposes. These fall into three categories: link control frames, link service frames, and extended link service frames. The following table lists the most common ones:
| Mnemonic | Frame type | Meaning |
| ABTS | Link service | Abort Sequence |
| ACK | Link control | Acknowledge data frame (success) |
| BA_ACC | Link service | Basic accept |
| BA_RJT | Link service | Basic reject |
| F_BSY | Link control | Fabric busy |
| F_RJT | Link control | Fabric frame reject |
| FLOGI | Extended link service | Fabric login |
| NOP | Link service | No Operation |
| P_BSY | Link control | Port busy |
| P_RJT | Link control | Port frame reject |
| PLOGI | Extended link service | Port login |
| PRLI | Extended link service | Process login |
| PRLO | Extended link service | Process logout |
| PRMT | Link service | Dedicated connection preempted |
| RMC | Link service | Remove connection |
| RSI | Extended link service | Request sequence initiative |