Skip to content

Commit

Permalink
Merge branch 'net-next' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/vxy/lksctp-dev

Add missing linux/vmalloc.h include to net/sctp/probe.c

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 3, 2010
2 parents 4f70ecc + 0e3aef8 commit f546061
Show file tree
Hide file tree
Showing 16 changed files with 365 additions and 176 deletions.
2 changes: 1 addition & 1 deletion include/net/sctp/sctp.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
#define WORD_ROUND(s) (((s)+3)&~3)

/* Make a new instance of type. */
#define t_new(type, flags) (type *)kmalloc(sizeof(type), flags)
#define t_new(type, flags) (type *)kzalloc(sizeof(type), flags)

/* Compare two timevals. */
#define tv_lt(s, t) \
Expand Down
2 changes: 1 addition & 1 deletion include/net/sctp/sm.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ sctp_vtag_verify_either(const struct sctp_chunk *chunk,
*/
if ((!sctp_test_T_bit(chunk) &&
(ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) ||
(sctp_test_T_bit(chunk) &&
(sctp_test_T_bit(chunk) && asoc->c.peer_vtag &&
(ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) {
return 1;
}
Expand Down
66 changes: 34 additions & 32 deletions include/net/sctp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,17 +643,15 @@ struct sctp_pf {
struct sctp_datamsg {
/* Chunks waiting to be submitted to lower layer. */
struct list_head chunks;
/* Chunks that have been transmitted. */
size_t msg_size;
/* Reference counting. */
atomic_t refcnt;
/* When is this message no longer interesting to the peer? */
unsigned long expires_at;
/* Did the messenge fail to send? */
int send_error;
char send_failed;
/* Control whether chunks from this message can be abandoned. */
char can_abandon;
u8 send_failed:1,
can_abandon:1, /* can chunks from this message can be abandoned. */
can_delay; /* should this message be Nagle delayed */
};

struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
Expand Down Expand Up @@ -757,7 +755,6 @@ struct sctp_chunk {
#define SCTP_NEED_FRTX 0x1
#define SCTP_DONT_FRTX 0x2
__u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
resent:1, /* Has this chunk ever been resent. */
has_tsn:1, /* Does this chunk have a TSN yet? */
has_ssn:1, /* Does this chunk have a SSN yet? */
singleton:1, /* Only chunk in the packet? */
Expand Down Expand Up @@ -879,7 +876,30 @@ struct sctp_transport {

/* Reference counting. */
atomic_t refcnt;
int dead;
int dead:1,
/* RTO-Pending : A flag used to track if one of the DATA
* chunks sent to this address is currently being
* used to compute a RTT. If this flag is 0,
* the next DATA chunk sent to this destination
* should be used to compute a RTT and this flag
* should be set. Every time the RTT
* calculation completes (i.e. the DATA chunk
* is SACK'd) clear this flag.
*/
rto_pending:1,

/*
* hb_sent : a flag that signals that we have a pending
* heartbeat.
*/
hb_sent:1,

/* Is the Path MTU update pending on this tranport */
pmtu_pending:1,

/* Is this structure kfree()able? */
malloced:1;


/* This is the peer's IP address and port. */
union sctp_addr ipaddr;
Expand Down Expand Up @@ -909,22 +929,6 @@ struct sctp_transport {
/* SRTT : The current smoothed round trip time. */
__u32 srtt;

/* RTO-Pending : A flag used to track if one of the DATA
* chunks sent to this address is currently being
* used to compute a RTT. If this flag is 0,
* the next DATA chunk sent to this destination
* should be used to compute a RTT and this flag
* should be set. Every time the RTT
* calculation completes (i.e. the DATA chunk
* is SACK'd) clear this flag.
* hb_sent : a flag that signals that we have a pending heartbeat.
*/
__u8 rto_pending;
__u8 hb_sent;

/* Flag to track the current fast recovery state */
__u8 fast_recovery;

/*
* These are the congestion stats.
*/
Expand All @@ -944,9 +948,6 @@ struct sctp_transport {

__u32 burst_limited; /* Holds old cwnd when max.burst is applied */

/* TSN marking the fast recovery exit point */
__u32 fast_recovery_exit;

/* Destination */
struct dst_entry *dst;
/* Source address. */
Expand Down Expand Up @@ -977,9 +978,6 @@ struct sctp_transport {
*/
__u16 pathmaxrxt;

/* is the Path MTU update pending on this tranport */
__u8 pmtu_pending;

/* PMTU : The current known path MTU. */
__u32 pathmtu;

Expand Down Expand Up @@ -1023,8 +1021,6 @@ struct sctp_transport {
/* This is the list of transports that have chunks to send. */
struct list_head send_ready;

int malloced; /* Is this structure kfree()able? */

/* State information saved for SFR_CACC algorithm. The key
* idea in SFR_CACC is to maintain state at the sender on a
* per-destination basis when a changeover happens.
Expand Down Expand Up @@ -1066,7 +1062,7 @@ void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
struct sctp_sock *);
void sctp_transport_pmtu(struct sctp_transport *);
void sctp_transport_free(struct sctp_transport *);
void sctp_transport_reset_timers(struct sctp_transport *, int);
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);
Expand Down Expand Up @@ -1720,6 +1716,12 @@ struct sctp_association {
/* Highest TSN that is acknowledged by incoming SACKs. */
__u32 highest_sacked;

/* TSN marking the fast recovery exit point */
__u32 fast_recovery_exit;

/* Flag to track the current fast recovery state */
__u8 fast_recovery;

/* The number of unacknowledged data chunks. Reported through
* the SCTP_STATUS sockopt.
*/
Expand Down
12 changes: 12 additions & 0 deletions net/sctp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ menuconfig IP_SCTP

if IP_SCTP

config NET_SCTPPROBE
tristate "SCTP: Association probing"
depends on PROC_FS && KPROBES
---help---
This module allows for capturing the changes to SCTP association
state in response to incoming packets. It is used for debugging
SCTP congestion control algorithms. If you don't understand
what was just said, you don't need it: say N.

To compile this code as a module, choose M here: the
module will be called sctp_probe.

config SCTP_DBG_MSG
bool "SCTP: Debug messages"
help
Expand Down
3 changes: 3 additions & 0 deletions net/sctp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

obj-$(CONFIG_IP_SCTP) += sctp.o
obj-$(CONFIG_NET_SCTPPROBE) += sctp_probe.o

sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \
protocol.o endpointola.o associola.o \
Expand All @@ -11,6 +12,8 @@ sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \
tsnmap.o bind_addr.o socket.o primitive.o \
output.o input.o debug.o ssnmap.o auth.o

sctp_probe-y := probe.o

sctp-$(CONFIG_SCTP_DBG_OBJCNT) += objcnt.o
sctp-$(CONFIG_PROC_FS) += proc.o
sctp-$(CONFIG_SYSCTL) += sysctl.o
Expand Down
13 changes: 6 additions & 7 deletions net/sctp/associola.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
/* Retrieve the SCTP per socket area. */
sp = sctp_sk((struct sock *)sk);

/* Init all variables to a known value. */
memset(asoc, 0, sizeof(struct sctp_association));

/* Discarding const is appropriate here. */
asoc->ep = (struct sctp_endpoint *)ep;
sctp_endpoint_hold(asoc->ep);
Expand Down Expand Up @@ -762,7 +759,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
asoc->peer.retran_path = peer;
}

if (asoc->peer.active_path == asoc->peer.retran_path) {
if (asoc->peer.active_path == asoc->peer.retran_path &&
peer->state != SCTP_UNCONFIRMED) {
asoc->peer.retran_path = peer;
}

Expand Down Expand Up @@ -1320,12 +1318,13 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
/* Keep track of the next transport in case
* we don't find any active transport.
*/
if (!next)
if (t->state != SCTP_UNCONFIRMED && !next)
next = t;
}
}

asoc->peer.retran_path = t;
if (t)
asoc->peer.retran_path = t;

SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_update_retran_path:association"
" %p addr: ",
Expand Down Expand Up @@ -1485,7 +1484,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned len)
if (asoc->rwnd >= len) {
asoc->rwnd -= len;
if (over) {
asoc->rwnd_press = asoc->rwnd;
asoc->rwnd_press += asoc->rwnd;
asoc->rwnd = 0;
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions net/sctp/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg)
msg->send_failed = 0;
msg->send_error = 0;
msg->can_abandon = 0;
msg->can_delay = 1;
msg->expires_at = 0;
INIT_LIST_HEAD(&msg->chunks);
msg->msg_size = 0;
}

/* Allocate and initialize datamsg. */
Expand Down Expand Up @@ -157,7 +157,6 @@ static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chu
{
sctp_datamsg_hold(msg);
chunk->msg = msg;
msg->msg_size += chunk->skb->len;
}


Expand Down Expand Up @@ -247,6 +246,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
if (msg_len >= first_len) {
msg_len -= first_len;
whole = 1;
msg->can_delay = 0;
}

/* How many full sized? How many bytes leftover? */
Expand Down
2 changes: 0 additions & 2 deletions net/sctp/endpointola.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
struct sctp_shared_key *null_key;
int err;

memset(ep, 0, sizeof(struct sctp_endpoint));

ep->digest = kzalloc(SCTP_SIGNATURE_SIZE, gfp);
if (!ep->digest)
return NULL;
Expand Down
27 changes: 10 additions & 17 deletions net/sctp/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,24 +429,17 @@ int sctp_packet_transmit(struct sctp_packet *packet)
list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) {
list_del_init(&chunk->list);
if (sctp_chunk_is_data(chunk)) {
/* 6.3.1 C4) When data is in flight and when allowed
* by rule C5, a new RTT measurement MUST be made each
* round trip. Furthermore, new RTT measurements
* SHOULD be made no more than once per round-trip
* for a given destination transport address.
*/

if (!chunk->resent) {

/* 6.3.1 C4) When data is in flight and when allowed
* by rule C5, a new RTT measurement MUST be made each
* round trip. Furthermore, new RTT measurements
* SHOULD be made no more than once per round-trip
* for a given destination transport address.
*/

if (!tp->rto_pending) {
chunk->rtt_in_progress = 1;
tp->rto_pending = 1;
}
if (!tp->rto_pending) {
chunk->rtt_in_progress = 1;
tp->rto_pending = 1;
}

chunk->resent = 1;

has_data = 1;
}

Expand Down Expand Up @@ -681,7 +674,7 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
* Don't delay large message writes that may have been
* fragmeneted into small peices.
*/
if ((len < max) && (chunk->msg->msg_size < max)) {
if ((len < max) && chunk->msg->can_delay) {
retval = SCTP_XMIT_NAGLE_DELAY;
goto finish;
}
Expand Down
Loading

0 comments on commit f546061

Please sign in to comment.