next up previous contents
Next: Recognising CC Options Up: CC Options Previous: tcp_calc_cc_options()

 

tcp_build_cc_options()

Now that the selection of CC options has been made, a mechanism for inserting the CC options into the header is needed.

The tcp_build_cc_options() function accomplishes this. It's prototype is as follows:

It takes in a pointer to the sock struct that is responsible for the packet to be sent, a pointer to where the CC options are to be inserted, and the send_cc parameter indicates which CC options to include. This parameter is set from the tcp_calc_cc_options() function described previously.

A test is done on send_cc and then the appropriate CC option is added in using the following code structure:

It would have been possible to use the htonl() library function but it was decided to use pointer arithmetic and shifting operations for speed, htonl() introduces the overhead of context switching and a function call. The speed improvement is necessary in the kernel for high performance. The code is still portable because all network segments are arranged in the same byte order. Appendix A.1.2 contains the code for this function.



Mark Stacey
Thu Apr 30 12:26:11 IST 1998