2022-03-21 08:57:34

by Wenli Looi

[permalink] [raw]
Subject: [PATCH 0/6] ath9k: suggested improvements and bugfixes

This patchset contains suggested improvements and bugfixes to ath9k that
I came across while attempting to implement QCN550x support. The patches
should be independent.

Wenli Looi (6):
ath9k: make ATH_SREV macros more consistent
ath9k: split set11nRateFlags and set11nChainSel
ath9k: use AR9300_MAX_CHAINS when appropriate
ath9k: fix ar9003_get_eepmisc
ath9k: refactor ar9003_hw_spur_mitigate_ofdm
ath9k: add functions to get paprd rate mask

drivers/net/wireless/ath/ath9k/ar9002_mac.c | 9 +++--
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 2 +-
.../net/wireless/ath/ath9k/ar9003_eeprom.c | 39 ++++++++++---------
.../net/wireless/ath/ath9k/ar9003_eeprom.h | 2 +
drivers/net/wireless/ath/ath9k/ar9003_mac.c | 9 +++--
drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 10 ++---
drivers/net/wireless/ath/ath9k/ar9003_phy.c | 25 ++++--------
drivers/net/wireless/ath/ath9k/mac.h | 6 ++-
drivers/net/wireless/ath/ath9k/reg.h | 10 ++---
9 files changed, 56 insertions(+), 56 deletions(-)

--
2.25.1


2022-03-21 08:57:50

by Wenli Looi

[permalink] [raw]
Subject: [PATCH 1/6] ath9k: make ATH_SREV macros more consistent

This makes the macros more consistent and removes hidden dependencies on
ah for macros that take _ah as a parameter.

This change does not appear to affect the final binary.

Signed-off-by: Wenli Looi <[email protected]>
---
drivers/net/wireless/ath/ath9k/reg.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index 653e79611..8983ea6fc 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -834,8 +834,8 @@
((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_22)) || \
((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9100))

