From 218cae5a714342b5d82a5b004d58f0a9ebbbfe5e Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Wed, 6 Nov 2013 01:44:09 +0100 Subject: pfinet: fix emission on the loopback device Unlike other devices, sending packets on the loopback device causes the netif_rx() function to be called from the net_bh worker thread. Since the thread is already running, it can't wake itself up when calling mark_bh(). Use a new variable to indicate when net_bh work is pending. * glue-include/linux/interrupt.h (net_bh_raised): Declare new global variable. (mark_bh): Set net_bh_raised to 1 before waking up net_bh worker thread. * loopback.c (loopback_xmit): Add comment giving details about locking. * sched.c (net_bh_raised): Define new global variable. (net_bh_worker): Wait for net_bh_raised to become true and reset it before processing net_bh work. --- pfinet/glue-include/linux/interrupt.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pfinet/glue-include/linux/interrupt.h') diff --git a/pfinet/glue-include/linux/interrupt.h b/pfinet/glue-include/linux/interrupt.h index df58d2f4..22312ba4 100644 --- a/pfinet/glue-include/linux/interrupt.h +++ b/pfinet/glue-include/linux/interrupt.h @@ -21,6 +21,7 @@ extern pthread_mutex_t net_bh_lock; /* See sched.c::net_bh_worker comments. */ extern pthread_cond_t net_bh_wakeup; +extern int net_bh_raised; #define NET_BH 0xb00bee51 @@ -30,6 +31,7 @@ static inline void mark_bh (int bh) { assert (bh == NET_BH); + net_bh_raised = 1; pthread_cond_broadcast (&net_bh_wakeup); } -- cgit v1.2.3