Mercurial > archived > louis > epitech > mq > rathaxes
comparison rathaxes_start_to_implement_sk_buff_in_the_lkm.patch @ 20:ecf2a0e61fff
rathaxes: add sk_buff stuff
author | Thomas Sanchez <thomas.sanchz@gmail.com> |
---|---|
date | Sat, 07 Jan 2012 12:46:45 +0100 |
parents | |
children | 65523c345b40 |
comparison
equal
deleted
inserted
replaced
19:670925d566c7 | 20:ecf2a0e61fff |
---|---|
1 # HG changeset patch | |
2 # Parent c979b95fd7fbc4c38849cf42a458a50d8d2d6901 | |
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 | |
5 diff -r c979b95fd7fb rathaxes/samples/lkm/CMakeLists.txt | |
6 --- a/rathaxes/samples/lkm/CMakeLists.txt Sat Jan 07 12:15:32 2012 +0100 | |
7 +++ b/rathaxes/samples/lkm/CMakeLists.txt Sat Jan 07 12:46:06 2012 +0100 | |
8 @@ -1,6 +1,6 @@ | |
9 ADD_RATHAXES_SOURCES(lkm lkm.rtx | |
10 - RTI log.rti lkm.rti pci.rti ethernet.rti | |
11 - BLT log.blt lkm.blt pci.blt ethernet.blt) | |
12 + RTI log.rti lkm.rti pci.rti socket.rti ethernet.rti | |
13 + BLT log.blt lkm.blt pci.blt socket.blt ethernet.blt) | |
14 | |
15 # We can't name lkm since it's already used as the target name to generate the | |
16 # source (with ADD_RATHAXES_SOURCES). | |
17 diff -r c979b95fd7fb rathaxes/samples/lkm/ethernet.blt | |
18 --- a/rathaxes/samples/lkm/ethernet.blt Sat Jan 07 12:15:32 2012 +0100 | |
19 +++ b/rathaxes/samples/lkm/ethernet.blt Sat Jan 07 12:46:06 2012 +0100 | |
20 @@ -1,4 +1,4 @@ | |
21 -with Ethernet, PCI, LKM | |
22 +with Ethernet, Socket, PCI, LKM | |
23 { | |
24 template type Ethernet::Device() | |
25 { | |
26 @@ -51,6 +51,24 @@ | |
27 } | |
28 } | |
29 | |
30 + template sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) | |
31 + { | |
32 + chunk LKM::prototypes() | |
33 + { | |
34 + static int rtx_ethernet_xmit(struct sk_buff* skb, struct net_device *dev); | |
35 + } | |
36 + | |
37 + chunk LKM::code() | |
38 + { | |
39 + static int rtx_ethernet_xmit(struct sk_buff* skb, struct net_device *dev) | |
40 + { | |
41 + ${pointcut ::IMPLEMENTATION}; | |
42 + | |
43 + return 0; | |
44 + } | |
45 + } | |
46 + } | |
47 + | |
48 template sequence Ethernet::close(Ethernet::Device dev) | |
49 { | |
50 chunk LKM::prototypes() | |
51 @@ -100,7 +118,7 @@ | |
52 { | |
53 .ndo_open = rtx_ethernet_open, | |
54 .ndo_stop = rtx_ethernet_close, | |
55 - .ndo_start_xmit = NULL, | |
56 + .ndo_start_xmit = rtx_ethernet_xmit, | |
57 }; | |
58 } | |
59 | |
60 diff -r c979b95fd7fb rathaxes/samples/lkm/ethernet.rti | |
61 --- a/rathaxes/samples/lkm/ethernet.rti Sat Jan 07 12:15:32 2012 +0100 | |
62 +++ b/rathaxes/samples/lkm/ethernet.rti Sat Jan 07 12:46:06 2012 +0100 | |
63 @@ -1,4 +1,4 @@ | |
64 -interface Ethernet : PCI, LKM | |
65 +interface Ethernet : Socket, PCI, LKM | |
66 { | |
67 provided type Ethernet::Device; | |
68 | |
69 @@ -10,6 +10,12 @@ | |
70 provided chunk LKM::code; | |
71 } | |
72 | |
73 + required sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) | |
74 + { | |
75 + provided chunk LKM::prototypes; | |
76 + provided chunk LKM::code; | |
77 + } | |
78 + | |
79 required sequence Ethernet::close(Ethernet::Device) | |
80 { | |
81 provided chunk LKM::prototypes; | |
82 diff -r c979b95fd7fb rathaxes/samples/lkm/lkm.rtx | |
83 --- a/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 12:15:32 2012 +0100 | |
84 +++ b/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 12:46:06 2012 +0100 | |
85 @@ -15,6 +15,11 @@ | |
86 Log::info("Got an interruption"); | |
87 } | |
88 | |
89 + Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) | |
90 + { | |
91 + Log::info("We have one packet to transmit!"); | |
92 + } | |
93 + | |
94 PCI::probe(PCI::Device dev) | |
95 { | |
96 Log::info("Probe the device"); | |
97 diff -r c979b95fd7fb rathaxes/samples/lkm/socket.blt | |
98 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
99 +++ b/rathaxes/samples/lkm/socket.blt Sat Jan 07 12:46:06 2012 +0100 | |
100 @@ -0,0 +1,27 @@ | |
101 +with Socket, LKM | |
102 +{ | |
103 + template type Socket::SKBuff() | |
104 + { | |
105 + chunk LKM::includes() | |
106 + { | |
107 + #include <linux/sk_buff.h> | |
108 + } | |
109 + | |
110 + chunk ::decl() | |
111 + { | |
112 + struct sk_buff; | |
113 + } | |
114 + | |
115 + chunk ::init() | |
116 + { | |
117 + } | |
118 + | |
119 + map | |
120 + { | |
121 + // some work may have to be done here in order | |
122 + // to access to some field of the sk_buff. | |
123 + // We should determine if all the sk_buff managment | |
124 + // can be abstracted from the user. | |
125 + } | |
126 + } | |
127 +} | |
128 diff -r c979b95fd7fb rathaxes/samples/lkm/socket.rti | |
129 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
130 +++ b/rathaxes/samples/lkm/socket.rti Sat Jan 07 12:46:06 2012 +0100 | |
131 @@ -0,0 +1,4 @@ | |
132 +interface Socket : LKM | |
133 +{ | |
134 + provided type Socket::SKBuff; | |
135 +} |