diff options
author | Zheng Da <zhengda1936@gmail.com> | 2010-02-27 15:46:25 +0100 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2010-02-27 15:46:25 +0100 |
commit | a4bb3955579991dfb1ef5b8ffcc498b54671351e (patch) | |
tree | 158bb092ba98c1e29c100eab7229a7d7ca65c6e6 /libdde_linux26/lib/src | |
parent | 5980bdb21ee1c39455ed319b8390800d9cd7de14 (diff) |
Use lock to protect pending softirq variable.
This is a temporary solution. I should implement a correct mechanism to
simulate cli/sti.
Diffstat (limited to 'libdde_linux26/lib/src')
-rw-r--r-- | libdde_linux26/lib/src/arch/l4/softirq.c | 13 | ||||
-rw-r--r-- | libdde_linux26/lib/src/net/core/dev.c | 9 |
2 files changed, 18 insertions, 4 deletions
diff --git a/libdde_linux26/lib/src/arch/l4/softirq.c b/libdde_linux26/lib/src/arch/l4/softirq.c index 21b36d17..be13422b 100644 --- a/libdde_linux26/lib/src/arch/l4/softirq.c +++ b/libdde_linux26/lib/src/arch/l4/softirq.c @@ -172,6 +172,7 @@ static void tasklet_hi_action(struct softirq_action *a) } } +ddekit_lock_t cli_lock; #define MAX_SOFTIRQ_RETRIES 10 @@ -186,6 +187,8 @@ void __do_softirq(void) /* reset softirq count */ set_softirq_pending(0); + ddekit_lock_unlock(&cli_lock); +// local_irq_enable(); /* While we have a softirq pending... */ while (pending) { @@ -197,6 +200,8 @@ void __do_softirq(void) /* remove pending flag for last softirq */ pending >>= 1; } +// local_irq_disable(); + ddekit_lock_lock(&cli_lock); /* Somebody might have scheduled another softirq in between * (e.g., an IRQ thread or another tasklet). */ @@ -209,10 +214,14 @@ void do_softirq(void) { unsigned long flags; - local_irq_save(flags); + if (cli_lock == NULL) + ddekit_lock_init_unlocked(&cli_lock); + ddekit_lock_lock(&cli_lock); +// local_irq_save(flags); if (local_softirq_pending()) __do_softirq(); - local_irq_restore(flags); +// local_irq_restore(flags); + ddekit_lock_unlock(&cli_lock); } /** Softirq thread function. diff --git a/libdde_linux26/lib/src/net/core/dev.c b/libdde_linux26/lib/src/net/core/dev.c index 64917332..128f4d73 100644 --- a/libdde_linux26/lib/src/net/core/dev.c +++ b/libdde_linux26/lib/src/net/core/dev.c @@ -2611,11 +2611,16 @@ out: void __napi_schedule(struct napi_struct *n) { unsigned long flags; + extern ddekit_lock_t cli_lock; - local_irq_save(flags); + if (cli_lock == NULL) + ddekit_lock_init_unlocked(&cli_lock); + ddekit_lock_lock(&cli_lock); +// local_irq_save(flags); list_add_tail(&n->poll_list, &__get_cpu_var(softnet_data).poll_list); __raise_softirq_irqoff(NET_RX_SOFTIRQ); - local_irq_restore(flags); +// local_irq_restore(flags); + ddekit_lock_unlock(&cli_lock); } EXPORT_SYMBOL(__napi_schedule); |