svn commit: r312853 - head/sys/dev/ath

Adrian Chadd adrian at FreeBSD.org
Fri Jan 27 01:17:01 UTC 2017


Author: adrian
Date: Fri Jan 27 01:17:00 2017
New Revision: 312853
URL: https://svnweb.freebsd.org/changeset/base/312853

Log:
  [ath] fix "doing stuff before wakeup" warning; add comments for ACK/CTS handling during DFS/PASSIVE channels
  
  * Although the hardware is awake, the power state handling doesn't think so.
    So just explicitly wake it up early in setup so ath_hal calls don't complain.
  
  * We shouldn't be transmitting or ACKing frames during DFS CAC or on passive
    channels before we hear a beacon.  So, start laying down comments in the
    places where this work has to be done.
  
  Note:
  
  * The main bit missing from finishing this particular bit of work is a state
    call to transition a VAP from passive to non-passive when a beacon is heard.
    CAC is easy, it's an interface state.  So, I'll go and add a method to control
    that soon.

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Fri Jan 27 00:17:07 2017	(r312852)
+++ head/sys/dev/ath/if_ath.c	Fri Jan 27 01:17:00 2017	(r312853)
@@ -634,6 +634,17 @@ ath_attach(u_int16_t devid, struct ath_s
 #endif
 
 	/*
+	 * Force the chip awake during setup, just to keep
+	 * the HAL/driver power tracking happy.
+	 *
+	 * There are some methods (eg ath_hal_setmac())
+	 * that poke the hardware.
+	 */
+	ATH_LOCK(sc);
+	ath_power_setpower(sc, HAL_PM_AWAKE, 1);
+	ATH_UNLOCK(sc);
+
+	/*
 	 * Setup the DMA/EDMA functions based on the current
 	 * hardware support.
 	 *
@@ -1010,6 +1021,28 @@ ath_attach(u_int16_t devid, struct ath_s
 	sc->sc_rx_lnamixer = ath_hal_hasrxlnamixer(ah);
 	sc->sc_hasdivcomb = ath_hal_hasdivantcomb(ah);
 
+	/*
+	 * Some WB335 cards do not support antenna diversity. Since
+	 * we use a hardcoded value for AR9565 instead of using the
+	 * EEPROM/OTP data, remove the combining feature from
+	 * the HW capabilities bitmap.
+	 */
+	/*
+	 * XXX TODO: check reference driver and ath9k for what to do
+	 * here for WB335.  I think we have to actually disable the
+	 * LNA div processing in the HAL and instead use the hard
+	 * coded values; and then use BT diversity.
+	 *
+	 * .. but also need to setup MCI too for WB335..
+	 */
+#if 0
+	if (sc->sc_pci_devinfo & (ATH9K_PCI_AR9565_1ANT | ATH9K_PCI_AR9565_2ANT)) {
+		device_printf(sc->sc_dev, "%s: WB335: disabling LNA mixer diversity\n",
+		    __func__);
+		sc->sc_dolnadiv = 0;
+	}
+#endif
+
 	if (ath_hal_hasfastframes(ah))
 		ic->ic_caps |= IEEE80211_C_FF;
 	wmodes = ath_hal_getwirelessmodes(ah);
@@ -1351,6 +1384,7 @@ bad2:
 	ath_desc_free(sc);
 	ath_txdma_teardown(sc);
 	ath_rxdma_teardown(sc);
+
 bad:
 	if (ah)
 		ath_hal_detach(ah);
@@ -3611,6 +3645,8 @@ ath_mode_init(struct ath_softc *sc)
 	struct ath_hal *ah = sc->sc_ah;
 	u_int32_t rfilt;
 
+	/* XXX power state? */
+
 	/* configure rx filter */
 	rfilt = ath_calcrxfilter(sc);
 	ath_hal_setrxfilter(ah, rfilt);
@@ -5654,6 +5690,56 @@ ath_newstate(struct ieee80211vap *vap, e
 	 */
 	IEEE80211_LOCK_ASSERT(ic);
 
+	/*
+	 * XXX TODO: if nstate is _S_CAC, then we should disable
+	 * ACK processing until CAC is completed.
+	 */
+
+	/*
+	 * XXX TODO: if we're on a passive channel, then we should
+	 * not allow any ACKs or self-generated frames until we hear
+	 * a beacon.  Unfortunately there isn't a notification from
+	 * net80211 so perhaps we could slot that particular check
+	 * into the mgmt receive path and just ensure that we clear
+	 * it on RX of beacons in passive mode (and only clear it
+	 * once, obviously.)
+	 */
+
+	/*
+	 * XXX TODO: net80211 should be tracking whether channels
+	 * have heard beacons and are thus considered "OK" for
+	 * transmitting - and then inform the driver about this
+	 * state change.  That way if we hear an AP go quiet
+	 * (and nothing else is beaconing on a channel) the
+	 * channel can go back to being passive until another
+	 * beacon is heard.
+	 */
+
+	/*
+	 * XXX TODO: if nstate is _S_CAC, then we should disable
+	 * ACK processing until CAC is completed.
+	 */
+
+	/*
+	 * XXX TODO: if we're on a passive channel, then we should
+	 * not allow any ACKs or self-generated frames until we hear
+	 * a beacon.  Unfortunately there isn't a notification from
+	 * net80211 so perhaps we could slot that particular check
+	 * into the mgmt receive path and just ensure that we clear
+	 * it on RX of beacons in passive mode (and only clear it
+	 * once, obviously.)
+	 */
+
+	/*
+	 * XXX TODO: net80211 should be tracking whether channels
+	 * have heard beacons and are thus considered "OK" for
+	 * transmitting - and then inform the driver about this
+	 * state change.  That way if we hear an AP go quiet
+	 * (and nothing else is beaconing on a channel) the
+	 * channel can go back to being passive until another
+	 * beacon is heard.
+	 */
+
 	if (nstate == IEEE80211_S_RUN) {
 		/* NB: collect bss node again, it may have changed */
 		ieee80211_free_node(ni);
@@ -5675,6 +5761,14 @@ ath_newstate(struct ieee80211vap *vap, e
 		case IEEE80211_M_HOSTAP:
 		case IEEE80211_M_IBSS:
 		case IEEE80211_M_MBSS:
+
+			/*
+			 * TODO: Enable ACK processing (ie, clear AR_DIAG_ACK_DIS.)
+			 * For channels that are in CAC, we may have disabled
+			 * this during CAC to ensure we don't ACK frames
+			 * sent to us.
+			 */
+
 			/*
 			 * Allocate and setup the beacon frame.
 			 *
@@ -6279,6 +6373,15 @@ ath_dfs_tasklet(void *p, int npending)
 	 */
 	if (ath_dfs_process_radar_event(sc, sc->sc_curchan)) {
 		/* DFS event found, initiate channel change */
+
+		/*
+		 * XXX TODO: immediately disable ACK processing
+		 * on the current channel.  This would be done
+		 * by setting AR_DIAG_ACK_DIS (AR5212; may be
+		 * different for others) until we are out of
+		 * CAC.
+		 */
+
 		/*
 		 * XXX doesn't currently tell us whether the event
 		 * XXX was found in the primary or extension


More information about the svn-src-all mailing list