Revert "Use small lock to protect resources related to ethernet."

This reverts commit 60125038fc.
This commit is contained in:
Xiang Xiao 2025-02-06 22:58:59 +08:00 committed by archer
parent 259f25b2ce
commit 83c2bcb33a
12 changed files with 61 additions and 100 deletions

View file

@ -40,7 +40,7 @@
#include <net/ethernet.h>
#include <nuttx/wdog.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/ip.h>
@ -299,7 +299,6 @@ struct c5471_driver_s
struct wdog_s c_txtimeout; /* TX timeout timer */
struct work_s c_irqwork; /* For deferring interrupt work to the work queue */
struct work_s c_pollwork; /* For deferring poll work to the work queue */
spinlock_t c_lock; /* Spinlock */
/* Note: According to the C547x documentation: "The software has to
* maintain two pointers to the current RX-CPU and TX-CPU descriptors.
@ -1787,7 +1786,7 @@ static int c5471_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->c_lock);
flags = enter_critical_section();
up_disable_irq(C5471_IRQ_ETHER);
/* Disable interrupts going from EIM Module to Interrupt Module. */
@ -1810,7 +1809,7 @@ static int c5471_ifdown(struct net_driver_s *dev)
/* Reset the device */
priv->c_bifup = false;
spin_unlock_irqrestore(&priv->c_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -2336,8 +2335,6 @@ void arm_netinitialize(void)
#endif
g_c5471[0].c_dev.d_private = g_c5471; /* Used to recover private state from dev */
spin_lock_init(&g_c5471[0].c_lock); /* Initialize spinlock */
/* Register the device with the OS so that socket IOCTLs can be performed */
netdev_register(&g_c5471[0].c_dev, NET_LL_ETHERNET);

View file

@ -40,7 +40,7 @@
#include <arpa/inet.h>
#include <nuttx/wdog.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
@ -298,7 +298,6 @@ struct lpc17_40_driver_s
struct work_s lp_rxwork; /* RX work continuation */
struct work_s lp_pollwork; /* Poll work continuation */
uint32_t status;
spinlock_t lp_lock; /* Spinlock */
/* This holds the information visible to the NuttX networking layer */
@ -425,7 +424,6 @@ static inline void lpc17_40_txdescinit(struct lpc17_40_driver_s *priv);
static inline void lpc17_40_rxdescinit(struct lpc17_40_driver_s *priv);
static inline void lpc17_40_macmode(uint8_t mode);
static void lpc17_40_ethreset(struct lpc17_40_driver_s *priv);
static void lpc17_40_ethreset_nolock(struct lpc17_40_driver_s *priv);
/****************************************************************************
* Private Functions
@ -1005,14 +1003,14 @@ static void lpc17_40_rxdone_work(void *arg)
* lp-txpending TX underrun state is in effect.
*/
flags = spin_lock_irqsave(&priv->lp_lock);
flags = enter_critical_section();
if (!priv->lp_txpending)
{
priv->lp_inten |= ETH_RXINTS;
lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
}
spin_unlock_irqrestore(&priv->lp_lock, flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -1536,7 +1534,7 @@ static int lpc17_40_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->lp_lock);
flags = enter_critical_section();
up_disable_irq(LPC17_40_IRQ_ETH);
/* Cancel the TX timeout timers */
@ -1545,9 +1543,9 @@ static int lpc17_40_ifdown(struct net_driver_s *dev)
/* Reset the device and mark it as down. */
lpc17_40_ethreset_nolock(priv);
lpc17_40_ethreset(priv);
priv->lp_ifup = false;
spin_unlock_irqrestore(&priv->lp_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -2911,8 +2909,14 @@ static inline void lpc17_40_macmode(uint8_t mode)
*
****************************************************************************/
static void lpc17_40_ethreset_nolock(struct lpc17_40_driver_s *priv)
static void lpc17_40_ethreset(struct lpc17_40_driver_s *priv)
{
irqstate_t flags;
/* Reset the MAC */
flags = enter_critical_section();
/* Put the MAC into the reset state */
lpc17_40_putreg((ETH_MAC1_TXRST | ETH_MAC1_MCSTXRST | ETH_MAC1_RXRST |
@ -2961,15 +2965,7 @@ static void lpc17_40_ethreset_nolock(struct lpc17_40_driver_s *priv)
/* Clear any pending interrupts (shouldn't be any) */
lpc17_40_putreg(0xffffffff, LPC17_40_ETH_INTCLR);
}
static void lpc17_40_ethreset(struct lpc17_40_driver_s *priv)
{
irqstate_t flags;
flags = spin_lock_irqsave(&priv->lp_lock);
lpc17_40_ethreset_nolock(priv);
spin_unlock_irqrestore(&priv->lp_lock, flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -3037,8 +3033,6 @@ static inline int lpc17_40_ethinitialize(int intf)
#endif
priv->lp_dev.d_private = priv; /* Used to recover private state from dev */
spin_lock_init(&priv->lp_lock); /* Initialize spinlock */
#if CONFIG_LPC17_40_NINTERFACES > 1
# error "A mechanism to associate base address an IRQ with an interface is needed"
priv->lp_base = ??; /* Ethernet controller base address */

View file

@ -39,7 +39,7 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/queue.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
@ -512,7 +512,6 @@ struct lpc43_ethmac_s
struct wdog_s txtimeout; /* TX timeout timer */
struct work_s irqwork; /* For deferring work to the work queue */
struct work_s pollwork; /* For deferring work to the work queue */
spinlock_t lock; /* Spinlock */
/* This holds the information visible to the NuttX network */
@ -2127,7 +2126,7 @@ static int lpc43_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->lock);
flags = enter_critical_section();
up_disable_irq(LPC43M4_IRQ_ETHERNET);
/* Cancel the TX timeout timers */
@ -2144,7 +2143,7 @@ static int lpc43_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->ifup = false;
spin_unlock_irqrestore(&priv->lock, flags);
leave_critical_section(flags);
return OK;
}
@ -3608,8 +3607,6 @@ static inline int lpc43_ethinitialize(void)
#endif
priv->dev.d_private = &g_lpc43ethmac; /* Used to recover private state from dev */
spin_lock_init(&priv->lock); /* Initialize spinlock */
/* Configure GPIO pins to support Ethernet */
lpc43_ethgpioconfig(priv);

View file

@ -71,7 +71,7 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/queue.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
@ -297,7 +297,6 @@ struct lpc54_ethdriver_s
struct work_s eth_pollwork; /* For deferring poll work to the work queue */
struct work_s eth_timeoutwork; /* For deferring timeout work to the work queue */
struct sq_queue_s eth_freebuf; /* Free packet buffers */
spinlock_t lock; /* Spinlock */
/* Ring state */
@ -1451,7 +1450,7 @@ static void lpc54_eth_interrupt_work(void *arg)
lpc54_eth_channel_work(priv, 1);
}
/* Un-eth_lock the network and re-enable Ethernet interrupts */
/* Un-lock the network and re-enable Ethernet interrupts */
net_unlock();
up_enable_irq(LPC54_IRQ_ETHERNET);
@ -2002,7 +2001,7 @@ static int lpc54_eth_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->eth_lock);
flags = enter_critical_section();
up_disable_irq(LPC54_IRQ_ETHERNET);
/* Cancel the TX timeout timers */
@ -2041,14 +2040,14 @@ static int lpc54_eth_ifdown(struct net_driver_s *dev)
if (ret < 0)
{
nerr("ERROR: lpc54_phy_reset failed: %d\n", ret);
spin_unlock_irqrestore(&priv->eth_lock, flags);
leave_critical_section(flags);
return ret;
}
/* Mark the device "down" */
priv->eth_bifup = 0;
spin_unlock_irqrestore(&priv->eth_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -2882,8 +2881,6 @@ void arm_netinitialize(void)
#endif
priv->eth_dev.d_private = &g_ethdriver; /* Used to recover private state from dev */
spin_lock_init(&priv->eth_lock); /* Initialize spinlock */
/* Configure GPIO pins to support Ethernet */
/* Common MIIM interface */

View file

@ -40,7 +40,7 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/queue.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
@ -614,7 +614,6 @@ struct stm32_ethmac_s
struct wdog_s txtimeout; /* TX timeout timer */
struct work_s irqwork; /* For deferring interrupt work to the work queue */
struct work_s pollwork; /* For deferring poll work to the work queue */
spinlock_t lock; /* Spinlock */
/* This holds the information visible to the NuttX network */
@ -2360,7 +2359,7 @@ static int stm32_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->lock);
flags = enter_critical_section();
up_disable_irq(STM32_IRQ_ETH);
/* Cancel the TX timeout timers */
@ -2377,7 +2376,7 @@ static int stm32_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->ifup = false;
spin_unlock_irqrestore(&priv->lock, flags);
leave_critical_section(flags);
return OK;
}
@ -3932,8 +3931,6 @@ int stm32_ethinitialize(int intf)
priv->dev.d_private = g_stm32ethmac; /* Used to recover private state from dev */
priv->intf = intf; /* Remember the interface number */
spin_lock_init(&priv->lock); /* Initialize spinlock */
stm32_get_uniqueid(uid);
crc = crc64(uid, 12);

View file

@ -38,7 +38,7 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/queue.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
@ -613,7 +613,6 @@ struct stm32_ethmac_s
struct wdog_s txtimeout; /* TX timeout timer */
struct work_s irqwork; /* For deferring interrupt work to the work queue */
struct work_s pollwork; /* For deferring poll work to the work queue */
spinlock_t lock; /* Spinlock */
/* This holds the information visible to the NuttX network */
@ -2473,7 +2472,7 @@ static int stm32_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->lock);
flags = enter_critical_section();
up_disable_irq(STM32_IRQ_ETH);
/* Cancel the TX timeout timers */
@ -2490,7 +2489,7 @@ static int stm32_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->ifup = false;
spin_unlock_irqrestore(&priv->lock, flags);
leave_critical_section(flags);
return OK;
}
@ -4193,8 +4192,6 @@ static inline int stm32_ethinitialize(int intf)
priv->dev.d_private = g_stm32ethmac; /* Used to recover private state */
priv->intf = intf; /* Remember the interface number */
spin_lock_init(&priv->lock); /* Initialize spinlock */
stm32_get_uniqueid(uid);
crc = crc64(uid, 12);

View file

@ -41,7 +41,7 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/queue.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
@ -672,7 +672,6 @@ struct stm32_ethmac_s
struct wdog_s txtimeout; /* TX timeout timer */
struct work_s irqwork; /* For deferring interrupt work to the work queue */
struct work_s pollwork; /* For deferring poll work to the work queue */
spinlock_t lock; /* Spinlock */
/* This holds the information visible to the NuttX network */
@ -2532,7 +2531,7 @@ static int stm32_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->lock);
flags = enter_critical_section();
up_disable_irq(STM32_IRQ_ETH);
/* Cancel the TX timeout timers */
@ -2549,7 +2548,7 @@ static int stm32_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->ifup = false;
spin_unlock_irqrestore(&priv->lock, flags);
leave_critical_section(flags);
return OK;
}
@ -4288,8 +4287,6 @@ static inline int stm32_ethinitialize(int intf)
priv->dev.d_private = g_stm32ethmac; /* Used to recover private state */
priv->intf = intf; /* Remember the interface number */
spin_lock_init(&priv->lock); /* Initialize spinlock */
stm32_get_uniqueid(uid);
crc = crc64(uid, 12);

View file

@ -40,7 +40,7 @@
#include <nuttx/arch.h>
#include <nuttx/wdog.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
@ -191,7 +191,6 @@ struct tiva_driver_s
struct wdog_s ld_txtimeout; /* TX timeout timer */
struct work_s ld_irqwork; /* For deferring interrupt work to the work queue */
struct work_s ld_pollwork; /* For deferring poll work to the work queue */
spinlock_t ld_lock; /* Spinlock */
/* This holds the information visible to the NuttX network */
@ -354,7 +353,7 @@ static void tiva_ethreset(struct tiva_driver_s *priv)
/* Make sure that clocking is enabled for the Ethernet&PHY peripherals */
flags = spin_lock_irqsave(&priv->ld_lock);
flags = enter_critical_section();
regval = getreg32(TIVA_SYSCON_RCGC2);
regval |= (SYSCON_RCGC2_EMAC0 | SYSCON_RCGC2_EPHY0);
putreg32(regval, TIVA_SYSCON_RCGC2);
@ -401,7 +400,7 @@ static void tiva_ethreset(struct tiva_driver_s *priv)
regval = tiva_ethin(priv, TIVA_MAC_RIS_OFFSET);
tiva_ethout(priv, TIVA_MAC_IACK_OFFSET, regval);
spin_unlock_irqrestore(&priv->ld_lock, flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -511,7 +510,7 @@ static int tiva_transmit(struct tiva_driver_s *priv)
/* Verify that the hardware is ready to send another packet */
flags = spin_lock_irqsave(&priv->ld_lock);
flags = enter_critical_section();
if ((tiva_ethin(priv, TIVA_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0)
{
/* Increment statistics */
@ -583,7 +582,7 @@ static int tiva_transmit(struct tiva_driver_s *priv)
ret = OK;
}
spin_unlock_irqrestore(&priv->ld_lock, flags);
leave_critical_section(flags);
return ret;
}
@ -1141,7 +1140,7 @@ static int tiva_ifup(struct net_driver_s *dev)
/* Enable and reset the Ethernet controller */
flags = spin_lock_irqsave(&priv->ld_lock);
flags = enter_critical_section();
tiva_ethreset(priv);
/* Set the management clock divider register for access to the PHY
@ -1260,7 +1259,7 @@ static int tiva_ifup(struct net_driver_s *dev)
tiva_ethout(priv, TIVA_MAC_IA1_OFFSET, regval);
priv->ld_bifup = true;
spin_unlock_irqrestore(&priv->ld_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -1293,7 +1292,7 @@ static int tiva_ifdown(struct net_driver_s *dev)
/* Cancel the TX timeout timers */
flags = spin_lock_irqsave(&priv->ld_lock);
flags = enter_critical_section();
wd_cancel(&priv->ld_txtimeout);
/* Disable the Ethernet interrupt */
@ -1342,7 +1341,7 @@ static int tiva_ifdown(struct net_driver_s *dev)
/* The interface is now DOWN */
priv->ld_bifup = false;
spin_unlock_irqrestore(&priv->ld_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -1548,8 +1547,6 @@ static inline int tiva_ethinitialize(int intf)
priv->ld_irq = ??; /* Ethernet controller IRQ number */
#endif
spin_lock_init(&priv->ld_lock); /* Initialize spinlock */
#ifdef CONFIG_TIVA_BOARDMAC
/* If the board can provide us with a MAC address, get the address
* from the board now. The MAC will not be applied until tiva_ifup()

View file

@ -38,7 +38,7 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/wdog.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
@ -79,7 +79,6 @@ struct emac_driver_s
{
bool d_bifup; /* true:ifup false:ifdown */
struct wdog_s d_txtimeout; /* TX timeout timer */
spinlock_t d_lock; /* Spinlock */
/* This holds the information visible to the NuttX network */
@ -476,7 +475,7 @@ static int emac_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->d_lock);
flags = enter_critical_section();
up_disable_irq(CONFIG_HCS12_IRQ);
/* Cancel the TX timeout timers */
@ -491,7 +490,7 @@ static int emac_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->d_bifup = false;
spin_unlock_irqrestore(&priv->d_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -524,7 +523,7 @@ static int emac_txavail(struct net_driver_s *dev)
* level processing.
*/
flags = spin_lock_irqsave(&priv->d_lock);
flags = enter_critical_section();
/* Ignore the notification if the interface is not yet up */
@ -537,7 +536,7 @@ static int emac_txavail(struct net_driver_s *dev)
devif_poll(&priv->d_dev, emac_txpoll);
}
spin_unlock_irqrestore(&priv->d_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -655,8 +654,6 @@ int emac_initialize(int intf)
#endif
priv->d_dev.d_private = priv; /* Used to recover private state from dev */
spin_lock_init(&priv->d_lock); /* Initialize spinlock */
/* Put the interface in the down state. This usually amounts to resetting
* the device and/or calling emac_ifdown().
*/

View file

@ -39,7 +39,7 @@
#include <arpa/inet.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
@ -304,7 +304,6 @@ struct pic32mx_driver_s
struct wdog_s pd_txtimeout; /* TX timeout timer */
struct work_s pd_irqwork; /* For deferring interrupt work to the work queue */
struct work_s pd_pollwork; /* For deferring poll work to the work queue */
spinlock_t pd_lock; /* Spinlock */
sq_queue_t pd_freebuffers; /* The free buffer list */
@ -2218,7 +2217,7 @@ static int pic32mx_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->pd_lock);
flags = enter_critical_section();
#if CONFIG_PIC32MX_NINTERFACES > 1
up_disable_irq(priv->pd_irqsrc);
#else
@ -2233,7 +2232,7 @@ static int pic32mx_ifdown(struct net_driver_s *dev)
pic32mx_ethreset(priv);
priv->pd_ifup = false;
spin_unlock_irqrestore(&priv->pd_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -3083,7 +3082,7 @@ static void pic32mx_ethreset(struct pic32mx_driver_s *priv)
/* Reset the MAC */
flags = spin_lock_irqsave(&priv->pd_lock);
flags = enter_critical_section();
/* Ethernet Controller Initialization *************************************/
@ -3147,7 +3146,7 @@ static void pic32mx_ethreset(struct pic32mx_driver_s *priv)
up_udelay(50);
pic32mx_putreg(0, PIC32MX_EMAC1_CFG1);
spin_unlock_irqrestore(&priv->pd_lock, flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -3201,8 +3200,6 @@ static inline int pic32mx_ethinitialize(int intf)
priv->pd_irqsrc = ??; /* Ethernet controller IRQ source number */
#endif
spin_lock_init(&priv->pd_lock); /* Initialize spinlock */
/* Reset the Ethernet controller and leave in the ifdown state. The
* Ethernet controller will be properly re-initialized each time
* pic32mx_ifup() is called.

View file

@ -37,7 +37,7 @@
#include <arpa/inet.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
@ -366,7 +366,6 @@ struct pic32mz_driver_s
struct wdog_s pd_txtimeout; /* TX timeout timer */
struct work_s pd_irqwork; /* For deferring interrupt work to the work queue */
struct work_s pd_pollwork; /* For deferring poll work to the work queue */
spinlock_t pd_lock; /* Spinlock */
sq_queue_t pd_freebuffers; /* The free buffer list */
@ -2367,7 +2366,7 @@ static int pic32mz_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->pd_lock);
flags = enter_critical_section();
#if CONFIG_PIC32MZ_NINTERFACES > 1
up_disable_irq(priv->pd_irqsrc);
#else
@ -2382,7 +2381,7 @@ static int pic32mz_ifdown(struct net_driver_s *dev)
pic32mz_ethreset(priv);
priv->pd_ifup = false;
spin_unlock_irqrestore(&priv->pd_lock, flags);
leave_critical_section(flags);
return OK;
}
@ -3249,7 +3248,7 @@ static void pic32mz_ethreset(struct pic32mz_driver_s *priv)
/* Reset the MAC */
flags = spin_lock_irqsave(&priv->pd_lock);
flags = enter_critical_section();
/* Ethernet Controller Initialization *************************************/
@ -3314,7 +3313,7 @@ static void pic32mz_ethreset(struct pic32mz_driver_s *priv)
up_udelay(50);
pic32mz_putreg(0, PIC32MZ_EMAC1_CFG1);
spin_unlock_irqrestore(&priv->pd_lock, flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -3368,8 +3367,6 @@ static inline int pic32mz_ethinitialize(int intf)
priv->pd_irqsrc = ; /* Ethernet controller IRQ source number */
#endif
spin_lock_init(&priv->pd_lock); /* Initialize spinlock */
/* Configure Ethernet peripheral pin selections */
/* Controlled by DEVCFG FMIIEN and FETHIO settings */

View file

@ -38,7 +38,7 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/irq.h>
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
#include <nuttx/kmalloc.h>
@ -272,7 +272,6 @@ struct mpfs_ethmac_s
struct wdog_s txtimeout; /* TX timeout timer */
struct work_s irqwork; /* For deferring interrupt work to the work queue */
struct work_s pollwork; /* For deferring poll work to the work queue */
spinlock_t lock; /* Spinlock */
/* This holds the information visible to the NuttX network */
@ -1589,7 +1588,7 @@ static int mpfs_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = spin_lock_irqsave(&priv->lock);
flags = enter_critical_section();
up_disable_irq(priv->mac_q_int[0]);
up_disable_irq(priv->mac_q_int[1]);
up_disable_irq(priv->mac_q_int[2]);
@ -1614,7 +1613,7 @@ static int mpfs_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->ifup = false;
spin_unlock_irqrestore(&priv->lock, flags);
leave_critical_section(flags);
return OK;
}
@ -3609,8 +3608,6 @@ int mpfs_ethinitialize(int intf)
priv->queue[2].dma_rxbuf_size = (uint32_t *)(base + DMA_RXBUF_SIZE_Q2);
priv->queue[3].dma_rxbuf_size = (uint32_t *)(base + DMA_RXBUF_SIZE_Q3);
spin_lock_init(&priv->lock); /* Initialize spinlock */
/* Generate a locally administrated MAC address for this ethernet if */
/* Set first byte to 0x02 or 0x06 acc. to the intf */