Skip to contentSkip to conversation

Constant data modified, problem for multiple cards

ath9k-devel Pavel Roskin 1 participant 1 message Apr 2, 2010

lore
Share & tools
lore
#0 lore raw

Hello!

ath9k uses cast in INIT_INI_ARRAY to remove const modifier from the tables of the initial values of registers. The tables are actually modified in three places:

ath9k_hw_4k_set_addac()
ath9k_hw_def_set_addac()
ath9k_hw_init_eeprom_fix()

If there are multiple devices supported by ath9k, modifications made for one device will affect other devices.

I can actually observe the problem by using D-Link DWL-552 rev A2 and Ubiquiti SR71-15 on the same system. Ubiquiti SR71-15 needs adjustment for AR_AN_TOP2 in ath9k_hw_init_eeprom_fix() (pBase->pwdclkind = 0), but D-Link DWL-552 doesn't (pBase->pwdclkind = 1). If both cards are present, both will be using the values for the card that is initialized last.

Possible fixed could be:

1) Apply fixups whenever iniAddac or iniModes are used. The fixed values could be precalculated and stored for the card.

2) Use a variation of INIT_INI_ARRAY that would call kmalloc(). Use it for iniAddac and iniModes. Free those tables when ah is freed.

The first approach is easier to implement. There are just a few replacement values for the card. ath9k_hw_process_ini() already does some overrides for iniAddac.

The second approach is potentially more extensible, but it's more memory consuming. Particularly for the iniModes, most cards don't need the fixup, but they will still use copies of the tables.

Signature · 2 lines
Regards,
Pavel Roskin