7

I understand that Carrier Sense is essentially the NIC "listening" to the medium for any transmissions, Multiple Access means that multiple devices on the network can "listen" to the medium, and Collision Detection is the procedure it goes through if there is a Frame collision. My question is how does a NIC actually determine if there was a collision? is there a discrepancy in the voltages, or what?

user3662222
  • 73
  • 1
  • 3

3 Answers3

5

Assume you have the following situation...

  • PC with the NIC hard-coded to 100Mbps, Full-duplex
  • RJ45 cable, pinned EIA-568B (not that the colors in the pinout matter)
  • Cisco Catalyst Switch, using autonegotiation (at 100Mbps)

Since the PC's NIC is locked at 100/full, the Cisco's Ethernet autonegotiation fails and it falls back to 100/half. Now there is a duplex mismatch on the line. The Cisco switch uses CSMA/CD for access to the link.

Let's assume the PC and the Cisco both transmit at exactly the same instant; the logical diagram and physical layer diagram show the same behavior from two different perspectives, but the physical layer diagram is most relevant to your question.

  LOGICAL DIAGRAM
  ===============

                   Tx                     Tx
  100/full       ----->                 <-----   100/half
  PC        -----------------------------------  Cisco Catalyst Switch


  PHYSICAL LAYER PIN DIAGRAM
  ==========================

      PC                                         Cisco Catalyst Switch
      100/full                                   100/half

                    Tx D1             
                    ----->
      568B                                       568B
      Pin Signal                                 Pin Signal
      1   TX+ D1    ---------------------------  3   RX+ D2
      2   TX- D1    ---------------------------  6   RX- D2
      3   RX+ D2    ---------------------------  1   TX+ D1
      6   RX- D2    ---------------------------  2   TX- D1

                                         <------
                                           Tx D1

In the diagrams above, the PC (full duplex) is on the left and the Cisco Switch (half duplex) is on the right. Both sides transmit (Tx) simultaneously on pins 1 and 2, this pair of pins is called D1.

When the NIC on the switch receives the PC's frame on the D2 pair while the switch is simultaneously transmitting on the D1 pair, the switch registers a collision (answer reference). The collision is only registered on the switch, because it is in half-duplex mode.

Notes about GigabitEthernet:

  • Half-duplex is called out in the standardNote 1; however, nobody actually uses half-duplex GigE. This means that GE won't use CSMA/CD
  • GE uses all 8 pins in the RJ45 mod plug, and the specific TX / RX pins are allocated dynamically.

End Notes:

Note 1 Quoting IEEE 802.3-2012 4.1 (Italic emphasis mine):

4.1.2.1.2 Reception without contention

In half duplex mode, at an operating speed of 1000 Mb/s, frames may be extended by the transmitting station under the conditions described in 4.2.3.4. The extension is discarded by the MAC sublayer of the receiving station, as defined in the procedural model in 4.2.9.

