Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Remove the hack that handled truncated transfers.



details:   https://anonhg.NetBSD.org/src/rev/caf6b71d43a4
branches:  trunk
changeset: 481390:caf6b71d43a4
user:      augustss <augustss%NetBSD.org@localhost>
date:      Fri Jan 28 00:29:53 2000 +0000

description:
Remove the hack that handled truncated transfers.

diffstat:

 sys/dev/usb/if_aue.c    |  47 +++++++----------------------------------------
 sys/dev/usb/if_auereg.h |   5 +----
 sys/dev/usb/if_cue.c    |  36 +++++-------------------------------
 sys/dev/usb/if_cuereg.h |   4 +---
 4 files changed, 14 insertions(+), 78 deletions(-)

diffs (244 lines):

diff -r 6ba9de5f862a -r caf6b71d43a4 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c      Fri Jan 28 00:15:54 2000 +0000
+++ b/sys/dev/usb/if_aue.c      Fri Jan 28 00:29:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aue.c,v 1.14 2000/01/19 00:25:23 augustss Exp $     */
+/*     $NetBSD: if_aue.c,v 1.15 2000/01/28 00:29:53 augustss Exp $     */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -156,10 +156,6 @@
 #define DPRINTFN(n,x)
 #endif
 
-int aue_cutoff = AUE_CUTOFF;
-#undef AUE_CUTOFF
-#define AUE_CUTOFF aue_cutoff
-
 /*
  * Various supported device vendors/products.
  */
@@ -1005,7 +1001,6 @@
                c = &cd->aue_rx_chain[i];
                c->aue_sc = sc;
                c->aue_idx = i;
-               c->aue_accum = 0;
                if (aue_newbuf(sc, c, NULL) == ENOBUFS)
                        return (ENOBUFS);
                if (c->aue_xfer == NULL) {
@@ -1101,7 +1096,7 @@
 
        /* Setup new transfer. */
        usbd_setup_xfer(c->aue_xfer, sc->aue_ep[AUE_ENDPT_RX],
-           c, mtod(c->aue_mbuf, char *), AUE_CUTOFF, USBD_SHORT_XFER_OK,
+           c, mtod(c->aue_mbuf, char *), AUE_BUFSZ, USBD_SHORT_XFER_OK,
            USBD_NO_TIMEOUT, aue_rxeof);
        usbd_transfer(c->aue_xfer);
 }
@@ -1153,52 +1148,24 @@
 
        usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL);
 
-       /* XXX copy data to mbuf */
-       memcpy(mtod(c->aue_mbuf, char*) + c->aue_accum, c->aue_buf, total_len);
-
-       /*
-        * See if we've already accumulated some data from
-        * a previous transfer.
-        */
-       if (c->aue_accum) {
-               total_len += c->aue_accum;
-               c->aue_accum = 0;
-       }
+       memcpy(mtod(c->aue_mbuf, char*), c->aue_buf, total_len);
 
        if (total_len <= 4 + ETHER_CRC_LEN) {
                ifp->if_ierrors++;
                goto done;
        }
 
-       m = c->aue_mbuf;
-       memcpy(&r, mtod(m, char *) + total_len - 4, sizeof(r));
+       memcpy(&r, c->aue_buf + total_len - 4, sizeof(r));
 
        /* Turn off all the non-error bits in the rx status word. */
        r.aue_rxstat &= AUE_RXSTAT_MASK;
-
-       /*
-        * Check to see if this is just the first chunk of a
-        * split transfer. We really need a more reliable way
-        * to detect this.
-        */
-       if (UGETW(r.aue_pktlen) != total_len && total_len == AUE_CUTOFF) {
-               c->aue_accum = AUE_CUTOFF;
-               usbd_setup_xfer(xfer, sc->aue_ep[AUE_ENDPT_RX],
-                   c, c->aue_buf,
-                   AUE_CUTOFF, USBD_SHORT_XFER_OK | USBD_NO_COPY,
-                   USBD_NO_TIMEOUT, aue_rxeof);
-               DPRINTFN(5,("%s: %s: extra rx\n", USBDEVNAME(sc->aue_dev),
-                           __FUNCTION__));
-               usbd_transfer(xfer);
-               return;
-       }
-
        if (r.aue_rxstat) {
                ifp->if_ierrors++;
                goto done;
        }
 
        /* No errors; receive the packet. */
