diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/decnet/af_decnet.c | 25 | ||||
-rw-r--r-- | net/decnet/sysctl_net_decnet.c | 33 |
2 files changed, 55 insertions, 3 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index f89e55f814d9..d402e9020c68 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -153,6 +153,7 @@ static struct proto_ops dn_proto_ops; | |||
153 | static DEFINE_RWLOCK(dn_hash_lock); | 153 | static DEFINE_RWLOCK(dn_hash_lock); |
154 | static struct hlist_head dn_sk_hash[DN_SK_HASH_SIZE]; | 154 | static struct hlist_head dn_sk_hash[DN_SK_HASH_SIZE]; |
155 | static struct hlist_head dn_wild_sk; | 155 | static struct hlist_head dn_wild_sk; |
156 | static atomic_t decnet_memory_allocated; | ||
156 | 157 | ||
157 | static int __dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen, int flags); | 158 | static int __dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen, int flags); |
158 | static int __dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen, int flags); | 159 | static int __dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen, int flags); |
@@ -446,10 +447,26 @@ static void dn_destruct(struct sock *sk) | |||
446 | dst_release(xchg(&sk->sk_dst_cache, NULL)); | 447 | dst_release(xchg(&sk->sk_dst_cache, NULL)); |
447 | } | 448 | } |
448 | 449 | ||
450 | static int dn_memory_pressure; | ||
451 | |||
452 | static void dn_enter_memory_pressure(void) | ||
453 | { | ||
454 | if (!dn_memory_pressure) { | ||
455 | dn_memory_pressure = 1; | ||
456 | } | ||
457 | } | ||
458 | |||
449 | static struct proto dn_proto = { | 459 | static struct proto dn_proto = { |
450 | .name = "DECNET", | 460 | .name = "NSP", |
451 | .owner = THIS_MODULE, | 461 | .owner = THIS_MODULE, |
452 | .obj_size = sizeof(struct dn_sock), | 462 | .enter_memory_pressure = dn_enter_memory_pressure, |
463 | .memory_pressure = &dn_memory_pressure, | ||
464 | .memory_allocated = &decnet_memory_allocated, | ||
465 | .sysctl_mem = sysctl_decnet_mem, | ||
466 | .sysctl_wmem = sysctl_decnet_wmem, | ||
467 | .sysctl_rmem = sysctl_decnet_rmem, | ||
468 | .max_header = DN_MAX_NSP_DATA_HEADER + 64, | ||
469 | .obj_size = sizeof(struct dn_sock), | ||
453 | }; | 470 | }; |
454 | 471 | ||
455 | static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp) | 472 | static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp) |
@@ -470,6 +487,8 @@ static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp) | |||
470 | sk->sk_family = PF_DECnet; | 487 | sk->sk_family = PF_DECnet; |
471 | sk->sk_protocol = 0; | 488 | sk->sk_protocol = 0; |
472 | sk->sk_allocation = gfp; | 489 | sk->sk_allocation = gfp; |
490 | sk->sk_sndbuf = sysctl_decnet_wmem[1]; | ||
491 | sk->sk_rcvbuf = sysctl_decnet_rmem[1]; | ||
473 | 492 | ||
474 | /* Initialization of DECnet Session Control Port */ | 493 | /* Initialization of DECnet Session Control Port */ |
475 | scp = DN_SK(sk); | 494 | scp = DN_SK(sk); |
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 02bca49cb508..0e9d2c571165 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * | 10 | * |
11 | * Changes: | 11 | * Changes: |
12 | * Steve Whitehouse - C99 changes and default device handling | 12 | * Steve Whitehouse - C99 changes and default device handling |
13 | * Steve Whitehouse - Memory buffer settings, like the tcp ones | ||
13 | * | 14 | * |
14 | */ | 15 | */ |
15 | #include <linux/config.h> | 16 | #include <linux/config.h> |
@@ -37,6 +38,11 @@ int decnet_dr_count = 3; | |||
37 | int decnet_log_martians = 1; | 38 | int decnet_log_martians = 1; |
38 | int decnet_no_fc_max_cwnd = NSP_MIN_WINDOW; | 39 | int decnet_no_fc_max_cwnd = NSP_MIN_WINDOW; |
39 | 40 | ||
41 | /* Reasonable defaults, I hope, based on tcp's defaults */ | ||
42 | int sysctl_decnet_mem[3] = { 768 << 3, 1024 << 3, 1536 << 3 }; | ||
43 | int sysctl_decnet_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 }; | ||
44 | int sysctl_decnet_rmem[3] = { 4 * 1024, 87380, 87380 * 2 }; | ||
45 | |||
40 | #ifdef CONFIG_SYSCTL | 46 | #ifdef CONFIG_SYSCTL |
41 | extern int decnet_dst_gc_interval; | 47 | extern int decnet_dst_gc_interval; |
42 | static int min_decnet_time_wait[] = { 5 }; | 48 | static int min_decnet_time_wait[] = { 5 }; |
@@ -428,6 +434,33 @@ static ctl_table dn_table[] = { | |||
428 | .extra1 = &min_decnet_no_fc_max_cwnd, | 434 | .extra1 = &min_decnet_no_fc_max_cwnd, |
429 | .extra2 = &max_decnet_no_fc_max_cwnd | 435 | .extra2 = &max_decnet_no_fc_max_cwnd |
430 | }, | 436 | }, |
437 | { | ||
438 | .ctl_name = NET_DECNET_MEM, | ||
439 | .procname = "decnet_mem", | ||
440 | .data = &sysctl_decnet_mem, | ||
441 | .maxlen = sizeof(sysctl_decnet_mem), | ||
442 | .mode = 0644, | ||
443 | .proc_handler = &proc_dointvec, | ||
444 | .strategy = &sysctl_intvec, | ||
445 | }, | ||
446 | { | ||
447 | .ctl_name = NET_DECNET_RMEM, | ||
448 | .procname = "decnet_rmem", | ||
449 | .data = &sysctl_decnet_rmem, | ||
450 | .maxlen = sizeof(sysctl_decnet_rmem), | ||
451 | .mode = 0644, | ||
452 | .proc_handler = &proc_dointvec, | ||
453 | .strategy = &sysctl_intvec, | ||
454 | }, | ||
455 | { | ||
456 | .ctl_name = NET_DECNET_WMEM, | ||
457 | .procname = "decnet_wmem", | ||
458 | .data = &sysctl_decnet_wmem, | ||
459 | .maxlen = sizeof(sysctl_decnet_wmem), | ||
460 | .mode = 0644, | ||
461 | .proc_handler = &proc_dointvec, | ||
462 | .strategy = &sysctl_intvec, | ||
463 | }, | ||
431 | { | 464 | { |
432 | .ctl_name = NET_DECNET_DEBUG_LEVEL, | 465 | .ctl_name = NET_DECNET_DEBUG_LEVEL, |
433 | .procname = "debug", | 466 | .procname = "debug", |