# Token Ring

Token Ring is a physical and data link layer computer networking technology used to build local area networks. It was introduced by IBM in 1984, and standardized in 1989 as IEEE 802.5. It uses a special three-byte frame called a token that is passed around a logical ring of workstations or servers. This token passing is a channel access method providing fair access for all stations, and eliminating the collisions of contention-based access methods.
Token Ring was a successful technology, particularly in corporate environments, but was gradually eclipsed by the later versions of Ethernet. The last thing the working group standardized was Gigabit Token Ring, completed in 2001.

## History

A wide range of different local area network technologies were developed in the early 1970s, of which one, the Cambridge Ring, had demonstrated the potential of a token passing ring topology, and many teams worldwide began working on their own implementations. At the IBM Zurich Research Laboratory Werner Bux and Hans Müller, in particular, worked on the design and development of IBM's Token Ring technology, while early work at MIT led to the Proteon 10 Mbit/s ProNet-10 Token Ring network in 1981 – the same year that workstation vendor Apollo Computer introduced their proprietary 12 Mbit/s Apollo Token Ring (ATR) network running over 75-ohm RG-6U coaxial cabling. Proteon later evolved a 16 Mbit/s version that ran on unshielded twisted pair cable.

### 1985 IBM launch

IBM launched their own proprietary Token Ring product on October 15, 1985. It ran at 4 Mbit/s, and attachment was possible from IBM PCs, midrange computers and mainframes. It used a convenient star-wired physical topology and ran over shielded twisted-pair cabling. Shortly thereafter it became the basis for the IEEE 802.5 standard.
During this time, IBM argued that Token Ring LANs were superior to Ethernet, especially under load, but these claims were debated.
In 1988, the faster 16 Mbit/s Token Ring was standardized by the 802.5 working group. An increase to 100 Mbit/s was standardized and marketed during the wane of Token Ring's existence and was never widely used. While a 1000 Mbit/s standard was approved in 2001, no products were ever brought to market and standards activity came to a standstill as Fast Ethernet and Gigabit Ethernet dominated the local area networking market.

### Gallery

* 100 Mbit/s IBM Token Ring Management Adapter with wake-on-LAN. Both UTP (RJ45) and STP (IBM Data Connector) interfaces are present.
* Assorted full-length Micro Channel Token Ring cards, including a LANStreamer which features multiple RJ45 ports for usage in a Token Ring network
* Token Ring Network Interface Cards (NICs) with varying interfaces from: ISA, PCI and Micro Channel
* Madge 4/16 Mbit/s TokenRing ISA NIC
* A series of multiple 16/4 early Micro Channel Token Ring cards which would have predominantly been installed in many Personal System/2 machines
* Texas Instruments TMS380C26PQL network communication processor, used in a Hewlett Packard JetDirect Token Ring print server card

## Comparison with Ethernet

Early Ethernet and Token Ring both used a shared transmission medium. They differed in their channel access methods. These differences have become immaterial, as modern Ethernet networks consist of switches and point-to-point links operating in full-duplex mode.
Token Ring and legacy Ethernet have some notable differences:
* Token Ring access is more deterministic, compared to Ethernet's contention-based CSMA/CD.
* Ethernet supports a direct cable connection between two network interface cards by the use of a crossover cable or through auto-sensing if supported. Token Ring does not inherently support this feature and requires additional software and hardware to operate on a direct cable connection setup.
* Token Ring eliminates collision by the use of a single-use token and early token release to alleviate the down time. Legacy Ethernet alleviates collision by carrier-sense multiple access and by the use of an intelligent switch; primitive Ethernet devices like hubs could precipitate collisions due to repeating traffic blindly.
* Token Ring network interface cards contain all of the intelligence required for speed autodetection, routing and can drive themselves on many Multistation Access Units (MAUs) that operate without power (most MAUs operate in this fashion, only requiring a power supply for LEDs). Ethernet network interface cards can theoretically operate on a passive hub to a degree, but not as a large LAN and the issue of collisions is still present.
* Token Ring employs access priority in which certain nodes can have priority over the token. Unswitched Ethernet did not have a provision for an access priority system as all nodes have equal access to the transmission medium.
* Multiple identical MAC addresses are supported on Token Ring (a feature used by S/390 mainframes). Switched Ethernet cannot support duplicate MAC addresses without reprimand.
* Token Ring was more complex than Ethernet, requiring a specialized processor and licensed MAC/LLC firmware for each interface. By contrast, Ethernet included both the (simpler) firmware and the lower licensing cost in the MAC chip. The cost of a token Ring interface using the Texas Instruments TMS380C16 MAC and PHY was approximately three times that of an Ethernet interface using the Intel 82586 MAC and PHY.
* Initially both networks used expensive cable, but once Ethernet was standardized for unshielded twisted pair with 10BASE-T (Cat 3) and 100BASE-TX (Cat 5(e)), it had a distinct advantage and sales of it increased markedly.
* Even more significant when comparing overall system costs was the much-higher cost of router ports and network cards for Token Ring vs Ethernet. The emergence of Ethernet switches may have been the final straw.

