Mercurial > archived > louis > epitech > mq > rathaxes
annotate rathaxes_start_to_implement_sk_buff_in_the_lkm.patch @ 25:e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
author | Thomas Sanchez <thomas.sanchz@gmail.com> |
---|---|
date | Sat, 07 Jan 2012 20:11:27 +0100 |
parents | 60dd543b67b0 |
children | 8eac832f763d |
rev | line source |
---|---|
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
1 # HG changeset patch |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
2 # Parent 606e807b8bc7a3a7ea6f1b895bfe909cd7875c2e |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
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 |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
4 |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
5 diff -r 606e807b8bc7 rathaxes/samples/lkm/CMakeLists.txt |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
6 --- a/rathaxes/samples/lkm/CMakeLists.txt Sat Jan 07 20:02:55 2012 +0100 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
7 +++ b/rathaxes/samples/lkm/CMakeLists.txt Sat Jan 07 20:10:46 2012 +0100 |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
8 @@ -1,6 +1,6 @@ |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
9 ADD_RATHAXES_SOURCES(lkm lkm.rtx |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
10 - RTI log.rti lkm.rti pci.rti ethernet.rti |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
11 - BLT log.blt lkm.blt pci.blt ethernet.blt) |
23 | 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 e1000.blt) | |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
14 |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
15 # We can't name lkm since it's already used as the target name to generate the |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
16 # source (with ADD_RATHAXES_SOURCES). |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
17 diff -r 606e807b8bc7 rathaxes/samples/lkm/e1000.blt |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
18 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
19 +++ b/rathaxes/samples/lkm/e1000.blt Sat Jan 07 20:10:46 2012 +0100 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
20 @@ -0,0 +1,57 @@ |
23 | 21 +with e1000, Ethernet, Socket, PCI, LKM, Log |
22 +{ | |
23 + template type e1000::Context() | |
24 + { | |
25 + chunk LKM::includes() | |
26 + { | |
27 + /* | |
28 + * Force the generation of the structure in the "headers part, we | |
29 + * have to do this since we do not use the structure in this blt | |
30 + * (we hacked a bit and used it in ethernet.blt directly). | |
31 + */ | |
32 + typedef int ${e1000::Context}; /* CNorm __std__ workaround */ | |
33 + ${e1000::Context} force_declaration_in_includes; | |
34 + } | |
35 + | |
36 + chunk ::decl() | |
37 + { | |
38 + struct rtx_e1000_ctx | |
39 + { | |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
40 + unsigned char /* __iomem */ *ioaddr; |
23 | 41 + }; |
42 + } | |
43 + | |
44 + map | |
45 + { | |
46 + } | |
47 + } | |
48 + | |
49 + template sequence e1000::create() | |
50 + { | |
51 + chunk ::CALL | |
52 + { | |
53 + int bars = pci_select_bars(pdev, IORESOURCE_MEM); | |
54 + if (pci_enable_device_mem(pdev)) | |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
55 + { |
23 | 56 + ${Log::info("e1000::create: pci_enable_device_mem failed")}; |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
57 + } |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
58 + |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
59 + if (pci_request_selected_regions(pdev, bars, ${config.name})) |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
60 + { |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
61 + ${Log::info("e1000::create: pci_request_selected_regions failed")}; |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
62 + } |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
63 + |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
64 + if (${config.set_master}) |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
65 + { |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
66 + pci_set_master(pdev); |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
67 + } |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
68 + |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
69 + /* 0 here is for BAR_0: */ |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
70 + rtx_ether_ctx->hw_ctx.ioaddr = pci_ioremap_bar(pdev, 0); |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
71 + if (!rtx_ether_ctx->hw_ctx.ioaddr) |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
72 + { |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
73 + ${Log::info("e1000::create: pci_ioremap_bar failed")}; |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
74 + } |
23 | 75 + } |
76 + } | |
77 +} | |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
78 diff -r 606e807b8bc7 rathaxes/samples/lkm/e1000.rti |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
79 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
80 +++ b/rathaxes/samples/lkm/e1000.rti Sat Jan 07 20:10:46 2012 +0100 |
23 | 81 @@ -0,0 +1,10 @@ |
82 +interface e1000 : Socket, Ethernet, PCI, LKM | |
83 +{ | |
84 + provided type e1000::Context; | |
85 + | |
86 + /* Not sure if we need the argument */ | |
87 + provided sequence e1000::create() | |
88 + { | |
89 + provided chunk ::CALL; | |
90 + } | |
91 +} | |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
92 diff -r 606e807b8bc7 rathaxes/samples/lkm/ethernet.blt |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
93 --- a/rathaxes/samples/lkm/ethernet.blt Sat Jan 07 20:02:55 2012 +0100 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
94 +++ b/rathaxes/samples/lkm/ethernet.blt Sat Jan 07 20:10:46 2012 +0100 |
23 | 95 @@ -18,8 +18,11 @@ |
96 * I think it's useless to use the ${PCI::Device} "abstraction" | |
97 * here, since we are already in a Linux specific context here. | |
98 */ | |
99 - struct pci_dev *pci_dev; | |
100 - struct net_device *net_dev; | |
101 + struct pci_dev *pci_dev; | |
102 + struct net_device *net_dev; | |
103 + | |
104 + /* while waiting on issue #8 */ | |
105 + struct rtx_e1000_ctx hw_ctx; | |
106 }; | |
107 } | |
108 | |
109 @@ -51,6 +54,24 @@ | |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
110 } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
111 } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
112 |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
113 + template sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
114 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
115 + chunk LKM::prototypes() |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
116 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
117 + static int rtx_ethernet_xmit(struct sk_buff* skb, struct net_device *dev); |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
118 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
119 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
120 + chunk LKM::code() |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
121 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
122 + static int rtx_ethernet_xmit(struct sk_buff* skb, struct net_device *dev) |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
123 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
124 + ${pointcut ::IMPLEMENTATION}; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
125 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
126 + return 0; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
127 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
128 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
129 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
130 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
131 template sequence Ethernet::close(Ethernet::Device dev) |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
132 { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
133 chunk LKM::prototypes() |
23 | 134 @@ -100,7 +121,7 @@ |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
135 { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
136 .ndo_open = rtx_ethernet_open, |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
137 .ndo_stop = rtx_ethernet_close, |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
138 - .ndo_start_xmit = NULL, |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
139 + .ndo_start_xmit = rtx_ethernet_xmit, |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
140 }; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
141 } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
142 |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
143 diff -r 606e807b8bc7 rathaxes/samples/lkm/ethernet.rti |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
144 --- a/rathaxes/samples/lkm/ethernet.rti Sat Jan 07 20:02:55 2012 +0100 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
145 +++ b/rathaxes/samples/lkm/ethernet.rti Sat Jan 07 20:10:46 2012 +0100 |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
146 @@ -1,4 +1,4 @@ |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
147 -interface Ethernet : PCI, LKM |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
148 +interface Ethernet : Socket, PCI, LKM |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
149 { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
150 provided type Ethernet::Device; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
151 |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
152 @@ -10,6 +10,12 @@ |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
153 provided chunk LKM::code; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
154 } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
155 |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
156 + required sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
157 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
158 + provided chunk LKM::prototypes; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
159 + provided chunk LKM::code; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
160 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
161 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
162 required sequence Ethernet::close(Ethernet::Device) |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
163 { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
164 provided chunk LKM::prototypes; |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
165 diff -r 606e807b8bc7 rathaxes/samples/lkm/lkm.rtx |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
166 --- a/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 20:02:55 2012 +0100 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
167 +++ b/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 20:10:46 2012 +0100 |
23 | 168 @@ -15,10 +15,16 @@ |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
169 Log::info("Got an interruption"); |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
170 } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
171 |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
172 + Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
173 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
174 + Log::info("We have one packet to transmit!"); |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
175 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
176 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
177 PCI::probe(PCI::Device dev) |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
178 { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
179 Log::info("Probe the device"); |
23 | 180 Ethernet::init(dev); |
181 + e1000::create(); | |
182 } | |
183 | |
184 PCI::remove(PCI::Device dev) | |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
185 @@ -45,10 +51,11 @@ |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
186 LKM::name = "hello"; |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
187 LKM::author = "Rathaxes"; |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
188 LKM::description = "Hello World Loadable Kernel Module (LKM)"; |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
189 - LKM::license = "BSD"; |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
190 + LKM::license = "GPL"; |
24
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
191 |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
192 PCI::vendor_id = 0x8086; |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
193 PCI::product_id = 0x100f; |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
194 + PCI::set_master = true; |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
195 |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
196 Ethernet::ifname = "rtx%d"; |
60dd543b67b0
WIP on the e1000 pci stuff
Louis Opter <louis@lse.epitech.net>
parents:
23
diff
changeset
|
197 } |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
198 diff -r 606e807b8bc7 rathaxes/samples/lkm/socket.blt |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
199 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
200 +++ b/rathaxes/samples/lkm/socket.blt Sat Jan 07 20:10:46 2012 +0100 |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
201 @@ -0,0 +1,27 @@ |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
202 +with Socket, LKM |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
203 +{ |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
204 + template type Socket::SKBuff() |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
205 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
206 + chunk LKM::includes() |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
207 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
208 + #include <linux/sk_buff.h> |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
209 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
210 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
211 + chunk ::decl() |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
212 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
213 + struct sk_buff; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
214 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
215 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
216 + chunk ::init() |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
217 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
218 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
219 + |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
220 + map |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
221 + { |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
222 + // some work may have to be done here in order |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
223 + // to access to some field of the sk_buff. |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
224 + // We should determine if all the sk_buff managment |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
225 + // can be abstracted from the user. |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
226 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
227 + } |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
228 +} |
25
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
229 diff -r 606e807b8bc7 rathaxes/samples/lkm/socket.rti |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
230 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
e330b0cea45e
rathaxes: workaround resolution bug + update the license since we use pci_ioremap which is only available for gpl driver
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
24
diff
changeset
|
231 +++ b/rathaxes/samples/lkm/socket.rti Sat Jan 07 20:10:46 2012 +0100 |
20
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
232 @@ -0,0 +1,4 @@ |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
233 +interface Socket : LKM |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
234 +{ |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
235 + provided type Socket::SKBuff; |
ecf2a0e61fff
rathaxes: add sk_buff stuff
Thomas Sanchez <thomas.sanchz@gmail.com>
parents:
diff
changeset
|
236 +} |