aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ath/if_ath.c
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2013-06-07 09:02:02 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2013-06-07 09:02:02 +0000
commitb70f530bc7a43b0310cb9686a4b80a6d97577d1e (patch)
treec0b505bc147ebb82a9abd7b8dc2f1ac2c9b26aec /sys/dev/ath/if_ath.c
parentb9ef8051ae3c705e945edc593671e58174f07930 (diff)
downloadsrc-b70f530bc7a43b0310cb9686a4b80a6d97577d1e.tar.gz
src-b70f530bc7a43b0310cb9686a4b80a6d97577d1e.zip
Bring over the initial static bluetooth coexistence configuration
for the WB195 combo NIC - an AR9285 w/ an AR3011 USB bluetooth NIC. The AR3011 is wired up using a 3-wire coexistence scheme to the AR9285. The code in if_ath_btcoex.c sets up the initial hardware mapping and coexistence configuration. There's nothing special about it - it's static; it doesn't try to configure bluetooth / MAC traffic priorities or try to figure out what's actually going on. It's enough to stop basic bluetooth traffic from causing traffic stalls and diassociation from the wireless network. To use this code, you must have the above NIC. No, it won't work for the AR9287+AR3012, nor the AR9485, AR9462 or AR955x combo cards. Then you set a kernel hint before boot or before kldload, where 'X' is the unit number of your AR9285 NIC: # kenv hint.ath.X.btcoex_profile=wb195 This will then appear in your boot messages: [100482] athX: Enabling WB195 BTCOEX This code is going to evolve pretty quickly (well, depending upon my spare time) so don't assume the btcoex API is going to stay stable. In order to use the bluetooth side, you must also load in firmware using ath3kfw and the binary firmware file (ath3k-1.fw in my case.) Tested: * AR9280, no interference * WB195 - AR9285 + AR3011 combo; STA mode; basic bluetooth inquiries were enough to cause traffic stalls and disassociations. This has stopped with the btcoex profile code. TODO: * Importantly - the AR9285 needs ASPM disabled if bluetooth coexistence is enabled. No, I don't know why. It's likely some kind of bug to do with the AR3011 sending bluetooth coexistence signals whilst the device is asleep. Since we don't actually sleep the MAC just yet, it shouldn't be a problem. That said, to be totally correct: + ASPM should be disabled - upon attach and wakeup + The PCIe powersave HAL code should never be called Look at what the ath9k driver does for inspiration. * Add WB197 (AR9287+AR3012) support * Add support for the AR9485, which is another combo like the AR9285 * The later NICs have a different signaling mechanism between the MAC and the bluetooth device; I haven't even begun to experiment with making that HAL code work. But it should be a lot more automatic. * The hardware can do much more interesting traffic weighting with bluetooth and wifi traffic. None of this is currently used. Ideally someone would code up something to watch the bluetooth traffic GPIO (via an interrupt) and then watch it go high/low; then figure out what the bluetooth traffic is and adjust things appropriately. * If I get the time I may add in some code to at least track this stuff and expose statistics. But it's up to someone else to experiment with the bluetooth coexistence support and add the interesting stuff (like "real" detection of bulk, audio, etc bluetooth traffic patterns and change wifi parameters appropriately - eg, maximum aggregate length, transmit power, using quiet time to control TX duty cycle, etc.)
Notes
Notes: svn path=/head/; revision=251487
Diffstat (limited to 'sys/dev/ath/if_ath.c')
-rw-r--r--sys/dev/ath/if_ath.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 757ee6fe417e..91c5bf652090 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -111,6 +111,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ath/if_ath_rx_edma.h>
#include <dev/ath/if_ath_tx_edma.h>
#include <dev/ath/if_ath_beacon.h>
+#include <dev/ath/if_ath_btcoex.h>
#include <dev/ath/if_ath_spectral.h>
#include <dev/ath/if_athdfs.h>
@@ -521,6 +522,14 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
goto bad2;
}
+ /* Attach bluetooth coexistence module */
+ if (ath_btcoex_attach(sc) < 0) {
+ device_printf(sc->sc_dev,
+ "%s: unable to attach bluetooth coexistence\n", __func__);
+ error = EIO;
+ goto bad2;
+ }
+
/* Start DFS processing tasklet */
TASK_INIT(&sc->sc_dfstask, 0, ath_dfs_tasklet, sc);
@@ -1029,6 +1038,7 @@ ath_detach(struct ath_softc *sc)
#ifdef ATH_DEBUG_ALQ
if_ath_alq_tidyup(&sc->sc_alq);
#endif
+ ath_btcoex_detach(sc);
ath_spectral_detach(sc);
ath_dfs_detach(sc);
ath_desc_free(sc);
@@ -1589,6 +1599,11 @@ ath_resume(struct ath_softc *sc)
ath_spectral_enable(sc, ic->ic_curchan);
/*
+ * Let bluetooth coexistence at in case it's needed for this channel
+ */
+ ath_btcoex_enable(sc, ic->ic_curchan);
+
+ /*
* If we're doing TDMA, enforce the TXOP limitation for chips that
* support it.
*/
@@ -2045,6 +2060,11 @@ ath_init(void *arg)
ath_spectral_enable(sc, ic->ic_curchan);
/*
+ * Let bluetooth coexistence at in case it's needed for this channel
+ */
+ ath_btcoex_enable(sc, ic->ic_curchan);
+
+ /*
* If we're doing TDMA, enforce the TXOP limitation for chips that
* support it.
*/
@@ -2384,6 +2404,11 @@ ath_reset(struct ifnet *ifp, ATH_RESET_TYPE reset_type)
ath_spectral_enable(sc, ic->ic_curchan);
/*
+ * Let bluetooth coexistence at in case it's needed for this channel
+ */
+ ath_btcoex_enable(sc, ic->ic_curchan);
+
+ /*
* If we're doing TDMA, enforce the TXOP limitation for chips that
* support it.
*/
@@ -4946,6 +4971,12 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
ath_spectral_enable(sc, chan);
/*
+ * Let bluetooth coexistence at in case it's needed for this
+ * channel
+ */
+ ath_btcoex_enable(sc, ic->ic_curchan);
+
+ /*
* If we're doing TDMA, enforce the TXOP limitation for chips
* that support it.
*/