# HG changeset patch # User Louis Opter # Date 1325931730 -3600 # Node ID 41a434b0676b8f4c8d2cb4571641358ee63772ee # Parent 74d9d18d47327780dae9c4dd8dd4852014e380f1 WIP on the ethernet part of the LKM sample: set ifname + the irq in the net_device struct diff -r 74d9d18d4732 -r 41a434b0676b rathaxes_start_to_implement_the_ethernet_subsystem_in_the_lkm.patch --- a/rathaxes_start_to_implement_the_ethernet_subsystem_in_the_lkm.patch Fri Jan 06 22:46:33 2012 +0100 +++ b/rathaxes_start_to_implement_the_ethernet_subsystem_in_the_lkm.patch Sat Jan 07 11:22:10 2012 +0100 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent 93035f60f6725e2e0f25dcb5276c45d3a44d12fa +# Parent dd0e6d18bdef3c6ef7df3b0ed8bdbbea00406508 rathaxes: start to implement the Ethernet subsystem in linux LKM sample diff --git a/rathaxes/samples/lkm/CMakeLists.txt b/rathaxes/samples/lkm/CMakeLists.txt @@ -18,7 +18,7 @@ new file mode 100644 --- /dev/null +++ b/rathaxes/samples/lkm/ethernet.blt -@@ -0,0 +1,162 @@ +@@ -0,0 +1,164 @@ +with Ethernet, PCI, LKM +{ + template type Ethernet::Device() @@ -138,6 +138,8 @@ + net_dev = alloc_etherdev(sizeof(*rtx_ether_ctx)); + //if (net_dev == NULL) + // How should we raise the error in the parent context? ++ strlcpy(net_dev->name, ${config.ifname}, sizeof(net_dev->name)); ++ dev->irq = pdev->irq; + // Maybe we should try ${rtx_ether_ctx.init()} here: + rtx_ether_ctx = netdev_priv(net_dev); + //rtx_ether_ctx->pci_dev = ${pdev}; @@ -185,11 +187,13 @@ new file mode 100644 --- /dev/null +++ b/rathaxes/samples/lkm/ethernet.rti -@@ -0,0 +1,35 @@ +@@ -0,0 +1,37 @@ +interface Ethernet : PCI, LKM +{ + provided type Ethernet::Device; + ++ required variable ::string Ethernet::ifname; ++ + required sequence Ethernet::open(Ethernet::Device) + { + provided chunk LKM::prototypes; @@ -252,6 +256,13 @@ } LKM::init() +@@ -32,4 +44,6 @@ + + PCI::vendor_id = 0x8086; + PCI::product_id = 0x100f; ++ ++ Ethernet::ifname = "rtx"; + } diff --git a/rathaxes/samples/lkm/pci.blt b/rathaxes/samples/lkm/pci.blt --- a/rathaxes/samples/lkm/pci.blt +++ b/rathaxes/samples/lkm/pci.blt