Hi all.

Right now, vr_start() pokes the chip to start transmitting if
vr_cdata.vr_tx_cnt isn't zero.  That's the number of used descriptors in
the TX ring, not the number of packets we just added, so we're
needlessly telling the chip to start transmitting in cases where it
already knows.

This decreases the cpu utilization by about 0.5%

ok?

Index: dev/pci/if_vr.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
retrieving revision 1.121
diff -u -p -r1.121 if_vr.c
--- dev/pci/if_vr.c     1 Dec 2012 09:55:03 -0000       1.121
+++ dev/pci/if_vr.c     16 Jan 2013 02:38:32 -0000
@@ -1273,6 +1273,7 @@ vr_start(struct ifnet *ifp)
        struct vr_softc         *sc;
        struct mbuf             *m_head;
        struct vr_chain         *cur_tx, *head_tx;
+       unsigned int packets_sent = 0;
 
        sc = ifp->if_softc;
 
@@ -1298,6 +1299,7 @@ vr_start(struct ifnet *ifp)
                                IF_PREPEND(&ifp->if_snd, m_head);
                        break;
                }
+               packets_sent++;
 
                /* Only set ownership bit on first descriptor */
                head_tx->vr_ptr->vr_status |= htole32(VR_TXSTAT_OWN);
@@ -1313,7 +1315,7 @@ vr_start(struct ifnet *ifp)
 #endif
                cur_tx = cur_tx->vr_nextdesc;
        }
-       if (sc->vr_cdata.vr_tx_cnt != 0) {
+       if (packets_sent != 0) {
                sc->vr_cdata.vr_tx_prod = cur_tx;
 
                bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap.vrm_map, 0,

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

Reply via email to