## Operation

Stations on a Token Ring LAN are logically organized in a ring topology with data being transmitted sequentially from one ring station to the next with a control token circulating around the ring controlling access. Similar token passing mechanisms are used by ARCNET, token bus, 100VG-AnyLAN (802.12) and FDDI, and they have theoretical advantages over the CSMA/CD of early Ethernet.

### Access control

The data transmission process goes as follows:
* Empty information frames are continuously circulated on the ring.
* When a computer has a message to send, it seizes the token. The computer will then be able to send the frame.
* The frame is then examined by each successive workstation. The workstation that identifies itself to be the destination for the message copies it from the frame and changes the token back to 0.
* When the frame gets back to the originator, it sees that the token has been changed to 0 and that the message has been copied and received. It removes the message from the frame.
* The frame continues to circulate as an empty frame, ready to be taken by a workstation when it has a message to send.

### Multistation Access Units and Controlled Access Units

Physically, a Token Ring network is wired as a star, with 'MAUs' in the center, 'arms' out to each station, and the loop going out-and-back through each.
A MAU could present in the form of a hub or a switch; since Token Ring had no collisions many MAUs were manufactured as hubs. Although Token Ring runs on LLC, it includes source routing to forward packets beyond the local network. The majority of MAUs are configured in a 'concentration' configuration by default, but later MAUs also supporting a feature to act as splitters and not concentrators exclusively such as on the IBM 8226.
Later IBM would release Controlled Access Units that could support multiple MAU modules known as a Lobe Attachment Module. The CAUs supported features such as Dual-Ring Redundancy for alternate routing in the event of a dead port, modular concentration with LAMs, and multiple interfaces like most later MAUs. This offered a more reliable setup and remote management than with an unmanaged MAU hub.

### Cabling and interfaces

Cabling is generally IBM "Type-1", a heavy two-pair 150 ohm shielded twisted pair cable. This was the basic cable for the "IBM Cabling System", a structured cabling system that IBM hoped would be widely adopted. Unique hermaphroditic connectors, referred to as IBM Data Connectors in formal writing or colloquially as Boy George connectors, were used. The connectors have the disadvantage of being quite bulky, requiring at least 3 cm × 3 cm (1.2 in × 1.2 in) panel space, and being relatively fragile. The advantages of the connectors being that they are genderless and have superior shielding over standard unshielded 8P8C. Connectors at the computer were usually DE-9 female. Several other types of cable existed such as type 2, and type 3 cable.
In later implementations of Token Ring, Cat 4 cabling was also supported, so 8P8C (RJ45) connectors were used on both of the MAUs, CAUs and NICs; with many of the network cards supporting both 8P8C and DE-9 for backwards compatibility.
* IBM Data Connectors on the IBM 8228 Multistation Access Unit
* 8P8C 'Media Filters' that plug into an IBM Data Connector converting it for use with 8P8C connectors

