提交 c226ef9b 编写于 作者: N Neil Horman 提交者: Vlad Yasevich

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: NNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: NVlad Yasevich <vladislav.yasevich@hp.com>
上级 845b8eda
...@@ -731,20 +731,23 @@ struct sctp_chunk { ...@@ -731,20 +731,23 @@ struct sctp_chunk {
*/ */
struct sk_buff *auth_chunk; struct sk_buff *auth_chunk;
__u8 rtt_in_progress; /* Is this chunk used for RTT calculation? */ #define SCTP_CAN_FRTX 0x0
__u8 resent; /* Has this chunk ever been retransmitted. */ #define SCTP_NEED_FRTX 0x1
__u8 has_tsn; /* Does this chunk have a TSN yet? */ #define SCTP_DONT_FRTX 0x2
__u8 has_ssn; /* Does this chunk have a SSN yet? */ __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
__u8 singleton; /* Was this the only chunk in the packet? */ resent:1, /* Has this chunk ever been resent. */
__u8 end_of_packet; /* Was this the last chunk in the packet? */ has_tsn:1, /* Does this chunk have a TSN yet? */
__u8 ecn_ce_done; /* Have we processed the ECN CE bit? */ has_ssn:1, /* Does this chunk have a SSN yet? */
__u8 pdiscard; /* Discard the whole packet now? */ singleton:1, /* Only chunk in the packet? */
__u8 tsn_gap_acked; /* Is this chunk acked by a GAP ACK? */ end_of_packet:1, /* Last chunk in the packet? */
__s8 fast_retransmit; /* Is this chunk fast retransmitted? */ ecn_ce_done:1, /* Have we processed the ECN CE bit? */
__u8 tsn_missing_report; /* Data chunk missing counter. */ pdiscard:1, /* Discard the whole packet now? */
__u8 data_accepted; /* At least 1 chunk in this packet accepted */ tsn_gap_acked:1, /* Is this chunk acked by a GAP ACK? */
__u8 auth; /* IN: was auth'ed | OUT: needs auth */ data_accepted:1, /* At least 1 chunk accepted */
__u8 has_asconf; /* IN: have seen an asconf before */ auth:1, /* IN: was auth'ed | OUT: needs auth */
has_asconf:1, /* IN: have seen an asconf before */
tsn_missing_report:2, /* Data chunk missing counter. */
fast_retransmit:2; /* Is this chunk fast retransmitted? */
}; };
void sctp_chunk_hold(struct sctp_chunk *); void sctp_chunk_hold(struct sctp_chunk *);
......
...@@ -699,7 +699,7 @@ static sctp_xmit_t sctp_packet_append_data(struct sctp_packet *packet, ...@@ -699,7 +699,7 @@ static sctp_xmit_t sctp_packet_append_data(struct sctp_packet *packet,
* When a Fast Retransmit is being performed the sender SHOULD * When a Fast Retransmit is being performed the sender SHOULD
* ignore the value of cwnd and SHOULD NOT delay retransmission. * ignore the value of cwnd and SHOULD NOT delay retransmission.
*/ */
if (chunk->fast_retransmit <= 0) if (chunk->fast_retransmit != SCTP_NEED_FRTX)
if (transport->flight_size >= transport->cwnd) { if (transport->flight_size >= transport->cwnd) {
retval = SCTP_XMIT_RWND_FULL; retval = SCTP_XMIT_RWND_FULL;
goto finish; goto finish;
......
...@@ -420,7 +420,7 @@ void sctp_retransmit_mark(struct sctp_outq *q, ...@@ -420,7 +420,7 @@ void sctp_retransmit_mark(struct sctp_outq *q,
* be added to the retransmit queue. * be added to the retransmit queue.
*/ */
if ((reason == SCTP_RTXR_FAST_RTX && if ((reason == SCTP_RTXR_FAST_RTX &&
(chunk->fast_retransmit > 0)) || (chunk->fast_retransmit == SCTP_NEED_FRTX)) ||
(reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) { (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) {
/* If this chunk was sent less then 1 rto ago, do not /* If this chunk was sent less then 1 rto ago, do not
* retransmit this chunk, but give the peer time * 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,8 +650,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
/* Mark the chunk as ineligible for fast retransmit /* Mark the chunk as ineligible for fast retransmit
* after it is retransmitted. * after it is retransmitted.
*/ */
if (chunk->fast_retransmit > 0) if (chunk->fast_retransmit == SCTP_NEED_FRTX)
chunk->fast_retransmit = -1; chunk->fast_retransmit = SCTP_DONT_FRTX;
/* Force start T3-rtx timer when fast retransmitting /* Force start T3-rtx timer when fast retransmitting
* the earliest outstanding TSN * the earliest outstanding TSN
...@@ -680,8 +680,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, ...@@ -680,8 +680,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
*/ */
if (rtx_timeout || fast_rtx) { if (rtx_timeout || fast_rtx) {
list_for_each_entry(chunk1, lqueue, transmitted_list) { list_for_each_entry(chunk1, lqueue, transmitted_list) {
if (chunk1->fast_retransmit > 0) if (chunk1->fast_retransmit == SCTP_NEED_FRTX)
chunk1->fast_retransmit = -1; chunk1->fast_retransmit = SCTP_DONT_FRTX;
} }
} }
...@@ -1656,7 +1656,7 @@ static void sctp_mark_missing(struct sctp_outq *q, ...@@ -1656,7 +1656,7 @@ static void sctp_mark_missing(struct sctp_outq *q,
* chunk if it has NOT been fast retransmitted or marked for * chunk if it has NOT been fast retransmitted or marked for
* fast retransmit already. * fast retransmit already.
*/ */
if (!chunk->fast_retransmit && if (chunk->fast_retransmit == SCTP_CAN_FRTX &&
!chunk->tsn_gap_acked && !chunk->tsn_gap_acked &&
TSN_lt(tsn, highest_new_tsn_in_sack)) { TSN_lt(tsn, highest_new_tsn_in_sack)) {
...@@ -1681,7 +1681,7 @@ static void sctp_mark_missing(struct sctp_outq *q, ...@@ -1681,7 +1681,7 @@ static void sctp_mark_missing(struct sctp_outq *q,
*/ */
if (chunk->tsn_missing_report >= 3) { if (chunk->tsn_missing_report >= 3) {
chunk->fast_retransmit = 1; chunk->fast_retransmit = SCTP_NEED_FRTX;
do_fast_retransmit = 1; do_fast_retransmit = 1;
} }
} }
......
...@@ -1211,7 +1211,7 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb, ...@@ -1211,7 +1211,7 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,
*/ */
retval->tsn_missing_report = 0; retval->tsn_missing_report = 0;
retval->tsn_gap_acked = 0; retval->tsn_gap_acked = 0;
retval->fast_retransmit = 0; retval->fast_retransmit = SCTP_CAN_FRTX;
/* If this is a fragmented message, track all fragments /* If this is a fragmented message, track all fragments
* of the message (for SEND_FAILED). * of the message (for SEND_FAILED).
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册