From bbafb8f2fe5a2676eed19e7399d0c1cb8b327b72 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 18 Jan 2015 16:58:11 -0600 Subject: [PATCH] Tiva Ethernet: When calling into the stack from the worker thread, it is necessary to have the stack locked --- arch/arm/src/tiva/tm4c_ethernet.c | 12 ++++++++++++ drivers/net/skeleton.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index 3ac63ba685..597a08961d 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c_ethernet.c @@ -2050,12 +2050,15 @@ static inline void tiva_interrupt_process(FAR struct tiva_ethmac_s *priv) static void tiva_interrupt_work(FAR void *arg) { FAR struct tiva_ethmac_s *priv = (FAR struct tiva_ethmac_s *)arg; + net_lock_t state; DEBUGASSERT(priv); /* Process pending Ethernet interrupts */ + state = net_lock(); tiva_interrupt_process(priv); + net_unlock(state); /* Re-enable Ethernet interrupts at the NVIC */ @@ -2198,10 +2201,13 @@ static inline void tiva_txtimeout_process(FAR struct tiva_ethmac_s *priv) static void tiva_txtimeout_work(FAR void *arg) { FAR struct tiva_ethmac_s *priv = (FAR struct tiva_ethmac_s *)arg; + net_lock_t state; /* Process pending Ethernet interrupts */ + state = net_lock(); tiva_txtimeout_process(priv); + net_unlock(state); } #endif @@ -2347,10 +2353,13 @@ static inline void tiva_poll_process(FAR struct tiva_ethmac_s *priv) static void tiva_poll_work(FAR void *arg) { FAR struct tiva_ethmac_s *priv = (FAR struct tiva_ethmac_s *)arg; + net_lock_t state; /* Perform the poll */ + state = net_lock(); tiva_poll_process(priv); + net_unlock(state); } #endif @@ -2553,10 +2562,13 @@ static inline void tiva_txavail_process(FAR struct tiva_ethmac_s *priv) static void tiva_txavail_work(FAR void *arg) { FAR struct tiva_ethmac_s *priv = (FAR struct tiva_ethmac_s *)arg; + net_lock_t state; /* Perform the poll */ + state = net_lock(); tiva_txavail_process(priv); + net_unlock(state); } #endif diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index 86f1f83a11..61ac806d84 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -463,10 +463,13 @@ static inline void skel_interrupt_process(FAR struct skel_driver_s *skel) static void skel_interrupt_work(FAR void *arg) { FAR struct skel_driver_s *skel = (FAR struct skel_driver_s *)arg; + net_lock_t state; /* Process pending Ethernet interrupts */ + state = net_lock(); skel_interrupt_process(skel); + net_unlock(state); /* Re-enable Ethernet interrupts */ @@ -583,10 +586,13 @@ static inline void skel_txtimeout_process(FAR struct skel_driver_s *skel) static void skel_txtimeout_work(FAR void *arg) { FAR struct skel_driver_s *skel = (FAR struct skel_driver_s *)arg; + net_lock_t state; /* Process pending Ethernet interrupts */ + state = net_lock(); skel_txtimeout_process(skel); + net_unlock(state); } #endif @@ -693,10 +699,13 @@ static inline void skel_poll_process(FAR struct skel_driver_s *skel) static void skel_poll_work(FAR void *arg) { FAR struct skel_driver_s *skel = (FAR struct skel_driver_s *)arg; + net_lock_t state; /* Perform the poll */ + state = net_lock(); skel_poll_process(skel); + net_unlock(state); } #endif @@ -884,10 +893,13 @@ static int inline skel_txavail_process(FAR struct skel_driver_s *skel) static void skel_txavail_work(FAR void *arg) { FAR struct skel_driver_s *skel = (FAR struct skel_driver_s *)arg; + net_lock_t state; /* Perform the poll */ + state = net_lock(); skel_txavail_process(skel); + net_unlock(state); } #endif