## Technical details
### Frame types
#### Token

When no station is sending a frame, a special token frame circles the loop. This special token frame is repeated from station to station until arriving at a station that needs to send data.
Tokens are three octets in length and consist of a start delimiter, an access control octet, and an end delimiter.
| Start Delimiter | Access Control | End Delimiter |
| 8 bits | 8 bits | 8 bits |

#### Abort frame

Used by the sending station to abort transmission.
| SD | ED |
| 8 bits | 8 bits |

#### Data

Data frames carry information for upper-layer protocols, while command frames contain control information and have no data for upper-layer protocols. Data and command frames vary in size, depending on the size of the Information field.
| SD | AC | FC | DA | SA | PDU from LLC (IEEE 802.2) | CRC | ED | FS |
| 8 bits | 8 bits | 8 bits | 48 bits | 48 bits | Up to 4500 × 8 bits | 32 bits | 8 bits | 8 bits |

##### Starting delimiter – The starting delimiter consists of a special bit pattern denoting the beginning of the frame. The bits from most significant to least significant are J,K,0,J,K,0,0,0. J and K are code violations. Differential_Manchester encoding is self-clocking and has a mid symbol transition for every encoded bit 0 or 1, but the J and K codings do not have a mid symbol transition and will be detected by the hardware. Both the Starting Delimiter and Ending Delimiter fields are used to mark frame boundaries.

| J | K | 0 | J | K | 0 | 0 | 0 |
| 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit |

##### Access control – This byte field consists of the following bits from most significant to least significant bit order

    P,P,P,T,M,R,R,R. The P bits are priority bits, T is the token bit which when set specifies that this is a token frame, M is the monitor bit which is set by the Active Monitor (AM) station when it sees this frame, and R bits are reservation bits, which indicate that the next token should be issued with that priority.
| + | Bits 0–2 | Bits 0–2 | Bits 0–2 | Bits 0–2 | 3 | 3 | 3 | 3 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 5–7 | 5–7 | 5–7 |
| 0 | Priority | Priority | Priority | Priority | Token | Token | Token | Token | Monitor | Monitor | Monitor | Monitor | Monitor | Monitor | Monitor | Monitor | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation | Reservation |

##### Frame control – A one-byte field that contains bits describing the data portion of the frame contents which indicates whether the frame contains data or control information. In control frames, this byte specifies the type of control information.

| + | Bits 0–1 | Bits 0–1 | Bits 0–1 | Bits 0–1 | Bits 2–7 | Bits 2–7 | Bits 2–7 | Bits 2–7 |
| 0 | Frame type | Frame type | Frame type | Frame type | Control Bits | Control Bits | Control Bits | Control Bits |
Frame type – 01 indicates LLC frame IEEE 802.2 (data) and ignore control bits; 00 indicates MAC frame and control bits indicate the type of MAC control frame

##### Ending delimiter – The counterpart to the starting delimiter, this field marks the end of the frame and consists of the following bits from most significant to least significant

    J,K,1,J,K,1,I,E. I is the intermediate frame bit and E is the error bit.
| J | K | 1 | J | K | 1 | I | E |
| 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit |

##### Frame status – A one-byte field used as a primitive acknowledgment scheme on whether the frame was recognized and copied by its intended receiver.

| A | C | 0 | 0 | A | C | 0 | 0 |
| 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit |
A = 1, Address recognized C = 1, Frame copied

### Active and standby monitors

