From 9ee030d166954ee9f2e8a6eb27dc210c97c415c9 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 19 Nov 2005 23:04:49 +0000 Subject: Correct a performance bug from Bill Paul's original FreeBSD bge(4) driver: Each call to the FreeBSD bge_start() routine the transmit producer pointer index from the chip mailbox register BGE_MBX_TX_HOST_PROD0_LO. The local copy of that value is then updated by bge_encap() as bge_encap() encapsulates packets in the Tx ring. If bge_encap() succeds in encpuslating one or more packets, bge_start() tells the chip to start sending the newly-encinitiates writes the new value back to the chip mailbox register. However, comparison of the Linux drivers (Broadcom-supplied and open-source tg3.c) and to the OpenSolaris driver confirms that register BGE_MBX_TX_HOST_PROD0_LO is write-only to software. Thus, we can just keep a copy in the softc, and eliminate the (expensive) PCI register write on each call to bge_start(). From jonathan NetBSD tested by krw@, sturm@ and I on a few different bge NICs. --- sys/dev/pci/if_bgereg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/dev/pci/if_bgereg.h') diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h index d0962d8a1a0..8ab2b8f0344 100644 --- a/sys/dev/pci/if_bgereg.h +++ b/sys/dev/pci/if_bgereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bgereg.h,v 1.30 2005/10/09 23:41:55 brad Exp $ */ +/* $OpenBSD: if_bgereg.h,v 1.31 2005/11/19 23:04:48 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2328,6 +2328,7 @@ struct bge_softc { u_int16_t bge_rx_saved_considx; u_int16_t bge_ev_saved_considx; u_int16_t bge_return_ring_cnt; + u_int32_t bge_tx_prodidx; u_int16_t bge_std; /* current std ring head */ u_int16_t bge_jumbo; /* current jumo ring head */ SLIST_HEAD(__bge_jfreehead, bge_jpool_entry) bge_jfree_listhead; -- cgit v1.2.3