2

I need to implement an 'ethernet-wannabe protocol' with a sender and a receiver.(only layers 1,2).

Assuming a sender\receiver model for an Ethernet frame with varying payload length. As for the sender- I have no issues. The frame consists of the MAC's of the sender and receiver, type and length of the payload and a payload, and a 4 byte CRC calculation afterwards.

Layer 1 merely sends the bits to the receiver.

The receiver's layer 1 reads those bits and adds them up to form a frame. How do I know when has the frame ended? I know I have the length field to know how many bytes are reserved for the payload and then the CRC bytes afterwards.

However, what if an error occurred and the length byte was changed? I can't rely on it no more. Another solution is to put an 'end of frame' character after the CRC so the receiver knows this marks the end of the frame(assuming it can't be in the payload\macs\etc). But the same problem arises, what if any other byte was mistakenly changed into this special character , or this byte has changed?

0

1 Answer 1

3

You need to look at the entire ethernet scheme, including outside the frame. It starts with the Preamble of seven octets, then the one-octet Start-of-Frame delimiter. The frame follows that, and after the frame comes the 12-octet Inter-Packet gap, which is basically silence on the line (no bits).

The Preamble, SoF, and Inter-Packet gap are all dealt with by the hardware, as is the FCS for modern ethernet interfaces. Generally, only the frame (usually minus the CRC) is passed to the software.

4
  • So the surefire way to know it is the end of frame is if the line is silent, meaning we reached the IFG timer? Commented Apr 30, 2022 at 23:06
  • 1
    Yes. Starting from the Preamble all the way through the FCS, there will be activity in the carrier, but the Inter-Packet GAP is just the carrier with no modulation.
    – Ron Maupin
    Commented Apr 30, 2022 at 23:09
  • What if the payload of the ethernet frame contains a long string of zeros, enough to look like the IPG? How does layer 1 tell the difference between the real IPG and a segment of payload that has the same pattern?
    – CharlieB
    Commented Jul 23, 2023 at 20:51
  • A long string of zeros still requires carrier modulation. You need to study encoding to see why. There are many encoding types, and different ethernet versions use different encoding methods. Each method tries to limit the number of non-change events.
    – Ron Maupin
    Commented Jul 23, 2023 at 21:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.