Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Ethernet CRC calculation: (8 Items)
   
Ethernet CRC calculation  
Hi,

In io-net model, who is responsible for calculating (Tx) / validating (Rx) the ethernet CRC in ethernet frames? Is it 
the ethernet driver or the higher layers?

TIA,

Dan
RE: Ethernet CRC calculation  
Depending on the driver, it is either the Ethernet hardware or the upper
layers. The drivers don't perform any CRC calculations on the data. If
the hardware can perform the checking and it is enabled to do so, then
the hardware will perform the calculation and checking.


-----Original Message-----
From: Daniel Rodrick [mailto:daniel.rodrick@gmail.com] 
Sent: Thursday, July 03, 2008 5:43 AM
To: drivers-networking
Subject: Ethernet CRC calculation

Hi,

In io-net model, who is responsible for calculating (Tx) / validating
(Rx) the ethernet CRC in ethernet frames? Is it the ethernet driver or
the higher layers?

TIA,

Dan

_______________________________________________
Networking Drivers
http://community.qnx.com/sf/go/post9993
RE: Ethernet CRC calculation  
Hi,

A related query. How does the ethernet driver tell the upper layers that
the hardware will do the CRC calculation? In Rx diection? In Tx
direction? I looked at the Network DDK documentation for this, and it
only talks about TCP / UDP checksum offloading ... not ethernet
checksum.

Also, can you tell me a sample driver which does offload this CRC
calculation to hardware? How about devn-mpc85xx?

Thank You,

Rajat


----Original Message----
From: Hugh Brown [mailto:hsbrown@qnx.com]
Sent: Thursday, July 03, 2008 5:09 PM
To: drivers-networking
Subject: RE: Ethernet CRC calculation

> Depending on the driver, it is either the Ethernet hardware
> or the upper layers. The drivers don't perform any CRC
> calculations on the data. If the hardware can perform the
> checking and it is enabled to do so, then the hardware will
> perform the calculation and checking.
> 
> 
> -----Original Message-----
> From: Daniel Rodrick [mailto:daniel.rodrick@gmail.com]
> Sent: Thursday, July 03, 2008 5:43 AM
> To: drivers-networking
> Subject: Ethernet CRC calculation
> 
> Hi,
> 
> In io-net model, who is responsible for calculating (Tx) / validating
> (Rx) the ethernet CRC in ethernet frames? Is it the ethernet
> driver or the higher layers?
> 
> TIA,
> 
> Dan
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post9993
> 
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post9996
RE: Ethernet CRC calculation  
When the Ethernet driver advertises itself to io-net, it sets the rx and
tx capabilities in the io-net advertisement structure. You can see this
in the devn-i82544.so driver. The Ethernet checksum (crc) is always
calculated and checked by the hardware.


-----Original Message-----
From: Rajat Jain [mailto:rajat.jain@infogain.com] 
Sent: Thursday, July 03, 2008 7:46 AM
To: drivers-networking
Subject: RE: Ethernet CRC calculation


Hi,

A related query. How does the ethernet driver tell the upper layers that
the hardware will do the CRC calculation? In Rx diection? In Tx
direction? I looked at the Network DDK documentation for this, and it
only talks about TCP / UDP checksum offloading ... not ethernet
checksum.

Also, can you tell me a sample driver which does offload this CRC
calculation to hardware? How about devn-mpc85xx?

Thank You,

Rajat


----Original Message----
From: Hugh Brown [mailto:hsbrown@qnx.com]
Sent: Thursday, July 03, 2008 5:09 PM
To: drivers-networking
Subject: RE: Ethernet CRC calculation

> Depending on the driver, it is either the Ethernet hardware
> or the upper layers. The drivers don't perform any CRC
> calculations on the data. If the hardware can perform the
> checking and it is enabled to do so, then the hardware will
> perform the calculation and checking.
> 
> 
> -----Original Message-----
> From: Daniel Rodrick [mailto:daniel.rodrick@gmail.com]
> Sent: Thursday, July 03, 2008 5:43 AM
> To: drivers-networking
> Subject: Ethernet CRC calculation
> 
> Hi,
> 
> In io-net model, who is responsible for calculating (Tx) / validating
> (Rx) the ethernet CRC in ethernet frames? Is it the ethernet
> driver or the higher layers?
> 
> TIA,
> 
> Dan
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post9993
> 
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post9996


