From cfcb50259dc2ae0280ae97f9cd960ebcdede240d Mon Sep 17 00:00:00 2001 From: Oleg Bulyzhin Date: Wed, 1 Feb 2006 15:16:03 +0000 Subject: [PATCH] Optimize bge_rxeof() & bge_txeof(): return immediately if there are no packets to process. It could give us [significant?] perfomance increase if there is big difference between RX/TX flows. Submitted by: Mihail Balikov Approved by: glebius (mentor) MFC after: 3 days --- sys/dev/bge/if_bge.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index e95805c47287..7a83bb4afcca 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -2520,6 +2520,11 @@ bge_rxeof(sc) BGE_LOCK_ASSERT(sc); + /* Nothing to do */ + if (sc->bge_rx_saved_considx == + sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx) + return; + ifp = sc->bge_ifp; bus_dmamap_sync(sc->bge_cdata.bge_rx_return_ring_tag, @@ -2666,8 +2671,6 @@ bge_rxeof(sc) CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); if (jumbocnt) CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); - - return; } static void @@ -2679,6 +2682,11 @@ bge_txeof(sc) BGE_LOCK_ASSERT(sc); + /* Nothing to do */ + if (sc->bge_tx_saved_considx == + sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx) + return; + ifp = sc->bge_ifp; bus_dmamap_sync(sc->bge_cdata.bge_tx_ring_tag, @@ -2712,8 +2720,6 @@ bge_txeof(sc) if (cur_tx != NULL) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - return; } #ifdef DEVICE_POLLING