#include #include static void exp_slow_start(struct tcp_sock *tp) { /* Handle cwnd manipulation for slow start here */ } static void exp_cong_avoid(struct sock *sk, u32 adk, u32 in_flight) { /* Handle cwnd manipulation for congestion avoidance here */ } static u32 exp_ssthresh(struct sock *sk) { /* Compute the appropriate value of ssthresh here */ } //See http://lwn.net/Articles/128681/ for more information /* * The start() method initializes the algorithm when a new batch of data * is being transmitted; this can happen for new sockets, or when one * has been idle for a while. * * The ssthresh() method calculates the "slow start threshold"; when the * congestion window is below that threshold, the connection is in slow * start mode rather than full congestion avoidance mode. This method is * called when congestion occurs. * * The actual initial window may be set by min_cwnd() to be less than * the threshold value as a starting point for the slow start algorithm. * * When an acknowledgment arrives from the remote end, the cong_avoid() * method is invoked; it may respond to successful packet delivery by * enlarging the congestion window. * * rtt_sample() tells the algorithm about a measured round-trip time - * the time taken between sending a packet and receiving the * corresponding acknowledgment. * * set_state() indicates that the TCP state of the socket has changed. * * Various events of interest can be communicated to the algorithm via * cwnd_event(). * * Sometimes, transient situations can cause the congestion window to be * reduced; the undo_cwnd() method can be called when such a situation * is detected to restore a larger window. * * The get_info() method can be used to make congestion avoidance * information available to user space. */ static struct tcp_congestion_ops tcp_exp __read_mostly = { .init = NULL, .ssthresh = exp_ssthresh, .cong_avoid = exp_cong_avoid, .min_cwnd = tcp_reno_min_cwnd, .owner = THIS_MODULE, .name = "exp" }; static int __init exp_register(void) { return tcp_register_congestion_control(&tcp_exp); } static void __exit exp_unregister(void) { tcp_unregister_congestion_control(&tcp_exp); } module_init(exp_register); module_exit(exp_unregister); MODULE_AUTHOR("Your Name Here"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Experimental TCP");