Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

Ticket #1371 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

Add locking in ath_hal_api

Reported by: mtaylor Assigned to: mtaylor
Priority: minor Milestone: version 0.9.5
Component: madwifi: other Version: trunk
Keywords: Cc:
Patch is attached: 1 Pending:

Description

We need to add a lock around the HAL functions to make them thread safe since the HAL has critical sections, but defers to the driver for all synchronization.

The approach discussed with mentor and nbd is to create a perl script to generate ath_hal_api.h and ath_hal_api.c from ah.h automatically, and insert appropriate locking macros.

Attachments

regenerate_ath_hal_api.pl (16.7 kB) - added by mtaylor on 06/12/07 11:10:12.
Very early draft of perl script to create ath_hal_api.h and ath_hal_api.c. Far from complete.
madwifi-trunk-hallock.diff (67.3 kB) - added by mtaylor on 06/15/07 11:08:04.
Initial patch for HAL locking
madwifi-trunk-hallock2.diff (67.3 kB) - added by mtaylor on 06/15/07 11:10:16.
Initial patch for HAL locking
madwifi-trunk-hallock3.diff (67.7 kB) - added by mtaylor on 06/15/07 11:21:30.
Remove -DAH_HALOPS_FUNC from Makefile.inc, as isn't used with this patch

Change History

06/12/07 11:10:12 changed by mtaylor

  • attachment regenerate_ath_hal_api.pl added.

Very early draft of perl script to create ath_hal_api.h and ath_hal_api.c. Far from complete.

06/15/07 11:08:04 changed by mtaylor

  • attachment madwifi-trunk-hallock.diff added.

Initial patch for HAL locking

06/15/07 11:10:16 changed by mtaylor

  • attachment madwifi-trunk-hallock2.diff added.

Initial patch for HAL locking

06/15/07 11:20:43 changed by mtaylor

  • patch_attached set to 1.

This patch makes the following changes:

1. Replaces statically created ath_hal_api.h/ath_hal_api.c with a perl generated one. See scripts/if_ath_hal_generator.pl and scripts/if_ath_hal_settings.pl.

2. New HAL wrappers are done with static inline rather than maintaining both macros and functions.

3. New spinlock and macros added to protect all HAL access, sc_hal_lock.

4. New MadWifi safe register access [static inline] functions ath_reg_read and ath_reg_write added.

5. This fixes many race conditions between iwpriv/iwconfig commands and the HAL, including the dreaded abort on ath_hal_reg_read.

Things you can help with:

1. The only thing to be tested still is whether or not the static inline functions show up correctly in stack dumps. I haven't been able to crash it yet.

2. If this is the wrong way to do the inline functions, PLEASE tell me now. It's trivial to fix in the generator Perl script but I'd rather not break the build. ;-)

Thanks,

Mike

06/15/07 11:21:30 changed by mtaylor

  • attachment madwifi-trunk-hallock3.diff added.

Remove -DAH_HALOPS_FUNC from Makefile.inc, as isn't used with this patch

06/15/07 23:48:11 changed by mtaylor

  • status changed from new to closed.
  • resolution set to fixed.

Committed to trunk as r2460.

06/27/07 07:20:45 changed by mrenzmann

  • milestone changed from version 1.0.0 - first stable release to version 0.9.4.

02/11/08 06:19:56 changed by mrenzmann

  • milestone changed from version 0.9.4 to version 0.9.5.