_______________________________________________
Networking Drivers
http://community.qnx.com/sf/go/post9998
Re: RE: Ethernet CRC calculation  
If you would please refer to the MPC85xx Reference Manuals, you will see that there are configuration registers in the 
DPRAM that specifies whether the CPM will handle the MAC layer CRC.

Specifically, in the MPC8560RM, the CRC hardware assist can be configured as follows:

The transmitter packet pad and CRC append configuration are controlled by the following registers:
- TxBD bit 1 - PAD/CRC
- TxBD bit 5 - Tx CRC
- MACCFG2 bit 29 - PAD/CRC
- MACCFG2 bit 30 - CRC_EN

In the receiver, whenever a CRC error is detected, the RxBD[CR] bit will be set.
RE: Ethernet CRC calculation  
Hi,

As per me there are three checksums on different network layers:

1) Ethernet CRC on layer 2
2) IP checksum on layer 3
3) TCP / UDP checksum on layer 4

I'm clear on points 2 & 3 above. Either the hardware can do it or the
io-net (The default is io-net). In case the hardware wants to do it, the
ethernet driver communicates this as mentioned in Network DDK
documentation and as done in devn-i82544: 

ap->capabilities_rx = IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4;
ap->capabilities_tx = IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4;

But I'm confused on point 1. So who does it by default? And can we
change this behaviour?

Thanks,

Rajat


----Original Message----
From: Hugh Brown [mailto:hsbrown@qnx.com]
Sent: Thursday, July 03, 2008 5:40 PM
To: drivers-networking
Subject: RE: Ethernet CRC calculation

> When the Ethernet driver advertises itself to io-net, it sets
> the rx and tx capabilities in the io-net advertisement
> structure. You can see this in the devn-i82544.so driver. The
> Ethernet checksum (crc) is always calculated and checked by
> the hardware.
> 
> 
> -----Original Message-----
> From: Rajat Jain [mailto:rajat.jain@infogain.com]
> Sent: Thursday, July 03, 2008 7:46 AM
> To: drivers-networking
> Subject: RE: Ethernet CRC calculation
> 
> 
> Hi,
> 
> A related query. How does the ethernet driver tell the upper
> layers that
> the hardware will do the CRC calculation? In Rx diection? In Tx
> direction? I looked at the Network DDK documentation for this, and it
> only talks about TCP / UDP checksum offloading ... not ethernet
> checksum. 
> 
> Also, can you tell me a sample driver which does offload this CRC
> calculation to hardware? How about devn-mpc85xx?
> 
> Thank You,
> 
> Rajat
> 
> 
> ----Original Message----
> From: Hugh Brown [mailto:hsbrown@qnx.com]
> Sent: Thursday, July 03, 2008 5:09 PM
> To: drivers-networking
> Subject: RE: Ethernet CRC calculation
> 
>> Depending on the driver, it is either the Ethernet hardware
>> or the upper layers. The drivers don't perform any CRC
>> calculations on the data. If the hardware can perform the
>> checking and it is enabled to do so, then the hardware will
>> perform the calculation and checking.
>> 
>> 
>> -----Original Message-----
>> From: Daniel Rodrick [mailto:daniel.rodrick@gmail.com]
>> Sent: Thursday, July 03, 2008 5:43 AM
>> To: drivers-networking
>> Subject: Ethernet CRC calculation
>> 
>> Hi,
>> 
>> In io-net model, who is responsible for calculating (Tx) / validating
>> (Rx) the ethernet CRC in ethernet frames? Is it the ethernet driver
>> or the higher layers? 
>> 
>> TIA,
>> 
>> Dan
>> 
>> _______________________________________________
>> Networking Drivers
>> http://community.qnx.com/sf/go/post9993
>> 
>> 
>> _______________________________________________
>> Networking Drivers
>> http://community.qnx.com/sf/go/post9996
> 
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post9998
> 
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post10001
RE: Ethernet CRC calculation  
Why would you want to change the behaviour if the hardware does it for
you? On some chips you can turn the CRC off and do it in software, but I
don't see the point.


