Hi all.

I am modifying mac layer code for 802.11 radios to try and implement my own channel selection mechanism for mesh mode.

I am struck with a problem. In mac80211 framework, when a 802.11management frame is received the soft irq schedules a work using the work queues mechanism in 2.6 kernels and goes ahead with normal execution. The bottom half of the management frame handling (ie., the interrupt processing) is scheduled to be done as a work(lets call this work1) in the work Queue.

My problem is that, this scheduled work gets the control (gets to run) only after the kernel thread which was interrupted when the frame (lets call it thread1) is received completely finishes its job.

But, I need the work1 (scheduled due to reception of the mgmt frame) to be scheduled as soon as the processor comes out of the interrupt context. I need this work1 to be scheduled immediately after the processor comes out of interrupt context instead of scheduling the thread1 which was running before the frame was received.

I tried using set_user_nice() function in linux/sched.c to reduce the priority of the thread1 and also periodically used schedule_timeout() so that the work1 gets schduled as early as possible after the processor comes out of interrupt context.

But this did not help and work1 does not get scheduled till the thread1 completely finishes its execution.

Can you please tell me where I'm going wrong and suggest some mechanism to implement the control flow that I need.