summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2007-09-10 20:36:50 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2007-09-10 20:36:50 +0000
commitdcc8afb570bcc819910c09d2a176b510319f6746 (patch)
tree2e92e7e8dcc2bbe5f7093fe1a540109708efadae /sys/dev/pci
parent422ffb43fef323aaac6445504361a678cbfc3b91 (diff)
fix interrupts processing and scan command + cleanup
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_iwn.c16
-rw-r--r--sys/dev/pci/if_iwnreg.h13
2 files changed, 20 insertions, 9 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 56c62ca05ff..0b5220276ae 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.8 2007/09/10 18:14:55 damien Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.9 2007/09/10 20:36:49 damien Exp $ */
/*-
* Copyright (c) 2007
@@ -1227,13 +1227,14 @@ iwn_rx_intr(struct iwn_softc *sc, struct iwn_rx_desc *desc,
struct iwn_rx_ampdu *ampdu =
(struct iwn_rx_ampdu *)(desc + 1);
head = (caddr_t)(ampdu + 1);
- tail = (uint32_t *)(head + (len = letoh16(ampdu->len)));
+ len = letoh16(ampdu->len);
} else {
head = (caddr_t)(stat + 1) + stat->cfg_phy_len;
- tail = (uint32_t *)(head + (len = letoh16(stat->len)));
+ len = letoh16(stat->len);
}
/* discard Rx frames with bad CRC early */
+ tail = (uint32_t *)(head + len);
if ((letoh32(*tail) & IWN_RX_NOERROR) != IWN_RX_NOERROR) {
DPRINTFN(2, ("rx flags error %x\n", letoh32(*tail)));
ifp->if_ierrors++;
@@ -1626,7 +1627,8 @@ iwn_intr(void *arg)
iwn_stop(ifp, 1);
return 1;
}
- if (r1 & (IWN_RX_INTR | IWN_SW_RX_INTR))
+ if ((r1 & (IWN_RX_INTR | IWN_SW_RX_INTR)) ||
+ (r2 & IWN_RX_STATUS_INTR))
iwn_notif_intr(sc);
if (r1 & IWN_ALIVE_INTR)
@@ -3090,7 +3092,7 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags)
tx = (struct iwn_cmd_data *)(hdr + 1);
memset(tx, 0, sizeof (struct iwn_cmd_data));
- tx->flags = htole32(IWN_TX_AUTO_SEQ);
+ tx->flags = htole32(IWN_TX_AUTO_SEQ | 0x200); /* XXX */
tx->id = IWN_ID_BROADCAST;
tx->lifetime = htole32(IWN_LIFETIME_INFINITE);
tx->rflags = IWN_RFLAG_ANT_B;
@@ -3128,8 +3130,8 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags)
frm = (uint8_t *)(wh + 1);
- /* add empty SSID IE (firmware generates it for directed scans) */
- frm = ieee80211_add_ssid(frm, NULL, 0);
+ /* add SSID IE */
+ frm = ieee80211_add_ssid(frm, ic->ic_des_essid, ic->ic_des_esslen);
mode = ieee80211_chan2mode(ic, ic->ic_ibss_chan);
rs = &ic->ic_sup_rates[mode];
diff --git a/sys/dev/pci/if_iwnreg.h b/sys/dev/pci/if_iwnreg.h
index 4954b63e539..05cad22def5 100644
--- a/sys/dev/pci/if_iwnreg.h
+++ b/sys/dev/pci/if_iwnreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwnreg.h,v 1.5 2007/09/10 18:14:55 damien Exp $ */
+/* $OpenBSD: if_iwnreg.h,v 1.6 2007/09/10 20:36:49 damien Exp $ */
/*-
* Copyright (c) 2007
@@ -146,6 +146,16 @@
IWN_ALIVE_INTR | IWN_WAKEUP_INTR | IWN_SW_RX_INTR | \
IWN_CT_REACHED | IWN_RF_TOGGLED)
+/* possible flags for register IWN_INTR_STATUS */
+#define IWN_STATUS_TXQ(x) (1 << (x))
+#define IWN_STATUS_RXQ(x) (1 << ((x) + 16))
+#define IWN_STATUS_PRI (1 << 30)
+/* shortcuts for the above */
+#define IWN_TX_STATUS_INTR \
+ (IWN_STATUS_TXQ(0) | IWN_STATUS_TXQ(1) | IWN_STATUS_TXQ(6))
+#define IWN_RX_STATUS_INTR \
+ (IWN_STATUS_RXQ(0) | IWN_STATUS_RXQ(1) | IWN_STATUS_RXQ(2) | \
+ IWN_STATUS_PRI)
/* possible flags for register IWN_TX_STATUS */
#define IWN_TX_IDLE(qid) (1 << ((qid) + 24) | 1 << ((qid) + 16))
@@ -496,7 +506,6 @@ struct iwn_scan_hdr {
uint32_t filter;
/* followed by a struct iwn_cmd_data */
- /* followed by an 802.11 header */
/* followed by an array of 4x struct iwn_scan_essid */
/* followed by probe request body */
/* followed by nchan x struct iwn_scan_chan */