-----Original Message-----
From: Rajat Jain [mailto:rajat.jain@infogain.com] 
Sent: Friday, July 04, 2008 1:56 AM
To: drivers-networking
Subject: RE: Ethernet CRC calculation


Hi,

As per me there are three checksums on different network layers:

1) Ethernet CRC on layer 2
2) IP checksum on layer 3
3) TCP / UDP checksum on layer 4

I'm clear on points 2 & 3 above. Either the hardware can do it or the
io-net (The default is io-net). In case the hardware wants to do it, the
ethernet driver communicates this as mentioned in Network DDK
documentation and as done in devn-i82544: 

ap->capabilities_rx = IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4;
ap->capabilities_tx = IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4;

But I'm confused on point 1. So who does it by default? And can we
change this behaviour?

Thanks,

Rajat


----Original Message----
From: Hugh Brown [mailto:hsbrown@qnx.com]
Sent: Thursday, July 03, 2008 5:40 PM
To: drivers-networking
Subject: RE: Ethernet CRC calculation

> When the Ethernet driver advertises itself to io-net, it sets
> the rx and tx capabilities in the io-net advertisement
> structure. You can see this in the devn-i82544.so driver. The
> Ethernet checksum (crc) is always calculated and checked by
> the hardware.
> 
> 
> -----Original Message-----
> From: Rajat Jain [mailto:rajat.jain@infogain.com]
> Sent: Thursday, July 03, 2008 7:46 AM
> To: drivers-networking
> Subject: RE: Ethernet CRC calculation
> 
> 
> Hi,
> 
> A related query. How does the ethernet driver tell the upper
> layers that
> the hardware will do the CRC calculation? In Rx diection? In Tx
> direction? I looked at the Network DDK documentation for this, and it
> only talks about TCP / UDP checksum offloading ... not ethernet
> checksum. 
> 
> Also, can you tell me a sample driver which does offload this CRC
> calculation to hardware? How about devn-mpc85xx?
> 
> Thank You,
> 
> Rajat
> 
> 
> ----Original Message----
> From: Hugh Brown [mailto:hsbrown@qnx.com]
> Sent: Thursday, July 03, 2008 5:09 PM
> To: drivers-networking
> Subject: RE: Ethernet CRC calculation
> 
>> Depending on the driver, it is either the Ethernet hardware
>> or the upper layers. The drivers don't perform any CRC
>> calculations on the data. If the hardware can perform the
>> checking and it is enabled to do so, then the hardware will
>> perform the calculation and checking.
>> 
>> 
>> -----Original Message-----
>> From: Daniel Rodrick [mailto:daniel.rodrick@gmail.com]
>> Sent: Thursday, July 03, 2008 5:43 AM
>> To: drivers-networking
>> Subject: Ethernet CRC calculation
>> 
>> Hi,
>> 
>> In io-net model, who is responsible for calculating (Tx) / validating
>> (Rx) the ethernet CRC in ethernet frames? Is it the ethernet driver
>> or the higher layers? 
>> 
>> TIA,
>> 
>> Dan
>> 
>> _______________________________________________
>> Networking Drivers
>> http://community.qnx.com/sf/go/post9993
>> 
>> 
>> _______________________________________________
>> Networking Drivers
>> http://community.qnx.com/sf/go/post9996
> 
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post9998
> 
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post10001


_______________________________________________
Networking...
RE: Ethernet CRC calculation  
From: Hugh Brown

> On some chips you can turn the CRC off and do it in software

99.9999% of the ethernet nics and drivers on all operating
systems let the nic do the ethernet crc calculation, and
the nic is programmed to drop rxd packets with bad crc's, 
and increment a counter that the driver will read later.

For diagnostic purposes, occasionally the driver will program
the nic to pass up a packet with a bad ethernet crc.

However, it is far more efficient to let the nic calculate
and validated the ethernet crc than have the cpu (ie driver)
perform this task).  The more stuff like this that you can
offload to special-purpose hardware, the more cpu is left
over to do application (client/server) stuff.

--
aboyd