layer1: introduce concept of a 'l1 completion'

The idea is that the L1S part can schedule a completion handler which
will then execute in the asynchronous L1A part.  This should keep the
FIQ priority L1S extremely short, deferring most of the work into
the L1A part that runs in regular process context.
This commit is contained in:
Harald Welte 2010-05-07 16:46:47 +02:00
parent 452bc18470
commit ea3b3826f2
4 changed files with 51 additions and 0 deletions

View File

@ -29,6 +29,9 @@ void l1a_mftask_enable(enum mframe_task task);
/* Disable a repeating multiframe task */
void l1a_mftask_disable(enum mframe_task task);
/* Execute pending L1A completions */
void l1a_compl_execute(void);
/* Initialize asynchronous part of Layer1 */
void l1a_init(void);

View File

@ -28,6 +28,13 @@ enum l1s_chan {
_NUM_L1S_CHAN
};
enum l1_compl {
L1_COMPL_FB,
};
typedef void l1_compl_cb(enum l1_compl c);
#define L1S_NUM_COMPL 32
#define L1S_NUM_NEIGH_CELL 6
struct l1s_state {
@ -52,6 +59,11 @@ struct l1s_state {
/* Transmit queues of pending packets for main DCCH and ACCH */
struct llist_head tx_queue[_NUM_L1S_CHAN];
/* Which L1A completions are scheduled right now */
uint32_t scheduled_compl;
/* callbacks for each of the completions */
l1_compl_cb *completion[L1S_NUM_COMPL];
/* Structures below are for L1-task specific parameters, used
* to communicate between l1-sync and l1-async (l23_api) */
struct {
@ -126,6 +138,9 @@ void l1s_sb_test(uint8_t base_fn);
void l1s_pm_test(uint8_t base_fn, uint16_t arfcn);
void l1s_nb_test(uint8_t base_fn);
/* schedule a completion */
void l1s_compl_sched(enum l1_compl c);
void l1s_init(void);
/* reset the layer1 as part of synchronizing to a new cell */

View File

@ -69,3 +69,26 @@ void l1a_init(void)
{
l1a_l23api_init();
}
/* Execute pending L1A completions */
void l1a_compl_execute(void)
{
unsigned long flags;
unsigned int scheduled;
unsigned int i;
/* get and reset the currently scheduled tasks */
local_irq_save(flags);
scheduled = l1s.scheduled_compl;
l1s.scheduled_compl = 0;
local_irq_restore(flags);
/* Iterate over list of scheduled completions, call their
* respective completion handler */
for (i = 0; i < 32; i++) {
if (!(scheduled & (1 << i)))
continue;
/* call completion function */
l1s.completion[i](i);
}
}

View File

@ -200,6 +200,16 @@ static inline void check_lost_frame(void)
last_timestamp = timestamp;
}
/* schedule a completion */
void l1s_compl_sched(enum l1_compl c)
{
unsigned long flags;
local_irq_save(flags);
l1s.scheduled_compl |= (1 << c);
local_irq_restore(flags);
}
/* main routine for synchronous part of layer 1, called by frame interrupt
* generated by TPU once every TDMA frame */
static void l1_sync(void)