Commit 030ce1c7 authored by Jon Grimm's avatar Jon Grimm

Merge

parents 3c1ef96d b5c1e5fd
...@@ -73,7 +73,8 @@ typedef enum { ...@@ -73,7 +73,8 @@ typedef enum {
SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ SCTP_CMD_STRIKE, /* Mark a strike against a transport. */
SCTP_CMD_TRANSMIT, /* Transmit the outqueue. */ SCTP_CMD_TRANSMIT, /* Transmit the outqueue. */
SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
SCTP_CMD_HB_TIMERS_UPDATE, /* Update the heartbeat timers. */ SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */
SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */
SCTP_CMD_TRANSPORT_RESET, /* Reset the status of a transport. */ SCTP_CMD_TRANSPORT_RESET, /* Reset the status of a transport. */
SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */ SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */
SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */ SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */
...@@ -112,7 +113,7 @@ typedef union { ...@@ -112,7 +113,7 @@ typedef union {
void *ptr; void *ptr;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
sctp_association_t *asoc; sctp_association_t *asoc;
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_bind_addr_t *bp; sctp_bind_addr_t *bp;
sctp_init_chunk_t *init; sctp_init_chunk_t *init;
sctp_ulpevent_t *ulpevent; sctp_ulpevent_t *ulpevent;
...@@ -160,7 +161,7 @@ SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) ...@@ -160,7 +161,7 @@ SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
SCTP_ARG_CONSTRUCTOR(CHUNK, sctp_chunk_t *, chunk) SCTP_ARG_CONSTRUCTOR(CHUNK, sctp_chunk_t *, chunk)
SCTP_ARG_CONSTRUCTOR(ASOC, sctp_association_t *, asoc) SCTP_ARG_CONSTRUCTOR(ASOC, sctp_association_t *, asoc)
SCTP_ARG_CONSTRUCTOR(TRANSPORT, sctp_transport_t *, transport) SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport)
SCTP_ARG_CONSTRUCTOR(BA, sctp_bind_addr_t *, bp) SCTP_ARG_CONSTRUCTOR(BA, sctp_bind_addr_t *, bp)
SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init) SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init)
SCTP_ARG_CONSTRUCTOR(ULPEVENT, sctp_ulpevent_t *, ulpevent) SCTP_ARG_CONSTRUCTOR(ULPEVENT, sctp_ulpevent_t *, ulpevent)
......
...@@ -256,7 +256,7 @@ sctp_chunk_t *sctp_make_abort_user(const sctp_association_t *, ...@@ -256,7 +256,7 @@ sctp_chunk_t *sctp_make_abort_user(const sctp_association_t *,
const sctp_chunk_t *, const sctp_chunk_t *,
const struct msghdr *); const struct msghdr *);
sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *, sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *,
const sctp_transport_t *, const struct sctp_transport *,
const void *payload, const void *payload,
const size_t paylen); const size_t paylen);
sctp_chunk_t *sctp_make_heartbeat_ack(const sctp_association_t *, sctp_chunk_t *sctp_make_heartbeat_ack(const sctp_association_t *,
......
...@@ -107,7 +107,7 @@ union sctp_addr { ...@@ -107,7 +107,7 @@ union sctp_addr {
struct sctp_protocol; struct sctp_protocol;
struct SCTP_endpoint; struct SCTP_endpoint;
struct SCTP_association; struct SCTP_association;
struct SCTP_transport; struct sctp_transport;
struct SCTP_packet; struct SCTP_packet;
struct SCTP_chunk; struct SCTP_chunk;
struct SCTP_inqueue; struct SCTP_inqueue;
...@@ -121,7 +121,6 @@ struct sctp_ssnmap; ...@@ -121,7 +121,6 @@ struct sctp_ssnmap;
typedef struct sctp_protocol sctp_protocol_t; typedef struct sctp_protocol sctp_protocol_t;
typedef struct SCTP_endpoint sctp_endpoint_t; typedef struct SCTP_endpoint sctp_endpoint_t;
typedef struct SCTP_association sctp_association_t; typedef struct SCTP_association sctp_association_t;
typedef struct SCTP_transport sctp_transport_t;
typedef struct SCTP_packet sctp_packet_t; typedef struct SCTP_packet sctp_packet_t;
typedef struct SCTP_chunk sctp_chunk_t; typedef struct SCTP_chunk sctp_chunk_t;
typedef struct SCTP_inqueue sctp_inqueue_t; typedef struct SCTP_inqueue sctp_inqueue_t;
...@@ -561,7 +560,7 @@ struct SCTP_chunk { ...@@ -561,7 +560,7 @@ struct SCTP_chunk {
* For an outbound chunk, it tells us where we'd like it to * For an outbound chunk, it tells us where we'd like it to
* go. It is NULL if we have no preference. * go. It is NULL if we have no preference.
*/ */
sctp_transport_t *transport; struct sctp_transport *transport;
}; };
sctp_chunk_t *sctp_make_chunk(const sctp_association_t *, __u8 type, sctp_chunk_t *sctp_make_chunk(const sctp_association_t *, __u8 type,
...@@ -605,7 +604,7 @@ struct SCTP_packet { ...@@ -605,7 +604,7 @@ struct SCTP_packet {
* The function we finally use to pass down to the next lower * The function we finally use to pass down to the next lower
* layer lives in the transport structure. * layer lives in the transport structure.
*/ */
sctp_transport_t *transport; struct sctp_transport *transport;
/* Allow a callback for getting a high priority chunk /* Allow a callback for getting a high priority chunk
* bundled early into the packet (This is used for ECNE). * bundled early into the packet (This is used for ECNE).
...@@ -630,7 +629,7 @@ typedef int (sctp_outq_thandler_t)(struct sctp_outq *, void *); ...@@ -630,7 +629,7 @@ typedef int (sctp_outq_thandler_t)(struct sctp_outq *, void *);
typedef int (sctp_outq_ehandler_t)(struct sctp_outq *); typedef int (sctp_outq_ehandler_t)(struct sctp_outq *);
typedef sctp_packet_t *(sctp_outq_ohandler_init_t) typedef sctp_packet_t *(sctp_outq_ohandler_init_t)
(sctp_packet_t *, (sctp_packet_t *,
sctp_transport_t *, struct sctp_transport *,
__u16 sport, __u16 sport,
__u16 dport); __u16 dport);
typedef sctp_packet_t *(sctp_outq_ohandler_config_t) typedef sctp_packet_t *(sctp_outq_ohandler_config_t)
...@@ -670,7 +669,7 @@ void sctp_packet_free(sctp_packet_t *); ...@@ -670,7 +669,7 @@ void sctp_packet_free(sctp_packet_t *);
* period. * period.
* *
*/ */
struct SCTP_transport { struct sctp_transport {
/* A list of transports. */ /* A list of transports. */
struct list_head transports; struct list_head transports;
...@@ -819,24 +818,25 @@ struct SCTP_transport { ...@@ -819,24 +818,25 @@ struct SCTP_transport {
int malloced; /* Is this structure kfree()able? */ int malloced; /* Is this structure kfree()able? */
}; };
extern sctp_transport_t *sctp_transport_new(const union sctp_addr *, int); struct sctp_transport *sctp_transport_new(const union sctp_addr *, int);
extern sctp_transport_t *sctp_transport_init(sctp_transport_t *, struct sctp_transport *sctp_transport_init(struct sctp_transport *,
const union sctp_addr *, int); const union sctp_addr *, int);
extern void sctp_transport_set_owner(sctp_transport_t *, sctp_association_t *); void sctp_transport_set_owner(struct sctp_transport *, sctp_association_t *);
extern void sctp_transport_route(sctp_transport_t *, union sctp_addr *, void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
struct sctp_opt *); struct sctp_opt *);
extern void sctp_transport_free(sctp_transport_t *); void sctp_transport_free(struct sctp_transport *);
extern void sctp_transport_destroy(sctp_transport_t *); void sctp_transport_destroy(struct sctp_transport *);
extern void sctp_transport_reset_timers(sctp_transport_t *); void sctp_transport_reset_timers(struct sctp_transport *);
extern void sctp_transport_hold(sctp_transport_t *); void sctp_transport_hold(struct sctp_transport *);
extern void sctp_transport_put(sctp_transport_t *); void sctp_transport_put(struct sctp_transport *);
extern void sctp_transport_update_rto(sctp_transport_t *, __u32); void sctp_transport_update_rto(struct sctp_transport *, __u32);
extern void sctp_transport_raise_cwnd(sctp_transport_t *, __u32, __u32); void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
extern void sctp_transport_lower_cwnd(sctp_transport_t *, sctp_lower_cwnd_t); void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
unsigned long sctp_transport_timeout(struct sctp_transport *);
/* This is the structure we use to queue packets as they come into /* This is the structure we use to queue packets as they come into
* SCTP. We write packets to it and read chunks from it. It handles * SCTP. We write packets to it and read chunks from it.
* fragment reassembly and chunk unbundling.
*/ */
struct SCTP_inqueue { struct SCTP_inqueue {
/* This is actually a queue of sctp_chunk_t each /* This is actually a queue of sctp_chunk_t each
...@@ -940,9 +940,8 @@ int sctp_outq_set_output_handlers(struct sctp_outq *, ...@@ -940,9 +940,8 @@ int sctp_outq_set_output_handlers(struct sctp_outq *,
sctp_outq_ohandler_t build, sctp_outq_ohandler_t build,
sctp_outq_ohandler_force_t force); sctp_outq_ohandler_force_t force);
void sctp_outq_restart(struct sctp_outq *); void sctp_outq_restart(struct sctp_outq *);
void sctp_retransmit(struct sctp_outq *, sctp_transport_t *, void sctp_retransmit(struct sctp_outq *, struct sctp_transport *, __u8);
sctp_retransmit_reason_t); void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8);
void sctp_retransmit_mark(struct sctp_outq *, sctp_transport_t *, __u8);
/* These bind address data fields common between endpoints and associations */ /* These bind address data fields common between endpoints and associations */
...@@ -1131,7 +1130,7 @@ void sctp_endpoint_hold(sctp_endpoint_t *); ...@@ -1131,7 +1130,7 @@ void sctp_endpoint_hold(sctp_endpoint_t *);
void sctp_endpoint_add_asoc(sctp_endpoint_t *, sctp_association_t *asoc); void sctp_endpoint_add_asoc(sctp_endpoint_t *, sctp_association_t *asoc);
sctp_association_t *sctp_endpoint_lookup_assoc(const sctp_endpoint_t *ep, sctp_association_t *sctp_endpoint_lookup_assoc(const sctp_endpoint_t *ep,
const union sctp_addr *paddr, const union sctp_addr *paddr,
sctp_transport_t **); struct sctp_transport **);
int sctp_endpoint_is_peeled_off(sctp_endpoint_t *, const union sctp_addr *); int sctp_endpoint_is_peeled_off(sctp_endpoint_t *, const union sctp_addr *);
sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *, sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *,
const union sctp_addr *); const union sctp_addr *);
...@@ -1232,7 +1231,7 @@ struct SCTP_association { ...@@ -1232,7 +1231,7 @@ struct SCTP_association {
* designate the connection we are currently using to * designate the connection we are currently using to
* transmit new data and most control chunks. * transmit new data and most control chunks.
*/ */
sctp_transport_t *primary_path; struct sctp_transport *primary_path;
/* Cache the primary path address here, when we /* Cache the primary path address here, when we
* need a an address for msg_name. * need a an address for msg_name.
...@@ -1243,7 +1242,7 @@ struct SCTP_association { ...@@ -1243,7 +1242,7 @@ struct SCTP_association {
* The path that we are currently using to * The path that we are currently using to
* transmit new data and most control chunks. * transmit new data and most control chunks.
*/ */
sctp_transport_t *active_path; struct sctp_transport *active_path;
/* retran_path /* retran_path
* *
...@@ -1255,13 +1254,13 @@ struct SCTP_association { ...@@ -1255,13 +1254,13 @@ struct SCTP_association {
* different from the last destination address to * different from the last destination address to
* which the DATA chunk was sent. * which the DATA chunk was sent.
*/ */
sctp_transport_t *retran_path; struct sctp_transport *retran_path;
/* Pointer to last transport I have sent on. */ /* Pointer to last transport I have sent on. */
sctp_transport_t *last_sent_to; struct sctp_transport *last_sent_to;
/* This is the last transport I have recieved DATA on. */ /* This is the last transport I have recieved DATA on. */
sctp_transport_t *last_data_from; struct sctp_transport *last_data_from;
/* /*
* Mapping An array of bits or bytes indicating which out of * Mapping An array of bits or bytes indicating which out of
...@@ -1373,7 +1372,7 @@ struct SCTP_association { ...@@ -1373,7 +1372,7 @@ struct SCTP_association {
struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
/* Transport to which SHUTDOWN chunk was last sent. */ /* Transport to which SHUTDOWN chunk was last sent. */
sctp_transport_t *shutdown_last_sent_to; struct sctp_transport *shutdown_last_sent_to;
/* Next TSN : The next TSN number to be assigned to a new /* Next TSN : The next TSN number to be assigned to a new
* : DATA chunk. This is sent in the INIT or INIT * : DATA chunk. This is sent in the INIT or INIT
...@@ -1612,16 +1611,17 @@ void sctp_association_free(sctp_association_t *); ...@@ -1612,16 +1611,17 @@ void sctp_association_free(sctp_association_t *);
void sctp_association_put(sctp_association_t *); void sctp_association_put(sctp_association_t *);
void sctp_association_hold(sctp_association_t *); void sctp_association_hold(sctp_association_t *);
sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *); struct sctp_transport *sctp_assoc_choose_shutdown_transport(sctp_association_t *);
sctp_transport_t *sctp_assoc_lookup_paddr(const sctp_association_t *, struct sctp_transport *sctp_assoc_lookup_paddr(const sctp_association_t *,
const union sctp_addr *); const union sctp_addr *);
sctp_transport_t *sctp_assoc_add_peer(sctp_association_t *, struct sctp_transport *sctp_assoc_add_peer(sctp_association_t *,
const union sctp_addr *address, const union sctp_addr *address,
const int priority); const int priority);
void sctp_assoc_control_transport(sctp_association_t *, sctp_transport_t *, void sctp_assoc_control_transport(sctp_association_t *,
struct sctp_transport *,
sctp_transport_cmd_t, sctp_sn_error_t); sctp_transport_cmd_t, sctp_sn_error_t);
sctp_transport_t *sctp_assoc_lookup_tsn(sctp_association_t *, __u32); struct sctp_transport *sctp_assoc_lookup_tsn(sctp_association_t *, __u32);
sctp_transport_t *sctp_assoc_is_match(sctp_association_t *, struct sctp_transport *sctp_assoc_is_match(sctp_association_t *,
const union sctp_addr *, const union sctp_addr *,
const union sctp_addr *); const union sctp_addr *);
void sctp_assoc_migrate(sctp_association_t *, struct sock *); void sctp_assoc_migrate(sctp_association_t *, struct sock *);
......
...@@ -291,7 +291,7 @@ sctp_association_t *sctp_association_init(sctp_association_t *asoc, ...@@ -291,7 +291,7 @@ sctp_association_t *sctp_association_init(sctp_association_t *asoc,
*/ */
void sctp_association_free(sctp_association_t *asoc) void sctp_association_free(sctp_association_t *asoc)
{ {
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
struct list_head *pos, *temp; struct list_head *pos, *temp;
int i; int i;
...@@ -337,7 +337,7 @@ void sctp_association_free(sctp_association_t *asoc) ...@@ -337,7 +337,7 @@ void sctp_association_free(sctp_association_t *asoc)
/* Release the transport structures. */ /* Release the transport structures. */
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
transport = list_entry(pos, sctp_transport_t, transports); transport = list_entry(pos, struct sctp_transport, transports);
list_del(pos); list_del(pos);
sctp_transport_free(transport); sctp_transport_free(transport);
} }
...@@ -363,11 +363,11 @@ static void sctp_association_destroy(sctp_association_t *asoc) ...@@ -363,11 +363,11 @@ static void sctp_association_destroy(sctp_association_t *asoc)
/* Add a transport address to an association. */ /* Add a transport address to an association. */
sctp_transport_t *sctp_assoc_add_peer(sctp_association_t *asoc, struct sctp_transport *sctp_assoc_add_peer(sctp_association_t *asoc,
const union sctp_addr *addr, const union sctp_addr *addr,
int priority) int priority)
{ {
sctp_transport_t *peer; struct sctp_transport *peer;
sctp_opt_t *sp; sctp_opt_t *sp;
unsigned short port; unsigned short port;
...@@ -476,16 +476,16 @@ sctp_transport_t *sctp_assoc_add_peer(sctp_association_t *asoc, ...@@ -476,16 +476,16 @@ sctp_transport_t *sctp_assoc_add_peer(sctp_association_t *asoc,
} }
/* Lookup a transport by address. */ /* Lookup a transport by address. */
sctp_transport_t *sctp_assoc_lookup_paddr(const sctp_association_t *asoc, struct sctp_transport *sctp_assoc_lookup_paddr(const sctp_association_t *asoc,
const union sctp_addr *address) const union sctp_addr *address)
{ {
sctp_transport_t *t; struct sctp_transport *t;
struct list_head *pos; struct list_head *pos;
/* Cycle through all transports searching for a peer address. */ /* Cycle through all transports searching for a peer address. */
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, sctp_transport_t, transports); t = list_entry(pos, struct sctp_transport, transports);
if (sctp_cmp_addr_exact(address, &t->ipaddr)) if (sctp_cmp_addr_exact(address, &t->ipaddr))
return t; return t;
} }
...@@ -498,13 +498,13 @@ sctp_transport_t *sctp_assoc_lookup_paddr(const sctp_association_t *asoc, ...@@ -498,13 +498,13 @@ sctp_transport_t *sctp_assoc_lookup_paddr(const sctp_association_t *asoc,
* Select and update the new active and retran paths. * Select and update the new active and retran paths.
*/ */
void sctp_assoc_control_transport(sctp_association_t *asoc, void sctp_assoc_control_transport(sctp_association_t *asoc,
sctp_transport_t *transport, struct sctp_transport *transport,
sctp_transport_cmd_t command, sctp_transport_cmd_t command,
sctp_sn_error_t error) sctp_sn_error_t error)
{ {
sctp_transport_t *t = NULL; struct sctp_transport *t = NULL;
sctp_transport_t *first; struct sctp_transport *first;
sctp_transport_t *second; struct sctp_transport *second;
sctp_ulpevent_t *event; sctp_ulpevent_t *event;
struct list_head *pos; struct list_head *pos;
int spc_state = 0; int spc_state = 0;
...@@ -545,7 +545,7 @@ void sctp_assoc_control_transport(sctp_association_t *asoc, ...@@ -545,7 +545,7 @@ void sctp_assoc_control_transport(sctp_association_t *asoc,
first = NULL; second = NULL; first = NULL; second = NULL;
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, sctp_transport_t, transports); t = list_entry(pos, struct sctp_transport, transports);
if (!t->active) if (!t->active)
continue; continue;
...@@ -693,12 +693,12 @@ sctp_chunk_t *sctp_get_no_prepend(sctp_association_t *asoc) ...@@ -693,12 +693,12 @@ sctp_chunk_t *sctp_get_no_prepend(sctp_association_t *asoc)
/* /*
* Find which transport this TSN was sent on. * Find which transport this TSN was sent on.
*/ */
sctp_transport_t *sctp_assoc_lookup_tsn(sctp_association_t *asoc, __u32 tsn) struct sctp_transport *sctp_assoc_lookup_tsn(sctp_association_t *asoc, __u32 tsn)
{ {
sctp_transport_t *active; struct sctp_transport *active;
sctp_transport_t *match; struct sctp_transport *match;
struct list_head *entry, *pos; struct list_head *entry, *pos;
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
__u32 key = htonl(tsn); __u32 key = htonl(tsn);
...@@ -732,7 +732,7 @@ sctp_transport_t *sctp_assoc_lookup_tsn(sctp_association_t *asoc, __u32 tsn) ...@@ -732,7 +732,7 @@ sctp_transport_t *sctp_assoc_lookup_tsn(sctp_association_t *asoc, __u32 tsn)
/* If not found, go search all the other transports. */ /* If not found, go search all the other transports. */
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
transport = list_entry(pos, sctp_transport_t, transports); transport = list_entry(pos, struct sctp_transport, transports);
if (transport == active) if (transport == active)
break; break;
...@@ -750,11 +750,11 @@ sctp_transport_t *sctp_assoc_lookup_tsn(sctp_association_t *asoc, __u32 tsn) ...@@ -750,11 +750,11 @@ sctp_transport_t *sctp_assoc_lookup_tsn(sctp_association_t *asoc, __u32 tsn)
} }
/* Is this the association we are looking for? */ /* Is this the association we are looking for? */
sctp_transport_t *sctp_assoc_is_match(sctp_association_t *asoc, struct sctp_transport *sctp_assoc_is_match(sctp_association_t *asoc,
const union sctp_addr *laddr, const union sctp_addr *laddr,
const union sctp_addr *paddr) const union sctp_addr *paddr)
{ {
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_read_lock(&asoc->base.addr_lock); sctp_read_lock(&asoc->base.addr_lock);
...@@ -897,9 +897,9 @@ void sctp_assoc_update(sctp_association_t *asoc, sctp_association_t *new) ...@@ -897,9 +897,9 @@ void sctp_assoc_update(sctp_association_t *asoc, sctp_association_t *new)
* through the inactive transports as this is the next best thing * through the inactive transports as this is the next best thing
* we can try. * we can try.
*/ */
sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *asoc) struct sctp_transport *sctp_assoc_choose_shutdown_transport(sctp_association_t *asoc)
{ {
sctp_transport_t *t, *next; struct sctp_transport *t, *next;
struct list_head *head = &asoc->peer.transport_addr_list; struct list_head *head = &asoc->peer.transport_addr_list;
struct list_head *pos; struct list_head *pos;
...@@ -922,7 +922,7 @@ sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *asoc) ...@@ -922,7 +922,7 @@ sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *asoc)
else else
pos = pos->next; pos = pos->next;
t = list_entry(pos, sctp_transport_t, transports); t = list_entry(pos, struct sctp_transport, transports);
/* Try to find an active transport. */ /* Try to find an active transport. */
......
...@@ -262,7 +262,7 @@ sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *ep, ...@@ -262,7 +262,7 @@ sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *ep,
sctp_association_t *__sctp_endpoint_lookup_assoc( sctp_association_t *__sctp_endpoint_lookup_assoc(
const sctp_endpoint_t *endpoint, const sctp_endpoint_t *endpoint,
const union sctp_addr *paddr, const union sctp_addr *paddr,
sctp_transport_t **transport) struct sctp_transport **transport)
{ {
int rport; int rport;
sctp_association_t *asoc; sctp_association_t *asoc;
...@@ -287,9 +287,10 @@ sctp_association_t *__sctp_endpoint_lookup_assoc( ...@@ -287,9 +287,10 @@ sctp_association_t *__sctp_endpoint_lookup_assoc(
} }
/* Lookup association on an endpoint based on a peer address. BH-safe. */ /* Lookup association on an endpoint based on a peer address. BH-safe. */
sctp_association_t *sctp_endpoint_lookup_assoc(const sctp_endpoint_t *ep, sctp_association_t *sctp_endpoint_lookup_assoc(
const sctp_endpoint_t *ep,
const union sctp_addr *paddr, const union sctp_addr *paddr,
sctp_transport_t **transport) struct sctp_transport **transport)
{ {
sctp_association_t *asoc; sctp_association_t *asoc;
...@@ -331,7 +332,7 @@ static void sctp_endpoint_bh_rcv(sctp_endpoint_t *ep) ...@@ -331,7 +332,7 @@ static void sctp_endpoint_bh_rcv(sctp_endpoint_t *ep)
{ {
sctp_association_t *asoc; sctp_association_t *asoc;
struct sock *sk; struct sock *sk;
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
sctp_inqueue_t *inqueue; sctp_inqueue_t *inqueue;
sctp_subtype_t subtype; sctp_subtype_t subtype;
......
...@@ -66,7 +66,7 @@ static int sctp_rcv_ootb(struct sk_buff *); ...@@ -66,7 +66,7 @@ static int sctp_rcv_ootb(struct sk_buff *);
sctp_association_t *__sctp_rcv_lookup(struct sk_buff *skb, sctp_association_t *__sctp_rcv_lookup(struct sk_buff *skb,
const union sctp_addr *laddr, const union sctp_addr *laddr,
const union sctp_addr *paddr, const union sctp_addr *paddr,
sctp_transport_t **transportp); struct sctp_transport **transportp);
sctp_endpoint_t *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr); sctp_endpoint_t *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr);
...@@ -104,7 +104,7 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -104,7 +104,7 @@ int sctp_rcv(struct sk_buff *skb)
sctp_association_t *asoc; sctp_association_t *asoc;
sctp_endpoint_t *ep = NULL; sctp_endpoint_t *ep = NULL;
sctp_endpoint_common_t *rcvr; sctp_endpoint_common_t *rcvr;
sctp_transport_t *transport = NULL; struct sctp_transport *transport = NULL;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
struct sctphdr *sh; struct sctphdr *sh;
union sctp_addr src; union sctp_addr src;
...@@ -601,12 +601,12 @@ void __sctp_unhash_established(sctp_association_t *asoc) ...@@ -601,12 +601,12 @@ void __sctp_unhash_established(sctp_association_t *asoc)
/* Look up an association. */ /* Look up an association. */
sctp_association_t *__sctp_lookup_association(const union sctp_addr *laddr, sctp_association_t *__sctp_lookup_association(const union sctp_addr *laddr,
const union sctp_addr *paddr, const union sctp_addr *paddr,
sctp_transport_t **transportp) struct sctp_transport **transportp)
{ {
sctp_hashbucket_t *head; sctp_hashbucket_t *head;
sctp_endpoint_common_t *epb; sctp_endpoint_common_t *epb;
sctp_association_t *asoc; sctp_association_t *asoc;
sctp_transport_t *transport; struct sctp_transport *transport;
int hash; int hash;
/* Optimize here for direct hit, only listening connections can /* Optimize here for direct hit, only listening connections can
...@@ -637,7 +637,7 @@ sctp_association_t *__sctp_lookup_association(const union sctp_addr *laddr, ...@@ -637,7 +637,7 @@ sctp_association_t *__sctp_lookup_association(const union sctp_addr *laddr,
/* Look up an association. BH-safe. */ /* Look up an association. BH-safe. */
sctp_association_t *sctp_lookup_association(const union sctp_addr *laddr, sctp_association_t *sctp_lookup_association(const union sctp_addr *laddr,
const union sctp_addr *paddr, const union sctp_addr *paddr,
sctp_transport_t **transportp) struct sctp_transport **transportp)
{ {
sctp_association_t *asoc; sctp_association_t *asoc;
...@@ -653,7 +653,7 @@ int sctp_has_association(const union sctp_addr *laddr, ...@@ -653,7 +653,7 @@ int sctp_has_association(const union sctp_addr *laddr,
const union sctp_addr *paddr) const union sctp_addr *paddr)
{ {
sctp_association_t *asoc; sctp_association_t *asoc;
sctp_transport_t *transport; struct sctp_transport *transport;
if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) { if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) {
sock_put(asoc->base.sk); sock_put(asoc->base.sk);
...@@ -683,7 +683,7 @@ int sctp_has_association(const union sctp_addr *laddr, ...@@ -683,7 +683,7 @@ int sctp_has_association(const union sctp_addr *laddr,
* *
*/ */
static sctp_association_t *__sctp_rcv_init_lookup(struct sk_buff *skb, static sctp_association_t *__sctp_rcv_init_lookup(struct sk_buff *skb,
const union sctp_addr *laddr, sctp_transport_t **transportp) const union sctp_addr *laddr, struct sctp_transport **transportp)
{ {
sctp_association_t *asoc; sctp_association_t *asoc;
union sctp_addr addr; union sctp_addr addr;
...@@ -743,7 +743,7 @@ static sctp_association_t *__sctp_rcv_init_lookup(struct sk_buff *skb, ...@@ -743,7 +743,7 @@ static sctp_association_t *__sctp_rcv_init_lookup(struct sk_buff *skb,
sctp_association_t *__sctp_rcv_lookup(struct sk_buff *skb, sctp_association_t *__sctp_rcv_lookup(struct sk_buff *skb,
const union sctp_addr *paddr, const union sctp_addr *paddr,
const union sctp_addr *laddr, const union sctp_addr *laddr,
sctp_transport_t **transportp) struct sctp_transport **transportp)
{ {
sctp_association_t *asoc; sctp_association_t *asoc;
......
...@@ -90,7 +90,7 @@ sctp_packet_t *sctp_packet_config(sctp_packet_t *packet, ...@@ -90,7 +90,7 @@ sctp_packet_t *sctp_packet_config(sctp_packet_t *packet,
/* Initialize the packet structure. */ /* Initialize the packet structure. */
sctp_packet_t *sctp_packet_init(sctp_packet_t *packet, sctp_packet_t *sctp_packet_init(sctp_packet_t *packet,
sctp_transport_t *transport, struct sctp_transport *transport,
__u16 sport, __u16 sport,
__u16 dport) __u16 dport)
{ {
...@@ -236,7 +236,7 @@ sctp_xmit_t sctp_packet_append_chunk(sctp_packet_t *packet, sctp_chunk_t *chunk) ...@@ -236,7 +236,7 @@ sctp_xmit_t sctp_packet_append_chunk(sctp_packet_t *packet, sctp_chunk_t *chunk)
*/ */
int sctp_packet_transmit(sctp_packet_t *packet) int sctp_packet_transmit(sctp_packet_t *packet)
{ {
sctp_transport_t *transport = packet->transport; struct sctp_transport *transport = packet->transport;
sctp_association_t *asoc = transport->asoc; sctp_association_t *asoc = transport->asoc;
struct sctphdr *sh; struct sctphdr *sh;
__u32 crc32; __u32 crc32;
...@@ -477,7 +477,7 @@ static sctp_xmit_t sctp_packet_append_data(sctp_packet_t *packet, ...@@ -477,7 +477,7 @@ static sctp_xmit_t sctp_packet_append_data(sctp_packet_t *packet,
{ {
sctp_xmit_t retval = SCTP_XMIT_OK; sctp_xmit_t retval = SCTP_XMIT_OK;
size_t datasize, rwnd, inflight; size_t datasize, rwnd, inflight;
sctp_transport_t *transport = packet->transport; struct sctp_transport *transport = packet->transport;
__u32 max_burst_bytes; __u32 max_burst_bytes;
/* RFC 2960 6.1 Transmission of DATA Chunks /* RFC 2960 6.1 Transmission of DATA Chunks
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
static int sctp_acked(sctp_sackhdr_t *sack, __u32 tsn); static int sctp_acked(sctp_sackhdr_t *sack, __u32 tsn);
static void sctp_check_transmitted(struct sctp_outq *q, static void sctp_check_transmitted(struct sctp_outq *q,
struct list_head *transmitted_queue, struct list_head *transmitted_queue,
sctp_transport_t *transport, struct sctp_transport *transport,
sctp_sackhdr_t *sack, sctp_sackhdr_t *sack,
__u32 highest_new_tsn); __u32 highest_new_tsn);
...@@ -104,13 +104,13 @@ void sctp_outq_init(sctp_association_t *asoc, struct sctp_outq *q) ...@@ -104,13 +104,13 @@ void sctp_outq_init(sctp_association_t *asoc, struct sctp_outq *q)
*/ */
void sctp_outq_teardown(struct sctp_outq *q) void sctp_outq_teardown(struct sctp_outq *q)
{ {
sctp_transport_t *transport; struct sctp_transport *transport;
struct list_head *lchunk, *pos, *temp; struct list_head *lchunk, *pos, *temp;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
/* Throw away unacknowledged chunks. */ /* Throw away unacknowledged chunks. */
list_for_each(pos, &q->asoc->peer.transport_addr_list) { list_for_each(pos, &q->asoc->peer.transport_addr_list) {
transport = list_entry(pos, sctp_transport_t, transports); transport = list_entry(pos, struct sctp_transport, transports);
while ((lchunk = sctp_list_dequeue(&transport->transmitted))) { while ((lchunk = sctp_list_dequeue(&transport->transmitted))) {
chunk = list_entry(lchunk, sctp_chunk_t, chunk = list_entry(lchunk, sctp_chunk_t,
transmitted_list); transmitted_list);
...@@ -224,13 +224,13 @@ void sctp_retransmit_insert(struct list_head *tlchunk, struct sctp_outq *q) ...@@ -224,13 +224,13 @@ void sctp_retransmit_insert(struct list_head *tlchunk, struct sctp_outq *q)
} }
/* Mark all the eligible packets on a transport for retransmission. */ /* Mark all the eligible packets on a transport for retransmission. */
void sctp_retransmit_mark(struct sctp_outq *q, sctp_transport_t *transport, void sctp_retransmit_mark(struct sctp_outq *q,
struct sctp_transport *transport,
__u8 fast_retransmit) __u8 fast_retransmit)
{ {
struct list_head *lchunk, *ltemp; struct list_head *lchunk, *ltemp;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
/* Walk through the specified transmitted queue. */ /* Walk through the specified transmitted queue. */
list_for_each_safe(lchunk, ltemp, &transport->transmitted) { list_for_each_safe(lchunk, ltemp, &transport->transmitted) {
chunk = list_entry(lchunk, sctp_chunk_t, transmitted_list); chunk = list_entry(lchunk, sctp_chunk_t, transmitted_list);
...@@ -295,7 +295,7 @@ void sctp_retransmit_mark(struct sctp_outq *q, sctp_transport_t *transport, ...@@ -295,7 +295,7 @@ void sctp_retransmit_mark(struct sctp_outq *q, sctp_transport_t *transport,
/* Mark all the eligible packets on a transport for retransmission and force /* Mark all the eligible packets on a transport for retransmission and force
* one packet out. * one packet out.
*/ */
void sctp_retransmit(struct sctp_outq *q, sctp_transport_t *transport, void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
sctp_retransmit_reason_t reason) sctp_retransmit_reason_t reason)
{ {
int error = 0; int error = 0;
...@@ -334,7 +334,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, sctp_packet_t *pkt, ...@@ -334,7 +334,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, sctp_packet_t *pkt,
{ {
struct list_head *lqueue; struct list_head *lqueue;
struct list_head *lchunk; struct list_head *lchunk;
sctp_transport_t *transport = pkt->transport; struct sctp_transport *transport = pkt->transport;
sctp_xmit_t status; sctp_xmit_t status;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
sctp_association_t *asoc; sctp_association_t *asoc;
...@@ -442,7 +442,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, sctp_packet_t *pkt, ...@@ -442,7 +442,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, sctp_packet_t *pkt,
void sctp_xmit_frag(struct sctp_outq *q, struct sk_buff *pos, void sctp_xmit_frag(struct sctp_outq *q, struct sk_buff *pos,
sctp_packet_t *packet, sctp_chunk_t *frag, __u32 tsn) sctp_packet_t *packet, sctp_chunk_t *frag, __u32 tsn)
{ {
sctp_transport_t *transport = packet->transport; struct sctp_transport *transport = packet->transport;
struct sk_buff_head *queue = &q->out; struct sk_buff_head *queue = &q->out;
sctp_xmit_t status; sctp_xmit_t status;
int error; int error;
...@@ -655,8 +655,8 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) ...@@ -655,8 +655,8 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
sctp_packet_phandler_t *s_ecne_handler = NULL; sctp_packet_phandler_t *s_ecne_handler = NULL;
sctp_packet_phandler_t *ecne_handler = NULL; sctp_packet_phandler_t *ecne_handler = NULL;
struct sk_buff_head *queue; struct sk_buff_head *queue;
sctp_transport_t *transport = NULL; struct sctp_transport *transport = NULL;
sctp_transport_t *new_transport; struct sctp_transport *new_transport;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
sctp_xmit_t status; sctp_xmit_t status;
int error = 0; int error = 0;
...@@ -967,8 +967,9 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) ...@@ -967,8 +967,9 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
* --xguo * --xguo
*/ */
while ((ltransport = sctp_list_dequeue(&transport_list)) != NULL ) { while ((ltransport = sctp_list_dequeue(&transport_list)) != NULL ) {
sctp_transport_t *t = list_entry(ltransport, struct sctp_transport *t = list_entry(ltransport,
sctp_transport_t, send_ready); struct sctp_transport,
send_ready);
if (t != transport) if (t != transport)
transport = t; transport = t;
...@@ -1020,7 +1021,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack, ...@@ -1020,7 +1021,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack,
sctp_association_t *asoc) sctp_association_t *asoc)
{ {
struct list_head *ltransport, *lchunk; struct list_head *ltransport, *lchunk;
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_chunk_t *chunk; sctp_chunk_t *chunk;
__u32 highest_new_tsn, tsn; __u32 highest_new_tsn, tsn;
struct list_head *transport_list = &asoc->peer.transport_addr_list; struct list_head *transport_list = &asoc->peer.transport_addr_list;
...@@ -1028,7 +1029,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack, ...@@ -1028,7 +1029,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack,
highest_new_tsn = ntohl(sack->cum_tsn_ack); highest_new_tsn = ntohl(sack->cum_tsn_ack);
list_for_each(ltransport, transport_list) { list_for_each(ltransport, transport_list) {
transport = list_entry(ltransport, sctp_transport_t, transport = list_entry(ltransport, struct sctp_transport,
transports); transports);
list_for_each(lchunk, &transport->transmitted) { list_for_each(lchunk, &transport->transmitted) {
chunk = list_entry(lchunk, sctp_chunk_t, chunk = list_entry(lchunk, sctp_chunk_t,
...@@ -1053,7 +1054,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack, ...@@ -1053,7 +1054,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack,
int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack) int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack)
{ {
sctp_association_t *asoc = q->asoc; sctp_association_t *asoc = q->asoc;
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_chunk_t *tchunk; sctp_chunk_t *tchunk;
struct list_head *lchunk, *transport_list, *pos; struct list_head *lchunk, *transport_list, *pos;
sctp_sack_variable_t *frags = sack->variable; sctp_sack_variable_t *frags = sack->variable;
...@@ -1089,7 +1090,8 @@ int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack) ...@@ -1089,7 +1090,8 @@ int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack)
* This is a MASSIVE candidate for optimization. * This is a MASSIVE candidate for optimization.
*/ */
list_for_each(pos, transport_list) { list_for_each(pos, transport_list) {
transport = list_entry(pos, sctp_transport_t, transports); transport = list_entry(pos, struct sctp_transport,
transports);
sctp_check_transmitted(q, &transport->transmitted, sctp_check_transmitted(q, &transport->transmitted,
transport, sack, highest_new_tsn); transport, sack, highest_new_tsn);
} }
...@@ -1142,7 +1144,8 @@ int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack) ...@@ -1142,7 +1144,8 @@ int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack)
goto finish; goto finish;
list_for_each(pos, transport_list) { list_for_each(pos, transport_list) {
transport = list_entry(pos, sctp_transport_t, transports); transport = list_entry(pos, struct sctp_transport,
transports);
q->empty = q->empty && list_empty(&transport->transmitted); q->empty = q->empty && list_empty(&transport->transmitted);
if (!q->empty) if (!q->empty)
goto finish; goto finish;
...@@ -1178,7 +1181,7 @@ int sctp_outq_is_empty(const struct sctp_outq *q) ...@@ -1178,7 +1181,7 @@ int sctp_outq_is_empty(const struct sctp_outq *q)
*/ */
static void sctp_check_transmitted(struct sctp_outq *q, static void sctp_check_transmitted(struct sctp_outq *q,
struct list_head *transmitted_queue, struct list_head *transmitted_queue,
sctp_transport_t *transport, struct sctp_transport *transport,
sctp_sackhdr_t *sack, sctp_sackhdr_t *sack,
__u32 highest_new_tsn_in_sack) __u32 highest_new_tsn_in_sack)
{ {
......
...@@ -897,7 +897,7 @@ sctp_chunk_t *sctp_make_abort_user(const sctp_association_t *asoc, ...@@ -897,7 +897,7 @@ sctp_chunk_t *sctp_make_abort_user(const sctp_association_t *asoc,
/* Make a HEARTBEAT chunk. */ /* Make a HEARTBEAT chunk. */
sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *asoc, sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *asoc,
const sctp_transport_t *transport, const struct sctp_transport *transport,
const void *payload, const size_t paylen) const void *payload, const size_t paylen)
{ {
sctp_chunk_t *retval = sctp_make_chunk(asoc, SCTP_CID_HEARTBEAT, sctp_chunk_t *retval = sctp_make_chunk(asoc, SCTP_CID_HEARTBEAT,
...@@ -909,7 +909,7 @@ sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *asoc, ...@@ -909,7 +909,7 @@ sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *asoc,
/* Cast away the 'const', as this is just telling the chunk /* Cast away the 'const', as this is just telling the chunk
* what transport it belongs to. * what transport it belongs to.
*/ */
retval->transport = (sctp_transport_t *) transport; retval->transport = (struct sctp_transport *) transport;
retval->subh.hbs_hdr = sctp_addto_chunk(retval, paylen, payload); retval->subh.hbs_hdr = sctp_addto_chunk(retval, paylen, payload);
nodata: nodata:
...@@ -1686,7 +1686,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid, ...@@ -1686,7 +1686,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid,
int priority) int priority)
{ {
union sctp_params param; union sctp_params param;
sctp_transport_t *transport; struct sctp_transport *transport;
struct list_head *pos, *temp; struct list_head *pos, *temp;
char *cookie; char *cookie;
...@@ -1761,7 +1761,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid, ...@@ -1761,7 +1761,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid,
* advertised window). * advertised window).
*/ */
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
transport = list_entry(pos, sctp_transport_t, transports); transport = list_entry(pos, struct sctp_transport, transports);
transport->ssthresh = asoc->peer.i.a_rwnd; transport->ssthresh = asoc->peer.i.a_rwnd;
} }
...@@ -1801,7 +1801,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid, ...@@ -1801,7 +1801,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid,
clean_up: clean_up:
/* Release the transport structures. */ /* Release the transport structures. */
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
transport = list_entry(pos, sctp_transport_t, transports); transport = list_entry(pos, struct sctp_transport, transports);
list_del(pos); list_del(pos);
sctp_transport_free(transport); sctp_transport_free(transport);
} }
......
...@@ -56,33 +56,31 @@ ...@@ -56,33 +56,31 @@
#include <net/sctp/sm.h> #include <net/sctp/sm.h>
/* Do forward declarations of static functions. */ /* Do forward declarations of static functions. */
static void sctp_do_ecn_ce_work(sctp_association_t *asoc, static void sctp_do_ecn_ce_work(sctp_association_t *,__u32 lowest_tsn);
__u32 lowest_tsn);
static sctp_chunk_t *sctp_do_ecn_ecne_work(sctp_association_t *asoc, static sctp_chunk_t *sctp_do_ecn_ecne_work(sctp_association_t *asoc,
__u32 lowest_tsn, __u32 lowest_tsn,
sctp_chunk_t *); sctp_chunk_t *);
static void sctp_do_ecn_cwr_work(sctp_association_t *asoc, static void sctp_do_ecn_cwr_work(sctp_association_t *,__u32 lowest_tsn);
__u32 lowest_tsn); static void sctp_do_8_2_transport_strike(sctp_association_t *,
struct sctp_transport *);
static void sctp_do_8_2_transport_strike(sctp_association_t *asoc, static void sctp_cmd_init_failed(sctp_cmd_seq_t *, sctp_association_t *);
sctp_transport_t *transport); static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *, sctp_association_t *,
static void sctp_cmd_init_failed(sctp_cmd_seq_t *, sctp_association_t *asoc); sctp_event_t, sctp_subtype_t,
static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *, sctp_association_t *asoc,
sctp_event_t event_type, sctp_subtype_t stype,
sctp_chunk_t *chunk); sctp_chunk_t *chunk);
static int sctp_cmd_process_init(sctp_cmd_seq_t *, sctp_association_t *asoc, static int sctp_cmd_process_init(sctp_cmd_seq_t *, sctp_association_t *,
sctp_chunk_t *chunk, sctp_chunk_t *chunk,
sctp_init_chunk_t *peer_init, sctp_init_chunk_t *peer_init,
int priority); int priority);
static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *, sctp_association_t *); static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *, sctp_association_t *);
static void sctp_cmd_hb_timers_update(sctp_cmd_seq_t *, sctp_association_t *, static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *, sctp_association_t *);
sctp_transport_t *); static void sctp_cmd_hb_timer_update(sctp_cmd_seq_t *, sctp_association_t *,
struct sctp_transport *);
static void sctp_cmd_set_bind_addrs(sctp_cmd_seq_t *, sctp_association_t *, static void sctp_cmd_set_bind_addrs(sctp_cmd_seq_t *, sctp_association_t *,
sctp_bind_addr_t *); sctp_bind_addr_t *);
static void sctp_cmd_transport_reset(sctp_cmd_seq_t *, sctp_association_t *, static void sctp_cmd_transport_reset(sctp_cmd_seq_t *, sctp_association_t *,
sctp_transport_t *); struct sctp_transport *);
static void sctp_cmd_transport_on(sctp_cmd_seq_t *, sctp_association_t *, static void sctp_cmd_transport_on(sctp_cmd_seq_t *, sctp_association_t *,
sctp_transport_t *, sctp_chunk_t *); struct sctp_transport *, sctp_chunk_t *);
static int sctp_cmd_process_sack(sctp_cmd_seq_t *, sctp_association_t *, static int sctp_cmd_process_sack(sctp_cmd_seq_t *, sctp_association_t *,
sctp_sackhdr_t *); sctp_sackhdr_t *);
static void sctp_cmd_setup_t2(sctp_cmd_seq_t *, sctp_association_t *, static void sctp_cmd_setup_t2(sctp_cmd_seq_t *, sctp_association_t *,
...@@ -264,7 +262,7 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype, ...@@ -264,7 +262,7 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype,
struct list_head *pos; struct list_head *pos;
struct timer_list *timer; struct timer_list *timer;
unsigned long timeout; unsigned long timeout;
sctp_transport_t *t; struct sctp_transport *t;
sctp_sackhdr_t sackh; sctp_sackhdr_t sackh;
if(SCTP_EVENT_T_TIMEOUT != event_type) if(SCTP_EVENT_T_TIMEOUT != event_type)
...@@ -503,7 +501,7 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype, ...@@ -503,7 +501,7 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype,
* COOKIE-ECHO we need to resend. * COOKIE-ECHO we need to resend.
*/ */
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, sctp_transport_t, t = list_entry(pos, struct sctp_transport,
transports); transports);
sctp_retransmit_mark(&asoc->outqueue, t, 0); sctp_retransmit_mark(&asoc->outqueue, t, 0);
} }
...@@ -573,9 +571,13 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype, ...@@ -573,9 +571,13 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype,
sctp_cmd_hb_timers_start(commands, asoc); sctp_cmd_hb_timers_start(commands, asoc);
break; break;
case SCTP_CMD_HB_TIMERS_UPDATE: case SCTP_CMD_HB_TIMER_UPDATE:
t = command->obj.transport; t = command->obj.transport;
sctp_cmd_hb_timers_update(commands, asoc, t); sctp_cmd_hb_timer_update(commands, asoc, t);
break;
case SCTP_CMD_HB_TIMERS_STOP:
sctp_cmd_hb_timers_stop(commands, asoc);
break; break;
case SCTP_CMD_REPORT_ERROR: case SCTP_CMD_REPORT_ERROR:
...@@ -657,7 +659,7 @@ static sctp_chunk_t *sctp_do_ecn_ecne_work(sctp_association_t *asoc, ...@@ -657,7 +659,7 @@ static sctp_chunk_t *sctp_do_ecn_ecne_work(sctp_association_t *asoc,
* recent than the last response. * recent than the last response.
*/ */
if (TSN_lt(asoc->last_cwr_tsn, lowest_tsn)) { if (TSN_lt(asoc->last_cwr_tsn, lowest_tsn)) {
sctp_transport_t *transport; struct sctp_transport *transport;
/* Find which transport's congestion variables /* Find which transport's congestion variables
* need to be adjusted. * need to be adjusted.
...@@ -803,7 +805,7 @@ void sctp_do_TSNdup(sctp_association_t *asoc, sctp_chunk_t *chunk, long gap) ...@@ -803,7 +805,7 @@ void sctp_do_TSNdup(sctp_association_t *asoc, sctp_chunk_t *chunk, long gap)
void sctp_generate_t3_rtx_event(unsigned long peer) void sctp_generate_t3_rtx_event(unsigned long peer)
{ {
int error; int error;
sctp_transport_t *transport = (sctp_transport_t *) peer; struct sctp_transport *transport = (struct sctp_transport *) peer;
sctp_association_t *asoc = transport->asoc; sctp_association_t *asoc = transport->asoc;
/* Check whether a task is in the sock. */ /* Check whether a task is in the sock. */
...@@ -918,7 +920,7 @@ void sctp_generate_autoclose_event(unsigned long data) ...@@ -918,7 +920,7 @@ void sctp_generate_autoclose_event(unsigned long data)
void sctp_generate_heartbeat_event(unsigned long data) void sctp_generate_heartbeat_event(unsigned long data)
{ {
int error = 0; int error = 0;
sctp_transport_t *transport = (sctp_transport_t *) data; struct sctp_transport *transport = (struct sctp_transport *) data;
sctp_association_t *asoc = transport->asoc; sctp_association_t *asoc = transport->asoc;
sctp_bh_lock_sock(asoc->base.sk); sctp_bh_lock_sock(asoc->base.sk);
...@@ -991,7 +993,7 @@ sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES] = { ...@@ -991,7 +993,7 @@ sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES] = {
* *
*/ */
static void sctp_do_8_2_transport_strike(sctp_association_t *asoc, static void sctp_do_8_2_transport_strike(sctp_association_t *asoc,
sctp_transport_t *transport) struct sctp_transport *transport)
{ {
/* The check for association's overall error counter exceeding the /* The check for association's overall error counter exceeding the
* threshold is done in the state function. * threshold is done in the state function.
...@@ -1119,7 +1121,7 @@ static int sctp_cmd_process_init(sctp_cmd_seq_t *commands, ...@@ -1119,7 +1121,7 @@ static int sctp_cmd_process_init(sctp_cmd_seq_t *commands,
static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds, static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds,
sctp_association_t *asoc) sctp_association_t *asoc)
{ {
sctp_transport_t *t; struct sctp_transport *t;
struct list_head *pos; struct list_head *pos;
/* Start a heartbeat timer for each transport on the association. /* Start a heartbeat timer for each transport on the association.
...@@ -1127,22 +1129,35 @@ static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds, ...@@ -1127,22 +1129,35 @@ static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds,
* the needed data structures go away. * the needed data structures go away.
*/ */
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, sctp_transport_t, transports); t = list_entry(pos, struct sctp_transport, transports);
if (!mod_timer(&t->hb_timer, t->hb_interval + t->rto +
sctp_jitter(t->rto) + jiffies)) { if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t)))
sctp_transport_hold(t); sctp_transport_hold(t);
} }
}
static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds,
sctp_association_t *asoc)
{
struct sctp_transport *t;
struct list_head *pos;
/* Stop all heartbeat timers. */
list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, struct sctp_transport, transports);
if (del_timer(&t->hb_timer))
sctp_transport_put(t);
} }
} }
/* Helper function to update the heartbeat timer. */ /* Helper function to update the heartbeat timer. */
static void sctp_cmd_hb_timers_update(sctp_cmd_seq_t *cmds, static void sctp_cmd_hb_timer_update(sctp_cmd_seq_t *cmds,
sctp_association_t *asoc, sctp_association_t *asoc,
sctp_transport_t *t) struct sctp_transport *t)
{ {
/* Update the heartbeat timer. */ /* Update the heartbeat timer. */
if (!mod_timer(&t->hb_timer, t->hb_interval + t->rto + if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t)))
sctp_jitter(t->rto) + jiffies))
sctp_transport_hold(t); sctp_transport_hold(t);
} }
...@@ -1166,7 +1181,8 @@ void sctp_cmd_set_bind_addrs(sctp_cmd_seq_t *cmds, sctp_association_t *asoc, ...@@ -1166,7 +1181,8 @@ void sctp_cmd_set_bind_addrs(sctp_cmd_seq_t *cmds, sctp_association_t *asoc,
/* Helper function to handle the reception of an HEARTBEAT ACK. */ /* Helper function to handle the reception of an HEARTBEAT ACK. */
static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds, static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
sctp_association_t *asoc, sctp_association_t *asoc,
sctp_transport_t *t, sctp_chunk_t *chunk) struct sctp_transport *t,
sctp_chunk_t *chunk)
{ {
sctp_sender_hb_info_t *hbinfo; sctp_sender_hb_info_t *hbinfo;
...@@ -1198,7 +1214,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds, ...@@ -1198,7 +1214,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
*/ */
static void sctp_cmd_transport_reset(sctp_cmd_seq_t *cmds, static void sctp_cmd_transport_reset(sctp_cmd_seq_t *cmds,
sctp_association_t *asoc, sctp_association_t *asoc,
sctp_transport_t *t) struct sctp_transport *t)
{ {
sctp_transport_lower_cwnd(t, SCTP_LOWER_CWND_INACTIVE); sctp_transport_lower_cwnd(t, SCTP_LOWER_CWND_INACTIVE);
...@@ -1235,7 +1251,7 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds, ...@@ -1235,7 +1251,7 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds,
static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds, sctp_association_t *asoc, static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds, sctp_association_t *asoc,
sctp_chunk_t *chunk) sctp_chunk_t *chunk)
{ {
sctp_transport_t *t; struct sctp_transport *t;
t = sctp_assoc_choose_shutdown_transport(asoc); t = sctp_assoc_choose_shutdown_transport(asoc);
asoc->shutdown_last_sent_to = t; asoc->shutdown_last_sent_to = t;
......
...@@ -678,7 +678,7 @@ sctp_disposition_t sctp_sf_heartbeat(const sctp_endpoint_t *ep, ...@@ -678,7 +678,7 @@ sctp_disposition_t sctp_sf_heartbeat(const sctp_endpoint_t *ep,
void *arg, void *arg,
sctp_cmd_seq_t *commands) sctp_cmd_seq_t *commands)
{ {
sctp_transport_t *transport = (sctp_transport_t *) arg; struct sctp_transport *transport = (struct sctp_transport *) arg;
sctp_chunk_t *reply; sctp_chunk_t *reply;
sctp_sender_hb_info_t hbinfo; sctp_sender_hb_info_t hbinfo;
size_t paylen = 0; size_t paylen = 0;
...@@ -711,7 +711,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const sctp_endpoint_t *ep, ...@@ -711,7 +711,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const sctp_endpoint_t *ep,
void *arg, void *arg,
sctp_cmd_seq_t *commands) sctp_cmd_seq_t *commands)
{ {
sctp_transport_t *transport = (sctp_transport_t *) arg; struct sctp_transport *transport = (struct sctp_transport *) arg;
if (asoc->overall_error_count >= asoc->overall_error_threshold) { if (asoc->overall_error_count >= asoc->overall_error_threshold) {
/* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
...@@ -737,7 +737,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const sctp_endpoint_t *ep, ...@@ -737,7 +737,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const sctp_endpoint_t *ep,
sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_RESET, sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_RESET,
SCTP_TRANSPORT(transport)); SCTP_TRANSPORT(transport));
} }
sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_UPDATE, sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE,
SCTP_TRANSPORT(transport)); SCTP_TRANSPORT(transport));
return SCTP_DISPOSITION_CONSUME; return SCTP_DISPOSITION_CONSUME;
...@@ -842,7 +842,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const sctp_endpoint_t *ep, ...@@ -842,7 +842,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const sctp_endpoint_t *ep,
{ {
sctp_chunk_t *chunk = arg; sctp_chunk_t *chunk = arg;
union sctp_addr from_addr; union sctp_addr from_addr;
sctp_transport_t *link; struct sctp_transport *link;
sctp_sender_hb_info_t *hbinfo; sctp_sender_hb_info_t *hbinfo;
unsigned long max_interval; unsigned long max_interval;
...@@ -944,7 +944,7 @@ static int sctp_sf_check_restart_addrs(const sctp_association_t *new_asoc, ...@@ -944,7 +944,7 @@ static int sctp_sf_check_restart_addrs(const sctp_association_t *new_asoc,
sctp_chunk_t *init, sctp_chunk_t *init,
sctp_cmd_seq_t *commands) sctp_cmd_seq_t *commands)
{ {
sctp_transport_t *new_addr, *addr; struct sctp_transport *new_addr, *addr;
struct list_head *pos, *pos2; struct list_head *pos, *pos2;
int found; int found;
...@@ -963,10 +963,11 @@ static int sctp_sf_check_restart_addrs(const sctp_association_t *new_asoc, ...@@ -963,10 +963,11 @@ static int sctp_sf_check_restart_addrs(const sctp_association_t *new_asoc,
found = 0; found = 0;
list_for_each(pos, &new_asoc->peer.transport_addr_list) { list_for_each(pos, &new_asoc->peer.transport_addr_list) {
new_addr = list_entry(pos, sctp_transport_t, transports); new_addr = list_entry(pos, struct sctp_transport, transports);
found = 0; found = 0;
list_for_each(pos2, &asoc->peer.transport_addr_list) { list_for_each(pos2, &asoc->peer.transport_addr_list) {
addr = list_entry(pos2, sctp_transport_t, transports); addr = list_entry(pos2, struct sctp_transport,
transports);
if (sctp_cmp_addr_exact(&new_addr->ipaddr, if (sctp_cmp_addr_exact(&new_addr->ipaddr,
&addr->ipaddr)) { &addr->ipaddr)) {
found = 1; found = 1;
...@@ -1629,7 +1630,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const sctp_endpoint_t *ep, ...@@ -1629,7 +1630,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const sctp_endpoint_t *ep,
new_asoc); new_asoc);
break; break;
case 'C': /* Collisioun case C. */ case 'C': /* Collision case C. */
retval = sctp_sf_do_dupcook_c(ep, asoc, chunk, commands, retval = sctp_sf_do_dupcook_c(ep, asoc, chunk, commands,
new_asoc); new_asoc);
break; break;
...@@ -1799,7 +1800,7 @@ sctp_disposition_t sctp_sf_do_5_2_6_stale(const sctp_endpoint_t *ep, ...@@ -1799,7 +1800,7 @@ sctp_disposition_t sctp_sf_do_5_2_6_stale(const sctp_endpoint_t *ep,
sctp_cookie_preserve_param_t bht; sctp_cookie_preserve_param_t bht;
sctp_errhdr_t *err; sctp_errhdr_t *err;
struct list_head *pos; struct list_head *pos;
sctp_transport_t *t; struct sctp_transport *t;
sctp_chunk_t *reply; sctp_chunk_t *reply;
sctp_bind_addr_t *bp; sctp_bind_addr_t *bp;
int attempts; int attempts;
...@@ -1848,9 +1849,11 @@ sctp_disposition_t sctp_sf_do_5_2_6_stale(const sctp_endpoint_t *ep, ...@@ -1848,9 +1849,11 @@ sctp_disposition_t sctp_sf_do_5_2_6_stale(const sctp_endpoint_t *ep,
sctp_add_cmd_sf(commands, SCTP_CMD_COUNTER_INC, sctp_add_cmd_sf(commands, SCTP_CMD_COUNTER_INC,
SCTP_COUNTER(SCTP_COUNTER_INIT_ERROR)); SCTP_COUNTER(SCTP_COUNTER_INIT_ERROR));
/* If we've sent any data bundled with COOKIE-ECHO we need to resend. */ /* If we've sent any data bundled with COOKIE-ECHO we need to
* resend.
*/
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, sctp_transport_t, transports); t = list_entry(pos, struct sctp_transport, transports);
sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, SCTP_TRANSPORT(t)); sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, SCTP_TRANSPORT(t));
} }
...@@ -3767,7 +3770,7 @@ sctp_disposition_t sctp_sf_do_prm_requestheartbeat( ...@@ -3767,7 +3770,7 @@ sctp_disposition_t sctp_sf_do_prm_requestheartbeat(
void *arg, void *arg,
sctp_cmd_seq_t *commands) sctp_cmd_seq_t *commands)
{ {
return sctp_sf_heartbeat(ep, asoc, type, (sctp_transport_t *)arg, return sctp_sf_heartbeat(ep, asoc, type, (struct sctp_transport *)arg,
commands); commands);
} }
...@@ -3837,6 +3840,13 @@ sctp_disposition_t sctp_sf_do_9_2_start_shutdown(const sctp_endpoint_t *ep, ...@@ -3837,6 +3840,13 @@ sctp_disposition_t sctp_sf_do_9_2_start_shutdown(const sctp_endpoint_t *ep,
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
SCTP_STATE(SCTP_STATE_SHUTDOWN_SENT)); SCTP_STATE(SCTP_STATE_SHUTDOWN_SENT));
/* sctp-implguide 2.10 Issues with Heartbeating and failover
*
* HEARTBEAT ... is discontinued after sending either SHUTDOWN
* or SHUTDOWN-ACK.
*/
sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_STOP, SCTP_NULL());
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
return SCTP_DISPOSITION_CONSUME; return SCTP_DISPOSITION_CONSUME;
...@@ -3889,6 +3899,14 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown_ack(const sctp_endpoint_t *ep, ...@@ -3889,6 +3899,14 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown_ack(const sctp_endpoint_t *ep,
/* Enter the SHUTDOWN-ACK-SENT state. */ /* Enter the SHUTDOWN-ACK-SENT state. */
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
SCTP_STATE(SCTP_STATE_SHUTDOWN_ACK_SENT)); SCTP_STATE(SCTP_STATE_SHUTDOWN_ACK_SENT));
/* sctp-implguide 2.10 Issues with Heartbeating and failover
*
* HEARTBEAT ... is discontinued after sending either SHUTDOWN
* or SHUTDOWN-ACK.
*/
sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_STOP, SCTP_NULL());
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
return SCTP_DISPOSITION_CONSUME; return SCTP_DISPOSITION_CONSUME;
...@@ -3933,7 +3951,7 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const sctp_endpoint_t *ep, ...@@ -3933,7 +3951,7 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const sctp_endpoint_t *ep,
void *arg, void *arg,
sctp_cmd_seq_t *commands) sctp_cmd_seq_t *commands)
{ {
sctp_transport_t *transport = arg; struct sctp_transport *transport = arg;
if (asoc->overall_error_count >= asoc->overall_error_threshold) { if (asoc->overall_error_count >= asoc->overall_error_threshold) {
/* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
...@@ -4333,7 +4351,7 @@ sctp_packet_t *sctp_ootb_pkt_new(const sctp_association_t *asoc, ...@@ -4333,7 +4351,7 @@ sctp_packet_t *sctp_ootb_pkt_new(const sctp_association_t *asoc,
const sctp_chunk_t *chunk) const sctp_chunk_t *chunk)
{ {
sctp_packet_t *packet; sctp_packet_t *packet;
sctp_transport_t *transport; struct sctp_transport *transport;
__u16 sport; __u16 sport;
__u16 dport; __u16 dport;
__u32 vtag; __u32 vtag;
......
...@@ -206,7 +206,7 @@ sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, ...@@ -206,7 +206,7 @@ sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
/* SCTP_STATE_COOKIE_WAIT */ \ /* SCTP_STATE_COOKIE_WAIT */ \
{.fn = sctp_sf_violation, .name = "sctp_sf_violation"}, \ {.fn = sctp_sf_violation, .name = "sctp_sf_violation"}, \
/* SCTP_STATE_COOKIE_ECHOED */ \ /* SCTP_STATE_COOKIE_ECHOED */ \
{.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \ {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
/* SCTP_STATE_ESTABLISHED */ \ /* SCTP_STATE_ESTABLISHED */ \
{.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \ {.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
/* SCTP_STATE_SHUTDOWN_PENDING */ \ /* SCTP_STATE_SHUTDOWN_PENDING */ \
...@@ -216,7 +216,7 @@ sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, ...@@ -216,7 +216,7 @@ sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \ /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
{.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \ {.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \ /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
{.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \ {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
} /* TYPE_SCTP_HEARTBEAT_ACK */ } /* TYPE_SCTP_HEARTBEAT_ACK */
#define TYPE_SCTP_ABORT { \ #define TYPE_SCTP_ABORT { \
...@@ -1089,11 +1089,11 @@ sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STA ...@@ -1089,11 +1089,11 @@ sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STA
/* SCTP_STATE_SHUTDOWN_PENDING */ \ /* SCTP_STATE_SHUTDOWN_PENDING */ \
{.fn = sctp_sf_sendbeat_8_3, .name = "sctp_sf_sendbeat_8_3"}, \ {.fn = sctp_sf_sendbeat_8_3, .name = "sctp_sf_sendbeat_8_3"}, \
/* SCTP_STATE_SHUTDOWN_SENT */ \ /* SCTP_STATE_SHUTDOWN_SENT */ \
{.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \ {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \ /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
{.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \ {.fn = sctp_sf_sendbeat_8_3, .name = "sctp_sf_sendbeat_8_3"}, \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \ /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
{.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \ {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
} }
#define TYPE_SCTP_EVENT_TIMEOUT_SACK { \ #define TYPE_SCTP_EVENT_TIMEOUT_SACK { \
......
...@@ -717,7 +717,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -717,7 +717,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
sctp_opt_t *sp; sctp_opt_t *sp;
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
sctp_association_t *new_asoc=NULL, *asoc=NULL; sctp_association_t *new_asoc=NULL, *asoc=NULL;
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_chunk_t *chunk = NULL; sctp_chunk_t *chunk = NULL;
union sctp_addr to; union sctp_addr to;
struct sockaddr *msg_name = NULL; struct sockaddr *msg_name = NULL;
...@@ -1253,7 +1253,7 @@ static inline int sctp_setsockopt_set_peer_addr_params(struct sock *sk, ...@@ -1253,7 +1253,7 @@ static inline int sctp_setsockopt_set_peer_addr_params(struct sock *sk,
struct sctp_paddrparams params; struct sctp_paddrparams params;
sctp_association_t *asoc; sctp_association_t *asoc;
union sctp_addr *addr; union sctp_addr *addr;
sctp_transport_t *trans; struct sctp_transport *trans;
int error; int error;
if (optlen != sizeof(struct sctp_paddrparams)) if (optlen != sizeof(struct sctp_paddrparams))
...@@ -1442,7 +1442,7 @@ SCTP_STATIC int sctp_connect(struct sock *sk, struct sockaddr *uaddr, ...@@ -1442,7 +1442,7 @@ SCTP_STATIC int sctp_connect(struct sock *sk, struct sockaddr *uaddr,
sctp_opt_t *sp; sctp_opt_t *sp;
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
sctp_association_t *asoc; sctp_association_t *asoc;
sctp_transport_t *transport; struct sctp_transport *transport;
union sctp_addr to; union sctp_addr to;
sctp_scope_t scope; sctp_scope_t scope;
long timeo; long timeo;
...@@ -1659,7 +1659,7 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, char *optval, ...@@ -1659,7 +1659,7 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, char *optval,
struct sctp_status status; struct sctp_status status;
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
sctp_association_t *assoc = NULL; sctp_association_t *assoc = NULL;
sctp_transport_t *transport; struct sctp_transport *transport;
sctp_assoc_t associd; sctp_assoc_t associd;
int retval = 0; int retval = 0;
...@@ -1878,7 +1878,7 @@ static inline int sctp_getsockopt_get_peer_addr_params(struct sock *sk, ...@@ -1878,7 +1878,7 @@ static inline int sctp_getsockopt_get_peer_addr_params(struct sock *sk,
struct sctp_paddrparams params; struct sctp_paddrparams params;
sctp_association_t *asoc; sctp_association_t *asoc;
union sctp_addr *addr; union sctp_addr *addr;
sctp_transport_t *trans; struct sctp_transport *trans;
if (len != sizeof(struct sctp_paddrparams)) if (len != sizeof(struct sctp_paddrparams))
return -EINVAL; return -EINVAL;
...@@ -1962,7 +1962,7 @@ static inline int sctp_getsockopt_get_peer_addrs(struct sock *sk, int len, ...@@ -1962,7 +1962,7 @@ static inline int sctp_getsockopt_get_peer_addrs(struct sock *sk, int len,
struct list_head *pos; struct list_head *pos;
int cnt = 0; int cnt = 0;
struct sctp_getaddrs getaddrs; struct sctp_getaddrs getaddrs;
sctp_transport_t *from; struct sctp_transport *from;
struct sockaddr_storage *to; struct sockaddr_storage *to;
if (len != sizeof(struct sctp_getaddrs)) if (len != sizeof(struct sctp_getaddrs))
...@@ -1981,7 +1981,7 @@ static inline int sctp_getsockopt_get_peer_addrs(struct sock *sk, int len, ...@@ -1981,7 +1981,7 @@ static inline int sctp_getsockopt_get_peer_addrs(struct sock *sk, int len,
to = getaddrs.addrs; to = getaddrs.addrs;
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
from = list_entry(pos, sctp_transport_t, transports); from = list_entry(pos, struct sctp_transport, transports);
if (copy_to_user(to, &from->ipaddr, sizeof(from->ipaddr))) if (copy_to_user(to, &from->ipaddr, sizeof(from->ipaddr)))
return -EFAULT; return -EFAULT;
to ++; to ++;
......
/* SCTP kernel reference Implementation /* SCTP kernel reference Implementation
* Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 International Business Machines Corp. * Copyright (c) 2001-2003 International Business Machines Corp.
* Copyright (c) 2001 Intel Corp. * Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 La Monte H.P. Yarroll * Copyright (c) 2001 La Monte H.P. Yarroll
* *
...@@ -54,11 +54,12 @@ ...@@ -54,11 +54,12 @@
/* 1st Level Abstractions. */ /* 1st Level Abstractions. */
/* Allocate and initialize a new transport. */ /* Allocate and initialize a new transport. */
sctp_transport_t *sctp_transport_new(const union sctp_addr *addr, int priority) struct sctp_transport *sctp_transport_new(const union sctp_addr *addr,
int priority)
{ {
sctp_transport_t *transport; struct sctp_transport *transport;
transport = t_new(sctp_transport_t, priority); transport = t_new(struct sctp_transport, priority);
if (!transport) if (!transport)
goto fail; goto fail;
...@@ -78,7 +79,7 @@ sctp_transport_t *sctp_transport_new(const union sctp_addr *addr, int priority) ...@@ -78,7 +79,7 @@ sctp_transport_t *sctp_transport_new(const union sctp_addr *addr, int priority)
} }
/* Intialize a new transport from provided memory. */ /* Intialize a new transport from provided memory. */
sctp_transport_t *sctp_transport_init(sctp_transport_t *peer, struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
const union sctp_addr *addr, const union sctp_addr *addr,
int priority) int priority)
{ {
...@@ -140,7 +141,7 @@ sctp_transport_t *sctp_transport_init(sctp_transport_t *peer, ...@@ -140,7 +141,7 @@ sctp_transport_t *sctp_transport_init(sctp_transport_t *peer,
/* This transport is no longer needed. Free up if possible, or /* This transport is no longer needed. Free up if possible, or
* delay until it last reference count. * delay until it last reference count.
*/ */
void sctp_transport_free(sctp_transport_t *transport) void sctp_transport_free(struct sctp_transport *transport)
{ {
transport->dead = 1; transport->dead = 1;
...@@ -154,7 +155,7 @@ void sctp_transport_free(sctp_transport_t *transport) ...@@ -154,7 +155,7 @@ void sctp_transport_free(sctp_transport_t *transport)
/* Destroy the transport data structure. /* Destroy the transport data structure.
* Assumes there are no more users of this structure. * Assumes there are no more users of this structure.
*/ */
void sctp_transport_destroy(sctp_transport_t *transport) void sctp_transport_destroy(struct sctp_transport *transport)
{ {
SCTP_ASSERT(transport->dead, "Transport is not dead", return); SCTP_ASSERT(transport->dead, "Transport is not dead", return);
...@@ -169,7 +170,7 @@ void sctp_transport_destroy(sctp_transport_t *transport) ...@@ -169,7 +170,7 @@ void sctp_transport_destroy(sctp_transport_t *transport)
/* Start T3_rtx timer if it is not already running and update the heartbeat /* Start T3_rtx timer if it is not already running and update the heartbeat
* timer. This routine is called everytime a DATA chunk is sent. * timer. This routine is called everytime a DATA chunk is sent.
*/ */
void sctp_transport_reset_timers(sctp_transport_t *transport) void sctp_transport_reset_timers(struct sctp_transport *transport)
{ {
/* RFC 2960 6.3.2 Retransmission Timer Rules /* RFC 2960 6.3.2 Retransmission Timer Rules
* *
...@@ -178,16 +179,15 @@ void sctp_transport_reset_timers(sctp_transport_t *transport) ...@@ -178,16 +179,15 @@ void sctp_transport_reset_timers(sctp_transport_t *transport)
* start it running so that it will expire after the RTO of that * start it running so that it will expire after the RTO of that
* address. * address.
*/ */
if (!timer_pending(&transport->T3_rtx_timer)) {
if (!timer_pending(&transport->T3_rtx_timer))
if (!mod_timer(&transport->T3_rtx_timer, if (!mod_timer(&transport->T3_rtx_timer,
jiffies + transport->rto)) jiffies + transport->rto))
sctp_transport_hold(transport); sctp_transport_hold(transport);
}
/* When a data chunk is sent, reset the heartbeat interval. */ /* When a data chunk is sent, reset the heartbeat interval. */
if (!mod_timer(&transport->hb_timer, transport->hb_interval + if (!mod_timer(&transport->hb_timer,
transport->rto + sctp_jitter(transport->rto) + sctp_transport_timeout(transport)))
jiffies))
sctp_transport_hold(transport); sctp_transport_hold(transport);
} }
...@@ -195,7 +195,7 @@ void sctp_transport_reset_timers(sctp_transport_t *transport) ...@@ -195,7 +195,7 @@ void sctp_transport_reset_timers(sctp_transport_t *transport)
* Initialize fields from the association or from the sock itself. * Initialize fields from the association or from the sock itself.
* Register the reference count in the association. * Register the reference count in the association.
*/ */
void sctp_transport_set_owner(sctp_transport_t *transport, void sctp_transport_set_owner(struct sctp_transport *transport,
sctp_association_t *asoc) sctp_association_t *asoc)
{ {
transport->asoc = asoc; transport->asoc = asoc;
...@@ -205,8 +205,8 @@ void sctp_transport_set_owner(sctp_transport_t *transport, ...@@ -205,8 +205,8 @@ void sctp_transport_set_owner(sctp_transport_t *transport,
/* Caches the dst entry for a transport's destination address and an optional /* Caches the dst entry for a transport's destination address and an optional
* souce address. * souce address.
*/ */
void sctp_transport_route(sctp_transport_t *transport, union sctp_addr *saddr, void sctp_transport_route(struct sctp_transport *transport,
struct sctp_opt *opt) union sctp_addr *saddr, struct sctp_opt *opt)
{ {
sctp_association_t *asoc = transport->asoc; sctp_association_t *asoc = transport->asoc;
struct sctp_af *af = transport->af_specific; struct sctp_af *af = transport->af_specific;
...@@ -277,7 +277,7 @@ void sctp_transport_route(sctp_transport_t *transport, union sctp_addr *saddr, ...@@ -277,7 +277,7 @@ void sctp_transport_route(sctp_transport_t *transport, union sctp_addr *saddr,
} }
/* Hold a reference to a transport. */ /* Hold a reference to a transport. */
void sctp_transport_hold(sctp_transport_t *transport) void sctp_transport_hold(struct sctp_transport *transport)
{ {
atomic_inc(&transport->refcnt); atomic_inc(&transport->refcnt);
} }
...@@ -285,14 +285,14 @@ void sctp_transport_hold(sctp_transport_t *transport) ...@@ -285,14 +285,14 @@ void sctp_transport_hold(sctp_transport_t *transport)
/* Release a reference to a transport and clean up /* Release a reference to a transport and clean up
* if there are no more references. * if there are no more references.
*/ */
void sctp_transport_put(sctp_transport_t *transport) void sctp_transport_put(struct sctp_transport *transport)
{ {
if (atomic_dec_and_test(&transport->refcnt)) if (atomic_dec_and_test(&transport->refcnt))
sctp_transport_destroy(transport); sctp_transport_destroy(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(sctp_transport_t *tp, __u32 rtt) void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
{ {
sctp_protocol_t *proto = sctp_get_protocol(); sctp_protocol_t *proto = sctp_get_protocol();
...@@ -362,8 +362,8 @@ void sctp_transport_update_rto(sctp_transport_t *tp, __u32 rtt) ...@@ -362,8 +362,8 @@ void sctp_transport_update_rto(sctp_transport_t *tp, __u32 rtt)
/* This routine updates the transport's cwnd and partial_bytes_acked /* This routine updates the transport's cwnd and partial_bytes_acked
* parameters based on the bytes acked in the received SACK. * parameters based on the bytes acked in the received SACK.
*/ */
void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn, void sctp_transport_raise_cwnd(struct sctp_transport *transport,
__u32 bytes_acked) __u32 sack_ctsn, __u32 bytes_acked)
{ {
__u32 cwnd, ssthresh, flight_size, pba, pmtu; __u32 cwnd, ssthresh, flight_size, pba, pmtu;
...@@ -391,8 +391,8 @@ void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn, ...@@ -391,8 +391,8 @@ void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn,
* two conditions are met can the cwnd be increased otherwise * two conditions are met can the cwnd be increased otherwise
* the cwnd MUST not be increased. If these conditions are met * the cwnd MUST not be increased. If these conditions are met
* then cwnd MUST be increased by at most the lesser of * then cwnd MUST be increased by at most the lesser of
* 1) the total size of the previously outstanding DATA chunk(s) * 1) the total size of the previously outstanding DATA
* acknowledged, and 2) the destination's path MTU. * chunk(s) acknowledged, and 2) the destination's path MTU.
*/ */
if (bytes_acked > pmtu) if (bytes_acked > pmtu)
cwnd += pmtu; cwnd += pmtu;
...@@ -405,18 +405,18 @@ void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn, ...@@ -405,18 +405,18 @@ void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn,
transport, bytes_acked, cwnd, transport, bytes_acked, cwnd,
ssthresh, flight_size, pba); ssthresh, flight_size, pba);
} else { } else {
/* RFC 2960 7.2.2 Whenever cwnd is greater than ssthresh, upon /* RFC 2960 7.2.2 Whenever cwnd is greater than ssthresh,
* each SACK arrival that advances the Cumulative TSN Ack Point, * upon each SACK arrival that advances the Cumulative TSN Ack
* increase partial_bytes_acked by the total number of bytes of * Point, increase partial_bytes_acked by the total number of
* all new chunks acknowledged in that SACK including chunks * bytes of all new chunks acknowledged in that SACK including
* acknowledged by the new Cumulative TSN Ack and by Gap Ack * chunks acknowledged by the new Cumulative TSN Ack and by
* Blocks. * Gap Ack Blocks.
* *
* When partial_bytes_acked is equal to or greater than cwnd and * When partial_bytes_acked is equal to or greater than cwnd
* before the arrival of the SACK the sender had cwnd or more * and before the arrival of the SACK the sender had cwnd or
* bytes of data outstanding (i.e., before arrival of the SACK, * more bytes of data outstanding (i.e., before arrival of the
* flightsize was greater than or equal to cwnd), increase cwnd * SACK, flightsize was greater than or equal to cwnd),
* by MTU, and reset partial_bytes_acked to * increase cwnd by MTU, and reset partial_bytes_acked to
* (partial_bytes_acked - cwnd). * (partial_bytes_acked - cwnd).
*/ */
pba += bytes_acked; pba += bytes_acked;
...@@ -439,7 +439,7 @@ void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn, ...@@ -439,7 +439,7 @@ void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn,
/* This routine is used to lower the transport's cwnd when congestion is /* This routine is used to lower the transport's cwnd when congestion is
* detected. * detected.
*/ */
void sctp_transport_lower_cwnd(sctp_transport_t *transport, void sctp_transport_lower_cwnd(struct sctp_transport *transport,
sctp_lower_cwnd_t reason) sctp_lower_cwnd_t reason)
{ {
switch (reason) { switch (reason) {
...@@ -516,3 +516,12 @@ void sctp_transport_lower_cwnd(sctp_transport_t *transport, ...@@ -516,3 +516,12 @@ void sctp_transport_lower_cwnd(sctp_transport_t *transport,
transport, reason, transport, reason,
transport->cwnd, transport->ssthresh); transport->cwnd, transport->ssthresh);
} }
/* What is the next timeout value for this transport? */
unsigned long sctp_transport_timeout(struct sctp_transport *t)
{
unsigned long timeout;
timeout = t->hb_interval + t->rto + sctp_jitter(t->rto);
timeout += jiffies;
return timeout;
}
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