Right now we calculate the checksum for the establish SYN/ACK messages, but we do not calculate the checksum for the data packets, as it involves calculating the checksum before we transmit the data. To do this we will need a fifo that is at least one packet size (2048) to run the data through to calculate the checksum, then we can add this checksum to the header checksum to get the total checksum.
We already have the M2S dma SAF, what if we calculated the checksum there, and then stored the checksum in the control data? It would be one less memory that we have to use
We need to re-evaluate how we are evaluating the checksum. Right now the idea is to calculate the checksum for the data, then add that to the header checksum when we compute it. The other option is to just make the packet with the checksum set to 0 and then run the entire packet through the checksum calculator. Doing it the second way requires inserting the calculated checksum back into the stream midway through the packet though
And we know during the whole stream that we either have data or do not have data, so the order should go like this
We see i_hdr valid. We can then construct the ip_header all in parallel. If i_no_data is set, then we go straight to the header state. If not, then we go into the data_checksum state.
the data_checksum state calculates the checksum for the data. In this state, we advertise the fifo as ready and calculate the checksum as long as valid and ready are both set. Once we see last, we go into the header state 3
Or, we could just calculate the checksum as the packet comes in in a different checksum calc, and then just not continue with the header until we see tlast in the packet, and then we will know that the checksum is ready
I think we need to redesign our packet generator with checksum calculation in mind... lets make a diagram again. Option 2 is not so bad if we do it like the UDP one, for example. We just store all of the header fields in parallel, then create the serial packet afterwards.