|
@@ -15,6 +15,7 @@
|
15
|
15
|
#include <ipxe/open.h>
|
16
|
16
|
#include <ipxe/uri.h>
|
17
|
17
|
#include <ipxe/netdevice.h>
|
|
18
|
+#include <ipxe/profile.h>
|
18
|
19
|
#include <ipxe/tcpip.h>
|
19
|
20
|
#include <ipxe/tcp.h>
|
20
|
21
|
|
|
@@ -155,6 +156,15 @@ struct tcp_rx_queued_header {
|
155
|
156
|
*/
|
156
|
157
|
static LIST_HEAD ( tcp_conns );
|
157
|
158
|
|
|
159
|
+/** Transmit profiler */
|
|
160
|
+static struct profiler tcp_tx_profiler __profiler = { .name = "tcp.tx" };
|
|
161
|
+
|
|
162
|
+/** Receive profiler */
|
|
163
|
+static struct profiler tcp_rx_profiler __profiler = { .name = "tcp.rx" };
|
|
164
|
+
|
|
165
|
+/** Data transfer profiler */
|
|
166
|
+static struct profiler tcp_xfer_profiler __profiler = { .name = "tcp.xfer" };
|
|
167
|
+
|
158
|
168
|
/* Forward declarations */
|
159
|
169
|
static struct interface_descriptor tcp_xfer_desc;
|
160
|
170
|
static void tcp_expired ( struct retry_timer *timer, int over );
|
|
@@ -502,6 +512,9 @@ static int tcp_xmit ( struct tcp_connection *tcp ) {
|
502
|
512
|
uint32_t max_representable_win;
|
503
|
513
|
int rc;
|
504
|
514
|
|
|
515
|
+ /* Start profiling */
|
|
516
|
+ profile_start ( &tcp_tx_profiler );
|
|
517
|
+
|
505
|
518
|
/* If retransmission timer is already running, do nothing */
|
506
|
519
|
if ( timer_running ( &tcp->timer ) )
|
507
|
520
|
return 0;
|
|
@@ -613,6 +626,7 @@ static int tcp_xmit ( struct tcp_connection *tcp ) {
|
613
|
626
|
/* Clear ACK-pending flag */
|
614
|
627
|
tcp->flags &= ~TCP_ACK_PENDING;
|
615
|
628
|
|
|
629
|
+ profile_stop ( &tcp_tx_profiler );
|
616
|
630
|
return 0;
|
617
|
631
|
}
|
618
|
632
|
|
|
@@ -966,11 +980,13 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq,
|
966
|
980
|
tcp_rx_seq ( tcp, len );
|
967
|
981
|
|
968
|
982
|
/* Deliver data to application */
|
|
983
|
+ profile_start ( &tcp_xfer_profiler );
|
969
|
984
|
if ( ( rc = xfer_deliver_iob ( &tcp->xfer, iobuf ) ) != 0 ) {
|
970
|
985
|
DBGC ( tcp, "TCP %p could not deliver %08x..%08x: %s\n",
|
971
|
986
|
tcp, seq, ( seq + len ), strerror ( rc ) );
|
972
|
987
|
return rc;
|
973
|
988
|
}
|
|
989
|
+ profile_stop ( &tcp_xfer_profiler );
|
974
|
990
|
|
975
|
991
|
return 0;
|
976
|
992
|
}
|
|
@@ -1156,6 +1172,9 @@ static int tcp_rx ( struct io_buffer *iobuf,
|
1156
|
1172
|
size_t old_xfer_window;
|
1157
|
1173
|
int rc;
|
1158
|
1174
|
|
|
1175
|
+ /* Start profiling */
|
|
1176
|
+ profile_start ( &tcp_rx_profiler );
|
|
1177
|
+
|
1159
|
1178
|
/* Sanity check packet */
|
1160
|
1179
|
if ( iob_len ( iobuf ) < sizeof ( *tcphdr ) ) {
|
1161
|
1180
|
DBG ( "TCP packet too short at %zd bytes (min %zd bytes)\n",
|
|
@@ -1268,6 +1287,7 @@ static int tcp_rx ( struct io_buffer *iobuf,
|
1268
|
1287
|
if ( tcp_xfer_window ( tcp ) != old_xfer_window )
|
1269
|
1288
|
xfer_window_changed ( &tcp->xfer );
|
1270
|
1289
|
|
|
1290
|
+ profile_stop ( &tcp_rx_profiler );
|
1271
|
1291
|
return 0;
|
1272
|
1292
|
|
1273
|
1293
|
discard:
|