Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / net / sctp / structs.h
index 6c24d9c..5f69158 100644 (file)
@@ -127,9 +127,9 @@ extern struct sctp_globals {
         * RTO.Alpha                - 1/8  (3 when converted to right shifts.)
         * RTO.Beta                 - 1/4  (2 when converted to right shifts.)
         */
-       __u32 rto_initial;
-       __u32 rto_min;
-       __u32 rto_max;
+       unsigned long rto_initial;
+       unsigned long rto_min;
+       unsigned long rto_max;
 
        /* Note: rto_alpha and rto_beta are really defined as inverse
         * powers of two to facilitate integer operations.
@@ -140,12 +140,18 @@ extern struct sctp_globals {
        /* Max.Burst                - 4 */
        int max_burst;
 
-       /* Valid.Cookie.Life        - 60  seconds  */
-       int valid_cookie_life;
-
        /* Whether Cookie Preservative is enabled(1) or not(0) */
        int cookie_preserve_enable;
 
+       /* Valid.Cookie.Life        - 60  seconds  */
+       unsigned long valid_cookie_life;
+
+       /* Delayed SACK timeout  200ms default*/
+       unsigned long sack_timeout;
+
+       /* HB.interval              - 30 seconds  */
+       unsigned long hb_interval;
+
        /* Association.Max.Retrans  - 10 attempts
         * Path.Max.Retrans         - 5  attempts (per destination address)
         * Max.Init.Retransmits     - 8  attempts
@@ -161,8 +167,12 @@ extern struct sctp_globals {
         */
        int sndbuf_policy;
 
-       /* HB.interval              - 30 seconds  */
-       int hb_interval;
+       /*
+        * Policy for preforming sctp/socket accounting
+        * 0   - do socket level accounting, all assocs share sk_rcvbuf
+        * 1   - do sctp accounting, each asoc may use sk_rcvbuf bytes
+        */
+       int rcvbuf_policy;
 
        /* The following variables are implementation specific.  */
 
@@ -215,8 +225,10 @@ extern struct sctp_globals {
 #define sctp_cookie_preserve_enable    (sctp_globals.cookie_preserve_enable)
 #define sctp_max_retrans_association   (sctp_globals.max_retrans_association)
 #define sctp_sndbuf_policy             (sctp_globals.sndbuf_policy)
+#define sctp_rcvbuf_policy             (sctp_globals.rcvbuf_policy)
 #define sctp_max_retrans_path          (sctp_globals.max_retrans_path)
 #define sctp_max_retrans_init          (sctp_globals.max_retrans_init)
+#define sctp_sack_timeout              (sctp_globals.sack_timeout)
 #define sctp_hb_interval               (sctp_globals.hb_interval)
 #define sctp_max_instreams             (sctp_globals.max_instreams)
 #define sctp_max_outstreams            (sctp_globals.max_outstreams)
@@ -265,6 +277,24 @@ struct sctp_sock {
        __u32 default_context;
        __u32 default_timetolive;
 
+       /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
+        * the destination address every heartbeat interval. This value
+        * will be inherited by all new associations.
+        */
+       __u32 hbinterval;
+
+       /* This is the max_retrans value for new associations. */
+       __u16 pathmaxrxt;
+
+       /* The initial Path MTU to use for new associations. */
+       __u32 pathmtu;
+
+       /* The default SACK delay timeout for new associations. */
+       __u32 sackdelay;
+
+       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       __u32 param_flags;
+
        struct sctp_initmsg initmsg;
        struct sctp_rtoinfo rtoinfo;
        struct sctp_paddrparams paddrparam;
@@ -375,8 +405,9 @@ struct sctp_cookie {
 /* The format of our cookie that we send to our peer. */
 struct sctp_signed_cookie {
        __u8 signature[SCTP_SECRET_SIZE];
+       __u32 __pad;            /* force sctp_cookie alignment to 64 bits */
        struct sctp_cookie c;
-};
+} __attribute__((packed));
 
 /* This is another convenience type to allocate memory for address
  * params for the maximum size and pass such structures around
@@ -441,7 +472,8 @@ struct sctp_ssnmap {
        int malloced;
 };
 
-struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp);
+struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
+                                   gfp_t gfp);
 void sctp_ssnmap_free(struct sctp_ssnmap *map);
 void sctp_ssnmap_clear(struct sctp_ssnmap *map);
 
@@ -482,6 +514,16 @@ struct sctp_af {
                                         int optname,
                                         char __user *optval,
                                         int __user *optlen);
+       int             (*compat_setsockopt)    (struct sock *sk,
+                                        int level,
+                                        int optname,
+                                        char __user *optval,
+                                        int optlen);
+       int             (*compat_getsockopt)    (struct sock *sk,
+                                        int level,
+                                        int optname,
+                                        char __user *optval,
+                                        int __user *optlen);
        struct dst_entry *(*get_dst)    (struct sctp_association *asoc,
                                         union sctp_addr *daddr,
                                         union sctp_addr *saddr);
@@ -513,7 +555,8 @@ struct sctp_af {
        int             (*to_addr_param) (const union sctp_addr *,
                                          union sctp_addr_param *); 
        int             (*addr_valid)   (union sctp_addr *,
-                                        struct sctp_sock *);
+                                        struct sctp_sock *,
+                                        const struct sk_buff *);
        sctp_scope_t    (*scope) (union sctp_addr *);
        void            (*inaddr_any)   (union sctp_addr *, unsigned short);
        int             (*is_any)       (const union sctp_addr *);
@@ -578,7 +621,6 @@ void sctp_datamsg_track(struct sctp_chunk *);
 void sctp_chunk_fail(struct sctp_chunk *, int error);
 int sctp_chunk_abandoned(struct sctp_chunk *);
 
-
 /* RFC2960 1.4 Key Terms
  *
  * o Chunk: A unit of information within an SCTP packet, consisting of
@@ -588,13 +630,8 @@ int sctp_chunk_abandoned(struct sctp_chunk *);
  * each chunk as well as a few other header pointers...
  */
 struct sctp_chunk {
-       /* These first three elements MUST PRECISELY match the first
-        * three elements of struct sk_buff.  This allows us to reuse
-        * all the skb_* queue management functions.
-        */
-       struct sctp_chunk *next;
-       struct sctp_chunk *prev;
-       struct sk_buff_head *list;
+       struct list_head list;
+
        atomic_t refcnt;
 
        /* This is our link to the per-transport transmitted list.  */
@@ -674,8 +711,9 @@ struct sctp_chunk {
        __u8 ecn_ce_done;       /* Have we processed the ECN CE bit? */
        __u8 pdiscard;          /* Discard the whole packet now? */
        __u8 tsn_gap_acked;     /* Is this chunk acked by a GAP ACK? */
-       __u8 fast_retransmit;    /* Is this chunk fast retransmitted? */
+       __s8 fast_retransmit;    /* Is this chunk fast retransmitted? */
        __u8 tsn_missing_report; /* Data chunk missing counter. */
+       __u8 data_accepted;     /* At least 1 chunk in this packet accepted */
 };
 
 void sctp_chunk_hold(struct sctp_chunk *);
@@ -713,7 +751,7 @@ struct sctp_packet {
        __u32 vtag;
 
        /* This contains the payload chunks.  */
-       struct sk_buff_head chunks;
+       struct list_head chunk_list;
 
        /* This is the overhead of the sctp and ip headers. */
        size_t overhead;
@@ -802,7 +840,7 @@ struct sctp_transport {
        __u32 rtt;              /* This is the most recent RTT.  */
 
        /* RTO         : The current retransmission timeout value.  */
-       __u32 rto;
+       unsigned long rto;
 
        /* RTTVAR      : The current RTT variation.  */
        __u32 rttvar;
@@ -838,9 +876,6 @@ struct sctp_transport {
        /* Data that has been sent, but not acknowledged. */
        __u32 flight_size;
 
-       /* PMTU       : The current known path MTU.  */
-       __u32 pmtu;
-
        /* Destination */
        struct dst_entry *dst;
        /* Source address. */
@@ -855,7 +890,10 @@ struct sctp_transport {
        /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
         * the destination address every heartbeat interval.
         */
-       int hb_interval;
+       unsigned long hbinterval;
+
+       /* SACK delay timeout */
+       unsigned long sackdelay;
 
        /* When was the last time (in jiffies) that we heard from this
         * transport?  We use this to pick new active and retran paths.
@@ -867,27 +905,31 @@ struct sctp_transport {
         */
        unsigned long last_time_ecne_reduced;
 
-       /* active      : The current active state of this destination,
-        *             :  i.e. DOWN, UP, etc.
+       /* This is the max_retrans value for the transport and will
+        * be initialized from the assocs value.  This can be changed
+        * using SCTP_SET_PEER_ADDR_PARAMS socket option.
         */
-       int active;
+       __u16 pathmaxrxt;
+
+       /* PMTU       : The current known path MTU.  */
+       __u32 pathmtu;
+
+       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       __u32 param_flags;
+
+       /* The number of times INIT has been sent on this transport. */
+       int init_sent_count;
 
-       /* hb_allowed  : The current heartbeat state of this destination,
-        *             :  i.e. ALLOW-HB, NO-HEARTBEAT, etc.
+       /* state       : The current state of this destination,
+        *             : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN.
         */
-       int hb_allowed;
+       int state;
 
        /* These are the error stats for this destination.  */
 
        /* Error count : The current error count for this destination.  */
        unsigned short error_count;
 
-       /* This is the max_retrans value for the transport and will
-        * be initialized to proto.max_retrans.path.  This can be changed
-        * using SCTP_SET_PEER_ADDR_PARAMS socket option.
-        */
-       int max_retrans;
-
        /* Per         : A timer used by each destination.
         * Destination :
         * Timer       :
@@ -944,7 +986,8 @@ struct sctp_transport {
        } cacc;
 };
 
-struct sctp_transport *sctp_transport_new(const union sctp_addr *, int);
+struct sctp_transport *sctp_transport_new(const union sctp_addr *,
+                                         gfp_t);
 void sctp_transport_set_owner(struct sctp_transport *,
                              struct sctp_association *);
 void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
@@ -967,7 +1010,7 @@ struct sctp_inq {
        /* This is actually a queue of sctp_chunk each
         * containing a partially decoded packet.
         */
-       struct sk_buff_head in;
+       struct list_head in_chunk_list;
        /* This is the packet which is currently off the in queue and is
         * being worked on through the inbound chunk processing.
         */
@@ -1010,7 +1053,7 @@ struct sctp_outq {
        struct sctp_association *asoc;
 
        /* Data pending that has never been transmitted.  */
-       struct sk_buff_head out;
+       struct list_head out_chunk_list;
 
        unsigned out_qlen;      /* Total length of queued data chunks. */
 
@@ -1018,7 +1061,7 @@ struct sctp_outq {
        unsigned error;
 
        /* These are control chunks we want to send.  */
-       struct sk_buff_head control;
+       struct list_head control_chunk_list;
 
        /* These are chunks that have been sacked but are above the
         * CTSN, or cumulative tsn ack point.
@@ -1092,9 +1135,10 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
 void sctp_bind_addr_free(struct sctp_bind_addr *);
 int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
                        const struct sctp_bind_addr *src,
-                       sctp_scope_t scope, int gfp,int flags);
+                       sctp_scope_t scope, gfp_t gfp,
+                       int flags);
 int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
-                      int gfp);
+                      gfp_t gfp);
 int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
 int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
                         struct sctp_sock *);
@@ -1103,9 +1147,10 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr    *bp,
                                        int                     addrcnt,
                                        struct sctp_sock        *opt);
 union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
-                                        int *addrs_len, int gfp);
+                                        int *addrs_len,
+                                        gfp_t gfp);
 int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
-                          __u16 port, int gfp);
+                          __u16 port, gfp_t gfp);
 
 sctp_scope_t sctp_scope(const union sctp_addr *);
 int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope);
@@ -1217,14 +1262,19 @@ struct sctp_endpoint {
        int last_key;
        int key_changed_at;
 
-       /* Default timeouts.  */
-       int timeouts[SCTP_NUM_TIMEOUT_TYPES];
-
+       /* digest:  This is a digest of the sctp cookie.  This field is
+        *          only used on the receive path when we try to validate
+        *          that the cookie has not been tampered with.  We put
+        *          this here so we pre-allocate this once and can re-use
+        *          on every receive.
+        */
+       __u8 digest[SCTP_SIGNATURE_SIZE];
        /* sendbuf acct. policy.        */
        __u32 sndbuf_policy;
 
-       /* Name for debugging output... */
-       char *debug_name;
+       /* rcvbuf acct. policy. */
+       __u32 rcvbuf_policy;
 };
 
 /* Recover the outter endpoint structure. */
@@ -1237,7 +1287,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
 }
 
 /* These are function signatures for manipulating endpoints.  */
-struct sctp_endpoint *sctp_endpoint_new(struct sock *, int);
+struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
 void sctp_endpoint_free(struct sctp_endpoint *);
 void sctp_endpoint_put(struct sctp_endpoint *);
 void sctp_endpoint_hold(struct sctp_endpoint *);
@@ -1258,7 +1308,7 @@ int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t,
                     struct sctp_chunk **err_chunk);
 int sctp_process_init(struct sctp_association *, sctp_cid_t cid,
                      const union sctp_addr *peer,
-                     sctp_init_chunk_t *init, int gfp);
+                     sctp_init_chunk_t *init, gfp_t gfp);
 __u32 sctp_generate_tag(const struct sctp_endpoint *);
 __u32 sctp_generate_tsn(const struct sctp_endpoint *);
 
@@ -1314,11 +1364,23 @@ struct sctp_association {
                 *             : association. Normally this information is
                 *             : hashed or keyed for quick lookup and access
                 *             : of the TCB.
+                *             : The list is also initialized with the list
+                *             : of addresses passed with the sctp_connectx()
+                *             : call.
                 *
                 * It is a list of SCTP_transport's.
                 */
                struct list_head transport_addr_list;
 
+               /* transport_count
+                *
+                * Peer        : A count of the number of peer addresses
+                * Transport   : in the Peer Transport Address List.
+                * Address     :
+                * Count       :
+                */
+               __u16 transport_count;
+
                /* port
                 *   The transport layer port number.
                 */
@@ -1458,9 +1520,9 @@ struct sctp_association {
         * These values will be initialized by system defaults, but can
         * be modified via the SCTP_RTOINFO socket option.
         */
-       __u32 rto_initial;
-       __u32 rto_max;
-       __u32 rto_min;
+       unsigned long rto_initial;
+       unsigned long rto_max;
+       unsigned long rto_min;
 
        /* Maximum number of new data packets that can be sent in a burst.  */
        int max_burst;
@@ -1478,14 +1540,40 @@ struct sctp_association {
        __u16 init_retries;
 
        /* The largest timeout or RTO value to use in attempting an INIT */
-       __u16 max_init_timeo;
+       unsigned long max_init_timeo;
+
+       /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
+        * the destination address every heartbeat interval. This value
+        * will be inherited by all new transports.
+        */
+       unsigned long hbinterval;
+
+       /* This is the max_retrans value for new transports in the
+        * association.
+        */
+       __u16 pathmaxrxt;
+
+       /* Association : The smallest PMTU discovered for all of the
+        * PMTU        : peer's transport addresses.
+        */
+       __u32 pathmtu;
 
-       int timeouts[SCTP_NUM_TIMEOUT_TYPES];
+       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       __u32 param_flags;
+
+       /* SACK delay timeout */
+       unsigned long sackdelay;
+
+
+       unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES];
        struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
 
        /* Transport to which SHUTDOWN chunk was last sent.  */
        struct sctp_transport *shutdown_last_sent_to;
 
+       /* Transport to which INIT chunk was last sent.  */
+       struct sctp_transport *init_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
         *             : ACK chunk to the peer and incremented each
@@ -1536,21 +1624,24 @@ struct sctp_association {
         */
        int sndbuf_used;
 
+       /* This is the amount of memory that this association has allocated
+        * in the receive path at any given time.
+        */
+       atomic_t rmem_alloc;
+
        /* This is the wait queue head for send requests waiting on
         * the association sndbuf space.
         */
        wait_queue_head_t       wait;
 
-       /* Association : The smallest PMTU discovered for all of the
-        * PMTU        : peer's transport addresses.
-        */
-       __u32 pmtu;
-
        /* The message size at which SCTP fragmentation will occur. */
        __u32 frag_point;
 
-       /* Currently only one counter is used to count INIT errors. */
-       int counters[SCTP_NUMBER_COUNTERS];
+       /* Counter used to count INIT errors. */
+       int init_err_counter;
+
+       /* Count the number of INIT cycles (for doubling timeout). */
+       int init_cycle;
 
        /* Default send parameters. */
        __u16 default_stream;
@@ -1579,7 +1670,10 @@ struct sctp_association {
        /* How many duplicated TSNs have we seen?  */
        int numduptsns;
 
-       /* Number of seconds of idle time before an association is closed.  */
+       /* Number of seconds of idle time before an association is closed.
+        * In the association context, this is really used as a boolean
+        * since the real timeout is stored in the timeouts array
+        */
        __u32 autoclose;
 
        /* These are to support
@@ -1650,7 +1744,7 @@ struct sctp_association {
         *  which already resides in sctp_outq.  Please move this
         *  queue and its supporting logic down there.  --piggy]
         */
-       struct sk_buff_head addip_chunks;
+       struct list_head addip_chunk_list;
 
        /* ADDIP Section 4.1 ASCONF Chunk Procedures
         *
@@ -1703,11 +1797,13 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
 
 struct sctp_association *
 sctp_association_new(const struct sctp_endpoint *, const struct sock *,
-                    sctp_scope_t scope, int gfp);
+                    sctp_scope_t scope, gfp_t gfp);
 void sctp_association_free(struct sctp_association *);
 void sctp_association_put(struct sctp_association *);
 void sctp_association_hold(struct sctp_association *);
 
+struct sctp_transport *sctp_assoc_choose_init_transport(
+       struct sctp_association *);
 struct sctp_transport *sctp_assoc_choose_shutdown_transport(
        struct sctp_association *);
 void sctp_assoc_update_retran_path(struct sctp_association *);
@@ -1717,9 +1813,12 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
                            const union sctp_addr *laddr);
 struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
                                     const union sctp_addr *address,
-                                    const int gfp);
+                                    const gfp_t gfp,
+                                    const int peer_state);
 void sctp_assoc_del_peer(struct sctp_association *asoc,
                         const union sctp_addr *addr);
+void sctp_assoc_rm_peer(struct sctp_association *asoc,
+                        struct sctp_transport *peer);
 void sctp_assoc_control_transport(struct sctp_association *,
                                  struct sctp_transport *,
                                  sctp_transport_cmd_t, sctp_sn_error_t);
@@ -1738,9 +1837,11 @@ void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned);
 void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned);
 void sctp_assoc_set_primary(struct sctp_association *,
                            struct sctp_transport *);
-int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, int);
+int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *,
+                                    gfp_t);
 int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
-                                        struct sctp_cookie*, int gfp);
+                                        struct sctp_cookie*,
+                                        gfp_t gfp);
 
 int sctp_cmp_addr_exact(const union sctp_addr *ss1,
                        const union sctp_addr *ss2);