Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Make sure we can transmit larger packets correctly.



details:   https://anonhg.NetBSD.org/src/rev/69de41e17f5a
branches:  trunk
changeset: 554579:69de41e17f5a
user:      briggs <briggs%NetBSD.org@localhost>
date:      Thu Oct 30 04:11:36 2003 +0000

description:
Make sure we can transmit larger packets correctly.
Don't initialize extra fields of the ifp.
Use strcpy() instead of bcopy() for copying the device name.
Handle if_timer a bit better.

diffstat:

 sys/dev/pci/if_sk.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (79 lines):

diff -r a2bfdc2f94cc -r 69de41e17f5a sys/dev/pci/if_sk.c
--- a/sys/dev/pci/if_sk.c       Thu Oct 30 01:58:17 2003 +0000
+++ b/sys/dev/pci/if_sk.c       Thu Oct 30 04:11:36 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sk.c,v 1.4 2003/10/25 16:15:07 chs Exp $    */
+/*     $NetBSD: if_sk.c,v 1.5 2003/10/30 04:11:36 briggs Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -1183,18 +1183,16 @@
 
        ifp = &sc_if->sk_ethercom.ec_if;
        ifp->if_softc = sc_if;
-       ifp->if_mtu = ETHERMTU;
        ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
        ifp->if_ioctl = sk_ioctl;
        ifp->if_start = sk_start;
        ifp->if_stop = sk_stop;
        ifp->if_init = sk_init;
        ifp->if_watchdog = sk_watchdog;
-       ifp->if_baudrate = 1000000000;
        ifp->if_capabilities |= ETHERCAP_VLAN_MTU;
        IFQ_SET_MAXLEN(&ifp->if_snd, SK_TX_RING_CNT - 1);
        IFQ_SET_READY(&ifp->if_snd);
-       bcopy(sc_if->sk_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
+       strcpy(ifp->if_xname, sc_if->sk_dev.dv_xname);
 
        /*
         * Do miibus setup.
@@ -1764,7 +1762,7 @@
        struct sk_softc         *sc = sc_if->sk_softc;
        struct sk_tx_desc       *cur_tx = NULL;
        struct ifnet            *ifp = &sc_if->sk_ethercom.ec_if;
-       u_int32_t               idx, nsegs;
+       u_int32_t               idx;
        struct sk_txmap_entry   *entry;
 
        DPRINTFN(3, ("sk_txeof\n"));
@@ -1775,12 +1773,7 @@
         */
        idx = sc_if->sk_cdata.sk_tx_cons;
        while(idx != sc_if->sk_cdata.sk_tx_prod) {
-               entry = sc_if->sk_cdata.sk_tx_map[idx];
-               if (!entry)
-                       break;
-
-               nsegs = entry->dmamap->dm_nsegs;
-               SK_CDTXSYNC(sc_if, idx, nsegs,
+               SK_CDTXSYNC(sc_if, idx, 1,
                    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
 
                cur_tx = &sc_if->sk_rdata->sk_tx_ring[idx];
@@ -1789,12 +1782,14 @@
                        sk_dump_txdesc(cur_tx, idx);
 #endif
                if (cur_tx->sk_ctl & SK_TXCTL_OWN) {
-                       SK_CDTXSYNC(sc_if, idx, nsegs, BUS_DMASYNC_PREREAD);
+                       SK_CDTXSYNC(sc_if, idx, 1, BUS_DMASYNC_PREREAD);
                        break;
                }
                if (cur_tx->sk_ctl & SK_TXCTL_LASTFRAG)
                        ifp->if_opackets++;
                if (sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf != NULL) {
+                       entry = sc_if->sk_cdata.sk_tx_map[idx];
+
                        m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
                        sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
 
@@ -1808,8 +1803,9 @@
                }
                sc_if->sk_cdata.sk_tx_cnt--;
                SK_INC(idx, SK_TX_RING_CNT);
+       }
+       if (sc_if->sk_cdata.sk_tx_cnt == 0)
                ifp->if_timer = 0;
-       }
 
        sc_if->sk_cdata.sk_tx_cons = idx;
 



Home | Main Index | Thread Index | Old Index