[Ns-developers] Csma, ethernet length field, NSC and the link mtu...

Tom Henderson tomh at tomh.org
Tue Jul 22 21:47:06 PDT 2008


craigdo at ee.washington.edu wrote:
>>> In CsmaNetDevice::AddHeader we have this:
>>>     case LLC: {
>>>       lengthType = p->GetSize () + header.GetSerializedSize () + 
>>>         trailer.GetSerializedSize ();
>>>       LlcSnapHeader llc;
>>>       llc.SetType (protocolNumber);
>>>       p->AddHeader (llc);
>>>     } break;
>>>
>>> This looks bogus -- Why is the LLC header size ignored?
>>> And is the ethernet header really expected to be accounted 
>> for in the length field?
>>
>> no idea.
> 
> This seems wrong to me.  The LlcSnapHeader header comes after the
> dst/src/length and consumes eight bytes.  This means the maximum payload
> should be reduced to 1492 bytes when LLC/SNAP encapsulation is used.  
> 
> The EthernetHeader (header in the code above) represents the dst/src/length
> of the packet.  The LLC + SNAP header represents the LLC part
> (DSAP/SSAP/HDLC Mode) and the SNAP part (ORG/EtherType).  So my take is that
> the above code should really be,
> 
>       LlcSnapHeader llc;
>       llc.SetType (protocolNumber);
>       p->AddHeader (llc);
>       lengthType = header.GetSerializedSize () + llc.GetSerializedSize + 
>         p->GetSize () + trailer.GetSerializedSize ();
> 
> Now, there's the question of MTU.  The Ethernet MTU is 1500 bytes.  The MTU
> is 1500 bytes independent of what kind of headers and trailers are added by
> the device, right?

No, MTU is the maximum IP packet size carred by the device.  If the 
device has different headers/trailers (such as LLC/SNAP), the MTU 
changes accordingly.

> 
> Aren't we really talking about having an MTU of 1500 bytes and a maximum SDU
> (service data unit) of 1492 bytes in this case?  Is that being too pedantic?

I think we are talking about having an MTU of 1500 when IpArp 
encapsulation is used, and an MTU of 1492 bytes when LLC/SNAP 
encapsulation is used.

> 
> I can take care of getting the counts right, putting in a rational MTU and
> updating the regression traces tomorrow AM.
> 
> I'm thinking that we should add a GetSdu to net-device.h that works with the
> current MTU and mode and returns a max payload value that can be used by
> clients.  This probably also applies to the point-to-point device since I
> remember adding a ppp header but not finding any place to reduce a payload
> (it also has a 0xffff MTU where this all probably descended from).  Wifi
> too?
> 

I do not think that adding SDU really adds anything.  The MTU is the 
Ethernet SDU, but I haven't typically heard the SDU/PDU terminology when 
talking about TCP/IP.

I suggest the default for Csma should be the DIX frame variant, not the 
LLC.  We call this "IpArp" encapsulation, I believe.  Maybe this should 
be renamed to DIX or Ethernet II, or at least commented as such.

http://en.wikipedia.org/wiki/Ethernet_II_framing

Of course, ns-3 Csma is not truly Ethernet but we probably are going to 
treat it as such for now and people will put the traces through Wireshark.

Tom


More information about the Ns-developers mailing list