Browse Source

[undi] Profile transmit and receive datapaths

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
402ce65632
1 changed files with 33 additions and 1 deletions
  1. 33
    1
      src/arch/i386/drivers/net/undinet.c

+ 33
- 1
src/arch/i386/drivers/net/undinet.c View File

33
 #include <ipxe/netdevice.h>
33
 #include <ipxe/netdevice.h>
34
 #include <ipxe/if_ether.h>
34
 #include <ipxe/if_ether.h>
35
 #include <ipxe/ethernet.h>
35
 #include <ipxe/ethernet.h>
36
+#include <ipxe/profile.h>
36
 #include <undi.h>
37
 #include <undi.h>
37
 #include <undinet.h>
38
 #include <undinet.h>
38
 #include <pxeparent.h>
39
 #include <pxeparent.h>
79
 /** Address of UNDI entry point */
80
 /** Address of UNDI entry point */
80
 static SEGOFF16_t undinet_entry;
81
 static SEGOFF16_t undinet_entry;
81
 
82
 
83
+/** Transmit profiler */
84
+static struct profiler undinet_tx_profiler __profiler =
85
+	{ .name = "undinet.tx" };
86
+
87
+/** Transmit call profiler */
88
+static struct profiler undinet_tx_call_profiler __profiler =
89
+	{ .name = "undinet.tx_call" };
90
+
91
+/** IRQ profiler */
92
+static struct profiler undinet_irq_profiler __profiler =
93
+	{ .name = "undinet.irq" };
94
+
95
+/** ISR call profiler */
96
+static struct profiler undinet_isr_call_profiler __profiler =
97
+	{ .name = "undinet.isr_call" };
98
+
99
+/** Receive profiler */
100
+static struct profiler undinet_rx_profiler __profiler =
101
+	{ .name = "undinet.rx" };
102
+
82
 /*****************************************************************************
103
 /*****************************************************************************
83
  *
104
  *
84
  * UNDI interrupt service routine
105
  * UNDI interrupt service routine
194
 	size_t len;
215
 	size_t len;
195
 	int rc;
216
 	int rc;
196
 
217
 
218
+	/* Start profiling */
219
+	profile_start ( &undinet_tx_profiler );
220
+
197
 	/* Technically, we ought to make sure that the previous
221
 	/* Technically, we ought to make sure that the previous
198
 	 * transmission has completed before we re-use the buffer.
222
 	 * transmission has completed before we re-use the buffer.
199
 	 * However, many PXE stacks (including at least some Intel PXE
223
 	 * However, many PXE stacks (including at least some Intel PXE
256
 	undinet_tbd.Xmit.offset = __from_data16 ( basemem_packet );
280
 	undinet_tbd.Xmit.offset = __from_data16 ( basemem_packet );
257
 
281
 
258
 	/* Issue PXE API call */
282
 	/* Issue PXE API call */
283
+	profile_start ( &undinet_tx_call_profiler );
259
 	if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_TRANSMIT,
284
 	if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_TRANSMIT,
260
 				     &undi_transmit,
285
 				     &undi_transmit,
261
 				     sizeof ( undi_transmit ) ) ) != 0 )
286
 				     sizeof ( undi_transmit ) ) ) != 0 )
262
 		goto done;
287
 		goto done;
288
+	profile_stop ( &undinet_tx_call_profiler );
263
 
289
 
264
 	/* Free I/O buffer */
290
 	/* Free I/O buffer */
265
 	netdev_tx_complete ( netdev, iobuf );
291
 	netdev_tx_complete ( netdev, iobuf );
266
-
292
+	profile_stop ( &undinet_tx_profiler );
267
  done:
293
  done:
268
 	return rc;
294
 	return rc;
269
 }
295
 }
316
 		 */
342
 		 */
317
 		if ( ! undinet_isr_triggered() ) {
343
 		if ( ! undinet_isr_triggered() ) {
318
 			/* Allow interrupt to occur */
344
 			/* Allow interrupt to occur */
345
+			profile_start ( &undinet_irq_profiler );
319
 			__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
346
 			__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
320
 							   "nop\n\t"
347
 							   "nop\n\t"
321
 							   "nop\n\t"
348
 							   "nop\n\t"
322
 							   "cli\n\t" ) : : );
349
 							   "cli\n\t" ) : : );
350
+			profile_stop ( &undinet_irq_profiler );
323
 
351
 
324
 			/* If interrupts are known to be supported,
352
 			/* If interrupts are known to be supported,
325
 			 * then do nothing on this poll; wait for the
353
 			 * then do nothing on this poll; wait for the
339
 
367
 
340
 	/* Run through the ISR loop */
368
 	/* Run through the ISR loop */
341
 	while ( 1 ) {
369
 	while ( 1 ) {
370
+		profile_start ( &undinet_isr_call_profiler );
342
 		if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
371
 		if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
343
 					     &undi_isr,
372
 					     &undi_isr,
344
 					     sizeof ( undi_isr ) ) ) != 0 )
373
 					     sizeof ( undi_isr ) ) ) != 0 )
345
 			break;
374
 			break;
375
+		profile_stop ( &undinet_isr_call_profiler );
346
 		switch ( undi_isr.FuncFlag ) {
376
 		switch ( undi_isr.FuncFlag ) {
347
 		case PXENV_UNDI_ISR_OUT_TRANSMIT:
377
 		case PXENV_UNDI_ISR_OUT_TRANSMIT:
348
 			/* We don't care about transmit completions */
378
 			/* We don't care about transmit completions */
349
 			break;
379
 			break;
350
 		case PXENV_UNDI_ISR_OUT_RECEIVE:
380
 		case PXENV_UNDI_ISR_OUT_RECEIVE:
351
 			/* Packet fragment received */
381
 			/* Packet fragment received */
382
+			profile_start ( &undinet_rx_profiler );
352
 			len = undi_isr.FrameLength;
383
 			len = undi_isr.FrameLength;
353
 			frag_len = undi_isr.BufferLength;
384
 			frag_len = undi_isr.BufferLength;
354
 			reserve_len = ( -undi_isr.FrameHeaderLength &
385
 			reserve_len = ( -undi_isr.FrameHeaderLength &
393
 				if ( undinic->hacks & UNDI_HACK_EB54 )
424
 				if ( undinic->hacks & UNDI_HACK_EB54 )
394
 					--last_trigger_count;
425
 					--last_trigger_count;
395
 			}
426
 			}
427
+			profile_stop ( &undinet_rx_profiler );
396
 			break;
428
 			break;
397
 		case PXENV_UNDI_ISR_OUT_DONE:
429
 		case PXENV_UNDI_ISR_OUT_DONE:
398
 			/* Processing complete */
430
 			/* Processing complete */

Loading…
Cancel
Save