Commit 139b2566 authored by Sridhar Samudrala's avatar Sridhar Samudrala

[SCTP] Rename struct sctp_protocol as struct sctp_globals and define

       macros for all the global fields in the structure.

This is to avoid the confusion with the static variable sctp_protocol
of type struct inet_protocol. Also fixes some calls that pass the
global variable as an argument.
parent c2052b27
...@@ -119,12 +119,10 @@ ...@@ -119,12 +119,10 @@
*/ */
/* /*
* sctp_protocol.c * sctp/protocol.c
*/ */
extern struct sctp_protocol sctp_proto;
extern struct sock *sctp_get_ctl_sock(void); extern struct sock *sctp_get_ctl_sock(void);
extern int sctp_copy_local_addr_list(struct sctp_protocol *, extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
struct sctp_bind_addr *,
sctp_scope_t, int gfp, int flags); sctp_scope_t, int gfp, int flags);
extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
extern int sctp_register_pf(struct sctp_pf *, sa_family_t); extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
...@@ -504,12 +502,6 @@ void sctp_put_port(struct sock *sk); ...@@ -504,12 +502,6 @@ void sctp_put_port(struct sock *sk);
/* Static inline functions. */ /* Static inline functions. */
/* Return the SCTP protocol structure. */
static inline struct sctp_protocol *sctp_get_protocol(void)
{
return &sctp_proto;
}
/* Convert from an IP version number to an Address Family symbol. */ /* Convert from an IP version number to an Address Family symbol. */
static inline int ipver2af(__u8 ipver) static inline int ipver2af(__u8 ipver)
{ {
...@@ -537,24 +529,21 @@ static inline int sctp_sanity_check(void) ...@@ -537,24 +529,21 @@ static inline int sctp_sanity_check(void)
/* This is the hash function for the SCTP port hash table. */ /* This is the hash function for the SCTP port hash table. */
static inline int sctp_phashfn(__u16 lport) static inline int sctp_phashfn(__u16 lport)
{ {
struct sctp_protocol *sctp_proto = sctp_get_protocol(); return (lport & (sctp_port_hashsize - 1));
return (lport & (sctp_proto->port_hashsize - 1));
} }
/* This is the hash function for the endpoint hash table. */ /* This is the hash function for the endpoint hash table. */
static inline int sctp_ep_hashfn(__u16 lport) static inline int sctp_ep_hashfn(__u16 lport)
{ {
struct sctp_protocol *sctp_proto = sctp_get_protocol(); return (lport & (sctp_ep_hashsize - 1));
return (lport & (sctp_proto->ep_hashsize - 1));
} }
/* This is the hash function for the association hash table. */ /* This is the hash function for the association hash table. */
static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport)
{ {
struct sctp_protocol *sctp_proto = sctp_get_protocol();
int h = (lport << 16) + rport; int h = (lport << 16) + rport;
h ^= h>>8; h ^= h>>8;
return (h & (sctp_proto->assoc_hashsize - 1)); return (h & (sctp_assoc_hashsize - 1));
} }
/* This is the hash function for the association hash table. This is /* This is the hash function for the association hash table. This is
...@@ -563,10 +552,9 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) ...@@ -563,10 +552,9 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport)
*/ */
static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag)
{ {
struct sctp_protocol *sctp_proto = sctp_get_protocol();
int h = (lport << 16) + rport; int h = (lport << 16) + rport;
h ^= vtag; h ^= vtag;
return (h & (sctp_proto->assoc_hashsize-1)); return (h & (sctp_assoc_hashsize-1));
} }
/* WARNING: Do not change the layout of the members in sctp_sock! */ /* WARNING: Do not change the layout of the members in sctp_sock! */
......
...@@ -71,7 +71,7 @@ union sctp_addr { ...@@ -71,7 +71,7 @@ union sctp_addr {
}; };
/* Forward declarations for data structures. */ /* Forward declarations for data structures. */
struct sctp_protocol; struct sctp_globals;
struct sctp_endpoint; struct sctp_endpoint;
struct sctp_association; struct sctp_association;
struct sctp_transport; struct sctp_transport;
...@@ -112,8 +112,8 @@ struct sctp_hashbucket { ...@@ -112,8 +112,8 @@ struct sctp_hashbucket {
} __attribute__((__aligned__(8))); } __attribute__((__aligned__(8)));
/* The SCTP protocol structure. */ /* The SCTP globals structure. */
struct sctp_protocol { extern struct sctp_globals {
/* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
* *
* The following protocol parameters are RECOMMENDED: * The following protocol parameters are RECOMMENDED:
...@@ -187,8 +187,33 @@ struct sctp_protocol { ...@@ -187,8 +187,33 @@ struct sctp_protocol {
*/ */
struct list_head local_addr_list; struct list_head local_addr_list;
spinlock_t local_addr_lock; spinlock_t local_addr_lock;
}; } sctp_globals;
#define sctp_rto_initial (sctp_globals.rto_initial)
#define sctp_rto_min (sctp_globals.rto_min)
#define sctp_rto_max (sctp_globals.rto_max)
#define sctp_rto_alpha (sctp_globals.rto_alpha)
#define sctp_rto_beta (sctp_globals.rto_beta)
#define sctp_max_burst (sctp_globals.max_burst)
#define sctp_valid_cookie_life (sctp_globals.valid_cookie_life)
#define sctp_cookie_preserve_enable (sctp_globals.cookie_preserve_enable)
#define sctp_max_retrans_association (sctp_globals.max_retrans_association)
#define sctp_max_retrans_path (sctp_globals.max_retrans_path)
#define sctp_max_retrans_init (sctp_globals.max_retrans_init)
#define sctp_hb_interval (sctp_globals.hb_interval)
#define sctp_max_instreams (sctp_globals.max_instreams)
#define sctp_max_outstreams (sctp_globals.max_outstreams)
#define sctp_address_families (sctp_globals.address_families)
#define sctp_ep_hashsize (sctp_globals.ep_hashsize)
#define sctp_ep_hashbucket (sctp_globals.ep_hashbucket)
#define sctp_assoc_hashsize (sctp_globals.assoc_hashsize)
#define sctp_assoc_hashbucket (sctp_globals.assoc_hashbucket)
#define sctp_port_hashsize (sctp_globals.port_hashsize)
#define sctp_port_rover (sctp_globals.port_rover)
#define sctp_port_alloc_lock (sctp_globals.port_alloc_lock)
#define sctp_port_hashtable (sctp_globals.port_hashtable)
#define sctp_local_addr_list (sctp_globals.local_addr_list)
#define sctp_local_addr_lock (sctp_globals.local_addr_lock)
/* /*
* Pointers to address related SCTP functions. * Pointers to address related SCTP functions.
......
...@@ -96,7 +96,6 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc, ...@@ -96,7 +96,6 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc,
int gfp) int gfp)
{ {
struct sctp_opt *sp; struct sctp_opt *sp;
struct sctp_protocol *proto = sctp_get_protocol();
int i; int i;
/* Retrieve the SCTP per socket area. */ /* Retrieve the SCTP per socket area. */
...@@ -129,18 +128,18 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc, ...@@ -129,18 +128,18 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc,
asoc->state_timestamp = jiffies; asoc->state_timestamp = jiffies;
/* Set things that have constant value. */ /* Set things that have constant value. */
asoc->cookie_life.tv_sec = sctp_proto.valid_cookie_life / HZ; asoc->cookie_life.tv_sec = sctp_valid_cookie_life / HZ;
asoc->cookie_life.tv_usec = (sctp_proto.valid_cookie_life % HZ) * asoc->cookie_life.tv_usec = (sctp_valid_cookie_life % HZ) *
1000000L / HZ; 1000000L / HZ;
asoc->pmtu = 0; asoc->pmtu = 0;
asoc->frag_point = 0; asoc->frag_point = 0;
/* Initialize the default association max_retrans and RTO values. */ /* Initialize the default association max_retrans and RTO values. */
asoc->max_retrans = proto->max_retrans_association; asoc->max_retrans = sctp_max_retrans_association;
asoc->rto_initial = proto->rto_initial; asoc->rto_initial = sctp_rto_initial;
asoc->rto_max = proto->rto_max; asoc->rto_max = sctp_rto_max;
asoc->rto_min = proto->rto_min; asoc->rto_min = sctp_rto_min;
asoc->overall_error_threshold = asoc->max_retrans; asoc->overall_error_threshold = asoc->max_retrans;
asoc->overall_error_count = 0; asoc->overall_error_count = 0;
...@@ -148,7 +147,7 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc, ...@@ -148,7 +147,7 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc,
/* Initialize the maximum mumber of new data packets that can be sent /* Initialize the maximum mumber of new data packets that can be sent
* in a burst. * in a burst.
*/ */
asoc->max_burst = proto->max_burst; asoc->max_burst = sctp_max_burst;
/* Copy things from the endpoint. */ /* Copy things from the endpoint. */
for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) { for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) {
......
...@@ -329,12 +329,10 @@ static int sctp_copy_one_addr(struct sctp_bind_addr *dest, ...@@ -329,12 +329,10 @@ static int sctp_copy_one_addr(struct sctp_bind_addr *dest,
union sctp_addr *addr, union sctp_addr *addr,
sctp_scope_t scope, int gfp, int flags) sctp_scope_t scope, int gfp, int flags)
{ {
struct sctp_protocol *proto = sctp_get_protocol();
int error = 0; int error = 0;
if (sctp_is_any(addr)) { if (sctp_is_any(addr)) {
error = sctp_copy_local_addr_list(proto, dest, scope, error = sctp_copy_local_addr_list(dest, scope, gfp, flags);
gfp, flags);
} else if (sctp_in_scope(addr, scope)) { } else if (sctp_in_scope(addr, scope)) {
/* Now that the address is in scope, check to see if /* Now that the address is in scope, check to see if
* the address type is supported by local sock as * the address type is supported by local sock as
......
...@@ -528,7 +528,7 @@ void __sctp_hash_endpoint(struct sctp_endpoint *ep) ...@@ -528,7 +528,7 @@ void __sctp_hash_endpoint(struct sctp_endpoint *ep)
epb = &ep->base; epb = &ep->base;
epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); epb->hashent = sctp_ep_hashfn(epb->bind_addr.port);
head = &sctp_proto.ep_hashbucket[epb->hashent]; head = &sctp_ep_hashbucket[epb->hashent];
sctp_write_lock(&head->lock); sctp_write_lock(&head->lock);
epp = &head->chain; epp = &head->chain;
...@@ -558,7 +558,7 @@ void __sctp_unhash_endpoint(struct sctp_endpoint *ep) ...@@ -558,7 +558,7 @@ void __sctp_unhash_endpoint(struct sctp_endpoint *ep)
epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); epb->hashent = sctp_ep_hashfn(epb->bind_addr.port);
head = &sctp_proto.ep_hashbucket[epb->hashent]; head = &sctp_ep_hashbucket[epb->hashent];
sctp_write_lock(&head->lock); sctp_write_lock(&head->lock);
...@@ -589,7 +589,7 @@ struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr) ...@@ -589,7 +589,7 @@ struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr)
int hash; int hash;
hash = sctp_ep_hashfn(laddr->v4.sin_port); hash = sctp_ep_hashfn(laddr->v4.sin_port);
head = &sctp_proto.ep_hashbucket[hash]; head = &sctp_ep_hashbucket[hash];
read_lock(&head->lock); read_lock(&head->lock);
for (epb = head->chain; epb; epb = epb->next) { for (epb = head->chain; epb; epb = epb->next) {
ep = sctp_ep(epb); ep = sctp_ep(epb);
...@@ -627,7 +627,7 @@ void __sctp_hash_established(struct sctp_association *asoc) ...@@ -627,7 +627,7 @@ void __sctp_hash_established(struct sctp_association *asoc)
/* Calculate which chain this entry will belong to. */ /* Calculate which chain this entry will belong to. */
epb->hashent = sctp_assoc_hashfn(epb->bind_addr.port, asoc->peer.port); epb->hashent = sctp_assoc_hashfn(epb->bind_addr.port, asoc->peer.port);
head = &sctp_proto.assoc_hashbucket[epb->hashent]; head = &sctp_assoc_hashbucket[epb->hashent];
sctp_write_lock(&head->lock); sctp_write_lock(&head->lock);
epp = &head->chain; epp = &head->chain;
...@@ -658,7 +658,7 @@ void __sctp_unhash_established(struct sctp_association *asoc) ...@@ -658,7 +658,7 @@ void __sctp_unhash_established(struct sctp_association *asoc)
epb->hashent = sctp_assoc_hashfn(epb->bind_addr.port, epb->hashent = sctp_assoc_hashfn(epb->bind_addr.port,
asoc->peer.port); asoc->peer.port);
head = &sctp_proto.assoc_hashbucket[epb->hashent]; head = &sctp_assoc_hashbucket[epb->hashent];
sctp_write_lock(&head->lock); sctp_write_lock(&head->lock);
...@@ -688,7 +688,7 @@ struct sctp_association *__sctp_lookup_association( ...@@ -688,7 +688,7 @@ struct sctp_association *__sctp_lookup_association(
* have wildcards anyways. * have wildcards anyways.
*/ */
hash = sctp_assoc_hashfn(local->v4.sin_port, peer->v4.sin_port); hash = sctp_assoc_hashfn(local->v4.sin_port, peer->v4.sin_port);
head = &sctp_proto.assoc_hashbucket[hash]; head = &sctp_assoc_hashbucket[hash];
read_lock(&head->lock); read_lock(&head->lock);
for (epb = head->chain; epb; epb = epb->next) { for (epb = head->chain; epb; epb = epb->next) {
asoc = sctp_assoc(epb); asoc = sctp_assoc(epb);
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#include <net/inet_ecn.h> #include <net/inet_ecn.h>
/* Global data structures. */ /* Global data structures. */
struct sctp_protocol sctp_proto; struct sctp_globals sctp_globals;
struct proc_dir_entry *proc_net_sctp; struct proc_dir_entry *proc_net_sctp;
DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics); DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
...@@ -158,7 +158,7 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist, ...@@ -158,7 +158,7 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
/* Extract our IP addresses from the system and stash them in the /* Extract our IP addresses from the system and stash them in the
* protocol structure. * protocol structure.
*/ */
static void __sctp_get_local_addr_list(struct sctp_protocol *proto) static void __sctp_get_local_addr_list(void)
{ {
struct net_device *dev; struct net_device *dev;
struct list_head *pos; struct list_head *pos;
...@@ -166,30 +166,30 @@ static void __sctp_get_local_addr_list(struct sctp_protocol *proto) ...@@ -166,30 +166,30 @@ static void __sctp_get_local_addr_list(struct sctp_protocol *proto)
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
for (dev = dev_base; dev; dev = dev->next) { for (dev = dev_base; dev; dev = dev->next) {
__list_for_each(pos, &proto->address_families) { __list_for_each(pos, &sctp_address_families) {
af = list_entry(pos, struct sctp_af, list); af = list_entry(pos, struct sctp_af, list);
af->copy_addrlist(&proto->local_addr_list, dev); af->copy_addrlist(&sctp_local_addr_list, dev);
} }
} }
read_unlock(&dev_base_lock); read_unlock(&dev_base_lock);
} }
static void sctp_get_local_addr_list(struct sctp_protocol *proto) static void sctp_get_local_addr_list(void)
{ {
unsigned long flags; unsigned long flags;
sctp_spin_lock_irqsave(&sctp_proto.local_addr_lock, flags); sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
__sctp_get_local_addr_list(&sctp_proto); __sctp_get_local_addr_list();
sctp_spin_unlock_irqrestore(&sctp_proto.local_addr_lock, flags); sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, flags);
} }
/* Free the existing local addresses. */ /* Free the existing local addresses. */
static void __sctp_free_local_addr_list(struct sctp_protocol *proto) static void __sctp_free_local_addr_list(void)
{ {
struct sockaddr_storage_list *addr; struct sockaddr_storage_list *addr;
struct list_head *pos, *temp; struct list_head *pos, *temp;
list_for_each_safe(pos, temp, &proto->local_addr_list) { list_for_each_safe(pos, temp, &sctp_local_addr_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list); addr = list_entry(pos, struct sockaddr_storage_list, list);
list_del(pos); list_del(pos);
kfree(addr); kfree(addr);
...@@ -197,18 +197,17 @@ static void __sctp_free_local_addr_list(struct sctp_protocol *proto) ...@@ -197,18 +197,17 @@ static void __sctp_free_local_addr_list(struct sctp_protocol *proto)
} }
/* Free the existing local addresses. */ /* Free the existing local addresses. */
static void sctp_free_local_addr_list(struct sctp_protocol *proto) static void sctp_free_local_addr_list(void)
{ {
unsigned long flags; unsigned long flags;
sctp_spin_lock_irqsave(&proto->local_addr_lock, flags); sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
__sctp_free_local_addr_list(proto); __sctp_free_local_addr_list();
sctp_spin_unlock_irqrestore(&proto->local_addr_lock, flags); sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, flags);
} }
/* Copy the local addresses which are valid for 'scope' into 'bp'. */ /* Copy the local addresses which are valid for 'scope' into 'bp'. */
int sctp_copy_local_addr_list(struct sctp_protocol *proto, int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope,
struct sctp_bind_addr *bp, sctp_scope_t scope,
int gfp, int copy_flags) int gfp, int copy_flags)
{ {
struct sockaddr_storage_list *addr; struct sockaddr_storage_list *addr;
...@@ -216,8 +215,8 @@ int sctp_copy_local_addr_list(struct sctp_protocol *proto, ...@@ -216,8 +215,8 @@ int sctp_copy_local_addr_list(struct sctp_protocol *proto,
struct list_head *pos; struct list_head *pos;
unsigned long flags; unsigned long flags;
sctp_spin_lock_irqsave(&proto->local_addr_lock, flags); sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
list_for_each(pos, &proto->local_addr_list) { list_for_each(pos, &sctp_local_addr_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list); addr = list_entry(pos, struct sockaddr_storage_list, list);
if (sctp_in_scope(&addr->a, scope)) { if (sctp_in_scope(&addr->a, scope)) {
/* Now that the address is in scope, check to see if /* Now that the address is in scope, check to see if
...@@ -238,7 +237,7 @@ int sctp_copy_local_addr_list(struct sctp_protocol *proto, ...@@ -238,7 +237,7 @@ int sctp_copy_local_addr_list(struct sctp_protocol *proto,
} }
end_copy: end_copy:
sctp_spin_unlock_irqrestore(&proto->local_addr_lock, flags); sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, flags);
return error; return error;
} }
...@@ -577,10 +576,10 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, ...@@ -577,10 +576,10 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
{ {
unsigned long flags; unsigned long flags;
sctp_spin_lock_irqsave(&sctp_proto.local_addr_lock, flags); sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
__sctp_free_local_addr_list(&sctp_proto); __sctp_free_local_addr_list();
__sctp_get_local_addr_list(&sctp_proto); __sctp_get_local_addr_list();
sctp_spin_unlock_irqrestore(&sctp_proto.local_addr_lock, flags); sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, flags);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
...@@ -631,7 +630,7 @@ int sctp_register_af(struct sctp_af *af) ...@@ -631,7 +630,7 @@ int sctp_register_af(struct sctp_af *af)
} }
INIT_LIST_HEAD(&af->list); INIT_LIST_HEAD(&af->list);
list_add_tail(&af->list, &sctp_proto.address_families); list_add_tail(&af->list, &sctp_address_families);
return 1; return 1;
} }
...@@ -967,91 +966,91 @@ __init int sctp_init(void) ...@@ -967,91 +966,91 @@ __init int sctp_init(void)
*/ */
/* The following protocol parameters are RECOMMENDED: */ /* The following protocol parameters are RECOMMENDED: */
/* RTO.Initial - 3 seconds */ /* RTO.Initial - 3 seconds */
sctp_proto.rto_initial = SCTP_RTO_INITIAL; sctp_rto_initial = SCTP_RTO_INITIAL;
/* RTO.Min - 1 second */ /* RTO.Min - 1 second */
sctp_proto.rto_min = SCTP_RTO_MIN; sctp_rto_min = SCTP_RTO_MIN;
/* RTO.Max - 60 seconds */ /* RTO.Max - 60 seconds */
sctp_proto.rto_max = SCTP_RTO_MAX; sctp_rto_max = SCTP_RTO_MAX;
/* RTO.Alpha - 1/8 */ /* RTO.Alpha - 1/8 */
sctp_proto.rto_alpha = SCTP_RTO_ALPHA; sctp_rto_alpha = SCTP_RTO_ALPHA;
/* RTO.Beta - 1/4 */ /* RTO.Beta - 1/4 */
sctp_proto.rto_beta = SCTP_RTO_BETA; sctp_rto_beta = SCTP_RTO_BETA;
/* Valid.Cookie.Life - 60 seconds */ /* Valid.Cookie.Life - 60 seconds */
sctp_proto.valid_cookie_life = 60 * HZ; sctp_valid_cookie_life = 60 * HZ;
/* Whether Cookie Preservative is enabled(1) or not(0) */ /* Whether Cookie Preservative is enabled(1) or not(0) */
sctp_proto.cookie_preserve_enable = 1; sctp_cookie_preserve_enable = 1;
/* Max.Burst - 4 */ /* Max.Burst - 4 */
sctp_proto.max_burst = SCTP_MAX_BURST; sctp_max_burst = SCTP_MAX_BURST;
/* Association.Max.Retrans - 10 attempts /* Association.Max.Retrans - 10 attempts
* Path.Max.Retrans - 5 attempts (per destination address) * Path.Max.Retrans - 5 attempts (per destination address)
* Max.Init.Retransmits - 8 attempts * Max.Init.Retransmits - 8 attempts
*/ */
sctp_proto.max_retrans_association = 10; sctp_max_retrans_association = 10;
sctp_proto.max_retrans_path = 5; sctp_max_retrans_path = 5;
sctp_proto.max_retrans_init = 8; sctp_max_retrans_init = 8;
/* HB.interval - 30 seconds */ /* HB.interval - 30 seconds */
sctp_proto.hb_interval = 30 * HZ; sctp_hb_interval = 30 * HZ;
/* Implementation specific variables. */ /* Implementation specific variables. */
/* Initialize default stream count setup information. */ /* Initialize default stream count setup information. */
sctp_proto.max_instreams = SCTP_DEFAULT_INSTREAMS; sctp_max_instreams = SCTP_DEFAULT_INSTREAMS;
sctp_proto.max_outstreams = SCTP_DEFAULT_OUTSTREAMS; sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS;
/* Allocate and initialize the association hash table. */ /* Allocate and initialize the association hash table. */
sctp_proto.assoc_hashsize = 4096; sctp_assoc_hashsize = 4096;
sctp_proto.assoc_hashbucket = (struct sctp_hashbucket *) sctp_assoc_hashbucket = (struct sctp_hashbucket *)
kmalloc(4096 * sizeof(struct sctp_hashbucket), GFP_KERNEL); kmalloc(4096 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
if (!sctp_proto.assoc_hashbucket) { if (!sctp_assoc_hashbucket) {
printk(KERN_ERR "SCTP: Failed association hash alloc.\n"); printk(KERN_ERR "SCTP: Failed association hash alloc.\n");
status = -ENOMEM; status = -ENOMEM;
goto err_ahash_alloc; goto err_ahash_alloc;
} }
for (i = 0; i < sctp_proto.assoc_hashsize; i++) { for (i = 0; i < sctp_assoc_hashsize; i++) {
sctp_proto.assoc_hashbucket[i].lock = RW_LOCK_UNLOCKED; sctp_assoc_hashbucket[i].lock = RW_LOCK_UNLOCKED;
sctp_proto.assoc_hashbucket[i].chain = NULL; sctp_assoc_hashbucket[i].chain = NULL;
} }
/* Allocate and initialize the endpoint hash table. */ /* Allocate and initialize the endpoint hash table. */
sctp_proto.ep_hashsize = 64; sctp_ep_hashsize = 64;
sctp_proto.ep_hashbucket = (struct sctp_hashbucket *) sctp_ep_hashbucket = (struct sctp_hashbucket *)
kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL); kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
if (!sctp_proto.ep_hashbucket) { if (!sctp_ep_hashbucket) {
printk(KERN_ERR "SCTP: Failed endpoint_hash alloc.\n"); printk(KERN_ERR "SCTP: Failed endpoint_hash alloc.\n");
status = -ENOMEM; status = -ENOMEM;
goto err_ehash_alloc; goto err_ehash_alloc;
} }
for (i = 0; i < sctp_proto.ep_hashsize; i++) { for (i = 0; i < sctp_ep_hashsize; i++) {
sctp_proto.ep_hashbucket[i].lock = RW_LOCK_UNLOCKED; sctp_ep_hashbucket[i].lock = RW_LOCK_UNLOCKED;
sctp_proto.ep_hashbucket[i].chain = NULL; sctp_ep_hashbucket[i].chain = NULL;
} }
/* Allocate and initialize the SCTP port hash table. */ /* Allocate and initialize the SCTP port hash table. */
sctp_proto.port_hashsize = 4096; sctp_port_hashsize = 4096;
sctp_proto.port_hashtable = (struct sctp_bind_hashbucket *) sctp_port_hashtable = (struct sctp_bind_hashbucket *)
kmalloc(4096 * sizeof(struct sctp_bind_hashbucket),GFP_KERNEL); kmalloc(4096 * sizeof(struct sctp_bind_hashbucket),GFP_KERNEL);
if (!sctp_proto.port_hashtable) { if (!sctp_port_hashtable) {
printk(KERN_ERR "SCTP: Failed bind hash alloc."); printk(KERN_ERR "SCTP: Failed bind hash alloc.");
status = -ENOMEM; status = -ENOMEM;
goto err_bhash_alloc; goto err_bhash_alloc;
} }
sctp_proto.port_alloc_lock = SPIN_LOCK_UNLOCKED; sctp_port_alloc_lock = SPIN_LOCK_UNLOCKED;
sctp_proto.port_rover = sysctl_local_port_range[0] - 1; sctp_port_rover = sysctl_local_port_range[0] - 1;
for (i = 0; i < sctp_proto.port_hashsize; i++) { for (i = 0; i < sctp_port_hashsize; i++) {
sctp_proto.port_hashtable[i].lock = SPIN_LOCK_UNLOCKED; sctp_port_hashtable[i].lock = SPIN_LOCK_UNLOCKED;
sctp_proto.port_hashtable[i].chain = NULL; sctp_port_hashtable[i].chain = NULL;
} }
sctp_sysctl_register(); sctp_sysctl_register();
INIT_LIST_HEAD(&sctp_proto.address_families); INIT_LIST_HEAD(&sctp_address_families);
sctp_register_af(&sctp_ipv4_specific); sctp_register_af(&sctp_ipv4_specific);
status = sctp_v6_init(); status = sctp_v6_init();
...@@ -1066,13 +1065,13 @@ __init int sctp_init(void) ...@@ -1066,13 +1065,13 @@ __init int sctp_init(void)
} }
/* Initialize the local address list. */ /* Initialize the local address list. */
INIT_LIST_HEAD(&sctp_proto.local_addr_list); INIT_LIST_HEAD(&sctp_local_addr_list);
sctp_proto.local_addr_lock = SPIN_LOCK_UNLOCKED; sctp_local_addr_lock = SPIN_LOCK_UNLOCKED;
/* Register notifier for inet address additions/deletions. */ /* Register notifier for inet address additions/deletions. */
register_inetaddr_notifier(&sctp_inetaddr_notifier); register_inetaddr_notifier(&sctp_inetaddr_notifier);
sctp_get_local_addr_list(&sctp_proto); sctp_get_local_addr_list();
__unsafe(THIS_MODULE); __unsafe(THIS_MODULE);
return 0; return 0;
...@@ -1082,11 +1081,11 @@ __init int sctp_init(void) ...@@ -1082,11 +1081,11 @@ __init int sctp_init(void)
err_v6_init: err_v6_init:
sctp_sysctl_unregister(); sctp_sysctl_unregister();
list_del(&sctp_ipv4_specific.list); list_del(&sctp_ipv4_specific.list);
kfree(sctp_proto.port_hashtable); kfree(sctp_port_hashtable);
err_bhash_alloc: err_bhash_alloc:
kfree(sctp_proto.ep_hashbucket); kfree(sctp_ep_hashbucket);
err_ehash_alloc: err_ehash_alloc:
kfree(sctp_proto.assoc_hashbucket); kfree(sctp_assoc_hashbucket);
err_ahash_alloc: err_ahash_alloc:
sctp_dbg_objcnt_exit(); sctp_dbg_objcnt_exit();
sctp_proc_exit(); sctp_proc_exit();
...@@ -1113,7 +1112,7 @@ __exit void sctp_exit(void) ...@@ -1113,7 +1112,7 @@ __exit void sctp_exit(void)
unregister_inetaddr_notifier(&sctp_inetaddr_notifier); unregister_inetaddr_notifier(&sctp_inetaddr_notifier);
/* Free the local address list. */ /* Free the local address list. */
sctp_free_local_addr_list(&sctp_proto); sctp_free_local_addr_list();
/* Free the control endpoint. */ /* Free the control endpoint. */
sock_release(sctp_ctl_socket); sock_release(sctp_ctl_socket);
...@@ -1122,9 +1121,9 @@ __exit void sctp_exit(void) ...@@ -1122,9 +1121,9 @@ __exit void sctp_exit(void)
sctp_sysctl_unregister(); sctp_sysctl_unregister();
list_del(&sctp_ipv4_specific.list); list_del(&sctp_ipv4_specific.list);
kfree(sctp_proto.assoc_hashbucket); kfree(sctp_assoc_hashbucket);
kfree(sctp_proto.ep_hashbucket); kfree(sctp_ep_hashbucket);
kfree(sctp_proto.port_hashtable); kfree(sctp_port_hashtable);
kmem_cache_destroy(sctp_chunk_cachep); kmem_cache_destroy(sctp_chunk_cachep);
kmem_cache_destroy(sctp_bucket_cachep); kmem_cache_destroy(sctp_bucket_cachep);
......
...@@ -1909,7 +1909,7 @@ int sctp_process_param(struct sctp_association *asoc, union sctp_params param, ...@@ -1909,7 +1909,7 @@ int sctp_process_param(struct sctp_association *asoc, union sctp_params param,
break; break;
case SCTP_PARAM_COOKIE_PRESERVATIVE: case SCTP_PARAM_COOKIE_PRESERVATIVE:
if (!sctp_proto.cookie_preserve_enable) if (!sctp_cookie_preserve_enable)
break; break;
stale = ntohl(param.life->lifespan_increment); stale = ntohl(param.life->lifespan_increment);
......
...@@ -1992,13 +1992,10 @@ SCTP_STATIC int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -1992,13 +1992,10 @@ SCTP_STATIC int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
SCTP_STATIC int sctp_init_sock(struct sock *sk) SCTP_STATIC int sctp_init_sock(struct sock *sk)
{ {
struct sctp_endpoint *ep; struct sctp_endpoint *ep;
struct sctp_protocol *proto;
struct sctp_opt *sp; struct sctp_opt *sp;
SCTP_DEBUG_PRINTK("sctp_init_sock(sk: %p)\n", sk); SCTP_DEBUG_PRINTK("sctp_init_sock(sk: %p)\n", sk);
proto = sctp_get_protocol();
sp = sctp_sk(sk); sp = sctp_sk(sk);
/* Initialize the SCTP per socket area. */ /* Initialize the SCTP per socket area. */
...@@ -2027,18 +2024,18 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) ...@@ -2027,18 +2024,18 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
* can be modified with the SCTP_INITMSG socket option or * can be modified with the SCTP_INITMSG socket option or
* overridden by the SCTP_INIT CMSG. * overridden by the SCTP_INIT CMSG.
*/ */
sp->initmsg.sinit_num_ostreams = proto->max_outstreams; sp->initmsg.sinit_num_ostreams = sctp_max_outstreams;
sp->initmsg.sinit_max_instreams = proto->max_instreams; sp->initmsg.sinit_max_instreams = sctp_max_instreams;
sp->initmsg.sinit_max_attempts = proto->max_retrans_init; sp->initmsg.sinit_max_attempts = sctp_max_retrans_init;
sp->initmsg.sinit_max_init_timeo = proto->rto_max / HZ; sp->initmsg.sinit_max_init_timeo = sctp_rto_max / HZ;
/* Initialize default RTO related parameters. These parameters can /* Initialize default RTO related parameters. These parameters can
* be modified for with the SCTP_RTOINFO socket option. * be modified for with the SCTP_RTOINFO socket option.
* FIXME: These are not used yet. * FIXME: These are not used yet.
*/ */
sp->rtoinfo.srto_initial = proto->rto_initial; sp->rtoinfo.srto_initial = sctp_rto_initial;
sp->rtoinfo.srto_max = proto->rto_max; sp->rtoinfo.srto_max = sctp_rto_max;
sp->rtoinfo.srto_min = proto->rto_min; sp->rtoinfo.srto_min = sctp_rto_min;
/* Initialize default event subscriptions. /* Initialize default event subscriptions.
* the struct sock is initialized to zero, so only * the struct sock is initialized to zero, so only
...@@ -2053,8 +2050,8 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) ...@@ -2053,8 +2050,8 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
/* Default Peer Address Parameters. These defaults can /* Default Peer Address Parameters. These defaults can
* be modified via SCTP_SET_PEER_ADDR_PARAMS * be modified via SCTP_SET_PEER_ADDR_PARAMS
*/ */
sp->paddrparam.spp_hbinterval = proto->hb_interval / HZ; sp->paddrparam.spp_hbinterval = sctp_hb_interval / HZ;
sp->paddrparam.spp_pathmaxrxt = proto->max_retrans_path; sp->paddrparam.spp_pathmaxrxt = sctp_max_retrans_path;
/* If enabled no SCTP message fragmentation will be performed. /* If enabled no SCTP message fragmentation will be performed.
* Configure through SCTP_DISABLE_FRAGMENTS socket option. * Configure through SCTP_DISABLE_FRAGMENTS socket option.
...@@ -2947,7 +2944,6 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) ...@@ -2947,7 +2944,6 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
{ {
struct sctp_bind_hashbucket *head; /* hash list */ struct sctp_bind_hashbucket *head; /* hash list */
struct sctp_bind_bucket *pp; /* hash list port iterator */ struct sctp_bind_bucket *pp; /* hash list port iterator */
struct sctp_protocol *sctp = sctp_get_protocol();
unsigned short snum; unsigned short snum;
int ret; int ret;
...@@ -2962,8 +2958,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) ...@@ -2962,8 +2958,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
if (snum == 0) { if (snum == 0) {
/* Search for an available port. /* Search for an available port.
* *
* 'sctp->port_rover' was the last port assigned, so * 'sctp_port_rover' was the last port assigned, so
* we start to search from 'sctp->port_rover + * we start to search from 'sctp_port_rover +
* 1'. What we do is first check if port 'rover' is * 1'. What we do is first check if port 'rover' is
* already in the hash table; if not, we use that; if * already in the hash table; if not, we use that; if
* it is, we try next. * it is, we try next.
...@@ -2974,14 +2970,14 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) ...@@ -2974,14 +2970,14 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
int rover; int rover;
int index; int index;
sctp_spin_lock(&sctp->port_alloc_lock); sctp_spin_lock(&sctp_port_alloc_lock);
rover = sctp->port_rover; rover = sctp_port_rover;
do { do {
rover++; rover++;
if ((rover < low) || (rover > high)) if ((rover < low) || (rover > high))
rover = low; rover = low;
index = sctp_phashfn(rover); index = sctp_phashfn(rover);
head = &sctp->port_hashtable[index]; head = &sctp_port_hashtable[index];
sctp_spin_lock(&head->lock); sctp_spin_lock(&head->lock);
for (pp = head->chain; pp; pp = pp->next) for (pp = head->chain; pp; pp = pp->next)
if (pp->port == rover) if (pp->port == rover)
...@@ -2990,8 +2986,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) ...@@ -2990,8 +2986,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
next: next:
sctp_spin_unlock(&head->lock); sctp_spin_unlock(&head->lock);
} while (--remaining > 0); } while (--remaining > 0);
sctp->port_rover = rover; sctp_port_rover = rover;
sctp_spin_unlock(&sctp->port_alloc_lock); sctp_spin_unlock(&sctp_port_alloc_lock);
/* Exhausted local port range during search? */ /* Exhausted local port range during search? */
ret = 1; ret = 1;
...@@ -3011,7 +3007,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) ...@@ -3011,7 +3007,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
* to the port number (snum) - we detect that with the * to the port number (snum) - we detect that with the
* port iterator, pp being NULL. * port iterator, pp being NULL.
*/ */
head = &sctp->port_hashtable[sctp_phashfn(snum)]; head = &sctp_port_hashtable[sctp_phashfn(snum)];
sctp_spin_lock(&head->lock); sctp_spin_lock(&head->lock);
for (pp = head->chain; pp; pp = pp->next) { for (pp = head->chain; pp; pp = pp->next) {
if (pp->port == snum) if (pp->port == snum)
...@@ -3351,9 +3347,8 @@ static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) ...@@ -3351,9 +3347,8 @@ static void sctp_bucket_destroy(struct sctp_bind_bucket *pp)
/* FIXME: Comments! */ /* FIXME: Comments! */
static __inline__ void __sctp_put_port(struct sock *sk) static __inline__ void __sctp_put_port(struct sock *sk)
{ {
struct sctp_protocol *sctp_proto = sctp_get_protocol();
struct sctp_bind_hashbucket *head = struct sctp_bind_hashbucket *head =
&sctp_proto->port_hashtable[sctp_phashfn(inet_sk(sk)->num)]; &sctp_port_hashtable[sctp_phashfn(inet_sk(sk)->num)];
struct sctp_bind_bucket *pp; struct sctp_bind_bucket *pp;
sctp_spin_lock(&head->lock); sctp_spin_lock(&head->lock);
......
...@@ -42,13 +42,11 @@ ...@@ -42,13 +42,11 @@
#include <net/sctp/structs.h> #include <net/sctp/structs.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
extern struct sctp_protocol sctp_proto;
static ctl_table sctp_table[] = { static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_RTO_INITIAL, .ctl_name = NET_SCTP_RTO_INITIAL,
.procname = "rto_initial", .procname = "rto_initial",
.data = &sctp_proto.rto_initial, .data = &sctp_rto_initial,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
...@@ -57,7 +55,7 @@ static ctl_table sctp_table[] = { ...@@ -57,7 +55,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_RTO_MIN, .ctl_name = NET_SCTP_RTO_MIN,
.procname = "rto_min", .procname = "rto_min",
.data = &sctp_proto.rto_min, .data = &sctp_rto_min,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
...@@ -66,7 +64,7 @@ static ctl_table sctp_table[] = { ...@@ -66,7 +64,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_RTO_MAX, .ctl_name = NET_SCTP_RTO_MAX,
.procname = "rto_max", .procname = "rto_max",
.data = &sctp_proto.rto_max, .data = &sctp_rto_max,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
...@@ -75,7 +73,7 @@ static ctl_table sctp_table[] = { ...@@ -75,7 +73,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_VALID_COOKIE_LIFE, .ctl_name = NET_SCTP_VALID_COOKIE_LIFE,
.procname = "valid_cookie_life", .procname = "valid_cookie_life",
.data = &sctp_proto.valid_cookie_life, .data = &sctp_valid_cookie_life,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
...@@ -84,7 +82,7 @@ static ctl_table sctp_table[] = { ...@@ -84,7 +82,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_MAX_BURST, .ctl_name = NET_SCTP_MAX_BURST,
.procname = "max_burst", .procname = "max_burst",
.data = &sctp_proto.max_burst, .data = &sctp_max_burst,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
...@@ -92,7 +90,7 @@ static ctl_table sctp_table[] = { ...@@ -92,7 +90,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS, .ctl_name = NET_SCTP_ASSOCIATION_MAX_RETRANS,
.procname = "association_max_retrans", .procname = "association_max_retrans",
.data = &sctp_proto.max_retrans_association, .data = &sctp_max_retrans_association,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
...@@ -100,7 +98,7 @@ static ctl_table sctp_table[] = { ...@@ -100,7 +98,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_PATH_MAX_RETRANS, .ctl_name = NET_SCTP_PATH_MAX_RETRANS,
.procname = "path_max_retrans", .procname = "path_max_retrans",
.data = &sctp_proto.max_retrans_path, .data = &sctp_max_retrans_path,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
...@@ -108,7 +106,7 @@ static ctl_table sctp_table[] = { ...@@ -108,7 +106,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS, .ctl_name = NET_SCTP_MAX_INIT_RETRANSMITS,
.procname = "max_init_retransmits", .procname = "max_init_retransmits",
.data = &sctp_proto.max_retrans_init, .data = &sctp_max_retrans_init,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
...@@ -116,7 +114,7 @@ static ctl_table sctp_table[] = { ...@@ -116,7 +114,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_HB_INTERVAL, .ctl_name = NET_SCTP_HB_INTERVAL,
.procname = "hb_interval", .procname = "hb_interval",
.data = &sctp_proto.hb_interval, .data = &sctp_hb_interval,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
...@@ -125,7 +123,7 @@ static ctl_table sctp_table[] = { ...@@ -125,7 +123,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_PRESERVE_ENABLE, .ctl_name = NET_SCTP_PRESERVE_ENABLE,
.procname = "cookie_preserve_enable", .procname = "cookie_preserve_enable",
.data = &sctp_proto.cookie_preserve_enable, .data = &sctp_cookie_preserve_enable,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
...@@ -134,7 +132,7 @@ static ctl_table sctp_table[] = { ...@@ -134,7 +132,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_RTO_ALPHA, .ctl_name = NET_SCTP_RTO_ALPHA,
.procname = "rto_alpha_exp_divisor", .procname = "rto_alpha_exp_divisor",
.data = &sctp_proto.rto_alpha, .data = &sctp_rto_alpha,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
...@@ -142,7 +140,7 @@ static ctl_table sctp_table[] = { ...@@ -142,7 +140,7 @@ static ctl_table sctp_table[] = {
{ {
.ctl_name = NET_SCTP_RTO_BETA, .ctl_name = NET_SCTP_RTO_BETA,
.procname = "rto_beta_exp_divisor", .procname = "rto_beta_exp_divisor",
.data = &sctp_proto.rto_beta, .data = &sctp_rto_beta,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
......
...@@ -82,8 +82,6 @@ struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, ...@@ -82,8 +82,6 @@ struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
const union sctp_addr *addr, const union sctp_addr *addr,
int gfp) int gfp)
{ {
struct sctp_protocol *proto = sctp_get_protocol();
/* Copy in the address. */ /* Copy in the address. */
peer->ipaddr = *addr; peer->ipaddr = *addr;
peer->af_specific = sctp_get_af_specific(addr->sa.sa_family); peer->af_specific = sctp_get_af_specific(addr->sa.sa_family);
...@@ -99,7 +97,7 @@ struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, ...@@ -99,7 +97,7 @@ struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
* parameter 'RTO.Initial'. * parameter 'RTO.Initial'.
*/ */
peer->rtt = 0; peer->rtt = 0;
peer->rto = proto->rto_initial; peer->rto = sctp_rto_initial;
peer->rttvar = 0; peer->rttvar = 0;
peer->srtt = 0; peer->srtt = 0;
peer->rto_pending = 0; peer->rto_pending = 0;
...@@ -112,7 +110,7 @@ struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, ...@@ -112,7 +110,7 @@ struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
peer->hb_allowed = 0; peer->hb_allowed = 0;
/* Initialize the default path max_retrans. */ /* Initialize the default path max_retrans. */
peer->max_retrans = proto->max_retrans_path; peer->max_retrans = sctp_max_retrans_path;
peer->error_threshold = 0; peer->error_threshold = 0;
peer->error_count = 0; peer->error_count = 0;
...@@ -272,8 +270,6 @@ void sctp_transport_put(struct sctp_transport *transport) ...@@ -272,8 +270,6 @@ void sctp_transport_put(struct sctp_transport *transport)
/* Update transport's RTO based on the newly calculated RTT. */ /* Update transport's RTO based on the newly calculated RTT. */
void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
{ {
struct sctp_protocol *proto = sctp_get_protocol();
/* Check for valid transport. */ /* Check for valid transport. */
SCTP_ASSERT(tp, "NULL transport", return); SCTP_ASSERT(tp, "NULL transport", return);
...@@ -292,10 +288,10 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) ...@@ -292,10 +288,10 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
* For example, assuming the default value of RTO.Alpha of * For example, assuming the default value of RTO.Alpha of
* 1/8, rto_alpha would be expressed as 3. * 1/8, rto_alpha would be expressed as 3.
*/ */
tp->rttvar = tp->rttvar - (tp->rttvar >> proto->rto_beta) tp->rttvar = tp->rttvar - (tp->rttvar >> sctp_rto_beta)
+ ((abs(tp->srtt - rtt)) >> proto->rto_beta); + ((abs(tp->srtt - rtt)) >> sctp_rto_beta);
tp->srtt = tp->srtt - (tp->srtt >> proto->rto_alpha) tp->srtt = tp->srtt - (tp->srtt >> sctp_rto_alpha)
+ (rtt >> proto->rto_alpha); + (rtt >> sctp_rto_alpha);
} else { } else {
/* 6.3.1 C2) When the first RTT measurement R is made, set /* 6.3.1 C2) When the first RTT measurement R is made, set
* SRTT <- R, RTTVAR <- R/2. * SRTT <- R, RTTVAR <- R/2.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment