2222 */
2323static bool rxrpc_check_tx_space (struct rxrpc_call * call , rxrpc_seq_t * _tx_win )
2424{
25- unsigned int win_size ;
26- rxrpc_seq_t tx_win = smp_load_acquire (& call -> acks_hard_ack );
27-
28- /* If we haven't transmitted anything for >1RTT, we should reset the
29- * congestion management state.
30- */
31- if (ktime_before (ktime_add_us (call -> tx_last_sent ,
32- call -> peer -> srtt_us >> 3 ),
33- ktime_get_real ())) {
34- if (RXRPC_TX_SMSS > 2190 )
35- win_size = 2 ;
36- else if (RXRPC_TX_SMSS > 1095 )
37- win_size = 3 ;
38- else
39- win_size = 4 ;
40- win_size += call -> cong_extra ;
41- } else {
42- win_size = min_t (unsigned int , call -> tx_winsize ,
43- call -> cong_cwnd + call -> cong_extra );
44- }
45-
4625 if (_tx_win )
47- * _tx_win = tx_win ;
48- return call -> tx_top - tx_win < win_size ;
26+ * _tx_win = call -> tx_bottom ;
27+ return call -> tx_prepared - call -> tx_bottom < 256 ;
4928}
5029
5130/*
@@ -66,11 +45,6 @@ static int rxrpc_wait_for_tx_window_intr(struct rxrpc_sock *rx,
6645 if (signal_pending (current ))
6746 return sock_intr_errno (* timeo );
6847
69- if (READ_ONCE (call -> acks_hard_ack ) != call -> tx_bottom ) {
70- rxrpc_shrink_call_tx_buffer (call );
71- continue ;
72- }
73-
7448 trace_rxrpc_txqueue (call , rxrpc_txqueue_wait );
7549 * timeo = schedule_timeout (* timeo );
7650 }
@@ -107,11 +81,6 @@ static int rxrpc_wait_for_tx_window_waitall(struct rxrpc_sock *rx,
10781 tx_win == tx_start && signal_pending (current ))
10882 return - EINTR ;
10983
110- if (READ_ONCE (call -> acks_hard_ack ) != call -> tx_bottom ) {
111- rxrpc_shrink_call_tx_buffer (call );
112- continue ;
113- }
114-
11584 if (tx_win != tx_start ) {
11685 timeout = rtt ;
11786 tx_start = tx_win ;
@@ -137,11 +106,6 @@ static int rxrpc_wait_for_tx_window_nonintr(struct rxrpc_sock *rx,
137106 if (call -> state >= RXRPC_CALL_COMPLETE )
138107 return call -> error ;
139108
140- if (READ_ONCE (call -> acks_hard_ack ) != call -> tx_bottom ) {
141- rxrpc_shrink_call_tx_buffer (call );
142- continue ;
143- }
144-
145109 trace_rxrpc_txqueue (call , rxrpc_txqueue_wait );
146110 * timeo = schedule_timeout (* timeo );
147111 }
@@ -207,29 +171,27 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
207171 unsigned long now ;
208172 rxrpc_seq_t seq = txb -> seq ;
209173 bool last = test_bit (RXRPC_TXBUF_LAST , & txb -> flags );
210- int ret ;
211174
212175 rxrpc_inc_stat (call -> rxnet , stat_tx_data );
213176
214- ASSERTCMP (seq , = = , call -> tx_top + 1 );
177+ ASSERTCMP (txb -> seq , = = , call -> tx_prepared + 1 );
215178
216179 /* We have to set the timestamp before queueing as the retransmit
217180 * algorithm can see the packet as soon as we queue it.
218181 */
219182 txb -> last_sent = ktime_get_real ();
220183
221- /* Add the packet to the call's output buffer */
222- rxrpc_get_txbuf (txb , rxrpc_txbuf_get_buffer );
223- spin_lock (& call -> tx_lock );
224- list_add_tail (& txb -> call_link , & call -> tx_buffer );
225- call -> tx_top = seq ;
226- spin_unlock (& call -> tx_lock );
227-
228184 if (last )
229185 trace_rxrpc_txqueue (call , rxrpc_txqueue_queue_last );
230186 else
231187 trace_rxrpc_txqueue (call , rxrpc_txqueue_queue );
232188
189+ /* Add the packet to the call's output buffer */
190+ spin_lock (& call -> tx_lock );
191+ list_add_tail (& txb -> call_link , & call -> tx_sendmsg );
192+ call -> tx_prepared = seq ;
193+ spin_unlock (& call -> tx_lock );
194+
233195 if (last || call -> state == RXRPC_CALL_SERVER_ACK_REQUEST ) {
234196 _debug ("________awaiting reply/ACK__________" );
235197 write_lock_bh (& call -> state_lock );
@@ -258,30 +220,11 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
258220 write_unlock_bh (& call -> state_lock );
259221 }
260222
261- if (seq == 1 && rxrpc_is_client_call (call ))
262- rxrpc_expose_client_call (call );
263-
264- ret = rxrpc_send_data_packet (call , txb );
265- if (ret < 0 ) {
266- switch (ret ) {
267- case - ENETUNREACH :
268- case - EHOSTUNREACH :
269- case - ECONNREFUSED :
270- rxrpc_set_call_completion (call , RXRPC_CALL_LOCAL_ERROR ,
271- 0 , ret );
272- goto out ;
273- }
274- } else {
275- unsigned long now = jiffies ;
276- unsigned long resend_at = now + call -> peer -> rto_j ;
277223
278- WRITE_ONCE (call -> resend_at , resend_at );
279- rxrpc_reduce_call_timer (call , resend_at , now ,
280- rxrpc_timer_set_for_send );
281- }
282-
283- out :
284- rxrpc_put_txbuf (txb , rxrpc_txbuf_put_trans );
224+ /* Stick the packet on the crypto queue or the transmission queue as
225+ * appropriate.
226+ */
227+ rxrpc_queue_call (call , rxrpc_call_queue_tx_data );
285228}
286229
287230/*
0 commit comments