diff options
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r-- | net/sctp/protocol.c | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 3d9ea9a48289..ab0d538a74ed 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1223,6 +1223,9 @@ static int __net_init sctp_defaults_init(struct net *net) | |||
1223 | /* Max.Burst - 4 */ | 1223 | /* Max.Burst - 4 */ |
1224 | net->sctp.max_burst = SCTP_DEFAULT_MAX_BURST; | 1224 | net->sctp.max_burst = SCTP_DEFAULT_MAX_BURST; |
1225 | 1225 | ||
1226 | /* Enable pf state by default */ | ||
1227 | net->sctp.pf_enable = 1; | ||
1228 | |||
1226 | /* Association.Max.Retrans - 10 attempts | 1229 | /* Association.Max.Retrans - 10 attempts |
1227 | * Path.Max.Retrans - 5 attempts (per destination address) | 1230 | * Path.Max.Retrans - 5 attempts (per destination address) |
1228 | * Max.Init.Retransmits - 8 attempts | 1231 | * Max.Init.Retransmits - 8 attempts |
@@ -1413,24 +1416,6 @@ static __init int sctp_init(void) | |||
1413 | for (order = 0; (1UL << order) < goal; order++) | 1416 | for (order = 0; (1UL << order) < goal; order++) |
1414 | ; | 1417 | ; |
1415 | 1418 | ||
1416 | do { | ||
1417 | sctp_assoc_hashsize = (1UL << order) * PAGE_SIZE / | ||
1418 | sizeof(struct sctp_hashbucket); | ||
1419 | if ((sctp_assoc_hashsize > (64 * 1024)) && order > 0) | ||
1420 | continue; | ||
1421 | sctp_assoc_hashtable = (struct sctp_hashbucket *) | ||
1422 | __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order); | ||
1423 | } while (!sctp_assoc_hashtable && --order > 0); | ||
1424 | if (!sctp_assoc_hashtable) { | ||
1425 | pr_err("Failed association hash alloc\n"); | ||
1426 | status = -ENOMEM; | ||
1427 | goto err_ahash_alloc; | ||
1428 | } | ||
1429 | for (i = 0; i < sctp_assoc_hashsize; i++) { | ||
1430 | rwlock_init(&sctp_assoc_hashtable[i].lock); | ||
1431 | INIT_HLIST_HEAD(&sctp_assoc_hashtable[i].chain); | ||
1432 | } | ||
1433 | |||
1434 | /* Allocate and initialize the endpoint hash table. */ | 1419 | /* Allocate and initialize the endpoint hash table. */ |
1435 | sctp_ep_hashsize = 64; | 1420 | sctp_ep_hashsize = 64; |
1436 | sctp_ep_hashtable = | 1421 | sctp_ep_hashtable = |
@@ -1452,7 +1437,7 @@ static __init int sctp_init(void) | |||
1452 | if ((sctp_port_hashsize > (64 * 1024)) && order > 0) | 1437 | if ((sctp_port_hashsize > (64 * 1024)) && order > 0) |
1453 | continue; | 1438 | continue; |
1454 | sctp_port_hashtable = (struct sctp_bind_hashbucket *) | 1439 | sctp_port_hashtable = (struct sctp_bind_hashbucket *) |
1455 | __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order); | 1440 | __get_free_pages(GFP_KERNEL | __GFP_NOWARN, order); |
1456 | } while (!sctp_port_hashtable && --order > 0); | 1441 | } while (!sctp_port_hashtable && --order > 0); |
1457 | if (!sctp_port_hashtable) { | 1442 | if (!sctp_port_hashtable) { |
1458 | pr_err("Failed bind hash alloc\n"); | 1443 | pr_err("Failed bind hash alloc\n"); |
@@ -1464,8 +1449,10 @@ static __init int sctp_init(void) | |||
1464 | INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain); | 1449 | INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain); |
1465 | } | 1450 | } |
1466 | 1451 | ||
1467 | pr_info("Hash tables configured (established %d bind %d)\n", | 1452 | if (sctp_transport_hashtable_init()) |
1468 | sctp_assoc_hashsize, sctp_port_hashsize); | 1453 | goto err_thash_alloc; |
1454 | |||
1455 | pr_info("Hash tables configured (bind %d)\n", sctp_port_hashsize); | ||
1469 | 1456 | ||
1470 | sctp_sysctl_register(); | 1457 | sctp_sysctl_register(); |
1471 | 1458 | ||
@@ -1518,12 +1505,10 @@ err_register_defaults: | |||
1518 | get_order(sctp_port_hashsize * | 1505 | get_order(sctp_port_hashsize * |
1519 | sizeof(struct sctp_bind_hashbucket))); | 1506 | sizeof(struct sctp_bind_hashbucket))); |
1520 | err_bhash_alloc: | 1507 | err_bhash_alloc: |
1508 | sctp_transport_hashtable_destroy(); | ||
1509 | err_thash_alloc: | ||
1521 | kfree(sctp_ep_hashtable); | 1510 | kfree(sctp_ep_hashtable); |
1522 | err_ehash_alloc: | 1511 | err_ehash_alloc: |
1523 | free_pages((unsigned long)sctp_assoc_hashtable, | ||
1524 | get_order(sctp_assoc_hashsize * | ||
1525 | sizeof(struct sctp_hashbucket))); | ||
1526 | err_ahash_alloc: | ||
1527 | percpu_counter_destroy(&sctp_sockets_allocated); | 1512 | percpu_counter_destroy(&sctp_sockets_allocated); |
1528 | err_percpu_counter_init: | 1513 | err_percpu_counter_init: |
1529 | kmem_cache_destroy(sctp_chunk_cachep); | 1514 | kmem_cache_destroy(sctp_chunk_cachep); |
@@ -1557,13 +1542,11 @@ static __exit void sctp_exit(void) | |||
1557 | 1542 | ||
1558 | sctp_sysctl_unregister(); | 1543 | sctp_sysctl_unregister(); |
1559 | 1544 | ||
1560 | free_pages((unsigned long)sctp_assoc_hashtable, | ||
1561 | get_order(sctp_assoc_hashsize * | ||
1562 | sizeof(struct sctp_hashbucket))); | ||
1563 | kfree(sctp_ep_hashtable); | ||
1564 | free_pages((unsigned long)sctp_port_hashtable, | 1545 | free_pages((unsigned long)sctp_port_hashtable, |
1565 | get_order(sctp_port_hashsize * | 1546 | get_order(sctp_port_hashsize * |
1566 | sizeof(struct sctp_bind_hashbucket))); | 1547 | sizeof(struct sctp_bind_hashbucket))); |
1548 | kfree(sctp_ep_hashtable); | ||
1549 | sctp_transport_hashtable_destroy(); | ||
1567 | 1550 | ||
1568 | percpu_counter_destroy(&sctp_sockets_allocated); | 1551 | percpu_counter_destroy(&sctp_sockets_allocated); |
1569 | 1552 | ||