On Wed, Jun 21, 2006 at 11:32:50PM +0200, Laurens Vets wrote:
> Matt Van Mater wrote:
> >I ran into a very similar (maybe same) problem here:
> >http://marc.theaimsgroup.com/?l=openbsd-misc&m=113236417207016&w=2
> >
> >I have not found a solution to my problem yet unfortunately.  One
> >thing I noticed is that my an0 card worked just find in 3.7 and 3.8
> >broke it, you might want to verify if that is the case with you as
> >well.
> >
> >Another thing I noticed is that the an0 card gets a dhcp address and
> >works properly during the initial install via cd or the ram disk off
> >of a floppy, but stops working upon first reboot.
> 
> I have noticed the exact same problem as the link above.  Card worked 
> with OpenBSD 3.7.  I did an upgrade from 3.7 -> 3.8 -> 3.9 following the 
> OpenBSD upgrade guides.
> After the upgrade to 3.8, I also saw the error "an0: failed to enable 
> MAC", but wifi access still worked.  After the upgrade to 3.9, I got the 
> following in my dmesg at startup:
> 
> an0 at pcmcia1 function 0 "Cisco Systems, 350 Series Wireless LAN Adapter"
> an0: record buffer is too small, rid=ff00, size=198, len=258
> an0: read caps failed
> an0: failed to attach controller

this is a piece of our changes that was lost when a driver was converted
to use net80211. i think this diff should fix it. please try.
i have not tested it beyound compile.
10x
cu
-- 
    paranoic mickey       (my employers have changed but, the name has remained)

Index: an.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/an.c,v
retrieving revision 1.51
diff -u -r1.51 an.c
--- an.c        22 May 2006 20:35:12 -0000      1.51
+++ an.c        22 Jun 2006 09:37:00 -0000
@@ -146,7 +146,7 @@
 
 int    an_cmd(struct an_softc *, int, int);
 int    an_seek_bap(struct an_softc *, int, int);
-int    an_read_bap(struct an_softc *, int, int, void *, int);
+int    an_read_bap(struct an_softc *, int, int, void *, int, int);
 int    an_write_bap(struct an_softc *, int, int, void *, int);
 int    an_mwrite_bap(struct an_softc *, int, int, struct mbuf *, int);
 int    an_read_rid(struct an_softc *, int, void *, int *);
@@ -367,7 +367,7 @@
        fid = CSR_READ_2(sc, AN_RX_FID);
 
        /* First read in the frame header */
-       if (an_read_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr)) != 0) {
+       if (an_read_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr), sizeof(frmhdr)) != 
0) {
                CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
                ifp->if_ierrors++;
                DPRINTF(("an_rxeof: read fid %x failed\n", fid));
@@ -437,12 +437,13 @@
                 */
                gap = m->m_data + sizeof(struct ieee80211_frame) -
                    sizeof(uint16_t);
-               an_read_bap(sc, fid, -1, gap, gaplen + sizeof(u_int16_t));
+               an_read_bap(sc, fid, -1, gap, gaplen + sizeof(u_int16_t),
+                   gaplen + sizeof(u_int16_t));
        } else
                gaplen = 0;
 
        an_read_bap(sc, fid, -1,
-           m->m_data + sizeof(struct ieee80211_frame) + gaplen, len);
+           m->m_data + sizeof(struct ieee80211_frame) + gaplen, len, len);
        an_swap16((u_int16_t *)(m->m_data + sizeof(struct ieee80211_frame) + 
gaplen), (len+1)/2);
        m->m_pkthdr.len = m->m_len = sizeof(struct ieee80211_frame) + gaplen +
            len;
@@ -695,11 +696,11 @@
 }
 
 int
-an_read_bap(struct an_softc *sc, int id, int off, void *buf, int buflen)
+an_read_bap(struct an_softc *sc, int id, int off, void *buf, int len, int blen)
 {
-       int error, cnt;
+       int error, cnt, cnt2;
 
-       if (buflen == 0)
+       if (len == 0 || blen == 0)
                return 0;
        if (off == -1)
                off = sc->sc_bap_off;
@@ -708,8 +709,10 @@
                        return EIO;
        }
 
-       cnt = (buflen + 1) / 2;
+       cnt = (blen + 1) / 2;
        CSR_READ_MULTI_STREAM_2(sc, AN_DATA0, (u_int16_t *)buf, cnt);
+       for (cnt2 = (len + 1) / 2; cnt < cnt2; cnt++)
+               (void) CSR_READ_2(sc, AN_DATA0);
        sc->sc_bap_off += cnt * 2;
 
        return 0;
@@ -841,19 +844,12 @@
                return error;
 
        /* length in byte, including length itself */
-       error = an_read_bap(sc, rid, 0, &len, sizeof(len));
+       error = an_read_bap(sc, rid, 0, &len, sizeof(len), sizeof(len));
        if (error)
                return error;
 
        len -= 2;
-       if (*buflenp < len) {
-               printf("%s: record buffer is too small, "
-                   "rid=%x, size=%d, len=%d\n",
-                   sc->sc_dev.dv_xname, rid, *buflenp, len);
-               return ENOSPC;
-       }
-       *buflenp = len;
-       return an_read_bap(sc, rid, sizeof(len), buf, len);
+       return an_read_bap(sc, rid, sizeof(len), buf, len, *buflenp);
 }
 
 int

Reply via email to