lkml.org 
[lkml]   [2006]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 3/5] [PREEMPT_RT] Changing interrupt handlers from running in thread to hardirq and back runtime.
Makes it possible for the e100 ethernet driver to have it's interrupt handler
in both hard-irq and threaded context under PREEMPT_RT.

Index: linux-2.6.16-rt23.spin_mutex/drivers/net/e100.c
===================================================================
--- linux-2.6.16-rt23.spin_mutex.orig/drivers/net/e100.c
+++ linux-2.6.16-rt23.spin_mutex/drivers/net/e100.c
@@ -530,7 +530,7 @@ struct nic {
enum ru_state ru_running;

spinlock_t cb_lock ____cacheline_aligned;
- spinlock_t cmd_lock;
+ spin_mutex_t cmd_lock;
struct csr __iomem *csr;
enum scb_cmd_lo cuc_cmd;
unsigned int cbs_avail;
@@ -1950,6 +1950,30 @@ static int e100_rx_alloc_list(struct nic
return 0;
}

+static int e100_change_context(int irq, void *dev_id,
+ enum change_context_cmd cmd)
+{
+ struct net_device *netdev = dev_id;
+ struct nic *nic = netdev_priv(netdev);
+
+ switch(cmd)
+ {
+ case IRQ_TO_HARDIRQ:
+ if(!spin_mutexes_can_spin())
+ return -ENOSYS;
+
+ spin_mutex_to_spin(&nic->cmd_lock);
+ break;
+ case IRQ_CAN_THREAD:
+ /* Ok - return 0 */
+ break;
+ case IRQ_TO_THREADED:
+ spin_mutex_to_mutex(&nic->cmd_lock);
+ break;
+ }
+ return 0; /* Ok */
+}
+
static irqreturn_t e100_intr(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *netdev = dev_id;
@@ -2064,9 +2088,12 @@ static int e100_up(struct nic *nic)
e100_set_multicast_list(nic->netdev);
e100_start_receiver(nic, NULL);
mod_timer(&nic->watchdog, jiffies);
- if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ,
- nic->netdev->name, nic->netdev)))
+ if((err = request_irq2(nic->pdev->irq, e100_intr,
+ SA_SHIRQ|SA_MUST_THREAD_RT,
+ nic->netdev->name, nic->netdev,
+ e100_change_context)))
goto err_no_irq;
+
netif_wake_queue(nic->netdev);
netif_poll_enable(nic->netdev);
/* enable ints _after_ enabling poll, preventing a race between
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-02 23:26    [W:0.155 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site