add files
This commit is contained in:
parent
2e6402b893
commit
1fd49f5ef9
5
Makefile
Normal file
5
Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
obj-m += tcp_const.o
|
||||||
|
|
||||||
|
all:
|
||||||
|
make -C /lib/modules/`uname -r`/build M=`pwd` modules
|
||||||
|
|
||||||
62
tcp_const.c
Normal file
62
tcp_const.c
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#include <linux/module.h>
|
||||||
|
#include <net/tcp.h>
|
||||||
|
|
||||||
|
static u32 const_cwnd = 1000;
|
||||||
|
module_param(const_cwnd, uint, 0664);
|
||||||
|
|
||||||
|
static void const_main(struct sock *sk, u32,int,const struct rate_sample *rs)
|
||||||
|
{
|
||||||
|
tcp_sk(sk)->snd_cwnd = const_cwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void const_cong_avoid(struct sock *sk, u32 ack, u32 acked)
|
||||||
|
{
|
||||||
|
tcp_sk(sk)->snd_cwnd = const_cwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void const_init(struct sock *sk)
|
||||||
|
{
|
||||||
|
tcp_sk(sk)->snd_cwnd = const_cwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static u32 const_ssthresh(struct sock *sk)
|
||||||
|
{
|
||||||
|
return const_cwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void const_set_state(struct sock *sk, u8 new_state)
|
||||||
|
{
|
||||||
|
if (new_state == TCP_CA_Loss) {
|
||||||
|
tcp_sk(sk)->snd_cwnd = const_cwnd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static u32 const_undo(struct sock *sk)
|
||||||
|
{
|
||||||
|
return tcp_sk(sk)->snd_cwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct tcp_congestion_ops tcp_const_cong_ops __read_mostly = {
|
||||||
|
.name = "const",
|
||||||
|
.undo_cwnd = const_undo,
|
||||||
|
.init = const_init,
|
||||||
|
.cong_control = const_main,
|
||||||
|
/*.cong_avoid = const_cong_avoid,*/
|
||||||
|
.ssthresh = const_ssthresh,
|
||||||
|
.set_state = const_set_state,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init const_register(void)
|
||||||
|
{
|
||||||
|
return tcp_register_congestion_control(&tcp_const_cong_ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit const_unregister(void)
|
||||||
|
{
|
||||||
|
tcp_unregister_congestion_control(&tcp_const_cong_ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
module_init(const_register);
|
||||||
|
module_exit(const_unregister);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
Loading…
Reference in New Issue
Block a user