#include <ipxe/open.h>
#include <ipxe/uri.h>
#include <ipxe/netdevice.h>
+#include <ipxe/profile.h>
#include <ipxe/tcpip.h>
#include <ipxe/tcp.h>
*/
static LIST_HEAD ( tcp_conns );
+/** Transmit profiler */
+static struct profiler tcp_tx_profiler __profiler = { .name = "tcp.tx" };
+
+/** Receive profiler */
+static struct profiler tcp_rx_profiler __profiler = { .name = "tcp.rx" };
+
+/** Data transfer profiler */
+static struct profiler tcp_xfer_profiler __profiler = { .name = "tcp.xfer" };
+
/* Forward declarations */
static struct interface_descriptor tcp_xfer_desc;
static void tcp_expired ( struct retry_timer *timer, int over );
uint32_t max_representable_win;
int rc;
+ /* Start profiling */
+ profile_start ( &tcp_tx_profiler );
+
/* If retransmission timer is already running, do nothing */
if ( timer_running ( &tcp->timer ) )
return 0;
/* Clear ACK-pending flag */
tcp->flags &= ~TCP_ACK_PENDING;
+ profile_stop ( &tcp_tx_profiler );
return 0;
}
tcp_rx_seq ( tcp, len );
/* Deliver data to application */
+ profile_start ( &tcp_xfer_profiler );
if ( ( rc = xfer_deliver_iob ( &tcp->xfer, iobuf ) ) != 0 ) {
DBGC ( tcp, "TCP %p could not deliver %08x..%08x: %s\n",
tcp, seq, ( seq + len ), strerror ( rc ) );
return rc;
}
+ profile_stop ( &tcp_xfer_profiler );
return 0;
}
size_t old_xfer_window;
int rc;
+ /* Start profiling */
+ profile_start ( &tcp_rx_profiler );
+
/* Sanity check packet */
if ( iob_len ( iobuf ) < sizeof ( *tcphdr ) ) {
DBG ( "TCP packet too short at %zd bytes (min %zd bytes)\n",
if ( tcp_xfer_window ( tcp ) != old_xfer_window )
xfer_window_changed ( &tcp->xfer );
+ profile_stop ( &tcp_rx_profiler );
return 0;
discard: