PERFORCE change 143106 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Sun Jun 8 10:48:50 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143106
Change 143106 by hselasky at hselasky_laptop001 on 2008/06/08 10:48:23
Some corrections, compile fixes and optimisations found
after review.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/if_ural.c#56 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/if_ural.c#56 (text+ko) ====
@@ -900,7 +900,8 @@
}
static void
-ural_config_copy_chan(struct ural_config_copy_chan *cc, struct ieee80211_channel *c)
+ural_config_copy_chan(struct ural_config_copy_chan *cc,
+ struct ieee80211com *ic, struct ieee80211_channel *c)
{
if (!c)
return;
@@ -943,8 +944,8 @@
ic = ifp->if_l2com;
if (ic) {
- ural_config_copy_chan(&cc->ic_curchan, ic->ic_curchan);
- ural_config_copy_chan(&cc->ic_bsschan, ic->ic_bsschan);
+ ural_config_copy_chan(&cc->ic_curchan, ic, ic->ic_curchan);
+ ural_config_copy_chan(&cc->ic_bsschan, ic, ic->ic_bsschan);
vap = TAILQ_FIRST(&ic->ic_vaps);
if (vap) {
ni = vap->iv_bss;
@@ -1108,13 +1109,16 @@
if (ni) {
/* send the frame to the 802.11 layer */
- ieee80211_input(ni, m, rssi, RAL_NOISE_FLOOR, 0);
-
+ if (ieee80211_input(ni, m, rssi, RAL_NOISE_FLOOR, 0)) {
+ /* ignore */
+ }
/* node is no longer needed */
ieee80211_free_node(ni);
} else {
/* broadcast */
- ieee80211_input_all(ic, m, rssi, RAL_NOISE_FLOOR, 0);
+ if (ieee80211_input_all(ic, m, rssi, RAL_NOISE_FLOOR, 0)) {
+ /* ignore */
+ }
}
mtx_lock(&(sc->sc_mtx));
@@ -1311,6 +1315,7 @@
struct ifnet *ifp = sc->sc_ifp;
struct mbuf *m;
uint16_t temp_len;
+ uint8_t align;
switch (USBD_GET_STATE(xfer)) {
case USBD_ST_TRANSFERRED:
@@ -1347,16 +1352,17 @@
temp_len = m->m_pkthdr.len;
/* make transfer length 16-bit aligned */
- if (temp_len & 1) {
- /* zero the extra byte */
- usbd_bzero(xfer->frbuffers, temp_len, 1);
- temp_len++;
+ align = (temp_len & 1);
+
+ /* check if we need to add two extra bytes */
+ if (((temp_len + align) % 64) == 0) {
+ align += 2;
}
- /* check if we need to add two extra bytes */
- if ((temp_len % 64) == 0) {
+ /* check if we need to align length */
+ if (align != 0) {
/* zero the extra bytes */
- usbd_bzero(xfer->frbuffers, temp_len, 2);
- temp_len += 2;
+ usbd_bzero(xfer->frbuffers, temp_len, align);
+ temp_len += align;
}
DPRINTF(sc, 10, "sending frame len=%u xferlen=%u\n",
m->m_pkthdr.len, temp_len);
@@ -2570,7 +2576,7 @@
}
tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)];
- m->m_pkthdr.rcvif = (void *)ni;
+ m->m_pkthdr.rcvif = (void *)ieee80211_ref_node(ni);
ural_setup_desc_and_tx(sc, m, RAL_TX_IFS_NEWBACKOFF | RAL_TX_TIMESTAMP,
tp->mgmtrate);
return;
@@ -2679,7 +2685,7 @@
return;
}
mprot->m_pkthdr.rcvif = (void *)ieee80211_ref_node(ni);
- ural_setup_desc_and_tx(sc, mprot, flags, rate);
+ ural_setup_desc_and_tx(sc, mprot, flags, protrate);
return;
}
More information about the p4-projects
mailing list