[ath] [ath_hal] [ath_hal_9300] Extend the start PCU receive to handle resetting ANI.

One of the fun issues with scanning has been how the existing
ANI values were programmed into the hardware when channels were
changed.  If you're on a really crappy channel and ANI has made
you deaf then when you scan you continue to be deaf on all channels.

This code passes in a flag to startpcureceive which in AR5416 and later
is also used to enable ANI.  This allows it to know if it's a normal
operation or a scan operation.

This fixes my situation at home where a temporary spot of a device
going deaf due to interference starts scanning and .. can't hear
anything until I restart.

Now, this isn't the full fix - ideally:

(a) all the ANI config and per-channel information would be migrated
     to the shared HAL stuff and enabled for all of the NICs;
(b) when a station reassociates and some other error conditions
    (like missed beacons, NF calibration failures, etc) a knob
    to reset ANI parameters would likely help recovery.

But hey, I'm committing bits of code again! woo!

Tested:

* AR9344 (2G), STA operation
This commit is contained in:
Adrian Chadd 2019-04-21 02:36:01 +00:00
parent 7251c2d8bc
commit a8083b9c0b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346470
15 changed files with 21 additions and 29 deletions

View File

@ -355,7 +355,7 @@ ar9300_attach_freebsd_ops(struct ath_hal *ah)
ah->ah_setRxDP = ar9300_set_rx_dp;
ah->ah_enableReceive = ar9300_enable_receive;
ah->ah_stopDmaReceive = ar9300_stop_dma_receive_freebsd;
ah->ah_startPcuReceive = ar9300_start_pcu_receive_freebsd;
ah->ah_startPcuReceive = ar9300_start_pcu_receive;
ah->ah_stopPcuReceive = ar9300_stop_pcu_receive;
ah->ah_setMulticastFilter = ar9300_set_multicast_filter;
ah->ah_setMulticastFilterIndex = ar9300SetMulticastFilterIndex;
@ -679,14 +679,6 @@ ar9300_reset_cal_valid_freebsd(struct ath_hal *ah,
}
void
ar9300_start_pcu_receive_freebsd(struct ath_hal *ah)
{
/* is_scanning flag == NULL */
ar9300_start_pcu_receive(ah, AH_FALSE);
}
/*
* FreeBSD will just pass in the descriptor value as 'pa'.
* The Atheros HAL treats 'pa' as the physical address of the RX

View File

@ -691,7 +691,7 @@ ar9300_Stub_StopDmaReceive(struct ath_hal *ah)
}
void
ar9300_Stub_StartPcuReceive(struct ath_hal *ah)
ar9300_Stub_StartPcuReceive(struct ath_hal *ah, HAL_BOOL is_scanning)
{
ath_hal_printf(ah, "%s: called\n", __func__);

View File

@ -112,7 +112,7 @@ extern void ar9300_Stub_SetRxDP(struct ath_hal *ah, uint32_t rxdp,
HAL_RX_QUEUE);
extern void ar9300_Stub_EnableReceive(struct ath_hal *ah);
extern HAL_BOOL ar9300_Stub_StopDmaReceive(struct ath_hal *ah);
extern void ar9300_Stub_StartPcuReceive(struct ath_hal *ah);
extern void ar9300_Stub_StartPcuReceive(struct ath_hal *ah, HAL_BOOL);
extern void ar9300_Stub_StopPcuReceive(struct ath_hal *ah);
extern void ar9300_Stub_SetMulticastFilter(struct ath_hal *ah,
uint32_t filter0, uint32_t filter1);

View File

@ -1314,7 +1314,7 @@ struct ath_hal {
void __ahdecl(*ah_setRxDP)(struct ath_hal*, uint32_t rxdp, HAL_RX_QUEUE);
void __ahdecl(*ah_enableReceive)(struct ath_hal*);
HAL_BOOL __ahdecl(*ah_stopDmaReceive)(struct ath_hal*);
void __ahdecl(*ah_startPcuReceive)(struct ath_hal*);
void __ahdecl(*ah_startPcuReceive)(struct ath_hal*, HAL_BOOL);
void __ahdecl(*ah_stopPcuReceive)(struct ath_hal*);
void __ahdecl(*ah_setMulticastFilter)(struct ath_hal*,
uint32_t filter0, uint32_t filter1);

View File

@ -195,7 +195,7 @@ extern uint32_t ar5210GetRxDP(struct ath_hal *, HAL_RX_QUEUE);
extern void ar5210SetRxDP(struct ath_hal *, uint32_t rxdp, HAL_RX_QUEUE);
extern void ar5210EnableReceive(struct ath_hal *);
extern HAL_BOOL ar5210StopDmaReceive(struct ath_hal *);
extern void ar5210StartPcuReceive(struct ath_hal *);
extern void ar5210StartPcuReceive(struct ath_hal *, HAL_BOOL);
extern void ar5210StopPcuReceive(struct ath_hal *);
extern void ar5210SetMulticastFilter(struct ath_hal *,
uint32_t filter0, uint32_t filter1);

View File

@ -86,7 +86,7 @@ ar5210StopDmaReceive(struct ath_hal *ah)
* Start Transmit at the PCU engine (unpause receive)
*/
void
ar5210StartPcuReceive(struct ath_hal *ah)
ar5210StartPcuReceive(struct ath_hal *ah, HAL_BOOL is_scanning)
{
ar5210UpdateDiagReg(ah,
OS_REG_READ(ah, AR_DIAG_SW) & ~(AR_DIAG_SW_DIS_RX));

View File

@ -218,7 +218,7 @@ extern uint32_t ar5211GetRxDP(struct ath_hal *, HAL_RX_QUEUE);
extern void ar5211SetRxDP(struct ath_hal *, uint32_t rxdp, HAL_RX_QUEUE);
extern void ar5211EnableReceive(struct ath_hal *);
extern HAL_BOOL ar5211StopDmaReceive(struct ath_hal *);
extern void ar5211StartPcuReceive(struct ath_hal *);
extern void ar5211StartPcuReceive(struct ath_hal *, HAL_BOOL);
extern void ar5211StopPcuReceive(struct ath_hal *);
extern void ar5211SetMulticastFilter(struct ath_hal *,
uint32_t filter0, uint32_t filter1);

View File

@ -87,7 +87,7 @@ ar5211StopDmaReceive(struct ath_hal *ah)
* Start Transmit at the PCU engine (unpause receive)
*/
void
ar5211StartPcuReceive(struct ath_hal *ah)
ar5211StartPcuReceive(struct ath_hal *ah, HAL_BOOL is_scanning)
{
OS_REG_WRITE(ah, AR_DIAG_SW,
OS_REG_READ(ah, AR_DIAG_SW) & ~(AR_DIAG_SW_DIS_RX));

View File

@ -539,7 +539,7 @@ extern uint32_t ar5212GetRxDP(struct ath_hal *ath, HAL_RX_QUEUE);
extern void ar5212SetRxDP(struct ath_hal *ah, uint32_t rxdp, HAL_RX_QUEUE);
extern void ar5212EnableReceive(struct ath_hal *ah);
extern HAL_BOOL ar5212StopDmaReceive(struct ath_hal *ah);
extern void ar5212StartPcuReceive(struct ath_hal *ah);
extern void ar5212StartPcuReceive(struct ath_hal *ah, HAL_BOOL);
extern void ar5212StopPcuReceive(struct ath_hal *ah);
extern void ar5212SetMulticastFilter(struct ath_hal *ah,
uint32_t filter0, uint32_t filter1);

View File

@ -87,7 +87,7 @@ ar5212StopDmaReceive(struct ath_hal *ah)
* Start Transmit at the PCU engine (unpause receive)
*/
void
ar5212StartPcuReceive(struct ath_hal *ah)
ar5212StartPcuReceive(struct ath_hal *ah, HAL_BOOL is_scanning)
{
struct ath_hal_private *ahp = AH_PRIVATE(ah);
@ -95,8 +95,8 @@ ar5212StartPcuReceive(struct ath_hal *ah)
OS_REG_WRITE(ah, AR_DIAG_SW,
OS_REG_READ(ah, AR_DIAG_SW) &~ AR_DIAG_RX_DIS);
ar5212EnableMibCounters(ah);
/* NB: restore current settings */
ar5212AniReset(ah, ahp->ah_curchan, ahp->ah_opmode, AH_TRUE);
/* NB: restore current settings if we're not scanning */
ar5212AniReset(ah, ahp->ah_curchan, ahp->ah_opmode, !is_scanning);
}
/*

View File

@ -289,7 +289,7 @@ extern HAL_BOOL ar5416SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,
extern uint32_t ar5416GetRxFilter(struct ath_hal *ah);
extern void ar5416SetRxFilter(struct ath_hal *ah, uint32_t bits);
extern HAL_BOOL ar5416StopDmaReceive(struct ath_hal *ah);
extern void ar5416StartPcuReceive(struct ath_hal *ah);
extern void ar5416StartPcuReceive(struct ath_hal *ah, HAL_BOOL);
extern void ar5416StopPcuReceive(struct ath_hal *ah);
extern HAL_BOOL ar5416SetupRxDesc(struct ath_hal *,
struct ath_desc *, uint32_t size, u_int flags);

View File

@ -106,14 +106,14 @@ ar5416StopDmaReceive(struct ath_hal *ah)
* Start receive at the PCU engine
*/
void
ar5416StartPcuReceive(struct ath_hal *ah)
ar5416StartPcuReceive(struct ath_hal *ah, HAL_BOOL is_scanning)
{
struct ath_hal_private *ahp = AH_PRIVATE(ah);
HALDEBUG(ah, HAL_DEBUG_RX, "%s: Start PCU Receive \n", __func__);
ar5212EnableMibCounters(ah);
/* NB: restore current settings */
ar5416AniReset(ah, ahp->ah_curchan, ahp->ah_opmode, AH_TRUE);
/* NB: restore current settings if we're not scanning */
ar5416AniReset(ah, ahp->ah_curchan, ahp->ah_opmode, ! is_scanning);
/*
* NB: must do after enabling phy errors to avoid rx
* frames w/ corrupted descriptor status.

View File

@ -1228,7 +1228,7 @@ ath_rx_proc(struct ath_softc *sc, int resched)
ath_hal_putrxbuf(ah, bf->bf_daddr, HAL_RX_QUEUE_HP);
ath_hal_rxena(ah); /* enable recv descriptors */
ath_mode_init(sc); /* set filters, etc. */
ath_hal_startpcurecv(ah); /* re-enable PCU/DMA engine */
ath_hal_startpcurecv(ah, (!! sc->sc_scanning)); /* re-enable PCU/DMA engine */
#endif
ath_hal_intrset(ah, sc->sc_imask);
@ -1444,7 +1444,7 @@ ath_legacy_startrecv(struct ath_softc *sc)
ath_hal_putrxbuf(ah, bf->bf_daddr, HAL_RX_QUEUE_HP);
ath_hal_rxena(ah); /* enable recv descriptors */
ath_mode_init(sc); /* set filters, etc. */
ath_hal_startpcurecv(ah); /* re-enable PCU/DMA engine */
ath_hal_startpcurecv(ah, (!! sc->sc_scanning)); /* re-enable PCU/DMA engine */
ATH_RX_UNLOCK(sc);
return 0;

View File

@ -282,7 +282,7 @@ ath_edma_startrecv(struct ath_softc *sc)
sc->sc_rxedma[HAL_RX_QUEUE_LP].m_fifolen);
ath_mode_init(sc);
ath_hal_startpcurecv(ah);
ath_hal_startpcurecv(ah, (!! sc->sc_scanning));
/*
* We're now doing RX DMA!

View File

@ -1155,8 +1155,8 @@ void ath_intr(void *);
((*(_ah)->ah_stopTxDma)((_ah), (_qnum)))
#define ath_hal_stoppcurecv(_ah) \
((*(_ah)->ah_stopPcuReceive)((_ah)))
#define ath_hal_startpcurecv(_ah) \
((*(_ah)->ah_startPcuReceive)((_ah)))
#define ath_hal_startpcurecv(_ah, _is_scanning) \
((*(_ah)->ah_startPcuReceive)((_ah), (_is_scanning)))
#define ath_hal_stopdmarecv(_ah) \
((*(_ah)->ah_stopDmaReceive)((_ah)))
#define ath_hal_getdiagstate(_ah, _id, _indata, _insize, _outdata, _outsize) \