aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/output.c
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2009-09-04 02:34:06 -0400
committerVlad Yasevich <vladislav.yasevich@hp.com>2009-09-04 18:21:02 -0400
commitbe2971438dec2e2d041af4701472a93a7dd03642 (patch)
tree9b69e184f1be9815f471f06a5456a68aef59578f /net/sctp/output.c
parent9237ccbc0b22b5aa5396463ba0b14dc5efe5b98c (diff)
sctp: remove dup code in net/sctp/output.c
Use sctp_packet_reset() instead of dup code. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/output.c')
-rw-r--r--net/sctp/output.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/net/sctp/output.c b/net/sctp/output.c
index e47398c07185..5cbda8f1ddfd 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -69,6 +69,17 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet,
69 struct sctp_chunk *chunk, 69 struct sctp_chunk *chunk,
70 u16 chunk_len); 70 u16 chunk_len);
71 71
72static void sctp_packet_reset(struct sctp_packet *packet)
73{
74 packet->size = packet->overhead;
75 packet->has_cookie_echo = 0;
76 packet->has_sack = 0;
77 packet->has_data = 0;
78 packet->has_auth = 0;
79 packet->ipfragok = 0;
80 packet->auth = NULL;
81}
82
72/* Config a packet. 83/* Config a packet.
73 * This appears to be a followup set of initializations. 84 * This appears to be a followup set of initializations.
74 */ 85 */
@@ -80,13 +91,8 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet,
80 SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__, 91 SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__,
81 packet, vtag); 92 packet, vtag);
82 93
94 sctp_packet_reset(packet);
83 packet->vtag = vtag; 95 packet->vtag = vtag;
84 packet->has_cookie_echo = 0;
85 packet->has_sack = 0;
86 packet->has_auth = 0;
87 packet->has_data = 0;
88 packet->ipfragok = 0;
89 packet->auth = NULL;
90 96
91 if (ecn_capable && sctp_packet_empty(packet)) { 97 if (ecn_capable && sctp_packet_empty(packet)) {
92 chunk = sctp_get_ecne_prepend(packet->transport->asoc); 98 chunk = sctp_get_ecne_prepend(packet->transport->asoc);
@@ -124,29 +130,12 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *packet,
124 } 130 }
125 overhead += sizeof(struct sctphdr); 131 overhead += sizeof(struct sctphdr);
126 packet->overhead = overhead; 132 packet->overhead = overhead;
127 packet->size = overhead; 133 sctp_packet_reset(packet);
128 packet->vtag = 0; 134 packet->vtag = 0;
129 packet->has_cookie_echo = 0;
130 packet->has_sack = 0;
131 packet->has_auth = 0;
132 packet->has_data = 0;
133 packet->ipfragok = 0;
134 packet->malloced = 0; 135 packet->malloced = 0;
135 packet->auth = NULL;
136 return packet; 136 return packet;
137} 137}
138 138
139static void sctp_packet_reset(struct sctp_packet *packet)
140{
141 packet->size = packet->overhead;
142 packet->has_cookie_echo = 0;
143 packet->has_sack = 0;
144 packet->has_data = 0;
145 packet->has_auth = 0;
146 packet->ipfragok = 0;
147 packet->auth = NULL;
148}
149
150/* Free a packet. */ 139/* Free a packet. */
151void sctp_packet_free(struct sctp_packet *packet) 140void sctp_packet_free(struct sctp_packet *packet)
152{ 141{