User`s guide

XVI. Traffic Management
Chelsio T5/T4 Unified Wire For Linux Page 218
ethX: Chelsio interface
Modifying the application
The application can also be modified in order to associate connections to scheduling classes.
Follow the steps mentioned below:
1. Determine the TCP socket file descriptor in the application through which data is sent.
2. Declare and initialize a variable in the application:
int cl=1;
Here,
cl is the TCP 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 7.
The application will function according to the parameters set for that traffic class.
3. Add socket option definitions:
In order to use setsockopt() to set the options to the TCP socket, the following two definitions
need to be made:
SOL_SCHEDCLASS used for setting TCP traffic class, which has the value 290.
IPPROTO_TCP used for setting the type of IP Protocol.
# define SOL_SCHEDCLASS 290
# define IPPROTO_TCP 6
4. Use the setsockopt() function to set socket options:
The setsockopt() call must be mentioned after the connect() call.
//Get the TCP socket descriptor variable
setsockopt (sockfd , IPPROTO_TCP, SOL_SCHEDCLASS, &cl, sizeof(cl));
For more information on additional parameters, refer cop manual by running the
man cop command.
Note