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

Merge

parents 3c1ef96d b5c1e5fd
/* SCTP kernel reference Implementation Copyright (C) 1999-2001
* Cisco, Motorola, and IBM
*
*
* This file is part of the SCTP kernel reference Implementation
*
*
* These are the definitions needed for the command object.
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* the SCTP reference implementation is distributed in the hope that it
*
* the SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to one of the
* following email addresses:
*
*
* La Monte H.P. Yarroll <piggy@acm.org>
* Karl Knutson <karl@athena.chicago.il.us>
* Ardelle Fan <ardelle.fan@intel.com>
*
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
......@@ -72,8 +72,9 @@ typedef enum {
SCTP_CMD_SET_BIND_ADDR, /* Set the association bind_addr. */
SCTP_CMD_STRIKE, /* Mark a strike against a transport. */
SCTP_CMD_TRANSMIT, /* Transmit the outqueue. */
SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
SCTP_CMD_HB_TIMERS_UPDATE, /* Update the heartbeat timers. */
SCTP_CMD_HB_TIMERS_START, /* Start 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_ON, /* Mark the transport as active. */
SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */
......@@ -112,7 +113,7 @@ typedef union {
void *ptr;
sctp_chunk_t *chunk;
sctp_association_t *asoc;
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_bind_addr_t *bp;
sctp_init_chunk_t *init;
sctp_ulpevent_t *ulpevent;
......@@ -160,7 +161,7 @@ SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
SCTP_ARG_CONSTRUCTOR(CHUNK, sctp_chunk_t *, chunk)
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(PEER_INIT, sctp_init_chunk_t *, init)
SCTP_ARG_CONSTRUCTOR(ULPEVENT, sctp_ulpevent_t *, ulpevent)
......
......@@ -256,7 +256,7 @@ sctp_chunk_t *sctp_make_abort_user(const sctp_association_t *,
const sctp_chunk_t *,
const struct msghdr *);
sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *,
const sctp_transport_t *,
const struct sctp_transport *,
const void *payload,
const size_t paylen);
sctp_chunk_t *sctp_make_heartbeat_ack(const sctp_association_t *,
......
......@@ -107,7 +107,7 @@ union sctp_addr {
struct sctp_protocol;
struct SCTP_endpoint;
struct SCTP_association;
struct SCTP_transport;
struct sctp_transport;
struct SCTP_packet;
struct SCTP_chunk;
struct SCTP_inqueue;
......@@ -121,7 +121,6 @@ struct sctp_ssnmap;
typedef struct sctp_protocol sctp_protocol_t;
typedef struct SCTP_endpoint sctp_endpoint_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_chunk sctp_chunk_t;
typedef struct SCTP_inqueue sctp_inqueue_t;
......@@ -360,7 +359,7 @@ typedef struct sctp_cookie {
struct timeval expiration;
/* Number of inbound/outbound streams which are set
* and negotiated during the INIT process.
* and negotiated during the INIT process.
*/
__u16 sinit_num_ostreams;
__u16 sinit_max_instreams;
......@@ -561,7 +560,7 @@ struct SCTP_chunk {
* For an outbound chunk, it tells us where we'd like it to
* 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,
......@@ -605,7 +604,7 @@ struct SCTP_packet {
* The function we finally use to pass down to the next lower
* layer lives in the transport structure.
*/
sctp_transport_t *transport;
struct sctp_transport *transport;
/* Allow a callback for getting a high priority chunk
* bundled early into the packet (This is used for ECNE).
......@@ -630,7 +629,7 @@ typedef int (sctp_outq_thandler_t)(struct sctp_outq *, void *);
typedef int (sctp_outq_ehandler_t)(struct sctp_outq *);
typedef sctp_packet_t *(sctp_outq_ohandler_init_t)
(sctp_packet_t *,
sctp_transport_t *,
struct sctp_transport *,
__u16 sport,
__u16 dport);
typedef sctp_packet_t *(sctp_outq_ohandler_config_t)
......@@ -670,7 +669,7 @@ void sctp_packet_free(sctp_packet_t *);
* period.
*
*/
struct SCTP_transport {
struct sctp_transport {
/* A list of transports. */
struct list_head transports;
......@@ -819,24 +818,25 @@ struct SCTP_transport {
int malloced; /* Is this structure kfree()able? */
};
extern sctp_transport_t *sctp_transport_new(const union sctp_addr *, int);
extern sctp_transport_t *sctp_transport_init(sctp_transport_t *,
const union sctp_addr *, int);
extern void sctp_transport_set_owner(sctp_transport_t *, sctp_association_t *);
extern void sctp_transport_route(sctp_transport_t *, union sctp_addr *,
struct sctp_opt *);
extern void sctp_transport_free(sctp_transport_t *);
extern void sctp_transport_destroy(sctp_transport_t *);
extern void sctp_transport_reset_timers(sctp_transport_t *);
extern void sctp_transport_hold(sctp_transport_t *);
extern void sctp_transport_put(sctp_transport_t *);
extern void sctp_transport_update_rto(sctp_transport_t *, __u32);
extern void sctp_transport_raise_cwnd(sctp_transport_t *, __u32, __u32);
extern void sctp_transport_lower_cwnd(sctp_transport_t *, sctp_lower_cwnd_t);
struct sctp_transport *sctp_transport_new(const union sctp_addr *, int);
struct sctp_transport *sctp_transport_init(struct sctp_transport *,
const union sctp_addr *, int);
void sctp_transport_set_owner(struct sctp_transport *, sctp_association_t *);
void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
struct sctp_opt *);
void sctp_transport_free(struct sctp_transport *);
void sctp_transport_destroy(struct sctp_transport *);
void sctp_transport_reset_timers(struct sctp_transport *);
void sctp_transport_hold(struct sctp_transport *);
void sctp_transport_put(struct sctp_transport *);
void sctp_transport_update_rto(struct sctp_transport *, __u32);
void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
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
* SCTP. We write packets to it and read chunks from it. It handles
* fragment reassembly and chunk unbundling.
* SCTP. We write packets to it and read chunks from it.
*/
struct SCTP_inqueue {
/* This is actually a queue of sctp_chunk_t each
......@@ -940,9 +940,8 @@ int sctp_outq_set_output_handlers(struct sctp_outq *,
sctp_outq_ohandler_t build,
sctp_outq_ohandler_force_t force);
void sctp_outq_restart(struct sctp_outq *);
void sctp_retransmit(struct sctp_outq *, sctp_transport_t *,
sctp_retransmit_reason_t);
void sctp_retransmit_mark(struct sctp_outq *, sctp_transport_t *, __u8);
void sctp_retransmit(struct sctp_outq *, struct sctp_transport *, __u8);
void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8);
/* These bind address data fields common between endpoints and associations */
......@@ -1131,7 +1130,7 @@ void sctp_endpoint_hold(sctp_endpoint_t *);
void sctp_endpoint_add_asoc(sctp_endpoint_t *, sctp_association_t *asoc);
sctp_association_t *sctp_endpoint_lookup_assoc(const sctp_endpoint_t *ep,
const union sctp_addr *paddr,
sctp_transport_t **);
struct sctp_transport **);
int sctp_endpoint_is_peeled_off(sctp_endpoint_t *, const union sctp_addr *);
sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *,
const union sctp_addr *);
......@@ -1232,7 +1231,7 @@ struct SCTP_association {
* designate the connection we are currently using to
* 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
* need a an address for msg_name.
......@@ -1243,7 +1242,7 @@ struct SCTP_association {
* The path that we are currently using to
* transmit new data and most control chunks.
*/
sctp_transport_t *active_path;
struct sctp_transport *active_path;
/* retran_path
*
......@@ -1255,13 +1254,13 @@ struct SCTP_association {
* different from the last destination address to
* which the DATA chunk was sent.
*/
sctp_transport_t *retran_path;
struct sctp_transport *retran_path;
/* 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. */
sctp_transport_t *last_data_from;
struct sctp_transport *last_data_from;
/*
* Mapping An array of bits or bytes indicating which out of
......@@ -1373,7 +1372,7 @@ struct SCTP_association {
struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
/* 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
* : DATA chunk. This is sent in the INIT or INIT
......@@ -1612,18 +1611,19 @@ void sctp_association_free(sctp_association_t *);
void sctp_association_put(sctp_association_t *);
void sctp_association_hold(sctp_association_t *);
sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *);
sctp_transport_t *sctp_assoc_lookup_paddr(const sctp_association_t *,
struct sctp_transport *sctp_assoc_choose_shutdown_transport(sctp_association_t *);
struct sctp_transport *sctp_assoc_lookup_paddr(const sctp_association_t *,
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 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_t *sctp_assoc_lookup_tsn(sctp_association_t *, __u32);
sctp_transport_t *sctp_assoc_is_match(sctp_association_t *,
const union sctp_addr *,
const union sctp_addr *);
struct sctp_transport *sctp_assoc_lookup_tsn(sctp_association_t *, __u32);
struct sctp_transport *sctp_assoc_is_match(sctp_association_t *,
const union sctp_addr *,
const union sctp_addr *);
void sctp_assoc_migrate(sctp_association_t *, struct sock *);
void sctp_assoc_update(sctp_association_t *dst, sctp_association_t *src);
......
......@@ -291,7 +291,7 @@ sctp_association_t *sctp_association_init(sctp_association_t *asoc,
*/
void sctp_association_free(sctp_association_t *asoc)
{
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_endpoint_t *ep;
struct list_head *pos, *temp;
int i;
......@@ -337,7 +337,7 @@ void sctp_association_free(sctp_association_t *asoc)
/* Release the transport structures. */
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);
sctp_transport_free(transport);
}
......@@ -363,11 +363,11 @@ static void sctp_association_destroy(sctp_association_t *asoc)
/* Add a transport address to an association. */
sctp_transport_t *sctp_assoc_add_peer(sctp_association_t *asoc,
const union sctp_addr *addr,
int priority)
struct sctp_transport *sctp_assoc_add_peer(sctp_association_t *asoc,
const union sctp_addr *addr,
int priority)
{
sctp_transport_t *peer;
struct sctp_transport *peer;
sctp_opt_t *sp;
unsigned short port;
......@@ -476,16 +476,16 @@ sctp_transport_t *sctp_assoc_add_peer(sctp_association_t *asoc,
}
/* 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)
{
sctp_transport_t *t;
struct sctp_transport *t;
struct list_head *pos;
/* Cycle through all transports searching for a peer address. */
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))
return t;
}
......@@ -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.
*/
void sctp_assoc_control_transport(sctp_association_t *asoc,
sctp_transport_t *transport,
struct sctp_transport *transport,
sctp_transport_cmd_t command,
sctp_sn_error_t error)
{
sctp_transport_t *t = NULL;
sctp_transport_t *first;
sctp_transport_t *second;
struct sctp_transport *t = NULL;
struct sctp_transport *first;
struct sctp_transport *second;
sctp_ulpevent_t *event;
struct list_head *pos;
int spc_state = 0;
......@@ -545,7 +545,7 @@ void sctp_assoc_control_transport(sctp_association_t *asoc,
first = NULL; second = NULL;
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)
continue;
......@@ -693,12 +693,12 @@ sctp_chunk_t *sctp_get_no_prepend(sctp_association_t *asoc)
/*
* 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;
sctp_transport_t *match;
struct sctp_transport *active;
struct sctp_transport *match;
struct list_head *entry, *pos;
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_chunk_t *chunk;
__u32 key = htonl(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. */
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)
break;
......@@ -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? */
sctp_transport_t *sctp_assoc_is_match(sctp_association_t *asoc,
const union sctp_addr *laddr,
const union sctp_addr *paddr)
struct sctp_transport *sctp_assoc_is_match(sctp_association_t *asoc,
const union sctp_addr *laddr,
const union sctp_addr *paddr)
{
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_read_lock(&asoc->base.addr_lock);
......@@ -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
* 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 *pos;
......@@ -922,7 +922,7 @@ sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *asoc)
else
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. */
......
......@@ -262,7 +262,7 @@ sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *ep,
sctp_association_t *__sctp_endpoint_lookup_assoc(
const sctp_endpoint_t *endpoint,
const union sctp_addr *paddr,
sctp_transport_t **transport)
struct sctp_transport **transport)
{
int rport;
sctp_association_t *asoc;
......@@ -287,9 +287,10 @@ sctp_association_t *__sctp_endpoint_lookup_assoc(
}
/* Lookup association on an endpoint based on a peer address. BH-safe. */
sctp_association_t *sctp_endpoint_lookup_assoc(const sctp_endpoint_t *ep,
const union sctp_addr *paddr,
sctp_transport_t **transport)
sctp_association_t *sctp_endpoint_lookup_assoc(
const sctp_endpoint_t *ep,
const union sctp_addr *paddr,
struct sctp_transport **transport)
{
sctp_association_t *asoc;
......@@ -331,7 +332,7 @@ static void sctp_endpoint_bh_rcv(sctp_endpoint_t *ep)
{
sctp_association_t *asoc;
struct sock *sk;
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_chunk_t *chunk;
sctp_inqueue_t *inqueue;
sctp_subtype_t subtype;
......
......@@ -66,7 +66,7 @@ static int sctp_rcv_ootb(struct sk_buff *);
sctp_association_t *__sctp_rcv_lookup(struct sk_buff *skb,
const union sctp_addr *laddr,
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);
......@@ -104,7 +104,7 @@ int sctp_rcv(struct sk_buff *skb)
sctp_association_t *asoc;
sctp_endpoint_t *ep = NULL;
sctp_endpoint_common_t *rcvr;
sctp_transport_t *transport = NULL;
struct sctp_transport *transport = NULL;
sctp_chunk_t *chunk;
struct sctphdr *sh;
union sctp_addr src;
......@@ -601,12 +601,12 @@ void __sctp_unhash_established(sctp_association_t *asoc)
/* Look up an association. */
sctp_association_t *__sctp_lookup_association(const union sctp_addr *laddr,
const union sctp_addr *paddr,
sctp_transport_t **transportp)
struct sctp_transport **transportp)
{
sctp_hashbucket_t *head;
sctp_endpoint_common_t *epb;
sctp_association_t *asoc;
sctp_transport_t *transport;
struct sctp_transport *transport;
int hash;
/* Optimize here for direct hit, only listening connections can
......@@ -637,7 +637,7 @@ sctp_association_t *__sctp_lookup_association(const union sctp_addr *laddr,
/* Look up an association. BH-safe. */
sctp_association_t *sctp_lookup_association(const union sctp_addr *laddr,
const union sctp_addr *paddr,
sctp_transport_t **transportp)
struct sctp_transport **transportp)
{
sctp_association_t *asoc;
......@@ -653,7 +653,7 @@ int sctp_has_association(const union sctp_addr *laddr,
const union sctp_addr *paddr)
{
sctp_association_t *asoc;
sctp_transport_t *transport;
struct sctp_transport *transport;
if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) {
sock_put(asoc->base.sk);
......@@ -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,
const union sctp_addr *laddr, sctp_transport_t **transportp)
const union sctp_addr *laddr, struct sctp_transport **transportp)
{
sctp_association_t *asoc;
union sctp_addr addr;
......@@ -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,
const union sctp_addr *paddr,
const union sctp_addr *laddr,
sctp_transport_t **transportp)
struct sctp_transport **transportp)
{
sctp_association_t *asoc;
......
......@@ -90,7 +90,7 @@ sctp_packet_t *sctp_packet_config(sctp_packet_t *packet,
/* Initialize the packet structure. */
sctp_packet_t *sctp_packet_init(sctp_packet_t *packet,
sctp_transport_t *transport,
struct sctp_transport *transport,
__u16 sport,
__u16 dport)
{
......@@ -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)
{
sctp_transport_t *transport = packet->transport;
struct sctp_transport *transport = packet->transport;
sctp_association_t *asoc = transport->asoc;
struct sctphdr *sh;
__u32 crc32;
......@@ -477,7 +477,7 @@ static sctp_xmit_t sctp_packet_append_data(sctp_packet_t *packet,
{
sctp_xmit_t retval = SCTP_XMIT_OK;
size_t datasize, rwnd, inflight;
sctp_transport_t *transport = packet->transport;
struct sctp_transport *transport = packet->transport;
__u32 max_burst_bytes;
/* RFC 2960 6.1 Transmission of DATA Chunks
......
......@@ -58,7 +58,7 @@
static int sctp_acked(sctp_sackhdr_t *sack, __u32 tsn);
static void sctp_check_transmitted(struct sctp_outq *q,
struct list_head *transmitted_queue,
sctp_transport_t *transport,
struct sctp_transport *transport,
sctp_sackhdr_t *sack,
__u32 highest_new_tsn);
......@@ -104,13 +104,13 @@ void sctp_outq_init(sctp_association_t *asoc, 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;
sctp_chunk_t *chunk;
/* Throw away unacknowledged chunks. */
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))) {
chunk = list_entry(lchunk, sctp_chunk_t,
transmitted_list);
......@@ -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. */
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)
{
struct list_head *lchunk, *ltemp;
sctp_chunk_t *chunk;
/* Walk through the specified transmitted queue. */
list_for_each_safe(lchunk, ltemp, &transport->transmitted) {
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,
/* Mark all the eligible packets on a transport for retransmission and force
* 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)
{
int error = 0;
......@@ -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 *lchunk;
sctp_transport_t *transport = pkt->transport;
struct sctp_transport *transport = pkt->transport;
sctp_xmit_t status;
sctp_chunk_t *chunk;
sctp_association_t *asoc;
......@@ -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,
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;
sctp_xmit_t status;
int error;
......@@ -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 *ecne_handler = NULL;
struct sk_buff_head *queue;
sctp_transport_t *transport = NULL;
sctp_transport_t *new_transport;
struct sctp_transport *transport = NULL;
struct sctp_transport *new_transport;
sctp_chunk_t *chunk;
sctp_xmit_t status;
int error = 0;
......@@ -967,8 +967,9 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
* --xguo
*/
while ((ltransport = sctp_list_dequeue(&transport_list)) != NULL ) {
sctp_transport_t *t = list_entry(ltransport,
sctp_transport_t, send_ready);
struct sctp_transport *t = list_entry(ltransport,
struct sctp_transport,
send_ready);
if (t != transport)
transport = t;
......@@ -1020,7 +1021,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack,
sctp_association_t *asoc)
{
struct list_head *ltransport, *lchunk;
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_chunk_t *chunk;
__u32 highest_new_tsn, tsn;
struct list_head *transport_list = &asoc->peer.transport_addr_list;
......@@ -1028,7 +1029,7 @@ static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack,
highest_new_tsn = ntohl(sack->cum_tsn_ack);
list_for_each(ltransport, transport_list) {
transport = list_entry(ltransport, sctp_transport_t,
transport = list_entry(ltransport, struct sctp_transport,
transports);
list_for_each(lchunk, &transport->transmitted) {
chunk = list_entry(lchunk, sctp_chunk_t,
......@@ -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)
{
sctp_association_t *asoc = q->asoc;
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_chunk_t *tchunk;
struct list_head *lchunk, *transport_list, *pos;
sctp_sack_variable_t *frags = sack->variable;
......@@ -1089,7 +1090,8 @@ int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack)
* This is a MASSIVE candidate for optimization.
*/
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,
transport, sack, highest_new_tsn);
}
......@@ -1142,7 +1144,8 @@ int sctp_outq_sack(struct sctp_outq *q, sctp_sackhdr_t *sack)
goto finish;
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);
if (!q->empty)
goto finish;
......@@ -1178,7 +1181,7 @@ int sctp_outq_is_empty(const struct sctp_outq *q)
*/
static void sctp_check_transmitted(struct sctp_outq *q,
struct list_head *transmitted_queue,
sctp_transport_t *transport,
struct sctp_transport *transport,
sctp_sackhdr_t *sack,
__u32 highest_new_tsn_in_sack)
{
......
......@@ -897,7 +897,7 @@ sctp_chunk_t *sctp_make_abort_user(const sctp_association_t *asoc,
/* Make a HEARTBEAT chunk. */
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)
{
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,
/* Cast away the 'const', as this is just telling the chunk
* 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);
nodata:
......@@ -1686,7 +1686,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid,
int priority)
{
union sctp_params param;
sctp_transport_t *transport;
struct sctp_transport *transport;
struct list_head *pos, *temp;
char *cookie;
......@@ -1761,7 +1761,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid,
* advertised window).
*/
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;
}
......@@ -1801,7 +1801,7 @@ int sctp_process_init(sctp_association_t *asoc, sctp_cid_t cid,
clean_up:
/* Release the transport structures. */
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);
sctp_transport_free(transport);
}
......
......@@ -56,33 +56,31 @@
#include <net/sctp/sm.h>
/* Do forward declarations of static functions. */
static void sctp_do_ecn_ce_work(sctp_association_t *asoc,
__u32 lowest_tsn);
static void sctp_do_ecn_ce_work(sctp_association_t *,__u32 lowest_tsn);
static sctp_chunk_t *sctp_do_ecn_ecne_work(sctp_association_t *asoc,
__u32 lowest_tsn,
sctp_chunk_t *);
static void sctp_do_ecn_cwr_work(sctp_association_t *asoc,
__u32 lowest_tsn);
static void sctp_do_8_2_transport_strike(sctp_association_t *asoc,
sctp_transport_t *transport);
static void sctp_cmd_init_failed(sctp_cmd_seq_t *, sctp_association_t *asoc);
static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *, sctp_association_t *asoc,
sctp_event_t event_type, sctp_subtype_t stype,
static void sctp_do_ecn_cwr_work(sctp_association_t *,__u32 lowest_tsn);
static void sctp_do_8_2_transport_strike(sctp_association_t *,
struct sctp_transport *);
static void sctp_cmd_init_failed(sctp_cmd_seq_t *, sctp_association_t *);
static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *, sctp_association_t *,
sctp_event_t, sctp_subtype_t,
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_init_chunk_t *peer_init,
int priority);
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 *,
sctp_transport_t *);
static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *, sctp_association_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 *,
sctp_bind_addr_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 *,
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 *,
sctp_sackhdr_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,
struct list_head *pos;
struct timer_list *timer;
unsigned long timeout;
sctp_transport_t *t;
struct sctp_transport *t;
sctp_sackhdr_t sackh;
if(SCTP_EVENT_T_TIMEOUT != event_type)
......@@ -503,7 +501,7 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype,
* COOKIE-ECHO we need to resend.
*/
list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, sctp_transport_t,
t = list_entry(pos, struct sctp_transport,
transports);
sctp_retransmit_mark(&asoc->outqueue, t, 0);
}
......@@ -573,9 +571,13 @@ int sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype,
sctp_cmd_hb_timers_start(commands, asoc);
break;
case SCTP_CMD_HB_TIMERS_UPDATE:
case SCTP_CMD_HB_TIMER_UPDATE:
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;
case SCTP_CMD_REPORT_ERROR:
......@@ -657,7 +659,7 @@ static sctp_chunk_t *sctp_do_ecn_ecne_work(sctp_association_t *asoc,
* recent than the last response.
*/
if (TSN_lt(asoc->last_cwr_tsn, lowest_tsn)) {
sctp_transport_t *transport;
struct sctp_transport *transport;
/* Find which transport's congestion variables
* need to be adjusted.
......@@ -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)
{
int error;
sctp_transport_t *transport = (sctp_transport_t *) peer;
struct sctp_transport *transport = (struct sctp_transport *) peer;
sctp_association_t *asoc = transport->asoc;
/* Check whether a task is in the sock. */
......@@ -918,7 +920,7 @@ void sctp_generate_autoclose_event(unsigned long data)
void sctp_generate_heartbeat_event(unsigned long data)
{
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_bh_lock_sock(asoc->base.sk);
......@@ -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,
sctp_transport_t *transport)
struct sctp_transport *transport)
{
/* The check for association's overall error counter exceeding the
* threshold is done in the state function.
......@@ -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,
sctp_association_t *asoc)
{
sctp_transport_t *t;
struct sctp_transport *t;
struct list_head *pos;
/* 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,
* the needed data structures go away.
*/
list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, sctp_transport_t, transports);
if (!mod_timer(&t->hb_timer, t->hb_interval + t->rto +
sctp_jitter(t->rto) + jiffies)) {
t = list_entry(pos, struct sctp_transport, transports);
if (!mod_timer(&t->hb_timer, sctp_transport_timeout(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. */
static void sctp_cmd_hb_timers_update(sctp_cmd_seq_t *cmds,
sctp_association_t *asoc,
sctp_transport_t *t)
static void sctp_cmd_hb_timer_update(sctp_cmd_seq_t *cmds,
sctp_association_t *asoc,
struct sctp_transport *t)
{
/* Update the heartbeat timer. */
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);
}
......@@ -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. */
static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
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;
......@@ -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,
sctp_association_t *asoc,
sctp_transport_t *t)
struct sctp_transport *t)
{
sctp_transport_lower_cwnd(t, SCTP_LOWER_CWND_INACTIVE);
......@@ -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,
sctp_chunk_t *chunk)
{
sctp_transport_t *t;
struct sctp_transport *t;
t = sctp_assoc_choose_shutdown_transport(asoc);
asoc->shutdown_last_sent_to = t;
......
......@@ -678,7 +678,7 @@ sctp_disposition_t sctp_sf_heartbeat(const sctp_endpoint_t *ep,
void *arg,
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_sender_hb_info_t hbinfo;
size_t paylen = 0;
......@@ -711,7 +711,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const sctp_endpoint_t *ep,
void *arg,
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) {
/* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
......@@ -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_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));
return SCTP_DISPOSITION_CONSUME;
......@@ -842,7 +842,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const sctp_endpoint_t *ep,
{
sctp_chunk_t *chunk = arg;
union sctp_addr from_addr;
sctp_transport_t *link;
struct sctp_transport *link;
sctp_sender_hb_info_t *hbinfo;
unsigned long max_interval;
......@@ -944,7 +944,7 @@ static int sctp_sf_check_restart_addrs(const sctp_association_t *new_asoc,
sctp_chunk_t *init,
sctp_cmd_seq_t *commands)
{
sctp_transport_t *new_addr, *addr;
struct sctp_transport *new_addr, *addr;
struct list_head *pos, *pos2;
int found;
......@@ -963,10 +963,11 @@ static int sctp_sf_check_restart_addrs(const sctp_association_t *new_asoc,
found = 0;
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;
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,
&addr->ipaddr)) {
found = 1;
......@@ -1629,7 +1630,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const sctp_endpoint_t *ep,
new_asoc);
break;
case 'C': /* Collisioun case C. */
case 'C': /* Collision case C. */
retval = sctp_sf_do_dupcook_c(ep, asoc, chunk, commands,
new_asoc);
break;
......@@ -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_errhdr_t *err;
struct list_head *pos;
sctp_transport_t *t;
struct sctp_transport *t;
sctp_chunk_t *reply;
sctp_bind_addr_t *bp;
int attempts;
......@@ -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_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) {
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));
}
......@@ -3767,7 +3770,7 @@ sctp_disposition_t sctp_sf_do_prm_requestheartbeat(
void *arg,
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);
}
......@@ -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_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));
return SCTP_DISPOSITION_CONSUME;
......@@ -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. */
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
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));
return SCTP_DISPOSITION_CONSUME;
......@@ -3933,7 +3951,7 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const sctp_endpoint_t *ep,
void *arg,
sctp_cmd_seq_t *commands)
{
sctp_transport_t *transport = arg;
struct sctp_transport *transport = arg;
if (asoc->overall_error_count >= asoc->overall_error_threshold) {
/* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
......@@ -4333,7 +4351,7 @@ sctp_packet_t *sctp_ootb_pkt_new(const sctp_association_t *asoc,
const sctp_chunk_t *chunk)
{
sctp_packet_t *packet;
sctp_transport_t *transport;
struct sctp_transport *transport;
__u16 sport;
__u16 dport;
__u32 vtag;
......
......@@ -206,7 +206,7 @@ sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
/* SCTP_STATE_COOKIE_WAIT */ \
{.fn = sctp_sf_violation, .name = "sctp_sf_violation"}, \
/* 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 */ \
{.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
/* SCTP_STATE_SHUTDOWN_PENDING */ \
......@@ -216,7 +216,7 @@ sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
{.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
/* 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 */
#define TYPE_SCTP_ABORT { \
......@@ -1089,11 +1089,11 @@ sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STA
/* SCTP_STATE_SHUTDOWN_PENDING */ \
{.fn = sctp_sf_sendbeat_8_3, .name = "sctp_sf_sendbeat_8_3"}, \
/* 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 */ \
{.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 */ \
{.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 { \
......
......@@ -717,7 +717,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
sctp_opt_t *sp;
sctp_endpoint_t *ep;
sctp_association_t *new_asoc=NULL, *asoc=NULL;
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_chunk_t *chunk = NULL;
union sctp_addr to;
struct sockaddr *msg_name = NULL;
......@@ -1253,7 +1253,7 @@ static inline int sctp_setsockopt_set_peer_addr_params(struct sock *sk,
struct sctp_paddrparams params;
sctp_association_t *asoc;
union sctp_addr *addr;
sctp_transport_t *trans;
struct sctp_transport *trans;
int error;
if (optlen != sizeof(struct sctp_paddrparams))
......@@ -1442,7 +1442,7 @@ SCTP_STATIC int sctp_connect(struct sock *sk, struct sockaddr *uaddr,
sctp_opt_t *sp;
sctp_endpoint_t *ep;
sctp_association_t *asoc;
sctp_transport_t *transport;
struct sctp_transport *transport;
union sctp_addr to;
sctp_scope_t scope;
long timeo;
......@@ -1659,7 +1659,7 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, char *optval,
struct sctp_status status;
sctp_endpoint_t *ep;
sctp_association_t *assoc = NULL;
sctp_transport_t *transport;
struct sctp_transport *transport;
sctp_assoc_t associd;
int retval = 0;
......@@ -1878,7 +1878,7 @@ static inline int sctp_getsockopt_get_peer_addr_params(struct sock *sk,
struct sctp_paddrparams params;
sctp_association_t *asoc;
union sctp_addr *addr;
sctp_transport_t *trans;
struct sctp_transport *trans;
if (len != sizeof(struct sctp_paddrparams))
return -EINVAL;
......@@ -1962,7 +1962,7 @@ static inline int sctp_getsockopt_get_peer_addrs(struct sock *sk, int len,
struct list_head *pos;
int cnt = 0;
struct sctp_getaddrs getaddrs;
sctp_transport_t *from;
struct sctp_transport *from;
struct sockaddr_storage *to;
if (len != sizeof(struct sctp_getaddrs))
......@@ -1981,7 +1981,7 @@ static inline int sctp_getsockopt_get_peer_addrs(struct sock *sk, int len,
to = getaddrs.addrs;
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)))
return -EFAULT;
to ++;
......
/* SCTP kernel reference Implementation
* Copyright (c) 1999-2000 Cisco, 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 La Monte H.P. Yarroll
*
......@@ -54,11 +54,12 @@
/* 1st Level Abstractions. */
/* 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)
goto fail;
......@@ -78,9 +79,9 @@ sctp_transport_t *sctp_transport_new(const union sctp_addr *addr, int priority)
}
/* Intialize a new transport from provided memory. */
sctp_transport_t *sctp_transport_init(sctp_transport_t *peer,
const union sctp_addr *addr,
int priority)
struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
const union sctp_addr *addr,
int priority)
{
sctp_protocol_t *proto = sctp_get_protocol();
......@@ -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
* 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;
......@@ -154,7 +155,7 @@ void sctp_transport_free(sctp_transport_t *transport)
/* Destroy the transport data 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);
......@@ -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
* 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
*
......@@ -178,24 +179,23 @@ void sctp_transport_reset_timers(sctp_transport_t *transport)
* start it running so that it will expire after the RTO of that
* address.
*/
if (!timer_pending(&transport->T3_rtx_timer)) {
if (!timer_pending(&transport->T3_rtx_timer))
if (!mod_timer(&transport->T3_rtx_timer,
jiffies + transport->rto))
sctp_transport_hold(transport);
}
/* When a data chunk is sent, reset the heartbeat interval. */
if (!mod_timer(&transport->hb_timer, transport->hb_interval +
transport->rto + sctp_jitter(transport->rto) +
jiffies))
sctp_transport_hold(transport);
if (!mod_timer(&transport->hb_timer,
sctp_transport_timeout(transport)))
sctp_transport_hold(transport);
}
/* This transport has been assigned to an association.
* Initialize fields from the association or from the sock itself.
* 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)
{
transport->asoc = asoc;
......@@ -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
* souce address.
*/
void sctp_transport_route(sctp_transport_t *transport, union sctp_addr *saddr,
struct sctp_opt *opt)
void sctp_transport_route(struct sctp_transport *transport,
union sctp_addr *saddr, struct sctp_opt *opt)
{
sctp_association_t *asoc = transport->asoc;
struct sctp_af *af = transport->af_specific;
......@@ -277,7 +277,7 @@ void sctp_transport_route(sctp_transport_t *transport, union sctp_addr *saddr,
}
/* 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);
}
......@@ -285,14 +285,14 @@ void sctp_transport_hold(sctp_transport_t *transport)
/* Release a reference to a transport and clean up
* 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))
sctp_transport_destroy(transport);
}
/* 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();
......@@ -332,7 +332,7 @@ void sctp_transport_update_rto(sctp_transport_t *tp, __u32 rtt)
if (tp->rttvar == 0)
tp->rttvar = SCTP_CLOCK_GRANULARITY;
/* 6.3.1 C3) After the computation, update RTO <- SRTT + 4 * RTTVAR. */
/* 6.3.1 C3) After the computation, update RTO <- SRTT + 4 * RTTVAR. */
tp->rto = tp->srtt + (tp->rttvar << 2);
/* 6.3.1 C6) Whenever RTO is computed, if it is less than RTO.Min
......@@ -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
* parameters based on the bytes acked in the received SACK.
*/
void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn,
__u32 bytes_acked)
void sctp_transport_raise_cwnd(struct sctp_transport *transport,
__u32 sack_ctsn, __u32 bytes_acked)
{
__u32 cwnd, ssthresh, flight_size, pba, pmtu;
......@@ -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
* the cwnd MUST not be increased. If these conditions are met
* then cwnd MUST be increased by at most the lesser of
* 1) the total size of the previously outstanding DATA chunk(s)
* acknowledged, and 2) the destination's path MTU.
* 1) the total size of the previously outstanding DATA
* chunk(s) acknowledged, and 2) the destination's path MTU.
*/
if (bytes_acked > pmtu)
cwnd += pmtu;
......@@ -405,18 +405,18 @@ void sctp_transport_raise_cwnd(sctp_transport_t *transport, __u32 sack_ctsn,
transport, bytes_acked, cwnd,
ssthresh, flight_size, pba);
} else {
/* RFC 2960 7.2.2 Whenever cwnd is greater than ssthresh, upon
* each SACK arrival that advances the Cumulative TSN Ack Point,
* increase partial_bytes_acked by the total number of bytes of
* all new chunks acknowledged in that SACK including chunks
* acknowledged by the new Cumulative TSN Ack and by Gap Ack
* Blocks.
/* RFC 2960 7.2.2 Whenever cwnd is greater than ssthresh,
* upon each SACK arrival that advances the Cumulative TSN Ack
* Point, increase partial_bytes_acked by the total number of
* bytes of all new chunks acknowledged in that SACK including
* chunks acknowledged by the new Cumulative TSN Ack and by
* Gap Ack Blocks.
*
* When partial_bytes_acked is equal to or greater than cwnd and
* before the arrival of the SACK the sender had cwnd or more
* bytes of data outstanding (i.e., before arrival of the SACK,
* flightsize was greater than or equal to cwnd), increase cwnd
* by MTU, and reset partial_bytes_acked to
* When partial_bytes_acked is equal to or greater than cwnd
* and before the arrival of the SACK the sender had cwnd or
* more bytes of data outstanding (i.e., before arrival of the
* SACK, flightsize was greater than or equal to cwnd),
* increase cwnd by MTU, and reset partial_bytes_acked to
* (partial_bytes_acked - cwnd).
*/
pba += bytes_acked;
......@@ -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
* detected.
*/
void sctp_transport_lower_cwnd(sctp_transport_t *transport,
void sctp_transport_lower_cwnd(struct sctp_transport *transport,
sctp_lower_cwnd_t reason)
{
switch (reason) {
......@@ -516,3 +516,12 @@ void sctp_transport_lower_cwnd(sctp_transport_t *transport,
transport, reason,
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