User`s guide

Chapter XI. UDP Segmentation Offload and Pacing
Chelsio T5/T4 Unified Wire For Linux Page 177
4. Software/Driver Configuration and Fine-tuning
4.1. Modifying the application
To use the UDP offload functionality, the application needs to be modified. Follow the steps
mentioned below:
i. Determine the UDP socket file descriptor in the application through which data is sent
ii. Declare and initialize two variables in the application:
int fs=1316;
int cl=1;
Here,
fs is the UDP packet payload size in bytes that is transmitted on the wire. The minimum
value of fs is 256 bytes.
cl is the UDP traffic class(scheduler-class-index) that the user wishes to assign the data
stream to. This value needs to be in the range of 0 to 14.
The application will function according to the parameters set for that traffic class.
iii. Add socket option definitions:
In order to use setsockopt() to set the options to the UDP socket, the following three definitions
need to be made:
SO_FRAMESIZE used for setting frame size, which has the value 291.
SOL_SCHEDCLASS used for setting UDP traffic class, which has the value 290.
IPPROTO_UDP used for setting the type of IP Protocol.
# define SO_FRAMESIZE 291
# define SOL_SCHEDCLASS 290
# define IPPROTO_UDP 17
iv. Use the setsockopt() function to set socket options:
//Get the UDP socket descriptor variable
setsockopt (sockfd , IPPROTO_UDP, SO_FRAMESIZE, &fs, sizeof(fs));
setsockopt (sockfd , IPPROTO_UDP, SOL_SCHEDCLASS, &cl, sizeof(cl));