Every station in a Token Ring network is either an active monitor (AM) or standby monitor (SM) station. There can be only one active monitor on a ring at a time. The active monitor is chosen through an election or monitor contention process.
The monitor contention process is initiated when the following happens:
* a loss of signal on the ring is detected.
* an active monitor station is not detected by other stations on the ring.
* a particular timer on an end station expires such as the case when a station hasn't seen a token frame in the past 7 seconds.
When any of the above conditions take place and a station decides that a new monitor is needed, it will transmit a claim token frame, announcing that it wants to become the new monitor. If that token returns to the sender, it is OK for it to become the monitor. If some other station tries to become the monitor at the same time then the station with the highest MAC address will win the election process. Every other station becomes a standby monitor. All stations must be capable of becoming an active monitor station if necessary.
The active monitor performs a number of ring administration functions. The first function is to operate as the master clock for the ring in order to provide synchronization of the signal for stations on the wire. Another function of the AM is to insert a 24-bit delay into the ring, to ensure that there is always sufficient buffering in the ring for the token to circulate. A third function for the AM is to ensure that exactly one token circulates whenever there is no frame being transmitted, and to detect a broken ring. Lastly, the AM is responsible for removing circulating frames from the ring.

### Token insertion process

Token Ring stations must go through a 5-phase ring insertion process before being allowed to participate in the ring network. If any of these phases fail, the Token Ring station will not insert into the ring and the Token Ring driver may report an error.
* Phase 0 (Lobe Check) – A station first performs a lobe media check. A station is wrapped at the MSAU and is able to send 2000 test frames down its transmit pair which will loop back to its receive pair. The station checks to ensure it can receive these frames without error.
* Phase 1 (Physical Insertion) – A station then sends a 5-volt signal to the MSAU to open the relay.
* Phase 2 (Address Verification) – A station then transmits MAC frames with its own MAC address in the destination address field of a Token Ring frame. When the frame returns and if the Address Recognized (AR) and Frame Copied (FC) bits in the frame-status are set to 0 (indicating that no other station currently on the ring uses that address), the station must participate in the periodic (every 7 seconds) ring poll process. This is where stations identify themselves on the network as part of the MAC management functions.
* Phase 3 (Participation in ring poll) – A station learns the address of its Nearest Active Upstream Neighbour (NAUN) and makes its address known to its nearest downstream neighbour, leading to the creation of the ring map. Station waits until it receives an AMP or SMP frame with the AR and FC bits set to 0. When it does, the station flips both bits (AR and FC) to 1, if enough resources are available, and queues an SMP frame for transmission. If no such frames are received within 18 seconds, then the station reports a failure to open and de-inserts from the ring. If the station successfully participates in a ring poll, it proceeds into the final phase of insertion, request initialization.
* Phase 4 (Request Initialization) – Finally a station sends out a special request to a parameter server to obtain configuration information. This frame is sent to a special functional address, typically a Token Ring bridge, which may hold timer and ring number information the new station needs to know.

### Optional priority scheme

In some applications there is an advantage to being able to designate one station having a higher priority. Token Ring specifies an optional scheme of this sort, as does the CAN Bus, (widely used in automotive applications) – but Ethernet does not.
In the Token Ring priority MAC, eight priority levels, 0–7, are used. When the station wishing to transmit receives a token or data frame with a priority less than or equal to the station's requested priority, it sets the priority bits to its desired priority. The station does not immediately transmit; the token circulates around the medium until it returns to the station. Upon sending and receiving its own data frame, the station downgrades the token priority back to the original priority.
Here are the following eight access priority and traffic types for devices that support 802.1Q and 802.1p:
| Priority bits | Traffic type |
| x'000' | Normal data traffic |
| x'001' | Not used |
| x'010' | Not used |
| x'011' | Not used |
| x'100' | Normal data traffic (forwarded from other devices) |
| x'101' | Data sent with time sensitivity requirements |
| x'110' | Data with real time sensitivity (i.e. VoIP) |
| x'111' | Station management |

## Interconnection with Ethernet

Bridging solutions for Token Ring and Ethernet networks included the AT&T StarWAN 10:4 Bridge, the IBM 8209 LAN Bridge and the Microcom LAN Bridge. Alternative connection solutions incorporated a router that could be configured to dynamically filter traffic, protocols and interfaces, such as the IBM 2210-24M Multiprotocol Router, which contained both Ethernet and Token Ring interfaces.

## Operating system support

In 2012, David S. Miller merged a patch to remove token ring networking support from the Linux kernel.