Commit 127dbff1 authored by Jon Grimm's avatar Jon Grimm Committed by Sridhar Samudrala

[SCTP] Various code cleanup.

More typedef removals and naming consistency.
Remove sctp_association_t, sctp_endpoint_t, & sctp_endpoint_common_t.
parent c99bec6e
......@@ -182,7 +182,7 @@ typedef struct {
/* Create a new sctp_command_sequence.
* Return NULL if creating a new sequence fails.
*/
sctp_cmd_seq_t *sctp_new_cmd_seq(int priority);
sctp_cmd_seq_t *sctp_new_cmd_seq(int gfp);
/* Initialize a block of memory as a command sequence.
* Return 0 if the initialization fails.
......
......@@ -125,7 +125,7 @@ extern struct sctp_protocol sctp_proto;
extern struct sock *sctp_get_ctl_sock(void);
extern int sctp_copy_local_addr_list(struct sctp_protocol *,
struct sctp_bind_addr *,
sctp_scope_t, int priority, int flags);
sctp_scope_t, int gfp, int flags);
extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
......@@ -141,11 +141,11 @@ extern unsigned int sctp_poll(struct file *file, struct socket *sock,
/*
* sctp/primitive.c
*/
extern int sctp_primitive_ASSOCIATE(sctp_association_t *, void *arg);
extern int sctp_primitive_SHUTDOWN(sctp_association_t *, void *arg);
extern int sctp_primitive_ABORT(sctp_association_t *, void *arg);
extern int sctp_primitive_SEND(sctp_association_t *, void *arg);
extern int sctp_primitive_REQUESTHEARTBEAT(sctp_association_t *, void *arg);
extern int sctp_primitive_ASSOCIATE(struct sctp_association *, void *arg);
extern int sctp_primitive_SHUTDOWN(struct sctp_association *, void *arg);
extern int sctp_primitive_ABORT(struct sctp_association *, void *arg);
extern int sctp_primitive_SEND(struct sctp_association *, void *arg);
extern int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg);
/*
* sctp/crc32c.c
......@@ -159,22 +159,23 @@ extern __u32 sctp_end_cksum(__u32 cksum);
*/
extern int sctp_rcv(struct sk_buff *skb);
extern void sctp_v4_err(struct sk_buff *skb, u32 info);
extern void sctp_hash_established(sctp_association_t *);
extern void __sctp_hash_established(sctp_association_t *);
extern void sctp_unhash_established(sctp_association_t *);
extern void __sctp_unhash_established(sctp_association_t *);
extern void sctp_hash_endpoint(sctp_endpoint_t *);
extern void __sctp_hash_endpoint(sctp_endpoint_t *);
extern void sctp_unhash_endpoint(sctp_endpoint_t *);
extern void __sctp_unhash_endpoint(sctp_endpoint_t *);
extern sctp_association_t *__sctp_lookup_association(const union sctp_addr *,
const union sctp_addr *,
struct sctp_transport **);
extern void sctp_hash_established(struct sctp_association *);
extern void __sctp_hash_established(struct sctp_association *);
extern void sctp_unhash_established(struct sctp_association *);
extern void __sctp_unhash_established(struct sctp_association *);
extern void sctp_hash_endpoint(struct sctp_endpoint *);
extern void __sctp_hash_endpoint(struct sctp_endpoint *);
extern void sctp_unhash_endpoint(struct sctp_endpoint *);
extern void __sctp_unhash_endpoint(struct sctp_endpoint *);
extern struct sctp_association *__sctp_lookup_association(
const union sctp_addr *,
const union sctp_addr *,
struct sctp_transport **);
extern struct sock *sctp_err_lookup(int family, struct sk_buff *,
struct sctphdr *, struct sctp_endpoint **,
struct sctp_association **,
struct sctphdr *, struct sctp_endpoint **,
struct sctp_association **,
struct sctp_transport **);
extern void sctp_err_finish(struct sock *, struct sctp_endpoint *,
extern void sctp_err_finish(struct sock *, struct sctp_endpoint *,
struct sctp_association *);
extern void sctp_icmp_frag_needed(struct sock *, struct sctp_association *,
struct sctp_transport *t, __u32 pmtu);
......@@ -335,20 +336,20 @@ static inline void sctp_v6_exit(void) { return; }
#define sctp_crypto_hmac crypto_hmac
#else
#define sctp_crypto_alloc_tfm(x...) NULL
#define sctp_crypto_free_tfm(x...)
#define sctp_crypto_hmac(x...)
#endif
#define sctp_crypto_free_tfm(x...)
#define sctp_crypto_hmac(x...)
#endif
/* Map an association to an assoc_id. */
static inline sctp_assoc_t sctp_assoc2id(const sctp_association_t *asoc)
static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
{
return (sctp_assoc_t) asoc;
}
/* Look up the association by its id. */
sctp_association_t *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
/* A macro to walk a list of skbs. */
......@@ -507,10 +508,10 @@ static inline int ipver2af(__u8 ipver)
/* Perform some sanity checks. */
static inline int sctp_sanity_check(void)
{
SCTP_ASSERT(sizeof(struct sctp_ulpevent) <=
SCTP_ASSERT(sizeof(struct sctp_ulpevent) <=
sizeof(((struct sk_buff *)0)->cb),
"SCTP: ulpevent does not fit in skb!\n", return 0);
return 1;
}
......
......@@ -81,8 +81,8 @@ typedef struct {
int action;
} sctp_sm_command_t;
typedef sctp_disposition_t (sctp_state_fn_t) (const sctp_endpoint_t *,
const sctp_association_t *,
typedef sctp_disposition_t (sctp_state_fn_t) (const struct sctp_endpoint *,
const struct sctp_association *,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *);
......@@ -209,67 +209,67 @@ __u32 sctp_generate_verification_tag(void);
void sctp_populate_tie_tags(__u8 *cookie, __u32 curTag, __u32 hisTag);
/* Prototypes for chunk-building functions. */
sctp_chunk_t *sctp_make_init(const sctp_association_t *,
sctp_chunk_t *sctp_make_init(const struct sctp_association *,
const sctp_bind_addr_t *,
int priority, int vparam_len);
sctp_chunk_t *sctp_make_init_ack(const sctp_association_t *,
int gfp, int vparam_len);
sctp_chunk_t *sctp_make_init_ack(const struct sctp_association *,
const sctp_chunk_t *,
const int priority,
const int gfp,
const int unkparam_len);
sctp_chunk_t *sctp_make_cookie_echo(const sctp_association_t *,
sctp_chunk_t *sctp_make_cookie_echo(const struct sctp_association *,
const sctp_chunk_t *);
sctp_chunk_t *sctp_make_cookie_ack(const sctp_association_t *,
sctp_chunk_t *sctp_make_cookie_ack(const struct sctp_association *,
const sctp_chunk_t *);
sctp_chunk_t *sctp_make_cwr(const sctp_association_t *,
sctp_chunk_t *sctp_make_cwr(const struct sctp_association *,
const __u32 lowest_tsn,
const sctp_chunk_t *);
sctp_chunk_t *sctp_make_datafrag(sctp_association_t *,
sctp_chunk_t *sctp_make_datafrag(struct sctp_association *,
const struct sctp_sndrcvinfo *sinfo,
int len, const __u8 *data,
__u8 flags, __u16 ssn);
sctp_chunk_t * sctp_make_datafrag_empty(sctp_association_t *,
sctp_chunk_t * sctp_make_datafrag_empty(struct sctp_association *,
const struct sctp_sndrcvinfo *sinfo,
int len, const __u8 flags,
__u16 ssn);
sctp_chunk_t *sctp_make_data(sctp_association_t *,
sctp_chunk_t *sctp_make_data(struct sctp_association *,
const struct sctp_sndrcvinfo *sinfo,
int len, const __u8 *data);
sctp_chunk_t *sctp_make_data_empty(sctp_association_t *,
sctp_chunk_t *sctp_make_data_empty(struct sctp_association *,
const struct sctp_sndrcvinfo *, int len);
sctp_chunk_t *sctp_make_ecne(const sctp_association_t *,
sctp_chunk_t *sctp_make_ecne(const struct sctp_association *,
const __u32);
sctp_chunk_t *sctp_make_sack(const sctp_association_t *);
sctp_chunk_t *sctp_make_shutdown(const sctp_association_t *asoc);
sctp_chunk_t *sctp_make_shutdown_ack(const sctp_association_t *asoc,
sctp_chunk_t *sctp_make_sack(const struct sctp_association *);
sctp_chunk_t *sctp_make_shutdown(const struct sctp_association *asoc);
sctp_chunk_t *sctp_make_shutdown_ack(const struct sctp_association *asoc,
const sctp_chunk_t *);
sctp_chunk_t *sctp_make_shutdown_complete(const sctp_association_t *,
sctp_chunk_t *sctp_make_shutdown_complete(const struct sctp_association *,
const sctp_chunk_t *);
void sctp_init_cause(sctp_chunk_t *, __u16 cause, const void *, size_t);
sctp_chunk_t *sctp_make_abort(const sctp_association_t *,
sctp_chunk_t *sctp_make_abort(const struct sctp_association *,
const sctp_chunk_t *,
const size_t hint);
sctp_chunk_t *sctp_make_abort_no_data(const sctp_association_t *,
sctp_chunk_t *sctp_make_abort_no_data(const struct sctp_association *,
const sctp_chunk_t *,
__u32 tsn);
sctp_chunk_t *sctp_make_abort_user(const sctp_association_t *,
sctp_chunk_t *sctp_make_abort_user(const struct sctp_association *,
const sctp_chunk_t *,
const struct msghdr *);
sctp_chunk_t *sctp_make_heartbeat(const sctp_association_t *,
sctp_chunk_t *sctp_make_heartbeat(const struct sctp_association *,
const struct sctp_transport *,
const void *payload,
const size_t paylen);
sctp_chunk_t *sctp_make_heartbeat_ack(const sctp_association_t *,
sctp_chunk_t *sctp_make_heartbeat_ack(const struct sctp_association *,
const sctp_chunk_t *,
const void *payload,
const size_t paylen);
sctp_chunk_t *sctp_make_op_error(const sctp_association_t *,
sctp_chunk_t *sctp_make_op_error(const struct sctp_association *,
const sctp_chunk_t *chunk,
__u16 cause_code,
const void *payload,
size_t paylen);
void sctp_chunk_assign_tsn(sctp_chunk_t *);
void sctp_chunk_assign_ssn(sctp_chunk_t *);
int sctp_datachunks_from_user(sctp_association_t *,
int sctp_datachunks_from_user(struct sctp_association *,
const struct sctp_sndrcvinfo *,
struct msghdr *, int len,
struct sk_buff_head *);
......@@ -279,34 +279,34 @@ int sctp_datachunks_from_user(sctp_association_t *,
int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
sctp_state_t state,
sctp_endpoint_t *,
sctp_association_t *asoc,
struct sctp_endpoint *,
struct sctp_association *asoc,
void *event_arg,
int priority);
int gfp);
int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
sctp_state_t state,
sctp_endpoint_t *,
sctp_association_t *asoc,
struct sctp_endpoint *,
struct sctp_association *asoc,
void *event_arg,
sctp_disposition_t status,
sctp_cmd_seq_t *commands,
int priority);
int gfp);
/* 2nd level prototypes */
int
sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype,
sctp_state_t state,
sctp_endpoint_t *ep,
sctp_association_t *asoc,
struct sctp_endpoint *ep,
struct sctp_association *asoc,
void *event_arg,
sctp_disposition_t status,
sctp_cmd_seq_t *retval,
int priority);
int gfp);
int sctp_gen_sack(sctp_association_t *, int force, sctp_cmd_seq_t *);
void sctp_do_TSNdup(sctp_association_t *, sctp_chunk_t *, long gap);
int sctp_gen_sack(struct sctp_association *, int force, sctp_cmd_seq_t *);
void sctp_do_TSNdup(struct sctp_association *, sctp_chunk_t *, long gap);
void sctp_generate_t3_rtx_event(unsigned long peer);
void sctp_generate_heartbeat_event(unsigned long peer);
......@@ -325,21 +325,21 @@ sctp_cookie_param_t *
sctp_pack_cookie(const struct sctp_endpoint *, const struct sctp_association *,
const struct sctp_chunk *, int *cookie_len,
const __u8 *, int addrs_len);
sctp_association_t *sctp_unpack_cookie(const sctp_endpoint_t *,
const sctp_association_t *,
sctp_chunk_t *, int priority, int *err,
struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *,
const struct sctp_association *,
sctp_chunk_t *, int gfp, int *err,
sctp_chunk_t **err_chk_p);
int sctp_addip_addr_config(sctp_association_t *, sctp_param_t,
int sctp_addip_addr_config(struct sctp_association *, sctp_param_t,
struct sockaddr_storage*, int);
void sctp_send_stale_cookie_err(const sctp_endpoint_t *ep,
const sctp_association_t *asoc,
void sctp_send_stale_cookie_err(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_chunk_t *chunk,
sctp_cmd_seq_t *commands,
sctp_chunk_t *err_chunk);
/* 3rd level prototypes */
__u32 sctp_generate_tag(const sctp_endpoint_t *);
__u32 sctp_generate_tsn(const sctp_endpoint_t *);
__u32 sctp_generate_tag(const struct sctp_endpoint *);
__u32 sctp_generate_tsn(const struct sctp_endpoint *);
/* 4th level prototypes */
void sctp_param2sockaddr(union sctp_addr *addr, sctp_addr_param_t *,
......@@ -450,7 +450,7 @@ static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_a
*/
static inline int
sctp_vtag_verify_either(const sctp_chunk_t *chunk,
const sctp_association_t *asoc)
const struct sctp_association *asoc)
{
/* RFC 2960 Section 8.5.1, sctpimpguide-06 Section 2.13.2
*
......
......@@ -83,14 +83,11 @@ struct sctp_outq;
struct sctp_bind_addr;
struct sctp_ulpq;
struct sctp_opt;
struct sctp_endpoint_common;
struct sctp_ep_common;
struct sctp_ssnmap;
typedef struct sctp_endpoint sctp_endpoint_t;
typedef struct sctp_association sctp_association_t;
typedef struct sctp_chunk sctp_chunk_t;
typedef struct sctp_bind_addr sctp_bind_addr_t;
typedef struct sctp_endpoint_common sctp_endpoint_common_t;
#include <net/sctp/tsnmap.h>
#include <net/sctp/ulpevent.h>
......@@ -114,7 +111,7 @@ typedef struct sctp_bind_hashbucket {
/* Used for hashing all associations. */
typedef struct sctp_hashbucket {
rwlock_t lock;
sctp_endpoint_common_t *chain;
struct sctp_ep_common *chain;
} sctp_hashbucket_t __attribute__((__aligned__(8)));
......@@ -517,7 +514,7 @@ struct sctp_chunk {
struct sctp_association *asoc;
/* What endpoint received this chunk? */
sctp_endpoint_common_t *rcvr;
struct sctp_ep_common *rcvr;
/* We fill this in if we are calculating RTT. */
unsigned long sent_at;
......@@ -976,7 +973,7 @@ int sctp_is_any(const union sctp_addr *addr);
int sctp_addr_is_valid(const union sctp_addr *addr);
/* What type of sctp_endpoint_common? */
/* What type of endpoint? */
typedef enum {
SCTP_EP_TYPE_SOCKET,
SCTP_EP_TYPE_ASSOCIATION,
......@@ -998,10 +995,10 @@ typedef enum {
*
*/
struct sctp_endpoint_common {
struct sctp_ep_common {
/* Fields to help us manage our entries in the hash tables. */
sctp_endpoint_common_t *next;
sctp_endpoint_common_t **pprev;
struct sctp_ep_common *next;
struct sctp_ep_common **pprev;
int hashent;
/* Runtime type information. What kind of endpoint is this? */
......@@ -1055,7 +1052,7 @@ struct sctp_endpoint_common {
struct sctp_endpoint {
/* Common substructure for endpoint and association. */
sctp_endpoint_common_t base;
struct sctp_ep_common base;
/* Associations: A list of current associations and mappings
* to the data consumers for each association. This
......@@ -1090,7 +1087,7 @@ struct sctp_endpoint {
};
/* Recover the outter endpoint structure. */
static inline struct sctp_endpoint *sctp_ep(sctp_endpoint_common_t *base)
static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
{
struct sctp_endpoint *ep;
......@@ -1110,7 +1107,7 @@ struct sctp_association *sctp_endpoint_lookup_assoc(
const struct sctp_endpoint *ep,
const union sctp_addr *paddr,
struct sctp_transport **);
int sctp_endpoint_is_peeled_off(struct sctp_endpoint *,
int sctp_endpoint_is_peeled_off(struct sctp_endpoint *,
const union sctp_addr *);
struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
const union sctp_addr *);
......@@ -1149,7 +1146,7 @@ struct sctp_association {
* In this context, it represents the associations's view
* of the local endpoint of the association.
*/
sctp_endpoint_common_t base;
struct sctp_ep_common base;
/* Associations on the same socket. */
struct list_head asocs;
......@@ -1558,7 +1555,7 @@ enum {
};
/* Recover the outter association structure. */
static inline struct sctp_association *sctp_assoc(sctp_endpoint_common_t *base)
static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
{
struct sctp_association *asoc;
......
......@@ -114,7 +114,7 @@ struct sctp_tsnmap_iter {
};
/* Create a new tsnmap. */
struct sctp_tsnmap *sctp_tsnmap_new(__u16 len, __u32 init_tsn, int priority);
struct sctp_tsnmap *sctp_tsnmap_new(__u16 len, __u32 init_tsn, int gfp);
/* Dispose of a tsnmap. */
void sctp_tsnmap_free(struct sctp_tsnmap *);
......
......@@ -64,7 +64,7 @@ static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
return (struct sctp_ulpevent *)skb->cb;
}
struct sctp_ulpevent *sctp_ulpevent_new(int size, int flags, int priority);
struct sctp_ulpevent *sctp_ulpevent_new(int size, int flags, int gfp);
struct sctp_ulpevent *sctp_ulpevent_init(struct sctp_ulpevent *, int flags);
void sctp_ulpevent_free(struct sctp_ulpevent *);
int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
......@@ -76,7 +76,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
__u16 error,
__u16 outbound,
__u16 inbound,
int priority);
int gfp);
struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
const struct sctp_association *asoc,
......@@ -84,32 +84,32 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
int flags,
int state,
int error,
int priority);
int gfp);
struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
const struct sctp_association *asoc,
struct sctp_chunk *chunk,
__u16 flags,
int priority);
int gfp);
struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
const struct sctp_association *asoc,
struct sctp_chunk *chunk,
__u16 flags,
__u32 error,
int priority);
int gfp);
struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
const struct sctp_association *asoc,
__u16 flags,
int priority);
int gfp);
struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
const struct sctp_association *asoc,
__u32 indication, int priority);
__u32 indication, int gfp);
struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
struct sctp_chunk *chunk,
int priority);
int gfp);
void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
struct msghdr *);
......
......@@ -50,14 +50,15 @@
struct sctp_ulpq {
char malloced;
char pd_mode;
sctp_association_t *asoc;
struct sctp_association *asoc;
struct sk_buff_head reasm;
struct sk_buff_head lobby;
};
/* Prototypes. */
struct sctp_ulpq *sctp_ulpq_new(sctp_association_t *asoc, int priority);
struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *, sctp_association_t *);
struct sctp_ulpq *sctp_ulpq_new(struct sctp_association *asoc, int gfp);
struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
struct sctp_association *);
void sctp_ulpq_free(struct sctp_ulpq *);
/* Add a new DATA chunk for processing. */
......
This diff is collapsed.
......@@ -43,9 +43,9 @@
#include <net/sctp/sm.h>
/* Create a new sctp_command_sequence. */
sctp_cmd_seq_t *sctp_new_cmd_seq(int priority)
sctp_cmd_seq_t *sctp_new_cmd_seq(int gfp)
{
sctp_cmd_seq_t *retval = t_new(sctp_cmd_seq_t, priority);
sctp_cmd_seq_t *retval = t_new(sctp_cmd_seq_t, gfp);
if (retval)
sctp_init_cmd_seq(retval);
......
......@@ -63,11 +63,11 @@
/* Forward declarations for internal helpers. */
static int sctp_rcv_ootb(struct sk_buff *);
sctp_association_t *__sctp_rcv_lookup(struct sk_buff *skb,
struct sctp_association *__sctp_rcv_lookup(struct sk_buff *skb,
const union sctp_addr *laddr,
const union sctp_addr *paddr,
struct sctp_transport **transportp);
sctp_endpoint_t *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr);
struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr);
/* Calculate the SCTP checksum of an SCTP packet. */
......@@ -102,9 +102,9 @@ static inline int sctp_rcv_checksum(struct sk_buff *skb)
int sctp_rcv(struct sk_buff *skb)
{
struct sock *sk;
sctp_association_t *asoc;
sctp_endpoint_t *ep = NULL;
sctp_endpoint_common_t *rcvr;
struct sctp_association *asoc;
struct sctp_endpoint *ep = NULL;
struct sctp_ep_common *rcvr;
struct sctp_transport *transport = NULL;
sctp_chunk_t *chunk;
struct sctphdr *sh;
......@@ -128,11 +128,11 @@ int sctp_rcv(struct sk_buff *skb)
if (sctp_rcv_checksum(skb) < 0)
goto bad_packet;
skb_pull(skb, sizeof(struct sctphdr));
skb_pull(skb, sizeof(struct sctphdr));
family = ipver2af(skb->nh.iph->version);
af = sctp_get_af_specific(family);
if (unlikely(!af))
if (unlikely(!af))
goto bad_packet;
/* Initialize local addresses for lookups. */
......@@ -286,8 +286,8 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
/* Common lookup code for icmp/icmpv6 error handler. */
struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
struct sctphdr *sctphdr,
struct sctp_endpoint **epp,
struct sctp_association **app,
struct sctp_endpoint **epp,
struct sctp_association **app,
struct sctp_transport **tpp)
{
union sctp_addr saddr;
......@@ -309,15 +309,15 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
af->from_skb(&saddr, skb, 1);
af->from_skb(&daddr, skb, 0);
/* Look for an association that matches the incoming ICMP error
/* Look for an association that matches the incoming ICMP error
* packet.
*/
asoc = __sctp_lookup_association(&saddr, &daddr, &transport);
if (!asoc) {
/* If there is no matching association, see if it matches any
* endpoint. This may happen for an ICMP error generated in
* response to an INIT_ACK.
*/
* endpoint. This may happen for an ICMP error generated in
* response to an INIT_ACK.
*/
ep = __sctp_rcv_lookup_endpoint(&daddr);
if (!ep) {
return NULL;
......@@ -345,25 +345,25 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
*app = asoc;
*tpp = transport;
return sk;
out:
sock_put(sk);
if (asoc)
sctp_association_put(asoc);
if (ep)
if (ep)
sctp_endpoint_put(ep);
return NULL;
}
/* Common cleanup code for icmp/icmpv6 error handler. */
void sctp_err_finish(struct sock *sk, struct sctp_endpoint *ep,
void sctp_err_finish(struct sock *sk, struct sctp_endpoint *ep,
struct sctp_association *asoc)
{
sctp_bh_unlock_sock(sk);
sock_put(sk);
if (asoc)
sctp_association_put(asoc);
if (ep)
if (ep)
sctp_endpoint_put(ep);
}
......@@ -389,8 +389,8 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
int type = skb->h.icmph->type;
int code = skb->h.icmph->code;
struct sock *sk;
sctp_endpoint_t *ep;
sctp_association_t *asoc;
struct sctp_endpoint *ep;
struct sctp_association *asoc;
struct sctp_transport *transport;
struct inet_opt *inet;
char *saveip, *savesctp;
......@@ -414,7 +414,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
ICMP_INC_STATS_BH(IcmpInErrors);
return;
}
/* Warning: The sock lock is held. Remember to call
/* Warning: The sock lock is held. Remember to call
* sctp_err_finish!
*/
......@@ -520,10 +520,10 @@ int sctp_rcv_ootb(struct sk_buff *skb)
}
/* Insert endpoint into the hash table. */
void __sctp_hash_endpoint(sctp_endpoint_t *ep)
void __sctp_hash_endpoint(struct sctp_endpoint *ep)
{
sctp_endpoint_common_t **epp;
sctp_endpoint_common_t *epb;
struct sctp_ep_common **epp;
struct sctp_ep_common *epb;
sctp_hashbucket_t *head;
epb = &ep->base;
......@@ -542,7 +542,7 @@ void __sctp_hash_endpoint(sctp_endpoint_t *ep)
}
/* Add an endpoint to the hash. Local BH-safe. */
void sctp_hash_endpoint(sctp_endpoint_t *ep)
void sctp_hash_endpoint(struct sctp_endpoint *ep)
{
sctp_local_bh_disable();
__sctp_hash_endpoint(ep);
......@@ -550,10 +550,10 @@ void sctp_hash_endpoint(sctp_endpoint_t *ep)
}
/* Remove endpoint from the hash table. */
void __sctp_unhash_endpoint(sctp_endpoint_t *ep)
void __sctp_unhash_endpoint(struct sctp_endpoint *ep)
{
sctp_hashbucket_t *head;
sctp_endpoint_common_t *epb;
struct sctp_ep_common *epb;
epb = &ep->base;
......@@ -574,7 +574,7 @@ void __sctp_unhash_endpoint(sctp_endpoint_t *ep)
}
/* Remove endpoint from the hash. Local BH-safe. */
void sctp_unhash_endpoint(sctp_endpoint_t *ep)
void sctp_unhash_endpoint(struct sctp_endpoint *ep)
{
sctp_local_bh_disable();
__sctp_unhash_endpoint(ep);
......@@ -582,11 +582,11 @@ void sctp_unhash_endpoint(sctp_endpoint_t *ep)
}
/* Look up an endpoint. */
sctp_endpoint_t *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr)
struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr)
{
sctp_hashbucket_t *head;
sctp_endpoint_common_t *epb;
sctp_endpoint_t *ep;
struct sctp_ep_common *epb;
struct sctp_endpoint *ep;
int hash;
hash = sctp_ep_hashfn(laddr->v4.sin_port);
......@@ -609,7 +609,7 @@ sctp_endpoint_t *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr)
}
/* Add an association to the hash. Local BH-safe. */
void sctp_hash_established(sctp_association_t *asoc)
void sctp_hash_established(struct sctp_association *asoc)
{
sctp_local_bh_disable();
__sctp_hash_established(asoc);
......@@ -617,10 +617,10 @@ void sctp_hash_established(sctp_association_t *asoc)
}
/* Insert association into the hash table. */
void __sctp_hash_established(sctp_association_t *asoc)
void __sctp_hash_established(struct sctp_association *asoc)
{
sctp_endpoint_common_t **epp;
sctp_endpoint_common_t *epb;
struct sctp_ep_common **epp;
struct sctp_ep_common *epb;
sctp_hashbucket_t *head;
epb = &asoc->base;
......@@ -641,7 +641,7 @@ void __sctp_hash_established(sctp_association_t *asoc)
}
/* Remove association from the hash table. Local BH-safe. */
void sctp_unhash_established(sctp_association_t *asoc)
void sctp_unhash_established(struct sctp_association *asoc)
{
sctp_local_bh_disable();
__sctp_unhash_established(asoc);
......@@ -649,10 +649,10 @@ void sctp_unhash_established(sctp_association_t *asoc)
}
/* Remove association from the hash table. */
void __sctp_unhash_established(sctp_association_t *asoc)
void __sctp_unhash_established(struct sctp_association *asoc)
{
sctp_hashbucket_t *head;
sctp_endpoint_common_t *epb;
struct sctp_ep_common *epb;
epb = &asoc->base;
......@@ -674,13 +674,14 @@ void __sctp_unhash_established(sctp_association_t *asoc)
}
/* Look up an association. */
sctp_association_t *__sctp_lookup_association(const union sctp_addr *local,
const union sctp_addr *peer,
struct sctp_transport **pt)
struct sctp_association *__sctp_lookup_association(
const union sctp_addr *local,
const union sctp_addr *peer,
struct sctp_transport **pt)
{
sctp_hashbucket_t *head;
sctp_endpoint_common_t *epb;
sctp_association_t *asoc;
struct sctp_ep_common *epb;
struct sctp_association *asoc;
struct sctp_transport *transport;
int hash;
......@@ -710,11 +711,11 @@ sctp_association_t *__sctp_lookup_association(const union sctp_addr *local,
}
/* Look up an association. BH-safe. */
sctp_association_t *sctp_lookup_association(const union sctp_addr *laddr,
struct sctp_association *sctp_lookup_association(const union sctp_addr *laddr,
const union sctp_addr *paddr,
struct sctp_transport **transportp)
{
sctp_association_t *asoc;
struct sctp_association *asoc;
sctp_local_bh_disable();
asoc = __sctp_lookup_association(laddr, paddr, transportp);
......@@ -727,7 +728,7 @@ sctp_association_t *sctp_lookup_association(const union sctp_addr *laddr,
int sctp_has_association(const union sctp_addr *laddr,
const union sctp_addr *paddr)
{
sctp_association_t *asoc;
struct sctp_association *asoc;
struct sctp_transport *transport;
if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) {
......@@ -757,10 +758,10 @@ int sctp_has_association(const union sctp_addr *laddr,
* in certain circumstances.
*
*/
static sctp_association_t *__sctp_rcv_init_lookup(struct sk_buff *skb,
static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb,
const union sctp_addr *laddr, struct sctp_transport **transportp)
{
sctp_association_t *asoc;
struct sctp_association *asoc;
union sctp_addr addr;
union sctp_addr *paddr = &addr;
struct sctphdr *sh = (struct sctphdr *) skb->h.raw;
......@@ -815,12 +816,12 @@ static sctp_association_t *__sctp_rcv_init_lookup(struct sk_buff *skb,
}
/* Lookup an association for an inbound skb. */
sctp_association_t *__sctp_rcv_lookup(struct sk_buff *skb,
struct sctp_association *__sctp_rcv_lookup(struct sk_buff *skb,
const union sctp_addr *paddr,
const union sctp_addr *laddr,
struct sctp_transport **transportp)
{
sctp_association_t *asoc;
struct sctp_association *asoc;
asoc = __sctp_lookup_association(laddr, paddr, transportp);
......
......@@ -78,7 +78,7 @@ void sctp_inq_free(struct sctp_inq *queue)
sctp_chunk_t *chunk;
/* Empty the queue. */
while ((chunk = (sctp_chunk_t *) skb_dequeue(&queue->in)) != NULL)
while ((chunk = (sctp_chunk_t *) skb_dequeue(&queue->in)))
sctp_free_chunk(chunk);
/* If there is a packet which is currently being worked on,
......@@ -123,7 +123,7 @@ sctp_chunk_t *sctp_inq_pop(struct sctp_inq *queue)
* at this time.
*/
if ((chunk = queue->in_progress) != NULL) {
if ((chunk = queue->in_progress)) {
/* There is a packet that we have been working on.
* Any post processing work to do before we move on?
*/
......
......@@ -95,8 +95,8 @@ void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);
struct sock *sk;
sctp_endpoint_t *ep;
sctp_association_t *asoc;
struct sctp_endpoint *ep;
struct sctp_association *asoc;
struct sctp_transport *transport;
struct ipv6_pinfo *np;
char *saveip, *savesctp;
......@@ -116,7 +116,7 @@ void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
return;
}
/* Warning: The sock lock is held. Remember to call
/* Warning: The sock lock is held. Remember to call
* sctp_err_finish!
*/
......@@ -142,7 +142,7 @@ void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
}
/* Based on tcp_v6_xmit() in tcp_ipv6.c. */
static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
int ipfragok)
{
struct sock *sk = skb->sk;
......@@ -187,7 +187,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
/* Returns the dst cache entry for the given source and destination ip
* addresses.
*/
struct dst_entry *sctp_v6_get_dst(sctp_association_t *asoc,
struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
union sctp_addr *daddr,
union sctp_addr *saddr)
{
......@@ -245,7 +245,7 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
/* Fills in the source address(saddr) based on the destination address(daddr)
* and asoc's bind address list.
*/
void sctp_v6_get_saddr(sctp_association_t *asoc, struct dst_entry *dst,
void sctp_v6_get_saddr(struct sctp_association *asoc, struct dst_entry *dst,
union sctp_addr *daddr, union sctp_addr *saddr)
{
sctp_bind_addr_t *bp;
......@@ -385,7 +385,7 @@ static void sctp_v6_dst_saddr(union sctp_addr *addr, struct dst_entry *dst,
ipv6_addr_copy(&addr->v6.sin6_addr, &rt->rt6i_src.addr);
}
/* Compare addresses exactly.
/* Compare addresses exactly.
* FIXME: v4-mapped-v6.
*/
static int sctp_v6_cmp_addr(const union sctp_addr *addr1,
......@@ -562,7 +562,7 @@ static void sctp_inet6_msgname(char *msgname, int *addr_len)
}
/* Initialize a PF_INET msgname from a ulpevent. */
static void sctp_inet6_event_msgname(struct sctp_ulpevent *event,
static void sctp_inet6_event_msgname(struct sctp_ulpevent *event,
char *msgname, int *addrlen)
{
struct sockaddr_in6 *sin6, *sin6from;
......@@ -589,7 +589,7 @@ static void sctp_inet6_event_msgname(struct sctp_ulpevent *event,
sin6from = &event->asoc->peer.primary_addr.v6;
ipv6_addr_copy(&sin6->sin6_addr, &sin6from->sin6_addr);
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
sin6->sin6_scope_id = sin6from->sin6_scope_id;
}
}
......@@ -689,7 +689,7 @@ static int sctp_inet6_bind_verify(struct sctp_opt *opt, union sctp_addr *addr)
if (addr->v6.sin6_scope_id)
sk->bound_dev_if = addr->v6.sin6_scope_id;
if (!sk->bound_dev_if)
return 0;
return 0;
}
af = opt->pf->af;
}
......@@ -719,11 +719,11 @@ static int sctp_inet6_send_verify(struct sctp_opt *opt, union sctp_addr *addr)
if (addr->v6.sin6_scope_id)
sk->bound_dev_if = addr->v6.sin6_scope_id;
if (!sk->bound_dev_if)
return 0;
return 0;
}
af = opt->pf->af;
}
return af != NULL;
}
......
......@@ -94,13 +94,13 @@ static inline void sctp_outq_insert_data(struct sctp_outq *q,
struct sctp_chunk *ch,
struct sctp_chunk *pos)
{
__skb_insert((struct sk_buff *)ch, (struct sk_buff *)pos->prev,
__skb_insert((struct sk_buff *)ch, (struct sk_buff *)pos->prev,
(struct sk_buff *)pos, pos->list);
q->out_qlen += ch->skb->len;
}
/* Generate a new outqueue. */
struct sctp_outq *sctp_outq_new(sctp_association_t *asoc)
struct sctp_outq *sctp_outq_new(struct sctp_association *asoc)
{
struct sctp_outq *q;
......@@ -116,7 +116,7 @@ struct sctp_outq *sctp_outq_new(sctp_association_t *asoc)
* You still need to define handlers if you really want to DO
* something with this structure...
*/
void sctp_outq_init(sctp_association_t *asoc, struct sctp_outq *q)
void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
{
q->asoc = asoc;
skb_queue_head_init(&q->out);
......@@ -417,7 +417,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
struct sctp_transport *transport = pkt->transport;
sctp_xmit_t status;
sctp_chunk_t *chunk;
sctp_association_t *asoc;
struct sctp_association *asoc;
int error = 0;
asoc = q->asoc;
......@@ -527,7 +527,7 @@ void sctp_xmit_frag(struct sctp_outq *q, struct sctp_chunk *pos,
SCTP_DEBUG_PRINTK("sctp_xmit_frag: q not empty. "
"adding 0x%x to outqueue\n",
ntohl(frag->subh.data_hdr->tsn));
if (pos)
if (pos)
sctp_outq_insert_data(q, frag, pos);
else
sctp_outq_tail_data(q, frag);
......@@ -584,7 +584,7 @@ void sctp_xmit_frag(struct sctp_outq *q, struct sctp_chunk *pos,
void sctp_xmit_fragmented_chunks(struct sctp_outq *q, struct sctp_packet *pkt,
sctp_chunk_t *frag)
{
sctp_association_t *asoc = frag->asoc;
struct sctp_association *asoc = frag->asoc;
struct list_head *lfrag, *frag_list;
__u32 tsn;
int nfrags = 1;
......@@ -618,7 +618,7 @@ void sctp_xmit_fragmented_chunks(struct sctp_outq *q, struct sctp_packet *pkt,
sctp_chunk_t *sctp_fragment_chunk(sctp_chunk_t *chunk,
size_t max_frag_data_len)
{
sctp_association_t *asoc = chunk->asoc;
struct sctp_association *asoc = chunk->asoc;
void *data_ptr = chunk->subh.data_hdr;
struct sctp_sndrcvinfo *sinfo = &chunk->sinfo;
__u16 chunk_data_len = sctp_data_size(chunk);
......@@ -724,7 +724,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
{
struct sctp_packet *packet;
struct sctp_packet singleton;
sctp_association_t *asoc = q->asoc;
struct sctp_association *asoc = q->asoc;
int ecn_capable = asoc->peer.ecn_capable;
__u16 sport = asoc->base.bind_addr.port;
__u16 dport = asoc->peer.port;
......@@ -1077,7 +1077,7 @@ int sctp_outq_set_output_handlers(struct sctp_outq *q,
}
/* Update unack_data based on the incoming SACK chunk */
static void sctp_sack_update_unack_data(sctp_association_t *assoc,
static void sctp_sack_update_unack_data(struct sctp_association *assoc,
sctp_sackhdr_t *sack)
{
sctp_sack_variable_t *frags;
......@@ -1097,7 +1097,7 @@ static void sctp_sack_update_unack_data(sctp_association_t *assoc,
/* Return the highest new tsn that is acknowledged by the given SACK chunk. */
static __u32 sctp_highest_new_tsn(sctp_sackhdr_t *sack,
sctp_association_t *asoc)
struct sctp_association *asoc)
{
struct list_head *ltransport, *lchunk;
struct sctp_transport *transport;
......@@ -1132,7 +1132,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;
struct sctp_association *asoc = q->asoc;
struct sctp_transport *transport;
sctp_chunk_t *tchunk;
struct list_head *lchunk, *transport_list, *pos;
......
......@@ -55,12 +55,12 @@
#define DECLARE_PRIMITIVE(name) \
/* This is called in the code as sctp_primitive_ ## name. */ \
int sctp_primitive_ ## name(sctp_association_t *asoc, \
int sctp_primitive_ ## name(struct sctp_association *asoc, \
void *arg) { \
int error = 0; \
sctp_event_t event_type; sctp_subtype_t subtype; \
sctp_state_t state; \
sctp_endpoint_t *ep; \
struct sctp_endpoint *ep; \
\
event_type = SCTP_EVENT_T_PRIMITIVE; \
subtype = SCTP_ST_PRIMITIVE(SCTP_PRIMITIVE_ ## name); \
......
......@@ -203,7 +203,7 @@ static void sctp_free_local_addr_list(struct sctp_protocol *proto)
/* Copy the local addresses which are valid for 'scope' into 'bp'. */
int sctp_copy_local_addr_list(struct sctp_protocol *proto,
struct sctp_bind_addr *bp, sctp_scope_t scope,
int priority, int copy_flags)
int gfp, int copy_flags)
{
struct sockaddr_storage_list *addr;
int error = 0;
......@@ -223,8 +223,7 @@ int sctp_copy_local_addr_list(struct sctp_protocol *proto,
(((AF_INET6 == addr->a.sa.sa_family) &&
(copy_flags & SCTP_ADDR6_ALLOWED) &&
(copy_flags & SCTP_ADDR6_PEERSUPP)))) {
error = sctp_add_bind_addr(bp, &addr->a,
priority);
error = sctp_add_bind_addr(bp, &addr->a, gfp);
if (error)
goto end_copy;
}
......@@ -471,7 +470,7 @@ struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
/* For v4, the source address is cached in the route entry(dst). So no need
* to cache it separately and hence this is an empty routine.
*/
void sctp_v4_get_saddr(sctp_association_t *asoc,
void sctp_v4_get_saddr(struct sctp_association *asoc,
struct dst_entry *dst,
union sctp_addr *daddr,
union sctp_addr *saddr)
......@@ -480,12 +479,12 @@ void sctp_v4_get_saddr(sctp_association_t *asoc,
}
/* What interface did this skb arrive on? */
int sctp_v4_skb_iif(const struct sk_buff *skb)
int sctp_v4_skb_iif(const struct sk_buff *skb)
{
return ((struct rtable *)skb->dst)->rt_iif;
return ((struct rtable *)skb->dst)->rt_iif;
}
/* Create and initialize a new sk for the socket returned by accept(). */
/* Create and initialize a new sk for the socket returned by accept(). */
struct sock *sctp_v4_create_accept_sk(struct sock *sk,
struct sctp_association *asoc)
{
......@@ -511,7 +510,7 @@ struct sock *sctp_v4_create_accept_sk(struct sock *sk,
newsk->family = PF_INET;
newsk->protocol = IPPROTO_SCTP;
newsk->backlog_rcv = sk->prot->backlog_rcv;
newinet = inet_sk(newsk);
newinet->sport = inet->sport;
newinet->saddr = inet->saddr;
......@@ -520,7 +519,7 @@ struct sock *sctp_v4_create_accept_sk(struct sock *sk,
newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
newinet->pmtudisc = inet->pmtudisc;
newinet->id = 0;
newinet->ttl = sysctl_ip_default_ttl;
newinet->mc_loop = 1;
newinet->mc_ttl = 1;
......@@ -567,7 +566,7 @@ int sctp_ctl_sock_init(void)
if (sctp_get_pf_specific(PF_INET6))
family = PF_INET6;
else
else
family = PF_INET;
err = sock_create(family, SOCK_SEQPACKET, IPPROTO_SCTP,
......@@ -694,7 +693,7 @@ static int sctp_inet_bind_verify(struct sctp_opt *opt, union sctp_addr *addr)
return sctp_v4_available(addr);
}
/* Verify that sockaddr looks sendable. Common verification has already
/* Verify that sockaddr looks sendable. Common verification has already
* been taken care of.
*/
static int sctp_inet_send_verify(struct sctp_opt *opt, union sctp_addr *addr)
......@@ -705,7 +704,7 @@ static int sctp_inet_send_verify(struct sctp_opt *opt, union sctp_addr *addr)
/* Fill in Supported Address Type information for INIT and INIT-ACK
* chunks. Returns number of addresses supported.
*/
static int sctp_inet_supported_addrs(const struct sctp_opt *opt,
static int sctp_inet_supported_addrs(const struct sctp_opt *opt,
__u16 *types)
{
types[0] = SCTP_PARAM_IPV4_ADDRESS;
......
......@@ -2064,7 +2064,7 @@ int sctp_process_param(struct sctp_association *asoc, union sctp_params param,
}
/* Select a new verification tag. */
__u32 sctp_generate_tag(const sctp_endpoint_t *ep)
__u32 sctp_generate_tag(const struct sctp_endpoint *ep)
{
/* I believe that this random number generator complies with RFC1750.
* A tag of 0 is reserved for special cases (e.g. INIT).
......@@ -2079,7 +2079,7 @@ __u32 sctp_generate_tag(const sctp_endpoint_t *ep)
}
/* Select an initial TSN to send during startup. */
__u32 sctp_generate_tsn(const sctp_endpoint_t *ep)
__u32 sctp_generate_tsn(const struct sctp_endpoint *ep)
{
__u32 retval;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -53,11 +53,11 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
/* Create a new sctp_ssnmap.
* Allocate room to store at least 'len' contiguous TSNs.
*/
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int priority)
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
{
struct sctp_ssnmap *retval;
retval = kmalloc(sctp_ssnmap_size(in, out), priority);
retval = kmalloc(sctp_ssnmap_size(in, out), gfp);
if (!retval)
goto fail;
......
......@@ -54,16 +54,15 @@
/* 1st Level Abstractions. */
/* Allocate and initialize a new transport. */
struct sctp_transport *sctp_transport_new(const union sctp_addr *addr,
int priority)
struct sctp_transport *sctp_transport_new(const union sctp_addr *addr, int gfp)
{
struct sctp_transport *transport;
transport = t_new(struct sctp_transport, priority);
transport = t_new(struct sctp_transport, gfp);
if (!transport)
goto fail;
if (!sctp_transport_init(transport, addr, priority))
if (!sctp_transport_init(transport, addr, gfp))
goto fail_init;
transport->malloced = 1;
......@@ -81,7 +80,7 @@ struct sctp_transport *sctp_transport_new(const union sctp_addr *addr,
/* Intialize a new transport from provided memory. */
struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
const union sctp_addr *addr,
int priority)
int gfp)
{
struct sctp_protocol *proto = sctp_get_protocol();
......@@ -199,13 +198,13 @@ void sctp_transport_reset_timers(struct sctp_transport *transport)
* Register the reference count in the association.
*/
void sctp_transport_set_owner(struct sctp_transport *transport,
sctp_association_t *asoc)
struct sctp_association *asoc)
{
transport->asoc = asoc;
sctp_association_hold(asoc);
}
/* Initialize the pmtu of a transport. */
/* Initialize the pmtu of a transport. */
void sctp_transport_pmtu(struct sctp_transport *transport)
{
struct dst_entry *dst;
......@@ -225,7 +224,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport)
void sctp_transport_route(struct sctp_transport *transport,
union sctp_addr *saddr, struct sctp_opt *opt)
{
sctp_association_t *asoc = transport->asoc;
struct sctp_association *asoc = transport->asoc;
struct sctp_af *af = transport->af_specific;
union sctp_addr *daddr = &transport->ipaddr;
struct dst_entry *dst;
......@@ -359,7 +358,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
* 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
* 1) the total size of the previously outstanding DATA
* chunk(s) acknowledged, and 2) the destination's path MTU.
*/
if (bytes_acked > pmtu)
......@@ -373,17 +372,17 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport,
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
/* 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),
* 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).
*/
......
......@@ -55,13 +55,12 @@ static void sctp_tsnmap_find_gap_ack(__u8 *map, __u16 off,
/* Create a new sctp_tsnmap.
* Allocate room to store at least 'len' contiguous TSNs.
*/
struct sctp_tsnmap *sctp_tsnmap_new(__u16 len, __u32 initial_tsn, int priority)
struct sctp_tsnmap *sctp_tsnmap_new(__u16 len, __u32 initial_tsn, int gfp)
{
struct sctp_tsnmap *retval;
retval = kmalloc(sizeof(struct sctp_tsnmap) +
sctp_tsnmap_storage_size(len),
priority);
sctp_tsnmap_storage_size(len), gfp);
if (!retval)
goto fail;
......
......@@ -52,12 +52,12 @@ static void sctp_ulpevent_set_owner(struct sk_buff *skb,
const struct sctp_association *asoc);
/* Create a new sctp_ulpevent. */
struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags, int priority)
struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags, int gfp)
{
struct sctp_ulpevent *event;
struct sk_buff *skb;
skb = alloc_skb(size, priority);
skb = alloc_skb(size, gfp);
if (!skb)
goto fail;
......@@ -106,16 +106,16 @@ int sctp_ulpevent_is_notification(const struct sctp_ulpevent *event)
* zero'd out.
*/
struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
const sctp_association_t *asoc,
const struct sctp_association *asoc,
__u16 flags, __u16 state, __u16 error, __u16 outbound,
__u16 inbound, int priority)
__u16 inbound, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_assoc_change *sac;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
MSG_NOTIFICATION, priority);
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
skb = sctp_event2skb(event);
......@@ -207,15 +207,16 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
* an interface details event is sent.
*/
struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
const sctp_association_t *asoc, const struct sockaddr_storage *aaddr,
int flags, int state, int error, int priority)
const struct sctp_association *asoc,
const struct sockaddr_storage *aaddr,
int flags, int state, int error, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_paddr_change *spc;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_paddr_change),
MSG_NOTIFICATION, priority);
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
......@@ -315,8 +316,8 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
* error formats.
*/
struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
const sctp_association_t *asoc, sctp_chunk_t *chunk,
__u16 flags, int priority)
const struct sctp_association *asoc, sctp_chunk_t *chunk,
__u16 flags, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_remote_error *sre;
......@@ -338,7 +339,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
skb = skb_copy_expand(chunk->skb,
sizeof(struct sctp_remote_error), /* headroom */
0, /* tailroom */
priority);
gfp);
/* Pull off the rest of the cause TLV from the chunk. */
skb_pull(chunk->skb, elen);
......@@ -419,8 +420,8 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
* 5.3.1.4 SCTP_SEND_FAILED
*/
struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
const sctp_association_t *asoc, sctp_chunk_t *chunk,
__u16 flags, __u32 error, int priority)
const struct sctp_association *asoc, sctp_chunk_t *chunk,
__u16 flags, __u32 error, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_send_failed *ssf;
......@@ -430,7 +431,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
skb = skb_copy_expand(chunk->skb,
sizeof(struct sctp_send_failed), /* headroom */
0, /* tailroom */
priority);
gfp);
if (!skb)
goto fail;
......@@ -521,15 +522,15 @@ struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
* 5.3.1.5 SCTP_SHUTDOWN_EVENT
*/
struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
const sctp_association_t *asoc,
__u16 flags, int priority)
const struct sctp_association *asoc,
__u16 flags, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_shutdown_event *sse;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
MSG_NOTIFICATION, priority);
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
......@@ -586,8 +587,8 @@ struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
* Socket Extensions for SCTP
* 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
*/
struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc,
sctp_chunk_t *chunk, int priority)
struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
sctp_chunk_t *chunk, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_sndrcvinfo *info;
......@@ -595,7 +596,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc,
size_t padding, len;
/* Clone the original skb, sharing the data. */
skb = skb_clone(chunk->skb, priority);
skb = skb_clone(chunk->skb, gfp);
if (!skb)
goto fail;
......@@ -631,7 +632,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc,
event->iif = sctp_chunk_iif(chunk);
/* Note: Not clearing the entire event struct as
* this is just a fragment of the real event. However,
* we still need to do rwnd accounting.
* we still need to do rwnd accounting.
*/
for (list = skb_shinfo(skb)->frag_list; list; list = list->next)
sctp_ulpevent_set_owner_r(list, asoc);
......@@ -690,16 +691,16 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc,
info->sinfo_flags |= MSG_UNORDERED;
/* sinfo_cumtsn: 32 bit (unsigned integer)
*
* This field will hold the current cumulative TSN as
* known by the underlying SCTP layer. Note this field is
* ignored when sending and only valid for a receive
*
* This field will hold the current cumulative TSN as
* known by the underlying SCTP layer. Note this field is
* ignored when sending and only valid for a receive
* operation when sinfo_flags are set to MSG_UNORDERED.
*/
info->sinfo_cumtsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map);
}
/* Note: For reassembly, we need to have the fragmentation bits.
/* Note: For reassembly, we need to have the fragmentation bits.
* For now, merge these into the msg_flags, since those bit
* possitions are not used.
*/
......@@ -732,7 +733,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc,
return NULL;
}
/* Create a partial delivery related event.
/* Create a partial delivery related event.
*
* 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
*
......@@ -741,14 +742,14 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc,
* various events.
*/
struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
const sctp_association_t *asoc, __u32 indication, int priority)
const struct sctp_association *asoc, __u32 indication, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_rcv_pdapi_event *pd;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
MSG_NOTIFICATION, priority);
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
......@@ -780,7 +781,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
pd->pdapi_indication = indication;
/* pdapi_assoc_id: sizeof (sctp_assoc_t)
*
*
* The association id field, holds the identifier for the association.
*/
pd->pdapi_assoc_id = sctp_assoc2id(asoc);
......@@ -817,7 +818,7 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
/* Do accounting for bytes just read by user. */
static void sctp_rcvmsg_rfree(struct sk_buff *skb)
{
sctp_association_t *asoc;
struct sctp_association *asoc;
struct sctp_ulpevent *event;
/* Current stack structures assume that the rcv buffer is
......@@ -834,7 +835,7 @@ static void sctp_rcvmsg_rfree(struct sk_buff *skb)
/* Charge receive window for bytes received. */
static void sctp_ulpevent_set_owner_r(struct sk_buff *skb,
sctp_association_t *asoc)
struct sctp_association *asoc)
{
struct sctp_ulpevent *event;
......
......@@ -57,11 +57,11 @@ static inline struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *,
/* 1st Level Abstractions */
/* Create a new ULP queue. */
struct sctp_ulpq *sctp_ulpq_new(sctp_association_t *asoc, int priority)
struct sctp_ulpq *sctp_ulpq_new(struct sctp_association *asoc, int gfp)
{
struct sctp_ulpq *ulpq;
ulpq = kmalloc(sizeof(struct sctp_ulpq), priority);
ulpq = kmalloc(sizeof(struct sctp_ulpq), gfp);
if (!ulpq)
goto fail;
if (!sctp_ulpq_init(ulpq, asoc))
......@@ -77,7 +77,7 @@ struct sctp_ulpq *sctp_ulpq_new(sctp_association_t *asoc, int priority)
/* Initialize a ULP queue from a block of memory. */
struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *ulpq,
sctp_association_t *asoc)
struct sctp_association *asoc)
{
memset(ulpq, sizeof(struct sctp_ulpq), 0x00);
......@@ -119,7 +119,7 @@ void sctp_ulpq_free(struct sctp_ulpq *ulpq)
/* Process an incoming DATA chunk. */
int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, sctp_chunk_t *chunk,
int priority)
int gfp)
{
struct sk_buff_head temp;
sctp_data_chunk_t *hdr;
......@@ -128,7 +128,7 @@ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, sctp_chunk_t *chunk,
hdr = (sctp_data_chunk_t *) chunk->chunk_hdr;
/* Create an event from the incoming chunk. */
event = sctp_ulpevent_make_rcvmsg(chunk->asoc, chunk, priority);
event = sctp_ulpevent_make_rcvmsg(chunk->asoc, chunk, gfp);
if (!event)
return -ENOMEM;
......@@ -705,7 +705,7 @@ static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed)
/* Partial deliver the first message as there is pressure on rwnd. */
void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
struct sctp_chunk *chunk, int priority)
struct sctp_chunk *chunk, int gfp)
{
struct sctp_ulpevent *event;
struct sctp_association *asoc;
......@@ -729,7 +729,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
/* Renege some packets to make room for an incoming chunk. */
void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
int priority)
int gfp)
{
struct sctp_association *asoc;
__u16 needed, freed;
......@@ -755,9 +755,9 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
__u32 tsn;
tsn = ntohl(chunk->subh.data_hdr->tsn);
sctp_tsnmap_mark(&asoc->peer.tsn_map, tsn);
sctp_ulpq_tail_data(ulpq, chunk, priority);
sctp_ulpq_tail_data(ulpq, chunk, gfp);
sctp_ulpq_partial_delivery(ulpq, chunk, priority);
sctp_ulpq_partial_delivery(ulpq, chunk, gfp);
}
return;
......@@ -768,7 +768,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
/* Notify the application if an association is aborted and in
* partial delivery mode. Send up any pending received messages.
*/
void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, int priority)
void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, int gfp)
{
struct sctp_ulpevent *ev = NULL;
struct sock *sk;
......@@ -781,7 +781,7 @@ void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, int priority)
&sctp_sk(sk)->subscribe))
ev = sctp_ulpevent_make_pdapi(ulpq->asoc,
SCTP_PARTIAL_DELIVERY_ABORTED,
priority);
gfp);
if (ev)
__skb_queue_tail(&sk->receive_queue, sctp_event2skb(ev));
......
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