aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2008-07-25 12:44:09 -0400
committerVlad Yasevich <vladislav.yasevich@hp.com>2008-10-01 11:33:06 -0400
commitc226ef9b83694311327f3ab0036c6de9c22e9daf (patch)
tree04c81b4186fd79a1f1b129a8627da6a41ceb4c25
parent845b8eda4d783a7ce2670d482a716840a650389e (diff)
sctp: reduce memory footprint of sctp_chunk structure
sctp_chunks should be put on a diet. This is some of the low hanging fruit that we can strip out. Changes all the __s8/__u8 flags to bitfields. Saves 12 bytes per chunk. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
-rw-r--r--include/net/sctp/structs.h31
-rw-r--r--net/sctp/output.c2
-rw-r--r--net/sctp/outqueue.c14
-rw-r--r--net/sctp/sm_make_chunk.c2
4 files changed, 26 insertions, 23 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ab1c472ea753..0dc1b7267c37 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -731,20 +731,23 @@ struct sctp_chunk {
731 */ 731 */
732 struct sk_buff *auth_chunk; 732 struct sk_buff *auth_chunk;
733 733
734 __u8 rtt_in_progress; /* Is this chunk used for RTT calculation? */ 734#define SCTP_CAN_FRTX 0x0
735 __u8 resent; /* Has this chunk ever been retransmitted. */ 735#define SCTP_NEED_FRTX 0x1
736 __u8 has_tsn; /* Does this chunk have a TSN yet? */ 736#define SCTP_DONT_FRTX 0x2
737 __u8 has_ssn; /* Does this chunk have a SSN yet? */ 737 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
738 __u8 singleton; /* Was this the only chunk in the packet? */ 738 resent:1, /* Has this chunk ever been resent. */
739 __u8 end_of_packet; /* Was this the last chunk in the packet? */ 739 has_tsn:1, /* Does this chunk have a TSN yet? */
740 __u8 ecn_ce_done; /* Have we processed the ECN CE bit? */ 740 has_ssn:1, /* Does this chunk have a SSN yet? */
741 __u8 pdiscard; /* Discard the whole packet now? */ 741 singleton:1, /* Only chunk in the packet? */
742 __u8 tsn_gap_acked; /* Is this chunk acked by a GAP ACK? */ 742 end_of_packet:1, /* Last chunk in the packet? */
743 __s8 fast_retransmit; /* Is this chunk fast retransmitted? */ 743 ecn_ce_done:1, /* Have we processed the ECN CE bit? */
744 __u8 tsn_missing_report; /* Data chunk missing counter. */ 744 pdiscard:1, /* Discard the whole packet now? */
745 __u8 data_accepted; /* At least 1 chunk in this packet accepted */ 745 tsn_gap_acked:1, /* Is this chunk acked by a GAP ACK? */
746 __u8 auth; /* IN: was auth'ed | OUT: needs auth */ 746 data_accepted:1, /* At least 1 chunk accepted */
747 __u8 has_asconf; /* IN: have seen an asconf before */ 747 auth:1, /* IN: was auth'ed | OUT: needs auth */
748 has_asconf:1, /* IN: have seen an asconf before */
749 tsn_missing_report:2, /* Data chunk missing counter. */
750 fast_retransmit:2; /* Is this chunk fast retransmitted? */
748}; 751};
749 752
750void sctp_chunk_hold(struct sctp_chunk *); 753void sctp_chunk_hold(struct sctp_chunk *);
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 225c7123c41f..c3f417f7ec6e 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -699,7 +699,7 @@ static sctp_xmit_t sctp_packet_append_data(struct sctp_packet *packet,
699 * When a Fast Retransmit is being performed the sender SHOULD 699 * When a Fast Retransmit is being performed the sender SHOULD
700 * ignore the value of cwnd and SHOULD NOT delay retransmission. 700 * ignore the value of cwnd and SHOULD NOT delay retransmission.
701 */ 701 */
702 if (chunk->fast_retransmit <= 0) 702 if (chunk->fast_retransmit != SCTP_NEED_FRTX)
703 if (transport->flight_size >= transport->cwnd) { 703 if (transport->flight_size >= transport->cwnd) {
704 retval = SCTP_XMIT_RWND_FULL; 704 retval = SCTP_XMIT_RWND_FULL;
705 goto finish; 705 goto finish;
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index da8d846301c1..247ebc95c1e5 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -420,7 +420,7 @@ void sctp_retransmit_mark(struct sctp_outq *q,
420 * be added to the retransmit queue. 420 * be added to the retransmit queue.
421 */ 421 */
422 if ((reason == SCTP_RTXR_FAST_RTX && 422 if ((reason == SCTP_RTXR_FAST_RTX &&
423 (chunk->fast_retransmit > 0)) || 423 (chunk->fast_retransmit == SCTP_NEED_FRTX)) ||
424 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) { 424 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) {
425 /* If this chunk was sent less then 1 rto ago, do not 425 /* If this chunk was sent less then 1 rto ago, do not
426 * retransmit this chunk, but give the peer time 426 * retransmit this chunk, but give the peer time
@@ -650,8 +650,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
650 /* Mark the chunk as ineligible for fast retransmit 650 /* Mark the chunk as ineligible for fast retransmit
651 * after it is retransmitted. 651 * after it is retransmitted.
652 */ 652 */
653 if (chunk->fast_retransmit > 0) 653 if (chunk->fast_retransmit == SCTP_NEED_FRTX)
654 chunk->fast_retransmit = -1; 654 chunk->fast_retransmit = SCTP_DONT_FRTX;
655 655
656 /* Force start T3-rtx timer when fast retransmitting 656 /* Force start T3-rtx timer when fast retransmitting
657 * the earliest outstanding TSN 657 * the earliest outstanding TSN
@@ -680,8 +680,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
680 */ 680 */
681 if (rtx_timeout || fast_rtx) { 681 if (rtx_timeout || fast_rtx) {
682 list_for_each_entry(chunk1, lqueue, transmitted_list) { 682 list_for_each_entry(chunk1, lqueue, transmitted_list) {
683 if (chunk1->fast_retransmit > 0) 683 if (chunk1->fast_retransmit == SCTP_NEED_FRTX)
684 chunk1->fast_retransmit = -1; 684 chunk1->fast_retransmit = SCTP_DONT_FRTX;
685 } 685 }
686 } 686 }
687 687
@@ -1656,7 +1656,7 @@ static void sctp_mark_missing(struct sctp_outq *q,
1656 * chunk if it has NOT been fast retransmitted or marked for 1656 * chunk if it has NOT been fast retransmitted or marked for
1657 * fast retransmit already. 1657 * fast retransmit already.
1658 */ 1658 */
1659 if (!chunk->fast_retransmit && 1659 if (chunk->fast_retransmit == SCTP_CAN_FRTX &&
1660 !chunk->tsn_gap_acked && 1660 !chunk->tsn_gap_acked &&
1661 TSN_lt(tsn, highest_new_tsn_in_sack)) { 1661 TSN_lt(tsn, highest_new_tsn_in_sack)) {
1662 1662
@@ -1681,7 +1681,7 @@ static void sctp_mark_missing(struct sctp_outq *q,
1681 */ 1681 */
1682 1682
1683 if (chunk->tsn_missing_report >= 3) { 1683 if (chunk->tsn_missing_report >= 3) {
1684 chunk->fast_retransmit = 1; 1684 chunk->fast_retransmit = SCTP_NEED_FRTX;
1685 do_fast_retransmit = 1; 1685 do_fast_retransmit = 1;
1686 } 1686 }
1687 } 1687 }
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index d68869f966c3..99fe0747cc96 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1211,7 +1211,7 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,
1211 */ 1211 */
1212 retval->tsn_missing_report = 0; 1212 retval->tsn_missing_report = 0;
1213 retval->tsn_gap_acked = 0; 1213 retval->tsn_gap_acked = 0;
1214 retval->fast_retransmit = 0; 1214 retval->fast_retransmit = SCTP_CAN_FRTX;
1215 1215
1216 /* If this is a fragmented message, track all fragments 1216 /* If this is a fragmented message, track all fragments
1217 * of the message (for SEND_FAILED). 1217 * of the message (for SEND_FAILED).