-#define AR_SREV_9100(ah) \
- ((ah->hw_version.macVersion) == AR_SREV_VERSION_9100)
+#define AR_SREV_9100(_ah) \
+ (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9100))
#define AR_SREV_9100_OR_LATER(_ah) \
(((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9100))

@@ -891,7 +891,7 @@
#define AR_SREV_9300_20_OR_LATER(_ah) \
((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9300)
#define AR_SREV_9300_22(_ah) \
- (AR_SREV_9300(ah) && \
+ (AR_SREV_9300((_ah)) && \
((_ah)->hw_version.macRev == AR_SREV_REVISION_9300_22))

#define AR_SREV_9330(_ah) \
@@ -994,8 +994,8 @@
(((_ah)->hw_version.macVersion == AR_SREV_VERSION_9561))

#define AR_SREV_SOC(_ah) \
- (AR_SREV_9340(_ah) || AR_SREV_9531(_ah) || AR_SREV_9550(ah) || \
- AR_SREV_9561(ah))
+ (AR_SREV_9340(_ah) || AR_SREV_9531(_ah) || AR_SREV_9550(_ah) || \
+ AR_SREV_9561(_ah))

/* NOTE: When adding chips newer than Peacock, add chip check here */
#define AR_SREV_9580_10_OR_LATER(_ah) \
--
2.25.1

2022-03-21 09:26:05

by Wenli Looi

[permalink] [raw]
Subject: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

The current implementation is reading the wrong eeprom type.

Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
Signed-off-by: Wenli Looi <[email protected]>
---
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 669b49b56..a109a44a1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -5615,7 +5615,7 @@ unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,

static u8 ar9003_get_eepmisc(struct ath_hw *ah)
{
- return ah->eeprom.map4k.baseEepHeader.eepMisc;
+ return ah->eeprom.ar9300_eep.baseEepHeader.opCapFlags.eepMisc;
}

const struct eeprom_ops eep_ar9300_ops = {
--
2.25.1

2022-03-21 10:50:30

by Wenli Looi

[permalink] [raw]
Subject: [PATCH 5/6] ath9k: refactor ar9003_hw_spur_mitigate_ofdm

Similar to ar9003_hw_spur_mitigate_mrc_cck, simplify the code by using
ar9003_get_spur_chan_ptr. This may also be required for QCN550x support,
to provide an abstraction over the underlying EEPROM format.

Signed-off-by: Wenli Looi <[email protected]>
---
drivers/net/wireless/ath/ath9k/ar9003_phy.c | 25 +++++++--------------
1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index daf30f994..dc0e5ea25 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -523,21 +523,10 @@ static void ar9003_hw_spur_mitigate_ofdm(struct ath_hw *ah,
int synth_freq;
int range = 10;
int freq_offset = 0;
- int mode;
- u8* spurChansPtr;
+ u8 *spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, IS_CHAN_2GHZ(chan));
unsigned int i;
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
-
- if (IS_CHAN_5GHZ(chan)) {
- spurChansPtr = &(eep->modalHeader5G.spurChans[0]);
- mode = 0;
- }
- else {
- spurChansPtr = &(eep->modalHeader2G.spurChans[0]);
- mode = 1;
- }

- if (spurChansPtr[0] == 0)
+ if (spur_fbin_ptr[0] == 0)
return; /* No spur in the mode */

if (IS_CHAN_HT40(chan)) {
@@ -554,16 +543,18 @@ static void ar9003_hw_spur_mitigate_ofdm(struct ath_hw *ah,

ar9003_hw_spur_ofdm_clear(ah);

- for (i = 0; i < AR_EEPROM_MODAL_SPURS && spurChansPtr[i]; i++) {
- freq_offset = ath9k_hw_fbin2freq(spurChansPtr[i], mode);
+ for (i = 0; i < AR_EEPROM_MODAL_SPURS && spur_fbin_ptr[i]; i++) {
+ freq_offset = ath9k_hw_fbin2freq(spur_fbin_ptr[i],
+ IS_CHAN_2GHZ(chan));
freq_offset -= synth_freq;
if (abs(freq_offset) < range) {
ar9003_hw_spur_ofdm_work(ah, chan, freq_offset,
range, synth_freq);

if (AR_SREV_9565(ah) && (i < 4)) {
- freq_offset = ath9k_hw_fbin2freq(spurChansPtr[i + 1],
- mode);
+ freq_offset =
+ ath9k_hw_fbin2freq(spur_fbin_ptr[i + 1],
+ IS_CHAN_2GHZ(chan));
freq_offset -= synth_freq;
if (abs(freq_offset) < range)
ar9003_hw_spur_ofdm_9565(ah, freq_offset);
--
2.25.1

2022-03-21 11:00:05

by Wenli Looi

[permalink] [raw]
Subject: [PATCH 2/6] ath9k: split set11nRateFlags and set11nChainSel

This makes the code clearer since set11nRateFlags currently sets
both the rate flags and chain sel. This may also be required for
QCN550x support, where the rate flags and chain sel are in separate
fields.

This change does not appear to affect the final binary.

Signed-off-by: Wenli Looi <[email protected]>
---
drivers/net/wireless/ath/ath9k/ar9002_mac.c | 9 +++++----
drivers/net/wireless/ath/ath9k/ar9003_mac.c | 9 +++++----
drivers/net/wireless/ath/ath9k/mac.h | 6 ++++--
3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
index fba5a847c..a8c0e8e2d 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
@@ -301,10 +301,11 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
WRITE_ONCE(ads->ds_ctl5, set11nPktDurRTSCTS(i->rates, 2)
| set11nPktDurRTSCTS(i->rates, 3));

- WRITE_ONCE(ads->ds_ctl7, set11nRateFlags(i->rates, 0)
- | set11nRateFlags(i->rates, 1)
- | set11nRateFlags(i->rates, 2)
- | set11nRateFlags(i->rates, 3)
+ WRITE_ONCE(ads->ds_ctl7,
+ set11nRateFlags(i->rates, 0) | set11nChainSel(i->rates, 0)
+ | set11nRateFlags(i->rates, 1) | set11nChainSel(i->rates, 1)
+ | set11nRateFlags(i->rates, 2) | set11nChainSel(i->rates, 2)
+ | set11nRateFlags(i->rates, 3) | set11nChainSel(i->rates, 3)
| SM(i->rtscts_rate, AR_RTSCTSRate));

WRITE_ONCE(ads->ds_ctl9, SM(i->txpower[1], AR_XmitPower1));
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 5184a0aac..ff8ab58e6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -144,10 +144,11 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
WRITE_ONCE(ads->ctl16, set11nPktDurRTSCTS(i->rates, 2)
| set11nPktDurRTSCTS(i->rates, 3));

- WRITE_ONCE(ads->ctl18, set11nRateFlags(i->rates, 0)
- | set11nRateFlags(i->rates, 1)
- | set11nRateFlags(i->rates, 2)
- | set11nRateFlags(i->rates, 3)
+ WRITE_ONCE(ads->ctl18,
+ set11nRateFlags(i->rates, 0) | set11nChainSel(i->rates, 0)
+ | set11nRateFlags(i->rates, 1) | set11nChainSel(i->rates, 1)
+ | set11nRateFlags(i->rates, 2) | set11nChainSel(i->rates, 2)
+ | set11nRateFlags(i->rates, 3) | set11nChainSel(i->rates, 3)
| SM(i->rtscts_rate, AR_RTSCTSRate));

WRITE_ONCE(ads->ctl19, AR_Not_Sounding);
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index fd6aa49ad..af44b3381 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -35,8 +35,10 @@
|((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ? \
AR_GI##_index : 0) \
|((_series)[_index].RateFlags & ATH9K_RATESERIES_STBC ? \
- AR_STBC##_index : 0) \
- |SM((_series)[_index].ChSel, AR_ChainSel##_index))
+ AR_STBC##_index : 0))
+
+#define set11nChainSel(_series, _index) \
+ (SM((_series)[_index].ChSel, AR_ChainSel##_index))

#define CCK_SIFS_TIME 10
#define CCK_PREAMBLE_BITS 144
--
2.25.1

2022-03-21 12:40:15

by Wenli Looi

[permalink] [raw]
Subject: [PATCH 6/6] ath9k: add functions to get paprd rate mask

This removes some code duplication with le32_to_cpu. This may also be
required for QCN550x support, to provide an abstraction over the
underlying EEPROM format.

Signed-off-by: Wenli Looi <[email protected]>
---
.../net/wireless/ath/ath9k/ar9003_eeprom.c | 33 ++++++++++---------
.../net/wireless/ath/ath9k/ar9003_eeprom.h | 2 ++
drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 10 +++---
3 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index a109a44a1..abf12de0e 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -5449,8 +5449,6 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
{
struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
struct ath_common *common = ath9k_hw_common(ah);
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_modal_eep_header *modal_hdr;
u8 targetPowerValT2[ar9300RateSize];
u8 target_power_val_t2_eep[ar9300RateSize];
u8 targetPowerValT2_tpc[ar9300RateSize];
@@ -5465,17 +5463,12 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2);

if (ar9003_is_paprd_enabled(ah)) {
- if (IS_CHAN_2GHZ(chan))
- modal_hdr = &eep->modalHeader2G;
- else
- modal_hdr = &eep->modalHeader5G;
-
ah->paprd_ratemask =
- le32_to_cpu(modal_hdr->papdRateMaskHt20) &
+ ar9003_get_paprd_rate_mask_ht20(ah, IS_CHAN_2GHZ(chan)) &
AR9300_PAPRD_RATE_MASK;

ah->paprd_ratemask_ht40 =
- le32_to_cpu(modal_hdr->papdRateMaskHt40) &
+ ar9003_get_paprd_rate_mask_ht40(ah, IS_CHAN_2GHZ(chan)) &
AR9300_PAPRD_RATE_MASK;

paprd_scale_factor = ar9003_get_paprd_scale_factor(ah, chan);
@@ -5592,23 +5585,33 @@ u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is2ghz)
return ar9003_modal_header(ah, is2ghz)->spurChans;
}

+u32 ar9003_get_paprd_rate_mask_ht20(struct ath_hw *ah, bool is2ghz)
+{
+ return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->papdRateMaskHt20);
+}
+
+u32 ar9003_get_paprd_rate_mask_ht40(struct ath_hw *ah, bool is2ghz)
+{
+ return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->papdRateMaskHt40);
+}
+
unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
struct ath9k_channel *chan)
{
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
+ bool is2ghz = IS_CHAN_2GHZ(chan);

- if (IS_CHAN_2GHZ(chan))
- return MS(le32_to_cpu(eep->modalHeader2G.papdRateMaskHt20),
+ if (is2ghz)
+ return MS(ar9003_get_paprd_rate_mask_ht20(ah, is2ghz),
AR9300_PAPRD_SCALE_1);
else {
if (chan->channel >= 5700)
- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
+ return MS(ar9003_get_paprd_rate_mask_ht20(ah, is2ghz),
AR9300_PAPRD_SCALE_1);
else if (chan->channel >= 5400)
- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
+ return MS(ar9003_get_paprd_rate_mask_ht40(ah, is2ghz),
AR9300_PAPRD_SCALE_2);
else
- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
+ return MS(ar9003_get_paprd_rate_mask_ht40(ah, is2ghz),
AR9300_PAPRD_SCALE_1);
}
}
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
index e8fda54ac..f8ae20318 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
@@ -363,6 +363,8 @@ u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz);

u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is_2ghz);

+u32 ar9003_get_paprd_rate_mask_ht20(struct ath_hw *ah, bool is2ghz);
+u32 ar9003_get_paprd_rate_mask_ht40(struct ath_hw *ah, bool is2ghz);
unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
struct ath9k_channel *chan);

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 34e100940..b2d53b6c0 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -21,7 +21,7 @@
void ar9003_paprd_enable(struct ath_hw *ah, bool val)
{
struct ath9k_channel *chan = ah->curchan;
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
+ bool is2ghz = IS_CHAN_2GHZ(chan);

/*
* 3 bits for modalHeader5G.papdRateMaskHt20
@@ -36,17 +36,17 @@ void ar9003_paprd_enable(struct ath_hw *ah, bool val)
* -- disable PAPRD for lower band 5GHz
*/

- if (IS_CHAN_5GHZ(chan)) {
+ if (!is2ghz) {
if (chan->channel >= UPPER_5G_SUB_BAND_START) {
- if (le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20)
+ if (ar9003_get_paprd_rate_mask_ht20(ah, is2ghz)
& BIT(30))
val = false;
} else if (chan->channel >= MID_5G_SUB_BAND_START) {
- if (le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20)
+ if (ar9003_get_paprd_rate_mask_ht20(ah, is2ghz)
& BIT(29))
val = false;
} else {
- if (le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20)
+ if (ar9003_get_paprd_rate_mask_ht20(ah, is2ghz)
& BIT(28))
val = false;
}
--
2.25.1

2022-03-21 15:18:14

by Wenli Looi

[permalink] [raw]
Subject: [PATCH 3/6] ath9k: use AR9300_MAX_CHAINS when appropriate

Replace other constants with AR9300_MAX_CHAINS when appropriate.

This change does not appear to affect the final binary.

Signed-off-by: Wenli Looi <[email protected]>
---
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 2 +-
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index dc24da1ff..6ca089f15 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -177,7 +177,7 @@ static void ar9003_hw_iqcal_collect(struct ath_hw *ah)
int i;

/* Accumulate IQ cal measures for active chains */
- for (i = 0; i < AR5416_MAX_CHAINS; i++) {
+ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
if (ah->txchainmask & BIT(i)) {
ah->totalPowerMeasI[i] +=
REG_READ(ah, AR_PHY_CAL_MEAS_0(i));
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index b0a4ca355..669b49b56 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3911,7 +3911,7 @@ static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan)
}

/* Test value. if 0 then attenuation is unused. Don't load anything. */
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
if (ah->txchainmask & BIT(i)) {
value = ar9003_hw_atten_chain_get(ah, i, chan);
REG_RMW_FIELD(ah, ext_atten_reg[i],
@@ -5126,7 +5126,7 @@ static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency)
frequency, correction[0], correction[1], correction[2]);

/* Store calibrated noise floor values */
- for (ichain = 0; ichain < AR5416_MAX_CHAINS; ichain++)
+ for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++)
if (mode) {
ah->nf_5g.cal[ichain] = nf_cal[ichain];
ah->nf_5g.pwr[ichain] = nf_pwr[ichain];
--
2.25.1

2022-03-21 18:00:39

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

Wenli Looi <[email protected]> writes:

> The current implementation is reading the wrong eeprom type.
>
> Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
> Signed-off-by: Wenli Looi <[email protected]>
> ---
> drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> index 669b49b56..a109a44a1 100644
> --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> @@ -5615,7 +5615,7 @@ unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
>
> static u8 ar9003_get_eepmisc(struct ath_hw *ah)
> {
> - return ah->eeprom.map4k.baseEepHeader.eepMisc;
> + return ah->eeprom.ar9300_eep.baseEepHeader.opCapFlags.eepMisc;
> }

Looks like this is only ever used to check for the
AR5416_EEPMISC_BIG_ENDIAN flag - so is that never used by AR9300, or how
was this ever working given that it's a completely different offset?

-Toke

2022-03-21 19:19:10

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 3/6] ath9k: use AR9300_MAX_CHAINS when appropriate

Wenli Looi <[email protected]> writes:

> Replace other constants with AR9300_MAX_CHAINS when appropriate.
>
> This change does not appear to affect the final binary.
>
> Signed-off-by: Wenli Looi <[email protected]>

Acked-by: Toke Høiland-Jørgensen <[email protected]>

2022-03-21 21:20:41

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 2/6] ath9k: split set11nRateFlags and set11nChainSel

Wenli Looi <[email protected]> writes:

> This makes the code clearer since set11nRateFlags currently sets
> both the rate flags and chain sel. This may also be required for
> QCN550x support, where the rate flags and chain sel are in separate
> fields.
>
> This change does not appear to affect the final binary.
>
> Signed-off-by: Wenli Looi <[email protected]>

Acked-by: Toke Høiland-Jørgensen <[email protected]>

2022-03-21 21:43:23

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 6/6] ath9k: add functions to get paprd rate mask

Wenli Looi <[email protected]> writes:

> This removes some code duplication with le32_to_cpu. This may also be
> required for QCN550x support, to provide an abstraction over the
> underlying EEPROM format.
>
> Signed-off-by: Wenli Looi <[email protected]>

Acked-by: Toke Høiland-Jørgensen <[email protected]>

2022-03-21 22:30:45

by Wenli Looi

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

On Mon, Mar 21, 2022 at 8:51 AM Toke Høiland-Jørgensen <[email protected]> wrote:
>
> Wenli Looi <[email protected]> writes:
>
> > The current implementation is reading the wrong eeprom type.
> >
> > Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
> > Signed-off-by: Wenli Looi <[email protected]>
> > ---
> > drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> > index 669b49b56..a109a44a1 100644
> > --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> > +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> > @@ -5615,7 +5615,7 @@ unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
> >
> > static u8 ar9003_get_eepmisc(struct ath_hw *ah)
> > {
> > - return ah->eeprom.map4k.baseEepHeader.eepMisc;
> > + return ah->eeprom.ar9300_eep.baseEepHeader.opCapFlags.eepMisc;
> > }
>
> Looks like this is only ever used to check for the
> AR5416_EEPMISC_BIG_ENDIAN flag - so is that never used by AR9300, or how
> was this ever working given that it's a completely different offset?
>
> -Toke

I think it's never used by AR9300, because get_eepmisc is only used in
ath9k_hw_nvram_swap_data, which is only used in the eeprom types other
than AR9300.

2022-03-21 22:54:03

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath9k: make ATH_SREV macros more consistent

Wenli Looi <[email protected]> writes:

> This makes the macros more consistent and removes hidden dependencies on
> ah for macros that take _ah as a parameter.
>
> This change does not appear to affect the final binary.
>
> Signed-off-by: Wenli Looi <[email protected]>

Acked-by: Toke Høiland-Jørgensen <[email protected]>

2022-03-21 23:08:14

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 5/6] ath9k: refactor ar9003_hw_spur_mitigate_ofdm

Wenli Looi <[email protected]> writes:

> Similar to ar9003_hw_spur_mitigate_mrc_cck, simplify the code by using
> ar9003_get_spur_chan_ptr. This may also be required for QCN550x support,
> to provide an abstraction over the underlying EEPROM format.
>
> Signed-off-by: Wenli Looi <[email protected]>

Acked-by: Toke Høiland-Jørgensen <[email protected]>

2022-03-21 23:33:56

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

Wenli Looi <[email protected]> writes:

> On Mon, Mar 21, 2022 at 8:51 AM Toke Høiland-Jørgensen <[email protected]> wrote:
>>
>> Wenli Looi <[email protected]> writes:
>>
>> > The current implementation is reading the wrong eeprom type.
>> >
>> > Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
>> > Signed-off-by: Wenli Looi <[email protected]>
>> > ---
>> > drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
>> > index 669b49b56..a109a44a1 100644
>> > --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
>> > +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
>> > @@ -5615,7 +5615,7 @@ unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
>> >
>> > static u8 ar9003_get_eepmisc(struct ath_hw *ah)
>> > {
>> > - return ah->eeprom.map4k.baseEepHeader.eepMisc;
>> > + return ah->eeprom.ar9300_eep.baseEepHeader.opCapFlags.eepMisc;
>> > }
>>
>> Looks like this is only ever used to check for the
>> AR5416_EEPMISC_BIG_ENDIAN flag - so is that never used by AR9300, or how
>> was this ever working given that it's a completely different offset?
>>
>> -Toke
>
> I think it's never used by AR9300, because get_eepmisc is only used in
> ath9k_hw_nvram_swap_data, which is only used in the eeprom types other
> than AR9300.

Alright, fair enough; let's merge this as a fix anyway...

-Toke

2022-03-21 23:34:08

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

Wenli Looi <[email protected]> writes:

> The current implementation is reading the wrong eeprom type.
>
> Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
> Signed-off-by: Wenli Looi <[email protected]>

Acked-by: Toke Høiland-Jørgensen <[email protected]>

2022-03-23 16:45:58

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

Kalle Valo <[email protected]> writes:

> Toke Høiland-Jørgensen <[email protected]> writes:
>
>> Kalle Valo <[email protected]> writes:
>>
>>> Wenli Looi <[email protected]> writes:
>>>
>>>> The current implementation is reading the wrong eeprom type.
>>>>
>>>> Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving
>>>> the eepmisc value")
>>>> Signed-off-by: Wenli Looi <[email protected]>
>>>
>>> The Fixes tag is wrong, I fixed it in the pending branch.
>>
>> Ah, oops, my bad for not catching that; thanks for the fixup! :)
>
> No worries, I'm using Stephen's script which check that :)

Ah yes, I thought I recognised the format of the notice ;)

-Toke

2022-03-23 16:50:15

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

Kalle Valo <[email protected]> writes:

> Wenli Looi <[email protected]> writes:
>
>> The current implementation is reading the wrong eeprom type.
>>
>> Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
>> Signed-off-by: Wenli Looi <[email protected]>
>
> The Fixes tag is wrong, I fixed it in the pending branch.

Ah, oops, my bad for not catching that; thanks for the fixup! :)

-Toke

2022-03-24 02:03:59

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

Toke Høiland-Jørgensen <[email protected]> writes:

> Kalle Valo <[email protected]> writes:
>
>> Wenli Looi <[email protected]> writes:
>>
>>> The current implementation is reading the wrong eeprom type.
>>>
>>> Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving
>>> the eepmisc value")
>>> Signed-off-by: Wenli Looi <[email protected]>
>>
>> The Fixes tag is wrong, I fixed it in the pending branch.
>
> Ah, oops, my bad for not catching that; thanks for the fixup! :)

No worries, I'm using Stephen's script which check that :)

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2022-03-24 14:18:50

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

Wenli Looi <[email protected]> writes:

> The current implementation is reading the wrong eeprom type.
>
> Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
> Signed-off-by: Wenli Looi <[email protected]>

The Fixes tag is wrong, I fixed it in the pending branch.

In commit

265e303cc469 ("ath9k: fix ar9003_get_eepmisc")

Fixes tag

Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")

has these problem(s):

- SHA1 should be at least 12 digits long
Can be fixed by setting core.abbrev to 12 (or more) or (for git
v2.11 or later) just making sure it is not set (or set to "auto").


--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2022-03-25 19:37:10

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath9k: make ATH_SREV macros more consistent

Wenli Looi <[email protected]> wrote:

> This makes the macros more consistent and removes hidden dependencies on
> ah for macros that take _ah as a parameter.
>
> This change does not appear to affect the final binary.
>
> Signed-off-by: Wenli Looi <[email protected]>
> Acked-by: Toke Høiland-Jørgensen <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

6 patches applied to ath-next branch of ath.git, thanks.

26c31016fe7e ath9k: make ATH_SREV macros more consistent
a96474a794e1 ath9k: split set11nRateFlags and set11nChainSel
3096a4d9eb9b ath9k: use AR9300_MAX_CHAINS when appropriate
9aaff3864b60 ath9k: fix ar9003_get_eepmisc
193025378c44 ath9k: refactor ar9003_hw_spur_mitigate_ofdm
673424ce0e77 ath9k: add functions to get paprd rate mask

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2022-03-25 20:07:20

by Wenli Looi

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath9k: fix ar9003_get_eepmisc

On Wed, Mar 23, 2022 at 3:30 AM Kalle Valo <[email protected]> wrote:
>
> Wenli Looi <[email protected]> writes:
>
> > The current implementation is reading the wrong eeprom type.
> >
> > Fixes: d8ec2e ("ath9k: Add an eeprom_ops callback for retrieving the eepmisc value")
> > Signed-off-by: Wenli Looi <[email protected]>
>
> The Fixes tag is wrong, I fixed it in the pending branch.
>

Thanks for the fix!