diff rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch @ 107:f42751b8ca99

Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
author Louis Opter <louis@lse.epita.fr>
date Sun, 24 Mar 2013 21:47:39 -0700
parents 976a4b87803f
children 7efe3212db3a
line wrap: on
line diff
--- a/rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch	Mon Mar 25 01:17:56 2013 +0100
+++ b/rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch	Sun Mar 24 21:47:39 2013 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent db54879402d420664f53e83cb7f55204571a9a8e
+# Parent a611642de7f291e4749a7f44027f9ebaa0cde75c
 Move the interrupt handler init/cleanup out of e1000.blt
 
 This is not device dependant and can be done from the Ethernet subsystem
@@ -146,7 +146,18 @@
  {
      template type   Ethernet::ProtocolId()
      {
-@@ -106,11 +106,17 @@
+@@ -61,7 +61,9 @@
+ 
+         map
+         {
+-            netdev:   ${self}->ndev;
++            netdev: ${self}->ndev;
++            /* This could be another init method for Ethernet::Device: */
++            rtx_ether_ctx: netdev_priv(&${self}->ndev);
+         }
+     }
+ 
+@@ -106,11 +108,17 @@
              net_device: ${self}->net_dev;
              perm_addr: ${self}->net_dev->ndev.perm_addr;
              dev_addr: ${self}->net_dev->ndev.dev_addr;
@@ -164,7 +175,7 @@
          chunk LKM::prototypes()
          {
              static int  rtx_ethernet_open(struct net_device *);
-@@ -123,9 +129,28 @@
+@@ -123,9 +131,28 @@
                  ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
  
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
@@ -193,7 +204,7 @@
              }
          }
      }
-@@ -165,7 +190,16 @@
+@@ -165,7 +192,16 @@
                  ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
  
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
@@ -211,7 +222,22 @@
  
                  return 0;
              }
-@@ -267,14 +301,11 @@
+@@ -187,9 +223,12 @@
+         {
+             static enum irqreturn   rtx_ethernet_interrupt_handler(int irq, void *dev_id)
+             {
+-                ${Ethernet::Device} *rtx_ether_ctx = dev_id;
++                ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id;
++                ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
++                ${Ethernet::Device} *rtx_ether_ctx;
++                ${cast local.rtx_ether_ctx as Ethernet::Device};
++                rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx};
+ 
+-                ${cast local.rtx_ether_ctx as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
+ 
+                 return IRQ_NONE;
+@@ -267,14 +306,11 @@
               */
              int bars = ${rtx_pci_dev.bars};
              unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr};
@@ -230,7 +256,19 @@
 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti
 --- a/rathaxes/samples/e1000/ethernet.rti
 +++ b/rathaxes/samples/e1000/ethernet.rti
-@@ -36,10 +36,12 @@
+@@ -18,6 +18,11 @@
+         chunk       LKM::includes();
+         decl        data_types();
+         attribute   Builtin::symbol.scalar netdev;
++        /*
++         * XXX: should be a Ethernet::Device, but that causes a circular
++         * dependency:
++         */
++        attribute   Builtin::symbol rtx_ether_ctx;
+     }
+ 
+     provided type   Device
+@@ -36,10 +41,12 @@
           */
          attribute   Builtin::symbol.scalar      perm_addr;
          attribute   Builtin::symbol.scalar      dev_addr;
@@ -243,7 +281,7 @@
          provided chunk  LKM::prototypes();
          provided chunk  LKM::code();
      }
-@@ -69,8 +71,7 @@
+@@ -69,8 +76,7 @@
  
          provided pointcut   Ethernet::adapter_init_context(Ethernet::Device,
                                                             Builtin::number,