comparison rathaxes_start_to_implement_sk_buff_in_the_lkm.patch @ 23:f0ab7ee21dd8

Merge
author Louis Opter <kalessin@kalessin.fr>
date Sat, 07 Jan 2012 19:28:54 +0100
parents 65523c345b40
children 60dd543b67b0
comparison
equal deleted inserted replaced
22:65523c345b40 23:f0ab7ee21dd8
1 # HG changeset patch 1 # HG changeset patch
2 # Parent 3af2c7465a59483f6980e4e819beb3520bc023a7 2 # Parent 7ed8c85f91b681a259ea6f7fcb39ec9ed4591a57
3 rathaxes: add sk_buff abstraction and add the implementation of the xmit function for the ethernet system. We have a fully (empty) functionnal ethernet driver 3 rathaxes: add sk_buff abstraction and add the implementation of the xmit function for the ethernet system. We have a fully (empty) functionnal ethernet driver
4 4
5 diff -r 3af2c7465a59 rathaxes/samples/lkm/CMakeLists.txt 5 diff --git a/rathaxes/samples/lkm/CMakeLists.txt b/rathaxes/samples/lkm/CMakeLists.txt
6 --- a/rathaxes/samples/lkm/CMakeLists.txt Sat Jan 07 19:18:24 2012 +0100 6 --- a/rathaxes/samples/lkm/CMakeLists.txt
7 +++ b/rathaxes/samples/lkm/CMakeLists.txt Sat Jan 07 19:19:17 2012 +0100 7 +++ b/rathaxes/samples/lkm/CMakeLists.txt
8 @@ -1,6 +1,6 @@ 8 @@ -1,6 +1,6 @@
9 ADD_RATHAXES_SOURCES(lkm lkm.rtx 9 ADD_RATHAXES_SOURCES(lkm lkm.rtx
10 - RTI log.rti lkm.rti pci.rti ethernet.rti 10 - RTI log.rti lkm.rti pci.rti ethernet.rti
11 - BLT log.blt lkm.blt pci.blt ethernet.blt) 11 - BLT log.blt lkm.blt pci.blt ethernet.blt)
12 + RTI log.rti lkm.rti pci.rti socket.rti ethernet.rti 12 + RTI log.rti lkm.rti pci.rti socket.rti ethernet.rti e1000.rti
13 + BLT log.blt lkm.blt pci.blt socket.blt ethernet.blt) 13 + BLT log.blt lkm.blt pci.blt socket.blt ethernet.blt e1000.blt)
14 14
15 # We can't name lkm since it's already used as the target name to generate the 15 # We can't name lkm since it's already used as the target name to generate the
16 # source (with ADD_RATHAXES_SOURCES). 16 # source (with ADD_RATHAXES_SOURCES).
17 diff -r 3af2c7465a59 rathaxes/samples/lkm/ethernet.blt 17 diff --git a/rathaxes/samples/lkm/e1000.blt b/rathaxes/samples/lkm/e1000.blt
18 --- a/rathaxes/samples/lkm/ethernet.blt Sat Jan 07 19:18:24 2012 +0100 18 new file mode 100644
19 +++ b/rathaxes/samples/lkm/ethernet.blt Sat Jan 07 19:19:17 2012 +0100 19 --- /dev/null
20 +++ b/rathaxes/samples/lkm/e1000.blt
21 @@ -0,0 +1,40 @@
22 +with e1000, Ethernet, Socket, PCI, LKM, Log
23 +{
24 + template type e1000::Context()
25 + {
26 + chunk LKM::includes()
27 + {
28 + /*
29 + * Force the generation of the structure in the "headers part, we
30 + * have to do this since we do not use the structure in this blt
31 + * (we hacked a bit and used it in ethernet.blt directly).
32 + */
33 + typedef int ${e1000::Context}; /* CNorm __std__ workaround */
34 + ${e1000::Context} force_declaration_in_includes;
35 + }
36 +
37 + chunk ::decl()
38 + {
39 + struct rtx_e1000_ctx
40 + {
41 + unsigned char *bar;
42 + };
43 + }
44 +
45 + map
46 + {
47 + }
48 + }
49 +
50 + template sequence e1000::create()
51 + {
52 + chunk ::CALL
53 + {
54 + int bars = pci_select_bars(pdev, IORESOURCE_MEM);
55 + if (pci_enable_device_mem(pdev))
56 + {
57 + ${Log::info("e1000::create: pci_enable_device_mem failed")};
58 + }
59 + }
60 + }
61 +}
62 diff --git a/rathaxes/samples/lkm/e1000.rti b/rathaxes/samples/lkm/e1000.rti
63 new file mode 100644
64 --- /dev/null
65 +++ b/rathaxes/samples/lkm/e1000.rti
66 @@ -0,0 +1,10 @@
67 +interface e1000 : Socket, Ethernet, PCI, LKM
68 +{
69 + provided type e1000::Context;
70 +
71 + /* Not sure if we need the argument */
72 + provided sequence e1000::create()
73 + {
74 + provided chunk ::CALL;
75 + }
76 +}
77 diff --git a/rathaxes/samples/lkm/ethernet.blt b/rathaxes/samples/lkm/ethernet.blt
78 --- a/rathaxes/samples/lkm/ethernet.blt
79 +++ b/rathaxes/samples/lkm/ethernet.blt
20 @@ -1,4 +1,4 @@ 80 @@ -1,4 +1,4 @@
21 -with Ethernet, PCI, LKM, Log 81 -with Ethernet, PCI, LKM
22 +with Ethernet, Socket, PCI, LKM, Log 82 +with Ethernet, Socket, PCI, LKM
23 { 83 {
24 template type Ethernet::Device() 84 template type Ethernet::Device()
25 { 85 {
26 @@ -51,6 +51,24 @@ 86 @@ -18,8 +18,11 @@
87 * I think it's useless to use the ${PCI::Device} "abstraction"
88 * here, since we are already in a Linux specific context here.
89 */
90 - struct pci_dev *pci_dev;
91 - struct net_device *net_dev;
92 + struct pci_dev *pci_dev;
93 + struct net_device *net_dev;
94 +
95 + /* while waiting on issue #8 */
96 + struct rtx_e1000_ctx hw_ctx;
97 };
98 }
99
100 @@ -51,6 +54,24 @@
27 } 101 }
28 } 102 }
29 103
30 + template sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) 104 + template sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb)
31 + { 105 + {
46 + } 120 + }
47 + 121 +
48 template sequence Ethernet::close(Ethernet::Device dev) 122 template sequence Ethernet::close(Ethernet::Device dev)
49 { 123 {
50 chunk LKM::prototypes() 124 chunk LKM::prototypes()
51 @@ -100,7 +118,7 @@ 125 @@ -100,7 +121,7 @@
52 { 126 {
53 .ndo_open = rtx_ethernet_open, 127 .ndo_open = rtx_ethernet_open,
54 .ndo_stop = rtx_ethernet_close, 128 .ndo_stop = rtx_ethernet_close,
55 - .ndo_start_xmit = NULL, 129 - .ndo_start_xmit = NULL,
56 + .ndo_start_xmit = rtx_ethernet_xmit, 130 + .ndo_start_xmit = rtx_ethernet_xmit,
57 }; 131 };
58 } 132 }
59 133
60 diff -r 3af2c7465a59 rathaxes/samples/lkm/ethernet.rti 134 diff --git a/rathaxes/samples/lkm/ethernet.rti b/rathaxes/samples/lkm/ethernet.rti
61 --- a/rathaxes/samples/lkm/ethernet.rti Sat Jan 07 19:18:24 2012 +0100 135 --- a/rathaxes/samples/lkm/ethernet.rti
62 +++ b/rathaxes/samples/lkm/ethernet.rti Sat Jan 07 19:19:17 2012 +0100 136 +++ b/rathaxes/samples/lkm/ethernet.rti
63 @@ -1,4 +1,4 @@ 137 @@ -1,4 +1,4 @@
64 -interface Ethernet : PCI, LKM 138 -interface Ethernet : PCI, LKM
65 +interface Ethernet : Socket, PCI, LKM 139 +interface Ethernet : Socket, PCI, LKM
66 { 140 {
67 provided type Ethernet::Device; 141 provided type Ethernet::Device;
77 + } 151 + }
78 + 152 +
79 required sequence Ethernet::close(Ethernet::Device) 153 required sequence Ethernet::close(Ethernet::Device)
80 { 154 {
81 provided chunk LKM::prototypes; 155 provided chunk LKM::prototypes;
82 diff -r 3af2c7465a59 rathaxes/samples/lkm/lkm.rtx 156 diff --git a/rathaxes/samples/lkm/lkm.rtx b/rathaxes/samples/lkm/lkm.rtx
83 --- a/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 19:18:24 2012 +0100 157 --- a/rathaxes/samples/lkm/lkm.rtx
84 +++ b/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 19:19:17 2012 +0100 158 +++ b/rathaxes/samples/lkm/lkm.rtx
85 @@ -15,6 +15,11 @@ 159 @@ -15,10 +15,16 @@
86 Log::info("Got an interruption"); 160 Log::info("Got an interruption");
87 } 161 }
88 162
89 + Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) 163 + Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb)
90 + { 164 + {
92 + } 166 + }
93 + 167 +
94 PCI::probe(PCI::Device dev) 168 PCI::probe(PCI::Device dev)
95 { 169 {
96 Log::info("Probe the device"); 170 Log::info("Probe the device");
97 diff -r 3af2c7465a59 rathaxes/samples/lkm/socket.blt 171 Ethernet::init(dev);
98 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 172 + e1000::create();
99 +++ b/rathaxes/samples/lkm/socket.blt Sat Jan 07 19:19:17 2012 +0100 173 }
174
175 PCI::remove(PCI::Device dev)
176 diff --git a/rathaxes/samples/lkm/socket.blt b/rathaxes/samples/lkm/socket.blt
177 new file mode 100644
178 --- /dev/null
179 +++ b/rathaxes/samples/lkm/socket.blt
100 @@ -0,0 +1,27 @@ 180 @@ -0,0 +1,27 @@
101 +with Socket, LKM 181 +with Socket, LKM
102 +{ 182 +{
103 + template type Socket::SKBuff() 183 + template type Socket::SKBuff()
104 + { 184 + {
123 + // We should determine if all the sk_buff managment 203 + // We should determine if all the sk_buff managment
124 + // can be abstracted from the user. 204 + // can be abstracted from the user.
125 + } 205 + }
126 + } 206 + }
127 +} 207 +}
128 diff -r 3af2c7465a59 rathaxes/samples/lkm/socket.rti 208 diff --git a/rathaxes/samples/lkm/socket.rti b/rathaxes/samples/lkm/socket.rti
129 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 209 new file mode 100644
130 +++ b/rathaxes/samples/lkm/socket.rti Sat Jan 07 19:19:17 2012 +0100 210 --- /dev/null
211 +++ b/rathaxes/samples/lkm/socket.rti
131 @@ -0,0 +1,4 @@ 212 @@ -0,0 +1,4 @@
132 +interface Socket : LKM 213 +interface Socket : LKM
133 +{ 214 +{
134 + provided type Socket::SKBuff; 215 + provided type Socket::SKBuff;
135 +} 216 +}