Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 2010 22:31:24 +0000 (UTC)
From:      Weongyo Jeong <weongyo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r212274 - stable/8/sys/dev/bwn
Message-ID:  <201009062231.o86MVOKH068460@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: weongyo
Date: Mon Sep  6 22:31:24 2010
New Revision: 212274
URL: http://svn.freebsd.org/changeset/base/212274

Log:
  MFC r209888:
    Fixes a bug for LP PHY that some frames have 2 padding bytes at the
    start so we should adjust the mbuf if the driver is running in PIO
    mode.  Now it should work well with WPA authentication and association
    for LP PHY devices.
  
    Tested by:    Warren Block <wblock at wonkity.com>

Modified:
  stable/8/sys/dev/bwn/if_bwn.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/bwn/if_bwn.c
==============================================================================
--- stable/8/sys/dev/bwn/if_bwn.c	Mon Sep  6 22:28:46 2010	(r212273)
+++ stable/8/sys/dev/bwn/if_bwn.c	Mon Sep  6 22:31:24 2010	(r212274)
@@ -9073,7 +9073,7 @@ bwn_pio_rxeof(struct bwn_pio_rxqueue *pr
 	struct mbuf *m;
 	uint32_t ctl32, macstat, v32;
 	unsigned int i, padding;
-	uint16_t ctl16, len, v16;
+	uint16_t ctl16, len, totlen, v16;
 	unsigned char *mp;
 	char *data;
 
@@ -9132,7 +9132,8 @@ ready:
 	}
 
 	padding = (macstat & BWN_RX_MAC_PADDING) ? 2 : 0;
-	KASSERT(len + padding <= MCLBYTES, ("too big..\n"));
+	totlen = len + padding;
+	KASSERT(totlen <= MCLBYTES, ("too big..\n"));
 	m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
 	if (m == NULL) {
 		device_printf(sc->sc_dev, "%s: out of memory", __func__);
@@ -9140,12 +9141,12 @@ ready:
 	}
 	mp = mtod(m, unsigned char *);
 	if (prq->prq_rev >= 8) {
-		siba_read_multi_4(sc->sc_dev, mp + padding, (len & ~3),
+		siba_read_multi_4(sc->sc_dev, mp, (totlen & ~3),
 		    prq->prq_base + BWN_PIO8_RXDATA);
-		if (len & 3) {
+		if (totlen & 3) {
 			v32 = bwn_pio_rx_read_4(prq, BWN_PIO8_RXDATA);
-			data = &(mp[len + padding - 1]);
-			switch (len & 3) {
+			data = &(mp[totlen - 1]);
+			switch (totlen & 3) {
 			case 3:
 				*data = (v32 >> 16);
 				data--;
@@ -9157,16 +9158,16 @@ ready:
 			}
 		}
 	} else {
-		siba_read_multi_2(sc->sc_dev, mp + padding, (len & ~1),
+		siba_read_multi_2(sc->sc_dev, mp, (totlen & ~1),
 		    prq->prq_base + BWN_PIO_RXDATA);
-		if (len & 1) {
+		if (totlen & 1) {
 			v16 = bwn_pio_rx_read_2(prq, BWN_PIO_RXDATA);
-			mp[len + padding - 1] = v16;
+			mp[totlen - 1] = v16;
 		}
 	}
 
 	m->m_pkthdr.rcvif = ifp;
-	m->m_len = m->m_pkthdr.len = len + padding;
+	m->m_len = m->m_pkthdr.len = totlen;
 
 	bwn_rxeof(prq->prq_mac, m, &rxhdr);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009062231.o86MVOKH068460>