Mike Pennington
  • 29,876
  • 11
  • 78
  • 152
  • That link is not "the standard". GigE does not support half-duplex operation. And finally, *nobody* makes hubs anymore. :-) – Ricky Oct 23 '14 at 19:31
  • Ricky, you really should investigate the standards before making statements like "GigE does not support half-duplex operation"... see my edit. Also, I never said anything about hubs – Mike Pennington Oct 23 '14 at 19:42
  • The cisco link you referenced did. Show me a single 1000base-XXX device that operates at half-duplex. Or for that matter, can be set to even *advertise* half-duplex. – Ricky Oct 23 '14 at 19:47
  • GE autonegotiation will fall back to half-duplex, if the PHY supports it... a simple `sudo ethtool eth0` on my linux system with an [RTL8111/8168B](http://www.realtek.com.tw/products/productsView.aspx?Langid=1&PFid=5&Level=5&Conn=4&ProdID=11) says: `Advertised link modes: ... 1000baseT/Half 1000baseT/Full` – Mike Pennington Oct 23 '14 at 19:51
  • 2
    1000BASE-T (802.3ab) does, indeed, support half or full duplex (see http://grouper.ieee.org/groups/802/3/tutorial/march98/mick_170398.pdf). Unlike 10 or 100 Mb ethernet, which default to half duplex, 1 Gb defaults to full duplex. With 10 Gb ethernet, they finally got rid of half duplex altogether. – Ron Maupin Oct 23 '14 at 20:11
  • @MikePennington, my linux box (broadcom 5704 chip) says the same thing, but it *cannot* be set to 1000/half. No Broadcom switch SoC can do it either. (sdk and docs to prove it) My RTL8169 won't allow it either. – Ricky Oct 23 '14 at 21:11
  • 2
    Ricky, at this point your comments have nothing to do with improving my answer. It's time to refocus on what I said. – Mike Pennington Oct 23 '14 at 21:42
  • 1
    All current physical layers for 1000base-X (CX, SX, LX, ZX, and T) are fundamentally full-duplex. No one implements a half-duplex mode. CSMA/CD is, thus, simulated by the transmit and receive functions, where it's implemented at all. – Ricky Oct 23 '14 at 22:24
  • So I'm not sure I'm fully understanding the diagrams provided. Could you elaborate in a different way, possibly? Thank you again for your responses, Mike. – user3662222 Oct 23 '14 at 22:29
  • @user3662222, I edited... hopefully this helps. If not, please be specific about what is confusing – Mike Pennington Oct 23 '14 at 23:43
  • @MikePennington, So I'm guessing the only way the switch detects the collision is simply because it is receiving on pair D2 while sending from D1, correct? What confused me earlier was the talk of duplex and full duplex (I'm in class for this and am still learning all of it, so that was a bit over my head). But I'm still confused as to how the switch detects that collision. Are the voltages altered when receiving on the D2 and simultaneously sending on D1 and in turn creating a collision? – user3662222 Oct 24 '14 at 01:03
  • 2
    Simultaneously transmitting and receiving in half duplex is a collision. The tx and rx signals don't physically collide because they are on different pairs; this is a logical collision condition not a physical collision. – Mike Pennington Oct 24 '14 at 01:15
2

In the olden days (10base-2), a collision was detected by current sensing -- it takes more power (electrical current) when two transmitters step on each other. For the 10/100/1000-baseT specs, it's as simple as looking at the RX pair while transmitting on your TX pair. (or pairs in the case of 1000, but gig-e never does half-duplex.)

Modern (for 10base-X tech) transceivers use echo cancellation to subtract their signal from the wire to listen for other signals.

Ricky
  • 31,438
  • 2
  • 43
  • 84
1

The MAC or repeater (hub) is is notified of a collision by the PHY

When a MAC is informed of a collision it goes through the collision detected procedure (random backoff).

When a repeater (hub) is informed of a collision it generates a "JAM signal" on all ports to ensure that the collision is detected by the MACs that sent the colliding frames and that other hosts correctly detect the line as busy.

How the phy detects the collision is media type specific. For coaxial ethernet it is based on the DC voltage on the coax https://books.google.co.uk/books?id=MRChaUQr0Q0C&pg=PA54&lpg=PA54&dq=coaxial+ethernet+collision+detection&source=bl&ots=oGaQGcNnkN&sig=OayChWr1zEIc8heoihW6Dm-p8JY&hl=en&sa=X&redir_esc=y#v=onepage&q=coaxial%20ethernet%20collision%20detection&f=false

The common variants of twisted pair and fiber ethernet are full duplex at an electricial level but for compatibility reasons and to allow operation in networks with repeaters (hubs) they needed to be able to operate in a half duplex mode. This is done by treating simultanious activity on the transmit and receive datapaths as a collision.

Note that links running in full duplex mode do not use CSMA/CD, collisions simply can't happen there. At 10Mbps CSMA/CD was the norm. In the early days of 100Mbps CSMA/CD was still used to support hubs (repeaters) but as switches (bridges) took over and autonegotiation matured full duplex became the norm. At 1Gbps half duplex mode exists in the standards but afaict noone ever sold a hub making it kinda pointless. At higher speeds half duplex is not supported at all.

CSMA/CD nowadays is a feature for compatbility with legacy equipment.

Peter Green
  • 12,935
  • 2
  • 20
  • 46