Ethernet Products
Determine ramifications of Intel® Ethernet products and technologies
4862 Discussions

UDP checksum not calculated fully in TSO mode

BMače
Beginner
799 Views

I have a standalone application for which I included Ethernet connectivity and I am in process of writing a simple driver for one of your devices. The setup I am currently using is Virtual Box 6 with Intel Pro /1000MT (82545). I made majority of things work, but I am struggling with TSO descriptor parameters. What I want to do is send UDP over IPv6 with segmentation and checksum offloading. My approach is to set context descriptor for segmentation offload, than data descriptor including only header, than data descriptor with the payload.

 

Code: Here is the code snippet:

// create context descriptor: TSO context->ipcss = ETH_HEADER_LENGTH; // ip checksum not used context->ipcso = 0; context->ipcse = 0; // to the end of the packet context->tucss = ETH_HEADER_LENGTH + IPV6_HEADER_LENGTH; context->tucso = ETH_HEADER_LENGTH + IPV6_HEADER_LENGTH + UDP_HEADER_LENGTH - 2; context->tucse = 0; // to the end of the packet context->cmd_len = data_count | TX_CONTEX_CMD_IDE | TX_CONTEX_CMD_DEXT | TX_CONTEX_CMD_RS | TX_CONTEX_CMD_TSE; context->status = 0; context->hdrlen = ETH_HEADER_LENGTH + IPV6_HEADER_LENGTH + UDP_HEADER_LENGTH; context->mss = mtu - (context->hdrlen);   // insert the header data->addr_low = (t_uint32)((t_mem_ptr)p->header + sizeof(struct net_buffer)); data->addr_high = 0x00000000; data->datalen_0 = (t_uint8)(p->header->length); data->datalen_1 = (t_uint8)(p->header->length >> 8); data->datalen_2 = ((t_uint8)(p->header->length >> 16) & (0x0f)) | 0x10; data->dcmd = TX_DATA_CMD_IDE | TX_DATA_CMD_DEXT | TX_DATA_CMD_RS | TX_DATA_CMD_TSE; data->status = 0; data->popts = TX_DATA_POPTS_TXSM; data->special = 0;   // data packets buffer = p->data; while(buffer) { data->addr_low = (t_uint32)((t_mem_ptr)buffer + sizeof(struct net_buffer)); data->addr_high = 0x00000000; data->datalen_0 = (t_uint8)(buffer->length); data->datalen_1 = (t_uint8)(buffer->length >> 8); data->datalen_2 = ((t_uint8)(buffer->length >> 16) & (0x0f)) | 0x10; if(buffer->next) data->dcmd = TX_DATA_CMD_IDE | TX_DATA_CMD_DEXT | TX_DATA_CMD_RS | TX_DATA_CMD_TSE; else data->dcmd = TX_DATA_CMD_IDE | TX_DATA_CMD_DEXT | TX_DATA_CMD_RS | TX_DATA_CMD_IFCS | TX_DATA_CMD_EOP; data->status = 0; data->popts = 0; data->special = 0;   buffer = net_buffer_next(buffer); }

The result:

 

The result is well segmented stream of packets, with the only problem being the UDP checksum. The value there is the partial header checksum which obviously gets calculated correct. However the data is not included in the checksum. I should note that:

  • header is prepared with checksum 0
  • if I manually add the data checksum to what is written I get the correct result

 

Question:

 

  1. Should I set one context (segmentation) as I do it now (it serves segmentation and checksum), or should I set up two separately (segmentation and checksum) since the checksum parameters are taken from the second one even with segmentation used?
  2. Should TXSM flag be set for the first data descriptor only (the one with the header) or should I set this flag for all data descriptors to follow (payload) as well?
  3. Is there something obvious with my setup of context descriptors that partial checksum gets calculated but does not include the data in the checksum?
  4. When should I pre-calculate the partial UDP pseudo-header and set it up so data gets added and when should the checksum of the prototype header be left 0?

 

Thank you, kind stranger for the help!

0 Kudos
2 Replies
Caguicla_Intel
Moderator
591 Views

Hello BMače,

 

Thank you for posting in Intel Ethernet Communities. 

 

Please allow us to check on your query. We will get back to you within 1-3 business days.

 

Hoping for your patience.

 

Best regards,

Crisselle C

Intel Customer Support

A Contingent Worker at Intel

0 Kudos
Caguicla_Intel
Moderator
591 Views

Hello BMače,

 

Thank you for the patience on this matter.

 

Due to this product being discontinued, Intel Customer Service no longer supports inquiries for it, but perhaps fellow community members have the knowledge to jump in and help. You may also find the Discontinued Products website helpful to address your request. Thank you for understanding.

 

All available technical information is included on the support site below.

Support information for Intel® PRO/1000 MT Dual Port Server Adapter

https://www.intel.com/content/www/us/en/support/products/50486/network-and-io/ethernet-products/legacy-ethernet-products/intel-pro1000-mt-server-adapter-series/intel-pro-1000-mt-dual-port-server-adapter.html

 

You may visit this link for the product discontinuance information.

http://qdms.intel.com/dm/i.aspx/4F40CFBF-CF3E-46AF-9461-2D6D2546BEA4/PCN112510-00.pdf

 

Please be informed that we will now proceed in closing this request. In case you have any other concern or assistance needed in the future, please feel free to post a new question.

 

Thank you for your time on this matter.

 

Best regards,

Crisselle C

Intel Customer Support

A Contingent Worker at Intel

0 Kudos
Reply