+       m = c->aue_mbuf;
        total_len -= ETHER_CRC_LEN + 4;
        m->m_pkthdr.len = m->m_len = total_len;
        ifp->if_ipackets++;
@@ -1250,7 +1217,7 @@
 
        /* Setup new transfer. */
        usbd_setup_xfer(xfer, sc->aue_ep[AUE_ENDPT_RX],
-           c, c->aue_buf, AUE_CUTOFF,
+           c, c->aue_buf, AUE_BUFSZ,
            USBD_SHORT_XFER_OK | USBD_NO_COPY,
            USBD_NO_TIMEOUT, aue_rxeof);
        usbd_transfer(xfer);
@@ -1538,7 +1505,7 @@
        for (i = 0; i < AUE_RX_LIST_CNT; i++) {
                c = &sc->aue_cdata.aue_rx_chain[i];
                usbd_setup_xfer(c->aue_xfer, sc->aue_ep[AUE_ENDPT_RX],
-                   c, c->aue_buf, AUE_CUTOFF,
+                   c, c->aue_buf, AUE_BUFSZ,
                    USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT,
                    aue_rxeof);
                usbd_transfer(c->aue_xfer);
diff -r 6ba9de5f862a -r caf6b71d43a4 sys/dev/usb/if_auereg.h
--- a/sys/dev/usb/if_auereg.h   Fri Jan 28 00:15:54 2000 +0000
+++ b/sys/dev/usb/if_auereg.h   Fri Jan 28 00:29:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_auereg.h,v 1.2 2000/01/19 00:25:23 augustss Exp $   */
+/*     $NetBSD: if_auereg.h,v 1.3 2000/01/28 00:29:53 augustss Exp $   */
 /*
  * Copyright (c) 1997, 1998, 1999
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -212,7 +212,6 @@
        usbd_xfer_handle        aue_xfer;
        char                    *aue_buf;
        struct mbuf             *aue_mbuf;
-       int                     aue_accum;
        int                     aue_idx;
 };
 
@@ -259,8 +258,6 @@
 #define AUE_TIMEOUT            1000
 #define ETHER_ALIGN            2
 #define AUE_BUFSZ              1536
-#define AUE_CUTOFF             1088
-//#define AUE_CUTOFF           1536
 #define AUE_MIN_FRAMELEN       60
 #define AUE_TX_TIMEOUT         10000 /* ms */
 #define AUE_INTR_INTERVAL      100 /* ms */
diff -r 6ba9de5f862a -r caf6b71d43a4 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c      Fri Jan 28 00:15:54 2000 +0000
+++ b/sys/dev/usb/if_cue.c      Fri Jan 28 00:29:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cue.c,v 1.2 2000/01/18 19:46:55 augustss Exp $      */
+/*     $NetBSD: if_cue.c,v 1.3 2000/01/28 00:34:12 augustss Exp $      */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -770,7 +770,6 @@
                c = &cd->cue_rx_chain[i];
                c->cue_sc = sc;
                c->cue_idx = i;
-               c->cue_accum = 0;
                if (cue_newbuf(sc, c, NULL) == ENOBUFS)
                        return (ENOBUFS);
                if (c->cue_xfer == NULL) {
@@ -831,7 +830,7 @@
 
        /* Setup new transfer. */
        usbd_setup_xfer(c->cue_xfer, sc->cue_ep[CUE_ENDPT_RX],
-           c, c->cue_buf, CUE_CUTOFF, USBD_SHORT_XFER_OK | USBD_NO_COPY,
+           c, c->cue_buf, CUE_BUFSZ, USBD_SHORT_XFER_OK | USBD_NO_COPY,
            USBD_NO_TIMEOUT, cue_rxeof);
        usbd_transfer(c->cue_xfer);
 
@@ -877,36 +876,11 @@
 
        usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL);
 
-       /* XXX copy data to mbuf */
-       memcpy(mtod(c->cue_mbuf, char*) + c->cue_accum, c->cue_buf, total_len);
-
-       /*
-        * See if we've already accumulated some data from
-        * a previous transfer.
-        */
-       if (c->cue_accum) {
-               total_len += c->cue_accum;
-               c->cue_accum = 0;
-       }
+       memcpy(mtod(c->cue_mbuf, char *), c->cue_buf, total_len);
 
        m = c->cue_mbuf;
        len = UGETW(mtod(m, u_int8_t *));
 
-       /*
-        * Check to see if this is just the first chunk of a
-        * split transfer. We really need a more reliable way
-        * to detect this.
-        */
-       if (len != total_len && total_len == CUE_CUTOFF) {
-               c->cue_accum = CUE_CUTOFF;
-               usbd_setup_xfer(xfer, sc->cue_ep[CUE_ENDPT_RX],
-                   c, c->cue_buf,
-                   CUE_CUTOFF, USBD_SHORT_XFER_OK | USBD_NO_COPY,
-                   USBD_NO_TIMEOUT, cue_rxeof);
-               usbd_transfer(xfer);
-               return;
-       }
-
        /* No errors; receive the packet. */
        total_len = len;
 
@@ -964,7 +938,7 @@
 done:
        /* Setup new transfer. */
        usbd_setup_xfer(c->cue_xfer, sc->cue_ep[CUE_ENDPT_RX],
-           c, c->cue_buf, CUE_CUTOFF, USBD_SHORT_XFER_OK | USBD_NO_COPY,
+           c, c->cue_buf, CUE_BUFSZ, USBD_SHORT_XFER_OK | USBD_NO_COPY,
            USBD_NO_TIMEOUT, cue_rxeof);
        usbd_transfer(c->cue_xfer);
 
@@ -1227,7 +1201,7 @@
        for (i = 0; i < CUE_RX_LIST_CNT; i++) {
                c = &sc->cue_cdata.cue_rx_chain[i];
                usbd_setup_xfer(c->cue_xfer, sc->cue_ep[CUE_ENDPT_RX],
-                   c, c->cue_buf, CUE_CUTOFF,
+                   c, c->cue_buf, CUE_BUFSZ,
                    USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT,
                    cue_rxeof);
                usbd_transfer(c->cue_xfer);
diff -r 6ba9de5f862a -r caf6b71d43a4 sys/dev/usb/if_cuereg.h
--- a/sys/dev/usb/if_cuereg.h   Fri Jan 28 00:15:54 2000 +0000
+++ b/sys/dev/usb/if_cuereg.h   Fri Jan 28 00:29:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cuereg.h,v 1.1 2000/01/17 17:12:21 augustss Exp $   */
+/*     $NetBSD: if_cuereg.h,v 1.2 2000/01/28 00:34:13 augustss Exp $   */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -119,7 +119,6 @@
 #define CUE_TIMEOUT            1000
 #define ETHER_ALIGN            2
 #define CUE_BUFSZ              1536
-#define CUE_CUTOFF             1088
 #define CUE_MIN_FRAMELEN       60
 #define CUE_RX_FRAMES          1
 #define CUE_TX_FRAMES          1
@@ -154,7 +153,6 @@
        usbd_xfer_handle        cue_xfer;
        char                    *cue_buf;
        struct mbuf             *cue_mbuf;
-       int                     cue_accum;
        int                     cue_idx;
 };
 



Home | Main Index | Thread Index | Old Index