mirror of
https://github.com/ipxe/ipxe
synced 2025-12-17 18:11:49 +03:00
[tcp] Send xfer_window_changed() when window opens
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -391,6 +391,25 @@ static size_t tcp_xmit_win ( struct tcp_connection *tcp ) {
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check data-transfer flow control window
|
||||||
|
*
|
||||||
|
* @v tcp TCP connection
|
||||||
|
* @ret len Length of window
|
||||||
|
*/
|
||||||
|
static size_t tcp_xfer_window ( struct tcp_connection *tcp ) {
|
||||||
|
|
||||||
|
/* Not ready if data queue is non-empty. This imposes a limit
|
||||||
|
* of only one unACKed packet in the TX queue at any time; we
|
||||||
|
* do this to conserve memory usage.
|
||||||
|
*/
|
||||||
|
if ( ! list_empty ( &tcp->tx_queue ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Return TCP window length */
|
||||||
|
return tcp_xmit_win ( tcp );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process TCP transmit queue
|
* Process TCP transmit queue
|
||||||
*
|
*
|
||||||
@@ -1084,6 +1103,7 @@ static int tcp_rx ( struct io_buffer *iobuf,
|
|||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
size_t len;
|
size_t len;
|
||||||
uint32_t seq_len;
|
uint32_t seq_len;
|
||||||
|
size_t old_xfer_window;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Sanity check packet */
|
/* Sanity check packet */
|
||||||
@@ -1145,6 +1165,9 @@ static int tcp_rx ( struct io_buffer *iobuf,
|
|||||||
goto discard;
|
goto discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Record old data-transfer window */
|
||||||
|
old_xfer_window = tcp_xfer_window ( tcp );
|
||||||
|
|
||||||
/* Handle ACK, if present */
|
/* Handle ACK, if present */
|
||||||
if ( flags & TCP_ACK ) {
|
if ( flags & TCP_ACK ) {
|
||||||
if ( ( rc = tcp_rx_ack ( tcp, ack, win ) ) != 0 ) {
|
if ( ( rc = tcp_rx_ack ( tcp, ack, win ) ) != 0 ) {
|
||||||
@@ -1191,6 +1214,10 @@ static int tcp_rx ( struct io_buffer *iobuf,
|
|||||||
start_timer_fixed ( &tcp->wait, ( 2 * TCP_MSL ) );
|
start_timer_fixed ( &tcp->wait, ( 2 * TCP_MSL ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Notify application if window has changed */
|
||||||
|
if ( tcp_xfer_window ( tcp ) != old_xfer_window )
|
||||||
|
xfer_window_changed ( &tcp->xfer );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
discard:
|
discard:
|
||||||
@@ -1256,25 +1283,6 @@ static void tcp_xfer_close ( struct tcp_connection *tcp, int rc ) {
|
|||||||
tcp_xmit ( tcp );
|
tcp_xmit ( tcp );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check flow control window
|
|
||||||
*
|
|
||||||
* @v tcp TCP connection
|
|
||||||
* @ret len Length of window
|
|
||||||
*/
|
|
||||||
static size_t tcp_xfer_window ( struct tcp_connection *tcp ) {
|
|
||||||
|
|
||||||
/* Not ready if data queue is non-empty. This imposes a limit
|
|
||||||
* of only one unACKed packet in the TX queue at any time; we
|
|
||||||
* do this to conserve memory usage.
|
|
||||||
*/
|
|
||||||
if ( ! list_empty ( &tcp->tx_queue ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Return TCP window length */
|
|
||||||
return tcp_xmit_win ( tcp );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deliver datagram as I/O buffer
|
* Deliver datagram as I/O buffer
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user