diff options
author | Michele Baldessari <michele@acksyn.org> | 2012-11-30 23:49:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-12-03 13:32:15 -0500 |
commit | 196d67593439b03088913227093e374235596e33 (patch) | |
tree | d8d1580673e3cf878d6db230bf86b71187bf3550 /net/sctp/outqueue.c | |
parent | 96070ae4d08eefe62ac534904ce21a01e1a5c9c4 (diff) |
sctp: Add support to per-association statistics via a new SCTP_GET_ASSOC_STATS call
The current SCTP stack is lacking a mechanism to have per association
statistics. This is an implementation modeled after OpenSolaris'
SCTP_GET_ASSOC_STATS.
Userspace part will follow on lksctp if/when there is a general ACK on
this.
V4:
- Move ipackets++ before q->immediate.func() for consistency reasons
- Move sctp_max_rto() at the end of sctp_transport_update_rto() to avoid
returning bogus RTO values
- return asoc->rto_min when max_obs_rto value has not changed
V3:
- Increase ictrlchunks in sctp_assoc_bh_rcv() as well
- Move ipackets++ to sctp_inq_push()
- return 0 when no rto updates took place since the last call
V2:
- Implement partial retrieval of stat struct to cope for future expansion
- Kill the rtxpackets counter as it cannot be precise anyway
- Rename outseqtsns to outofseqtsns to make it clearer that these are out
of sequence unexpected TSNs
- Move asoc->ipackets++ under a lock to avoid potential miscounts
- Fold asoc->opackets++ into the already existing asoc check
- Kill unneeded (q->asoc) test when increasing rtxchunks
- Do not count octrlchunks if sending failed (SCTP_XMIT_OK != 0)
- Don't count SHUTDOWNs as SACKs
- Move SCTP_GET_ASSOC_STATS to the private space API
- Adjust the len check in sctp_getsockopt_assoc_stats() to allow for
future struct growth
- Move association statistics in their own struct
- Update idupchunks when we send a SACK with dup TSNs
- return min_rto in max_rto when RTO has not changed. Also return the
transport when max_rto last changed.
Signed-off: Michele Baldessari <michele@acksyn.org>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/outqueue.c')
-rw-r--r-- | net/sctp/outqueue.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 1b4a7f8ec3fd..379c81dee9d1 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -667,6 +667,7 @@ redo: | |||
667 | chunk->fast_retransmit = SCTP_DONT_FRTX; | 667 | chunk->fast_retransmit = SCTP_DONT_FRTX; |
668 | 668 | ||
669 | q->empty = 0; | 669 | q->empty = 0; |
670 | q->asoc->stats.rtxchunks++; | ||
670 | break; | 671 | break; |
671 | } | 672 | } |
672 | 673 | ||
@@ -876,12 +877,14 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) | |||
876 | if (status != SCTP_XMIT_OK) { | 877 | if (status != SCTP_XMIT_OK) { |
877 | /* put the chunk back */ | 878 | /* put the chunk back */ |
878 | list_add(&chunk->list, &q->control_chunk_list); | 879 | list_add(&chunk->list, &q->control_chunk_list); |
879 | } else if (chunk->chunk_hdr->type == SCTP_CID_FWD_TSN) { | 880 | } else { |
881 | asoc->stats.octrlchunks++; | ||
880 | /* PR-SCTP C5) If a FORWARD TSN is sent, the | 882 | /* PR-SCTP C5) If a FORWARD TSN is sent, the |
881 | * sender MUST assure that at least one T3-rtx | 883 | * sender MUST assure that at least one T3-rtx |
882 | * timer is running. | 884 | * timer is running. |
883 | */ | 885 | */ |
884 | sctp_transport_reset_timers(transport); | 886 | if (chunk->chunk_hdr->type == SCTP_CID_FWD_TSN) |
887 | sctp_transport_reset_timers(transport); | ||
885 | } | 888 | } |
886 | break; | 889 | break; |
887 | 890 | ||
@@ -1055,6 +1058,10 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) | |||
1055 | */ | 1058 | */ |
1056 | if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING) | 1059 | if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING) |
1057 | chunk->chunk_hdr->flags |= SCTP_DATA_SACK_IMM; | 1060 | chunk->chunk_hdr->flags |= SCTP_DATA_SACK_IMM; |
1061 | if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) | ||
1062 | asoc->stats.ouodchunks++; | ||
1063 | else | ||
1064 | asoc->stats.oodchunks++; | ||
1058 | 1065 | ||
1059 | break; | 1066 | break; |
1060 | 1067 | ||
@@ -1162,6 +1169,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk) | |||
1162 | 1169 | ||
1163 | sack_ctsn = ntohl(sack->cum_tsn_ack); | 1170 | sack_ctsn = ntohl(sack->cum_tsn_ack); |
1164 | gap_ack_blocks = ntohs(sack->num_gap_ack_blocks); | 1171 | gap_ack_blocks = ntohs(sack->num_gap_ack_blocks); |
1172 | asoc->stats.gapcnt += gap_ack_blocks; | ||
1165 | /* | 1173 | /* |
1166 | * SFR-CACC algorithm: | 1174 | * SFR-CACC algorithm: |
1167 | * On receipt of a SACK the sender SHOULD execute the | 1175 | * On receipt of a SACK the sender SHOULD execute the |