Mercurial > archived > louis > epitech > mq > rathaxes
annotate e1000_implement_the_frame_transmission_chunk.patch @ 90:4968acb39c7b
Finalize work on minimal TX
author | Louis Opter <louis@lse.epitech.net> |
---|---|
date | Mon, 15 Oct 2012 06:17:32 +0200 |
parents | a9b47a2f8b98 |
children |
rev | line source |
---|---|
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1 # HG changeset patch |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
2 # Parent 87ba2a19a59fb7be346ad40a57439b6b752b152e |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
3 rathaxes: add the transmission code for very simple packets in the e1000 sample |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
4 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
5 Very simple packets are those which don't need to be fragmented nor checksummed. |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
6 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
7 The transmission code is defined in different chunks/methods of the TxRing type. |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
8 An e1000::xmit method template has been added to call the different methods on |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
9 the TxRing object in the e1000::Context object. The interrupt handler has been |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
10 reworked to handle transmission interrupts and cleanup the TxRing accordingly. |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
11 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
12 In parallel to the transmission code, the Socket::SKBuff type is now a real |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
13 Rathaxes type with its own debug and DMA operations methods. |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
14 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
15 Also, sorry, this changeset is mixed with other changes: |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
16 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
17 - Small improvements everywhere now that the compiler uses CNorm unstrict; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
18 - Add the Device::AbstractDevice type; this Rathaxes represents the generic type |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
19 used by the kernel to represent a device; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
20 - Add the Socket::AbstractSKBuff type too to represent the SKBuff type used by |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
21 the kernel; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
22 - Likewise the Ethernet::AbstractDevice type represents the type used by the |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
23 kernel for Ethernet devices; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
24 - Socket::SKBuff is now a real Rathaxes type which aggregates a KernelSKBuff |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
25 object. |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
26 |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
27 diff --git a/rathaxes/samples/e1000/CMakeLists.txt b/rathaxes/samples/e1000/CMakeLists.txt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
28 --- a/rathaxes/samples/e1000/CMakeLists.txt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
29 +++ b/rathaxes/samples/e1000/CMakeLists.txt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
30 @@ -1,6 +1,22 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
31 -ADD_RATHAXES_SOURCES(e1000_src lkm.rtx |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
32 - RTI builtin.rti log.rti lkm.rti pci.rti socket.rti ethernet.rti e1000.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
33 - BLT log.blt lkm.blt pci.blt socket.blt ethernet.blt e1000.blt) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
34 +ADD_RATHAXES_SOURCES(e1000_src |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
35 + lkm.rtx |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
36 + RTI |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
37 + builtin.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
38 + log.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
39 + lkm.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
40 + device.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
41 + pci.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
42 + socket.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
43 + ethernet.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
44 + e1000.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
45 + BLT |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
46 + log.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
47 + lkm.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
48 + pci.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
49 + device.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
50 + socket.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
51 + ethernet.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
52 + e1000.blt) |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
53 |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
54 IF (LINUX_KBUILD_DIR) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
55 ADD_RATHAXES_LKM(e1000 e1000_src) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
56 diff --git a/rathaxes/samples/e1000/device.blt b/rathaxes/samples/e1000/device.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
57 new file mode 100644 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
58 --- /dev/null |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
59 +++ b/rathaxes/samples/e1000/device.blt |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
60 @@ -0,0 +1,25 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
61 +with Device, LKM |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
62 +{ |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
63 + template type Device::AbstractDevice() |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
64 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
65 + chunk LKM::includes() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
66 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
67 + #include <linux/device.h> |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
68 + |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
69 + static const ${Device::AbstractDevice} force_rtx_device_decl; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
70 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
71 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
72 + chunk decl() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
73 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
74 + typedef struct device *rtx_device_p; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
75 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
76 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
77 + chunk init() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
78 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
79 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
80 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
81 + map |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
82 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
83 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
84 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
85 +} |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
86 diff --git a/rathaxes/samples/e1000/device.rti b/rathaxes/samples/e1000/device.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
87 new file mode 100644 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
88 --- /dev/null |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
89 +++ b/rathaxes/samples/e1000/device.rti |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
90 @@ -0,0 +1,9 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
91 +interface Device : LKM |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
92 +{ |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
93 + provided type AbstractDevice |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
94 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
95 + chunk LKM::includes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
96 + method decl(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
97 + method init(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
98 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
99 +} |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
100 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
101 --- a/rathaxes/samples/e1000/e1000.blt |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
102 +++ b/rathaxes/samples/e1000/e1000.blt |
88 | 103 @@ -11,16 +11,15 @@ |
104 | |
105 chunk ::decl() | |
106 { | |
107 - typedef struct rtx_e1000_rx_descriptor | |
108 + struct rtx_e1000_rx_descriptor | |
109 { | |
110 - /* actual types are in comments */ | |
111 - unsigned long int /* __le64 */ buff_addr; | |
112 - unsigned short /* __le16 */ length; | |
113 - unsigned short /* __le16 */ csum; | |
114 - unsigned char status; | |
115 - unsigned char errors; | |
116 - unsigned short /* __le16 */ special; | |
117 - } *rtx_e1000_rx_descriptor_p; | |
118 + __le64 buff_addr; | |
119 + __le16 length; | |
120 + __le16 csum; | |
121 + unsigned char status; | |
122 + unsigned char errors; | |
123 + __le16 special; | |
124 + }; | |
125 } | |
126 | |
127 chunk ::init() | |
128 @@ -50,30 +49,30 @@ | |
129 | |
130 chunk ::decl() | |
131 { | |
132 - typedef struct rtx_e1000_tx_descriptor | |
133 + struct rtx_e1000_tx_descriptor | |
134 { | |
135 - unsigned long int /* __le64 */ buff_addr; | |
136 + __le64 buff_addr; | |
137 union | |
138 { | |
139 - unsigned int /* __le32 */ data; | |
140 + __le32 data; | |
141 struct | |
142 { | |
143 - unsigned short /* __le16 */ length; | |
144 - unsigned char csum_offset; /* CSO */ | |
145 - unsigned char cmd; | |
146 - } fields; | |
147 - } lower; | |
148 + __le16 length; | |
149 + unsigned char csum_offset; /* CSO */ | |
150 + unsigned char cmd; | |
151 + } fields; | |
152 + } lower; | |
153 union | |
154 { | |
155 - unsigned int /* __le32 */ data; | |
156 + __le32 data; | |
157 struct | |
158 { | |
159 - unsigned char status; | |
160 - unsigned char csum_start; /* CSS */ | |
161 - unsigned short /* __le16 */ special; | |
162 - } fields; | |
163 - } upper; | |
164 - } *rtx_e1000_tx_descriptor_p; | |
165 + unsigned char status; | |
166 + unsigned char csum_start; /* CSS */ | |
167 + __le16 special; | |
168 + } fields; | |
169 + } upper; | |
170 + }; | |
171 } | |
172 | |
173 chunk ::init() | |
174 @@ -93,9 +92,8 @@ | |
175 * CNorm unstrict); | |
176 * - dma_base: (physical) address of the ring where the device can access | |
177 * the different descriptors; | |
178 - * - skbuffs: array of the skbuffs associated with each descriptor; | |
179 - * - dma_skbuffs: (physical) address of each skbuff where the device can | |
180 - * write the received packets; | |
181 + * - skbuffs: array of the skbuffs and their dma (physical) address | |
182 + * associated with each descriptor. | |
183 */ | |
184 template type e1000::RxRing() | |
185 { | |
186 @@ -110,9 +108,8 @@ | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
187 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
188 unsigned int size; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
189 struct rtx_e1000_rx_descriptor *base; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
190 - void* /* dma_addr_t */ dma_base; |
88 | 191 - struct sk_buff *skbuffs[256 /* ${config.rx_ring_size} */]; |
192 - void* /* dma_addr_t */ dma_skbuffs[256 /* ${config.rx_ring_size} */]; | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
193 + dma_addr_t dma_base; |
88 | 194 + ${Socket::SKBuff} skbuffs[${config.rx_ring_size}]; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
195 }; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
196 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
197 |
88 | 198 @@ -134,7 +131,13 @@ |
199 * - base: address of the ring (we can't use the typedef here until we get | |
200 * CNorm unstrict); | |
201 * - dma_base: (physical) address of the ring where the device can access | |
202 - * the different descriptors. | |
203 + * the different descriptors; | |
204 + * - skbuffs: the skbuffs associated with each descriptor of the ring; | |
205 + * - head: index on the head of the ring; | |
206 + * - tail: index on the tail of the ring. | |
207 + * | |
208 + * Keep in mind that the head and tail fields are, obviously, not | |
209 + * synchronized with TDT/TDH on the device. | |
210 */ | |
211 template type e1000::TxRing() | |
212 { | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
213 @@ -148,11 +151,112 @@ |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
214 struct rtx_e1000_tx_ring |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
215 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
216 unsigned int size; |
88 | 217 - struct rtx_e1000_tx_descriptor *base; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
218 - void* /* dma_addr_t */ dma_base; |
88 | 219 + /* XXX: can't use ${e1000::TxDescriptor} here: */ |
220 + struct rtx_e1000_tx_descriptor *base; /* rename to descs */ | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
221 + dma_addr_t dma_base; |
88 | 222 + ${Socket::SKBuff} skbuffs[${config.tx_ring_size}]; |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
223 + unsigned short head; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
224 + unsigned short tail; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
225 }; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
226 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
227 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
228 + chunk LKM::prototypes() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
229 + { |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
230 + static void rtx_e1000_tx_ring_clean(struct rtx_e1000_tx_ring *); |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
231 + static unsigned int rtx_e1000_tx_ring_descriptors_remaining(struct rtx_e1000_tx_ring *); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
232 + static int rtx_e1000_tx_ring_tso_cksum_offload(struct rtx_e1000_tx_ring *, struct rtx_socket_skbuff *); |
88 | 233 + static void rtx_e1000_tx_ring_put(struct rtx_e1000_tx_ring *, struct rtx_socket_skbuff *); |
234 + static void rtx_e1000_tx_ring_start_xmit(struct rtx_e1000_tx_ring *, const struct rtx_e1000_ctx *); | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
235 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
236 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
237 + chunk LKM::code() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
238 + { |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
239 + static void rtx_e1000_tx_ring_clean(struct rtx_e1000_tx_ring *self) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
240 + { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
241 + ${e1000::TxDescriptor} *tx_desc; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
242 + bool done; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
243 + |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
244 + for (; self->head != self->tail; self->head++) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
245 + { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
246 + tx_desc = &self->base[self->head]; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
247 + done = tx_desc->upper.fields.status & E1000_TXD_STAT_DD; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
248 + if (!done) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
249 + break ; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
250 + } |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
251 + |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
252 + pr_info("%s: tx_ring_clean: moving head to %d/%d", ${config.name}, self->head, ${config.tx_ring_size}); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
253 + } |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
254 + |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
255 + static unsigned int rtx_e1000_tx_ring_descriptors_remaining(struct rtx_e1000_tx_ring *self) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
256 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
257 + if (self->tail == self->head) /* ring is empty */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
258 + return 256; /* XXX: ${config.tx_ring_size}; */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
259 + if (self->tail > self->head) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
260 + /* XXX: ${config.tx_ring_size} */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
261 + return 256 - (self->tail - self->head); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
262 + return self->head - self->tail; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
263 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
264 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
265 + static int rtx_e1000_tx_ring_tso_cksum_offload(struct rtx_e1000_tx_ring *self, struct rtx_socket_skbuff *skb) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
266 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
267 + return skb_is_gso(skb->skbuff) || skb->skbuff->ip_summed == CHECKSUM_PARTIAL; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
268 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
269 + |
88 | 270 + static void rtx_e1000_tx_ring_put(struct rtx_e1000_tx_ring *self, struct rtx_socket_skbuff *skb) |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
271 + { |
88 | 272 + WARN_ON(!skb); |
273 + | |
274 + /* | |
275 + * Mark it as the last buffer (EOP) and ask the card to | |
276 + * insert the Ethernet FCS (Frame Check Sequence). | |
277 + * | |
278 + * XXX: it sucks to use skb_headlen() here (this part of the | |
279 + * code shouldn't be aware of it and use something more | |
280 + * abstract. | |
281 + */ | |
282 + struct rtx_e1000_tx_descriptor *tx_desc = &self->base[self->tail]; | |
283 + tx_desc->lower.data = cpu_to_le32( | |
284 + E1000_TXD_CMD_EOP | | |
285 + E1000_TXD_CMD_IFCS | | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
286 + E1000_TXD_CMD_RS | |
88 | 287 + skb_headlen(skb->skbuff)); |
288 + tx_desc->upper.data = 0; | |
289 + tx_desc->buff_addr = cpu_to_le64(skb->dma_handle); | |
290 + memcpy(&self->skbuffs[self->tail], skb, sizeof(*skb)); | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
291 + self->tail = (self->tail + 1) % ${config.tx_ring_size}; |
88 | 292 + } |
293 + | |
294 + static void rtx_e1000_tx_ring_start_xmit(struct rtx_e1000_tx_ring *self, const struct rtx_e1000_ctx *hw_ctx) | |
295 + { | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
296 + pr_info("%s: start_xmit: moving tail to %d/%d", ${config.name}, self->tail, ${config.tx_ring_size}); |
88 | 297 + rtx_e1000_register_write32(hw_ctx, E1000_TDT, self->tail); |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
298 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
299 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
300 + |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
301 + chunk clean() |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
302 + { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
303 + rtx_e1000_tx_ring_clean(${self}); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
304 + } |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
305 + |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
306 + chunk descriptors_remaining() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
307 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
308 + rtx_e1000_tx_ring_descriptors_remaining(${self}); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
309 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
310 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
311 + chunk tso_cksum_offload(Socket::SKBuff skb) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
312 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
313 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
314 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
315 + chunk put(Socket::SKBuff skb) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
316 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
317 + rtx_e1000_tx_ring_put(${self}, &${skb}); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
318 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
319 + |
88 | 320 + chunk start_xmit(e1000::Context ctx) |
321 + { | |
322 + rtx_e1000_tx_ring_start_xmit(${self}, ${ctx}); | |
323 + } | |
324 + | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
325 chunk ::init() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
326 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
327 } |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
328 @@ -334,6 +438,45 @@ |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
329 } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
330 } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
331 |
88 | 332 + template type e1000::TxDescriptorFlags() |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
333 + { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
334 + chunk LKM::includes() |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
335 + { |
88 | 336 + static const ${e1000::TxDescriptorFlags} force_enum_rtx_e1000_tx_descriptor_flags_decl; |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
337 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
338 + |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
339 + chunk ::decl() |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
340 + { |
88 | 341 + enum rtx_e1000_tx_descriptor_flags |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
342 + { |
88 | 343 + E1000_TXD_DTYP_D = 0x00100000, /* Data Descriptor */ |
344 + E1000_TXD_DTYP_C = 0x00000000, /* Context Descriptor */ | |
345 + E1000_TXD_POPTS_IXSM = 0x01, /* Insert IP checksum */ | |
346 + E1000_TXD_POPTS_TXSM = 0x02, /* Insert TCP/UDP checksum */ | |
347 + E1000_TXD_CMD_EOP = 0x01000000, /* End of Packet */ | |
348 + E1000_TXD_CMD_IFCS = 0x02000000, /* Insert FCS (Ethernet CRC) */ | |
349 + E1000_TXD_CMD_IC = 0x04000000, /* Insert Checksum */ | |
350 + E1000_TXD_CMD_RS = 0x08000000, /* Report Status */ | |
351 + E1000_TXD_CMD_RPS = 0x10000000, /* Report Packet Sent */ | |
352 + E1000_TXD_CMD_DEXT = 0x20000000, /* Descriptor extension (0 = legacy) */ | |
353 + E1000_TXD_CMD_VLE = 0x40000000, /* Add VLAN tag */ | |
354 + E1000_TXD_CMD_IDE = 0x80000000, /* Enable Tidv register */ | |
355 + E1000_TXD_STAT_DD = 0x00000001, /* Descriptor Done */ | |
356 + E1000_TXD_STAT_EC = 0x00000002, /* Excess Collisions */ | |
357 + E1000_TXD_STAT_LC = 0x00000004, /* Late Collisions */ | |
358 + E1000_TXD_STAT_TU = 0x00000008, /* Transmit underrun */ | |
359 + E1000_TXD_CMD_TCP = 0x01000000, /* TCP packet */ | |
360 + E1000_TXD_CMD_IP = 0x02000000, /* IP packet */ | |
361 + E1000_TXD_CMD_TSE = 0x04000000, /* TCP Seg enable */ | |
362 + E1000_TXD_STAT_TC = 0x00000004, /* Tx Underrun */ | |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
363 + }; |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
364 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
365 + |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
366 + map |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
367 + { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
368 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
369 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
370 + |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
371 template sequence e1000::create_device() |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
372 { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
373 chunk Ethernet::create_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx) |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
374 @@ -376,8 +519,7 @@ |
88 | 375 udelay(10); |
376 | |
377 /* Now we can load its mac address (thanks minix code) */ | |
378 - int i = 0; | |
379 - for (i = 0 /* < this is not generated! (cnorm bug) */; i < 3; ++i) | |
380 + for (int i = 0; i < 3; ++i) | |
381 { | |
382 rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_EEPROM_READ, (i << 8) | 1); | |
383 | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
384 @@ -420,6 +562,7 @@ |
88 | 385 } |
386 } | |
387 | |
388 + /* TODO: make that a method of e1000::Context */ | |
389 template sequence e1000::print_status(Ethernet::Device ctx) | |
390 { | |
391 chunk LKM::prototypes() | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
392 @@ -466,17 +609,19 @@ |
88 | 393 * ${e1000.init(E1000_STATUS); // didn't work, so we used the next line |
394 * reg_status = E1000_STATUS; | |
395 * ${e1000::register_read32(rtx_ether_ctx->hw_ctx, reg_status)}; | |
396 + * | |
397 + * TODO: make them methods of e1000::Context | |
398 */ | |
399 template sequence e1000::register_read32(e1000::Context ctx, e1000::Register reg_offset) | |
400 { | |
401 chunk LKM::prototypes() | |
402 { | |
403 - static unsigned int rtx_e1000_register_read32(struct rtx_e1000_ctx *, unsigned int); | |
404 + static unsigned int rtx_e1000_register_read32(const struct rtx_e1000_ctx *, unsigned int); | |
405 } | |
406 | |
407 chunk LKM::code() | |
408 { | |
409 - static unsigned int rtx_e1000_register_read32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset) | |
410 + static unsigned int rtx_e1000_register_read32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset) | |
411 { | |
412 return ioread32(ctx->ioaddr + reg_offset); | |
413 } | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
414 @@ -492,12 +637,12 @@ |
88 | 415 { |
416 chunk LKM::prototypes() | |
417 { | |
418 - static void rtx_e1000_register_write32(struct rtx_e1000_ctx *, unsigned int, unsigned int); | |
419 + static void rtx_e1000_register_write32(const struct rtx_e1000_ctx *, unsigned int, unsigned int); | |
420 } | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
421 |
88 | 422 chunk LKM::code() |
423 { | |
424 - static void rtx_e1000_register_write32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value) | |
425 + static void rtx_e1000_register_write32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value) | |
426 { | |
427 iowrite32(value, ctx->ioaddr + reg_offset); | |
428 } | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
429 @@ -513,12 +658,12 @@ |
88 | 430 { |
431 chunk LKM::prototypes() | |
432 { | |
433 - static void rtx_e1000_register_set32(struct rtx_e1000_ctx *, unsigned int, unsigned int); | |
434 + static void rtx_e1000_register_set32(const struct rtx_e1000_ctx *, unsigned int, unsigned int); | |
435 } | |
436 | |
437 chunk LKM::code() | |
438 { | |
439 - static void rtx_e1000_register_set32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value) | |
440 + static void rtx_e1000_register_set32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value) | |
441 { | |
442 iowrite32(rtx_e1000_register_read32(ctx, reg_offset) | value, ctx->ioaddr + reg_offset); | |
443 } | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
444 @@ -534,12 +679,12 @@ |
88 | 445 { |
446 chunk LKM::prototypes() | |
447 { | |
448 - static void rtx_e1000_register_unset32(struct rtx_e1000_ctx *, unsigned int, unsigned int); | |
449 + static void rtx_e1000_register_unset32(const struct rtx_e1000_ctx *, unsigned int, unsigned int); | |
450 } | |
451 | |
452 chunk LKM::code() | |
453 { | |
454 - static void rtx_e1000_register_unset32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value) | |
455 + static void rtx_e1000_register_unset32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value) | |
456 { | |
457 iowrite32(rtx_e1000_register_read32(ctx, reg_offset) & ~value, ctx->ioaddr + reg_offset); | |
458 } | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
459 @@ -626,12 +771,18 @@ |
88 | 460 } |
461 } | |
462 | |
463 + /* TODO: refactor | |
464 + * | |
465 + * Split into two method methods: | |
466 + * - e1000::RxRing::init_rx() | |
467 + * - e1000::TxRing::init_tx() | |
468 + * | |
469 + * Also it should use the new methods in Socket::SKbuff. | |
470 + */ | |
471 template sequence set_up_device(Ethernet::Device ctx) | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
472 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
473 chunk ::CALL() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
474 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
475 - typedef unsigned long int dma_addr_t; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
476 - |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
477 /* |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
478 * This part is documented in the Intel Gigabit Ethernet Controller |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
479 * Software Developper manual. (You can find it in the doc/hardware |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
480 @@ -663,6 +814,8 @@ |
88 | 481 * E1000_CRCERRS to E1000_TSCTFC. |
482 */ | |
483 | |
484 + int i; | |
485 + | |
486 rtx_e1000_register_set32(hw_ctx, E1000_CTRL, | |
487 E1000_CMD_ASDE | | |
488 E1000_CMD_SLU); | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
489 @@ -676,7 +829,6 @@ |
88 | 490 rtx_e1000_register_write32(hw_ctx, E1000_FCAL, 0); |
491 rtx_e1000_register_write32(hw_ctx, E1000_FCT, 0); | |
492 rtx_e1000_register_write32(hw_ctx, E1000_FCTTV, 0); | |
493 - int i = 0; /* CNorm workaround, the init part of for isn't generated */ | |
494 for (i = 0; i != 64; ++i) | |
495 rtx_e1000_register_write32(hw_ctx, E1000_CRCERRS + i * 4, 0); | |
496 | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
497 @@ -719,7 +871,6 @@ |
88 | 498 |
499 /* 2. Initialize the MTA */ | |
500 | |
501 - i = 0; /* CNorm workaround, the init part of for isn't generated */ | |
502 for (i = 0; i != 128; ++i) | |
503 rtx_e1000_register_write32(hw_ctx, E1000_MTA + i * 4, 0); | |
504 | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
505 @@ -733,7 +884,7 @@ |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
506 hw_ctx->rx_ring.base = dma_alloc_coherent( |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
507 &${ctx}->pci_dev->dev, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
508 hw_ctx->rx_ring.size, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
509 - (dma_addr_t *)&hw_ctx->rx_ring.dma_base, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
510 + &hw_ctx->rx_ring.dma_base, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
511 GFP_KERNEL); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
512 if (!hw_ctx->rx_ring.base) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
513 { |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
514 @@ -747,41 +898,37 @@ |
88 | 515 * Allocate the skbuffs, map them for DMA, and write their address |
516 * in the corresponding descriptor. | |
517 */ | |
518 - i = 0; | |
519 for (i = 0; i != ${config.rx_ring_size}; ++i) | |
520 { | |
521 - hw_ctx->rx_ring.skbuffs[i] = netdev_alloc_skb( | |
522 + hw_ctx->rx_ring.skbuffs[i].skbuff = netdev_alloc_skb( | |
523 ${ctx}->net_dev, | |
524 ${config.rx_buffer_len}); | |
525 - if (!hw_ctx->rx_ring.skbuffs[i]) | |
526 + if (!hw_ctx->rx_ring.skbuffs[i].skbuff) | |
527 { | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
528 ${Log::info("cannot allocate a skbuff for the rx ring")}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
529 goto err_skbuffs_alloc; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
530 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
531 - hw_ctx->rx_ring.dma_skbuffs[i] = (void *)dma_map_single( |
88 | 532 + hw_ctx->rx_ring.skbuffs[i].dma_handle = dma_map_single( |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
533 &${ctx}->pci_dev->dev, |
88 | 534 - hw_ctx->rx_ring.skbuffs[i]->data, |
535 + hw_ctx->rx_ring.skbuffs[i].skbuff->data, | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
536 ${config.rx_buffer_len}, |
88 | 537 DMA_FROM_DEVICE); |
538 - /* | |
539 - * Either this fails because, when compiling with gcc because | |
540 - * the last argument is not of the correct type (dma_addr_t). | |
541 - * Or it fails because of the lack of CNorm Unstrict. | |
542 - */ | |
543 - if (dma_mapping_error(&${ctx}->pci_dev->dev, (dma_addr_t)hw_ctx->rx_ring.dma_skbuffs[i])) | |
544 + int dma_error = dma_mapping_error(&${ctx}->pci_dev->dev, | |
545 + hw_ctx->rx_ring.skbuffs[i].dma_handle); | |
546 + if (dma_error) | |
547 { | |
548 ${Log::info("cannot dma-map a skbuff for the rx ring")}; | |
549 goto err_skbuffs_map; | |
550 } | |
551 - hw_ctx->rx_ring.base[i].buff_addr = (unsigned long int)cpu_to_le64( | |
552 - hw_ctx->rx_ring.dma_skbuffs[i]); | |
553 + hw_ctx->rx_ring.base[i].buff_addr = cpu_to_le64( | |
554 + hw_ctx->rx_ring.skbuffs[i].skbuff); | |
555 } | |
556 | |
557 ${Log::info("setup_device: skbuffs allocated")}; | |
558 | |
559 /* 5. Save the emplacement and the size of the ring in RDBA/RDLEN */ | |
560 - rtx_e1000_register_write32(hw_ctx, E1000_RDBAL, (dma_addr_t)hw_ctx->rx_ring.dma_base & 0xffffffff); | |
561 - rtx_e1000_register_write32(hw_ctx, E1000_RDBAH, (dma_addr_t)hw_ctx->rx_ring.dma_base >> 32); | |
562 + rtx_e1000_register_write32(hw_ctx, E1000_RDBAL, hw_ctx->rx_ring.dma_base & 0xffffffff); | |
563 + rtx_e1000_register_write32(hw_ctx, E1000_RDBAH, hw_ctx->rx_ring.dma_base >> 32); | |
564 rtx_e1000_register_write32(hw_ctx, E1000_RDLEN, hw_ctx->rx_ring.size); | |
565 | |
566 /* 6. Setup RDH/RDT */ | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
567 @@ -820,7 +967,7 @@ |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
568 hw_ctx->tx_ring.base = dma_alloc_coherent( |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
569 &${ctx}->pci_dev->dev, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
570 hw_ctx->tx_ring.size, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
571 - (dma_addr_t *)&hw_ctx->tx_ring.dma_base, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
572 + &hw_ctx->tx_ring.dma_base, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
573 GFP_KERNEL); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
574 if (!hw_ctx->rx_ring.base) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
575 { |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
576 @@ -831,16 +978,18 @@ |
88 | 577 ${Log::info("setup_device: tx descriptors allocated")}; |
578 | |
579 /* 2. Save the emplacement and the size of the ring in TDBA/TDLEN */ | |
580 - rtx_e1000_register_write32(hw_ctx, E1000_TDBAL, (dma_addr_t)hw_ctx->tx_ring.dma_base & 0xffffffff); | |
581 - rtx_e1000_register_write32(hw_ctx, E1000_TDBAH, (dma_addr_t)hw_ctx->tx_ring.dma_base >> 32); | |
582 + rtx_e1000_register_write32(hw_ctx, E1000_TDBAL, hw_ctx->tx_ring.dma_base & 0xffffffff); | |
583 + rtx_e1000_register_write32(hw_ctx, E1000_TDBAH, hw_ctx->tx_ring.dma_base >> 32); | |
584 rtx_e1000_register_write32(hw_ctx, E1000_TDLEN, hw_ctx->tx_ring.size); | |
585 | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
586 /* 3. Setup TDH/TDT to zero: the queue is empty */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
587 rtx_e1000_register_write32(hw_ctx, E1000_TDH, 0); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
588 rtx_e1000_register_write32(hw_ctx, E1000_TDT, 0); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
589 + hw_ctx->tx_ring.head = 0; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
590 + hw_ctx->tx_ring.tail = 0; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
591 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
592 /* 4. Set TCTL.PSP and enable the transmitter */ |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
593 - rtx_e1000_register_set32(hw_ctx, E1000_TCTL, E1000_TCTL_PSP|E1000_TCTL_PSP); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
594 + rtx_e1000_register_set32(hw_ctx, E1000_TCTL, E1000_TCTL_PSP|E1000_TCTL_EN); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
595 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
596 ${Log::info("transmit registers configured and transmitter enabled")}; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
597 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
598 @@ -860,15 +1009,15 @@ |
88 | 599 { |
600 dma_unmap_single( | |
601 &${ctx}->pci_dev->dev, | |
602 - (dma_addr_t)hw_ctx->rx_ring.dma_skbuffs[i], | |
603 + hw_ctx->rx_ring.skbuffs[i].dma_handle, | |
604 ${config.rx_buffer_len}, | |
605 DMA_FROM_DEVICE); | |
606 err_skbuffs_map: | |
607 - dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i]); | |
608 + dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i].skbuff); | |
609 } | |
610 | |
611 dma_free_coherent(&${ctx}->pci_dev->dev, hw_ctx->rx_ring.size, | |
612 - hw_ctx->rx_ring.base, (dma_addr_t)hw_ctx->rx_ring.dma_base); | |
613 + hw_ctx->rx_ring.base, hw_ctx->rx_ring.dma_base); | |
614 err_rx_ring_alloc: | |
615 return -ENOMEM; | |
616 | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
617 @@ -876,12 +1025,15 @@ |
88 | 618 } |
619 } | |
620 | |
621 + /* TODO: | |
622 + * | |
623 + * Refactor into two methods (one in RxRing and one in TxRing) and make use | |
624 + * of the new methods in Socket::SKBuff. | |
625 + */ | |
626 template sequence free_rx_tx(Ethernet::Device ctx) | |
627 { | |
628 chunk ::CALL() | |
629 { | |
630 - typedef unsigned long int dma_addr_t; | |
631 - | |
632 ${e1000::Context} *hw_ctx; | |
633 hw_ctx = &${ctx}->hw_ctx; | |
634 | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
635 @@ -890,18 +1042,17 @@ |
88 | 636 * - Unmap and free the skbuffs; |
637 * - Free the descriptors array. | |
638 */ | |
639 - int i = 0; | |
640 - for (i = 0; i != ${config.rx_ring_size}; ++i) | |
641 + for (int i = 0; i != ${config.rx_ring_size}; ++i) | |
642 { | |
643 dma_unmap_single( | |
644 &${ctx}->pci_dev->dev, | |
645 - (dma_addr_t)hw_ctx->rx_ring.dma_skbuffs[i], | |
646 + (dma_addr_t)hw_ctx->rx_ring.skbuffs[i].dma_handle, | |
647 ${config.rx_buffer_len}, | |
648 DMA_FROM_DEVICE); | |
649 - dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i]); | |
650 + dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i].skbuff); | |
651 } | |
652 dma_free_coherent(&${ctx}->pci_dev->dev, hw_ctx->rx_ring.size, | |
653 - hw_ctx->rx_ring.base, (dma_addr_t)hw_ctx->rx_ring.dma_base); | |
654 + hw_ctx->rx_ring.base, hw_ctx->rx_ring.dma_base); | |
655 ${Log::info("free_rx_tx: rx ring free'ed")}; | |
656 | |
657 /* | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
658 @@ -909,7 +1060,7 @@ |
88 | 659 * - Free the descriptors array. |
660 */ | |
661 dma_free_coherent(&${ctx}->pci_dev->dev, hw_ctx->tx_ring.size, | |
662 - hw_ctx->tx_ring.base, (dma_addr_t)hw_ctx->tx_ring.dma_base); | |
663 + hw_ctx->tx_ring.base, hw_ctx->tx_ring.dma_base); | |
664 ${Log::info("free_rx_tx: tx ring free'ed")}; | |
665 } | |
666 } | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
667 @@ -918,16 +1069,123 @@ |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
668 { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
669 chunk ::CALL() |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
670 { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
671 - int intr; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
672 - |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
673 - intr = rtx_e1000_register_read32(&${ctx}->hw_ctx, E1000_ICR); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
674 - if (intr) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
675 + unsigned int icr = rtx_e1000_register_read32(&${ctx}->hw_ctx, E1000_ICR); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
676 + pr_info("%s: interrupt received, ICR: 0x%x", ${config.name}, icr); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
677 + if (icr) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
678 { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
679 - if (intr & E1000_INTR_LSC) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
680 - ${Log::info("cable link status changed")}; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
681 + if (icr & E1000_INTR_LSC) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
682 + { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
683 + ${Log::info("handle_interrupt: cable link status changed, dumping card status:")}; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
684 + ${e1000::print_status(ctx)}; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
685 + } |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
686 + if (icr & (E1000_INTR_TXQE|E1000_INTR_TXDW)) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
687 + { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
688 + ${Log::info("handle_interrupt: TxRing: packet(s) sent")}; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
689 + /* |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
690 + * XXX Do a Rathaxes call (how can I bind |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
691 + * "&${ctx}->hw_ctx.tx_ring" to e1000::TxRing easily?) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
692 + */ |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
693 + rtx_e1000_tx_ring_clean(&${ctx}->hw_ctx.tx_ring); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
694 + } |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
695 + if (icr & E1000_INTR_RXT0) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
696 + { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
697 + ${Log::info("handle_interrupt: RxRing: packet(s) received")}; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
698 + } |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
699 + if (icr & E1000_INTR_RXO) |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
700 + { |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
701 + ${Log::info("handle_interrupt: RxRing: overrun")}; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
702 + } |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
703 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
704 return IRQ_HANDLED; |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
705 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
706 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
707 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
708 + |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
709 + template sequence e1000::_xmit_tso_cksum_offload(Ethernet::Device ctx, Socket::SKBuff skb) |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
710 + { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
711 + chunk ::CALL() |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
712 + { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
713 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
714 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
715 + |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
716 + template sequence e1000::xmit(Ethernet::Device ctx, Socket::AbstractSKBuff kernel_skb) |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
717 + { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
718 + chunk ::CALL() |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
719 + { |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
720 + /* |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
721 + * Put packets on the TX ring, must return NETDEV_TX_OK or |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
722 + * NETDEV_TX_BUSY. |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
723 + */ |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
724 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
725 + ${Socket::SKBuff} skb; |
88 | 726 + ${e1000::Context} *hw_ctx; |
727 + ${e1000::TxRing} *tx_ring; | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
728 + ${Device::AbstractDevice} dev; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
729 + |
88 | 730 + ${local.skb.init(kernel_skb)}; |
731 + hw_ctx = &${ctx}->hw_ctx; | |
732 + tx_ring = &hw_ctx->tx_ring; | |
733 + dev = &${ctx}->pci_dev->dev; | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
734 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
735 + ${Log::info("xmit: skbuff details:")}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
736 + /* |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
737 + * skb is not expand on the bound C variable (should be rtx_skbuff), |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
738 + * which is funny because it works for the sequence template call |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
739 + * right after. |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
740 + */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
741 + /* |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
742 + * XXX: doesn't work (I tried to pass self explicitely too): |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
743 + * ${local.skb.dump_infos()}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
744 + */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
745 + rtx_socket_skbuff_dump_infos(&skb); |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
746 + |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
747 + /* |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
748 + * The transmission is going to be several steps: |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
749 + * 1. TCP Segmentation Offload & Checksum Offloading: pick a |
88 | 750 + * descriptor from the tx ring and fill it as a context |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
751 + * descriptor to allow the card to slice into several packets |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
752 + * according to the MSS; |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
753 + * 2. DMA Map the skbuff data as slices of 4096; |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
754 + * 3. Signal the hardware that data is available via a tx desc. |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
755 + */ |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
756 + |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
757 + /* XXX: same thing wanted to use: ${local.tx_ring.descriptors_remaining()} */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
758 + if (!rtx_e1000_tx_ring_descriptors_remaining(tx_ring)) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
759 + return NETDEV_TX_BUSY; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
760 + |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
761 + /* 1. Offloading */ |
88 | 762 + |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
763 + /* XXX: ${local.tx_ring.tso_cksum_offload(skb)}; */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
764 + if (rtx_e1000_tx_ring_tso_cksum_offload(tx_ring, &skb)) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
765 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
766 + ${Log::info("xmit: the packet needs to be fragmented and/or checksummed but this not implemented yet!")}; |
88 | 767 + goto err_offload; |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
768 + } |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
769 + |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
770 + /* 2. Map the data */ |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
771 + |
88 | 772 + /* XXX: ${local.skb.map_to(local.dev)}; */ |
773 + if (rtx_socket_skbuff_map(&skb, dev, DMA_TO_DEVICE)) | |
774 + { | |
775 + ${Log::info("xmit: can't DMA map a SKbuff")}; | |
776 + goto err_skb_map_to; | |
777 + } | |
778 + | |
779 + /* 3. Update the TX Ring and signal the hardware */ | |
780 + | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
781 + /* XXX: ${local.tx_ring.put(skb)}; */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
782 + rtx_e1000_tx_ring_put(tx_ring, &skb); |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
783 + |
88 | 784 + /* XXX: ${local.tx_ring.start_xmit(hw_ctx)}; */ |
785 + rtx_e1000_tx_ring_start_xmit(tx_ring, hw_ctx); | |
786 + | |
787 + return NETDEV_TX_OK; | |
788 + | |
789 + err_offload: | |
790 + err_skb_map_to: | |
791 + /* XXX: ${local.skb.unmap_to_and_free(local.dev)}; */ | |
792 + rtx_socket_skbuff_unmap_and_free(&skb, dev, DMA_TO_DEVICE); | |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
793 + return NETDEV_TX_OK; |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
794 + } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
795 + } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
796 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
797 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
798 --- a/rathaxes/samples/e1000/e1000.rti |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
799 +++ b/rathaxes/samples/e1000/e1000.rti |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
800 @@ -31,8 +31,19 @@ |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
801 provided type TxRing |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
802 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
803 chunk LKM::includes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
804 + chunk LKM::prototypes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
805 + chunk LKM::code(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
806 method decl(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
807 method init(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
808 + |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
809 + /* Clean the ring (i.e: move the head closer to the tail): */ |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
810 + method clean(); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
811 + /* Return the number of clean descriptors left in the ring: */ |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
812 + method descriptors_remaining(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
813 + method tso_cksum_offload(Socket::SKBuff); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
814 + method put(Socket::SKBuff); |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
815 + /* Signal the device that new dirty descriptors are on the ring: */ |
88 | 816 + method start_xmit(e1000::Context); |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
817 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
818 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
819 /* |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
820 @@ -51,6 +62,12 @@ |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
821 method decl(); |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
822 } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
823 |
88 | 824 + provided type TxDescriptorFlags |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
825 + { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
826 + chunk LKM::includes(); |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
827 + chunk ::decl(); |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
828 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
829 + |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
830 provided sequence create_device() |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
831 { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
832 provided chunk Ethernet::create_device(PCI::Device, Ethernet::Device); |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
833 @@ -109,6 +126,16 @@ |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
834 provided chunk ::CALL(); |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
835 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
836 |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
837 + provided sequence _xmit_tso_cksum_offload(Ethernet::Device, Socket::SKBuff) |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
838 + { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
839 + provided chunk ::CALL(); |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
840 + } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
841 + |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
842 + provided sequence xmit(Ethernet::Device, Socket::AbstractSKBuff) |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
843 + { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
844 + provided chunk ::CALL(); |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
845 + } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
846 + |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
847 provided sequence register_read32(e1000::Context, e1000::Register) |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
848 { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
849 provided chunk LKM::prototypes(); |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
850 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
851 --- a/rathaxes/samples/e1000/ethernet.blt |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
852 +++ b/rathaxes/samples/e1000/ethernet.blt |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
853 @@ -1,6 +1,56 @@ |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
854 with Ethernet, PCI, LKM, Log |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
855 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
856 - template type Ethernet::Net() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
857 + template type Ethernet::ProtocolId() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
858 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
859 + chunk LKM::prototypes() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
860 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
861 + static const char *rtx_ethernet_protocol_id_to_str(unsigned short); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
862 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
863 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
864 + chunk LKM::data() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
865 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
866 + static const struct |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
867 + { |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
868 + unsigned short id; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
869 + const char *name; |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
870 + } rtx_ethernet_proto_table[] = |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
871 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
872 + { ETH_P_IP, "IPv4" }, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
873 + { ETH_P_IPV6, "IPv6" }, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
874 + { ETH_P_ARP, "ARP" }, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
875 + }; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
876 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
877 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
878 + chunk LKM::code() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
879 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
880 + static const char *rtx_ethernet_protocol_id_to_str(unsigned short proto_id) |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
881 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
882 + for (int i = 0; |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
883 + i != sizeof(rtx_ethernet_proto_table) / sizeof(rtx_ethernet_proto_table[0]); |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
884 + i++) |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
885 + if (proto_id == rtx_ethernet_proto_table[i].id) |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
886 + return rtx_ethernet_proto_table[i].name; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
887 + |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
888 + return "Unknown"; |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
889 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
890 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
891 + |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
892 + chunk decl() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
893 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
894 + typedef unsigned short rtx_ether_protocol_id; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
895 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
896 + |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
897 + chunk to_str() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
898 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
899 + rtx_ethernet_protocol_id_to_str(${self}); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
900 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
901 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
902 + map |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
903 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
904 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
905 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
906 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
907 + template type Ethernet::AbstractDevice() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
908 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
909 chunk LKM::includes() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
910 { |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
911 @@ -17,11 +67,6 @@ |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
912 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
913 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
914 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
915 - /* |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
916 - * Unlike PCI::Device, Ethernet::Device doesn't match the struct net_device |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
917 - * from Linux. Ethernet::Device is the type that we use in the private |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
918 - * field of the struct net_device. |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
919 - */ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
920 template type Ethernet::Device() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
921 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
922 chunk LKM::includes() |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
923 @@ -47,15 +92,15 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
924 struct pci_dev *pci_dev; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
925 struct net_device *net_dev; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
926 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
927 - /* while waiting on issue #8 */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
928 - //${e1000::Context} hw_ctx; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
929 - // In the long-term, this may disappear for a new concept allowing |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
930 - // to embbed a descriptor defined and manipulated by the front-end |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
931 + /* |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
932 + * In the long-term, this may disappear for a new concept allowing |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
933 + * to embbed a descriptor defined and manipulated by the front-end |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
934 + */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
935 ${pointcut Ethernet::SubContext()}; |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
936 } *rtx_ethernet_dev_p; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
937 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
938 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
939 - chunk ::init(Ethernet::Net net_dev, PCI::Device pci_dev) |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
940 + chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev) |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
941 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
942 ${self} = netdev_priv(${net_dev}); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
943 /* |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
944 @@ -82,9 +127,8 @@ |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
945 { |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
946 static int rtx_ethernet_open(struct net_device *dev) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
947 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
948 - struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
949 + ${Ethernet::Device} rtx_ether_dev = netdev_priv(dev); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
950 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
951 - ${cast local.rtx_ether_dev as Ethernet::Device}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
952 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
953 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
954 return 0; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
955 @@ -92,7 +136,7 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
956 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
957 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
958 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
959 - template sequence Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
960 + template sequence Ethernet::send(Ethernet::Device dev, Socket::AbstractSKBuff skb) |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
961 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
962 chunk LKM::prototypes() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
963 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
964 @@ -101,13 +145,11 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
965 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
966 chunk LKM::code() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
967 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
968 - static int rtx_ethernet_xmit(struct sk_buff* skb, struct net_device *dev) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
969 + static int rtx_ethernet_xmit(struct sk_buff* kernel_skb, struct net_device *net_dev) |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
970 { |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
971 - ${cast local.dev as Ethernet::Device}; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
972 - ${cast local.skb as Socket::SKBuff}; |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
973 - ${pointcut ::IMPLEMENTATION(local.dev, local.skb)}; |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
974 - |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
975 - return 0; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
976 + ${Ethernet::Device} rtx_ethernet_dev = netdev_priv(net_dev); |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
977 + ${cast local.kernel_skb as Socket::AbstractSKBuff}; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
978 + ${pointcut ::IMPLEMENTATION(local.rtx_ethernet_dev, local.kernel_skb)}; |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
979 } |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
980 } |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
981 } |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
982 @@ -123,9 +165,8 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
983 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
984 static int rtx_ethernet_close(struct net_device *dev) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
985 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
986 - struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
987 + ${Ethernet::Device} rtx_ether_dev = netdev_priv(dev); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
988 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
989 - ${cast local.rtx_ether_dev as Ethernet::Device}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
990 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
991 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
992 return 0; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
993 @@ -148,11 +189,8 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
994 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
995 static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
996 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
997 - struct rtx_ethernet_dev* rtx_ether_dev; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
998 - struct rtx_e1000_ctx* ctx; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
999 + ${Ethernet::Device} rtx_ether_dev = dev_id; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1000 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1001 - rtx_ether_dev = dev_id; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1002 - ${cast local.rtx_ether_dev as Ethernet::Device}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1003 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)}; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1004 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1005 return IRQ_NONE; |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1006 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1007 --- a/rathaxes/samples/e1000/ethernet.rti |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1008 +++ b/rathaxes/samples/e1000/ethernet.rti |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1009 @@ -1,16 +1,30 @@ |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1010 interface Ethernet : Socket, PCI, LKM |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1011 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1012 - provided type Net |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1013 + provided type ProtocolId |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1014 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1015 + chunk LKM::prototypes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1016 + chunk LKM::data(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1017 + chunk LKM::code(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1018 + method decl(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1019 + method to_str(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1020 + } |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1021 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1022 + provided type AbstractDevice |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1023 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1024 chunk LKM::includes(); |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1025 - method decl(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1026 + method decl(); |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1027 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1028 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1029 + /* |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1030 + * Unlike PCI::Device, Ethernet::Device doesn't match the struct net_device |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1031 + * from Linux. Ethernet::Device is the type that we use in the private |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1032 + * field of the struct net_device. |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1033 + */ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1034 provided type Device |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1035 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1036 chunk LKM::includes(); |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1037 method decl(); |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1038 - method init(Ethernet::Net, PCI::Device); |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1039 + method init(Ethernet::AbstractDevice, PCI::Device); |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1040 pointcut Ethernet::SubContext(); |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1041 } |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1042 |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1043 @@ -22,7 +36,7 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1044 provided chunk LKM::code(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1045 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1046 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1047 - required sequence send(Ethernet::Device dev, Socket::SKBuff skb) |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1048 + required sequence send(Ethernet::Device, Socket::AbstractSKBuff) |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1049 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1050 provided chunk LKM::prototypes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1051 provided chunk LKM::code(); |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1052 diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1053 --- a/rathaxes/samples/e1000/lkm.rtx |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1054 +++ b/rathaxes/samples/e1000/lkm.rtx |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1055 @@ -1,4 +1,4 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1056 -device LKM use LKM, PCI, Ethernet, Log |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1057 +device LKM use LKM, PCI, Ethernet, Log, Socket |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1058 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1059 Ethernet::open(Ethernet::Device dev) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1060 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1061 @@ -43,9 +43,10 @@ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1062 e1000::handle_interrupt(dev); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1063 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1064 |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1065 - Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1066 + Ethernet::send(Ethernet::Device dev, Socket::AbstractSKBuff skb) |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1067 { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1068 Log::info("we have one packet to transmit!"); |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1069 + e1000::xmit(dev, skb); |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1070 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1071 |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
1072 LKM::init() |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1073 @@ -66,8 +67,13 @@ |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1074 LKM::description = "Hello World Loadable Kernel Module (LKM)"; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1075 LKM::license = "GPL"; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1076 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1077 + /* |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1078 + * See section 5.2 of the Intel manual for all the values |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1079 + * - 0x100e is for the 82540EM-A; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1080 + * - 0x100f, apparently found on vmware by default, is for the 82545EM-A. |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1081 + */ |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1082 PCI::vendor_id = 0x8086; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1083 - PCI::product_id = 0x100e; /* e100f on vmware by default it seems */ |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1084 + PCI::product_id = 0x100e; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1085 PCI::set_master = true; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1086 |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1087 Ethernet::ifname = "rtx%d"; |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1088 @@ -79,4 +85,10 @@ |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1089 * 4096, 8192 and 16384 bytes: |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1090 */ |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1091 e1000::rx_buffer_len = 2048; |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1092 + /* |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1093 + * 4096 bytes maximum per transmit descriptor is used on Linux and FreeBSD, |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1094 + * 2048 on Minix and HelenOS, I can't find why. If I understand the Intel |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1095 + * manual correctly, the maximum should be 16288 (see section 3.3.3). |
85
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1096 + */ |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1097 + e1000::tx_max_data_per_desc = 4096; |
5dda73e7d728
Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
84
diff
changeset
|
1098 } |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1099 diff --git a/rathaxes/samples/e1000/socket.blt b/rathaxes/samples/e1000/socket.blt |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1100 --- a/rathaxes/samples/e1000/socket.blt |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1101 +++ b/rathaxes/samples/e1000/socket.blt |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1102 @@ -1,20 +1,152 @@ |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1103 -with Socket, LKM |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1104 +with Socket, LKM, Device, Ethernet |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1105 { |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1106 + template type Socket::AbstractSKBuff() |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1107 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1108 + chunk LKM::includes() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1109 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1110 + #include <linux/skbuff.h> |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1111 + |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1112 + static const ${Socket::AbstractSKBuff} force_rtx_socket_kernel_skbuff_decl; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1113 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1114 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1115 + chunk ::decl() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1116 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1117 + typedef struct sk_buff *rtx_socket_kernel_skbuff_p; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1118 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1119 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1120 + map |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1121 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1122 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1123 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1124 + |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1125 template type Socket::SKBuff() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1126 { |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1127 chunk LKM::includes() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1128 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1129 - #include <linux/skbuff.h> |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1130 - static const ${Socket::SKBuff} force_rtx_lnux_skbuf_decl; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1131 + static const ${Socket::SKBuff} force_rtx_socket_skbuff_decl; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1132 } |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1133 |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1134 chunk ::decl() |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1135 { |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1136 - struct sk_buff; |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1137 + struct rtx_socket_skbuff |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1138 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1139 + struct sk_buff *skbuff; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1140 + dma_addr_t dma_handle; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1141 + }; |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1142 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1143 |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1144 - chunk ::init() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1145 + chunk LKM::prototypes() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1146 { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1147 + static void rtx_socket_skbuff_dump_infos(struct rtx_socket_skbuff *); |
88 | 1148 + static int rtx_socket_skbuff_map(struct rtx_socket_skbuff *, struct device *, enum dma_data_direction); |
1149 + static void rtx_socket_skbuff_unmap_and_free(struct rtx_socket_skbuff *, struct device *, enum dma_data_direction); | |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1150 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1151 + |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1152 + chunk LKM::code() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1153 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1154 + static void rtx_socket_skbuff_dump_infos(struct rtx_socket_skbuff *self) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1155 + { |
88 | 1156 + WARN_ON(!self->skbuff); |
1157 + | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1158 + /* |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1159 + * We should use a Rathaxes log abstraction instead of pr_info here, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1160 + * but Rathaxes doesn't support functions with a variable number of |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1161 + * arguments yet. |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1162 + */ |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1163 + ${Ethernet::ProtocolId} ethernet_proto = be16_to_cpu(self->skbuff->protocol); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1164 + static const char * const ip_summed_values[] = { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1165 + "none", "unnecessary", "complete", "partial" |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1166 + }; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1167 + struct skb_shared_info *shinfo = skb_shinfo(self->skbuff); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1168 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1169 + pr_info( |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1170 + "\t protocol = %#-5x (%s) ip_summed = %d (%s)\n" |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1171 + "\t len = %-5u data_len = %-5u head_len = %-5u\n" |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1172 + "\t nr_frags = %u\n" |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1173 + "\t gso_size = %-5u gso_segs = %-5u gso_type = %-5u", |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1174 + ethernet_proto, rtx_ethernet_protocol_id_to_str(ethernet_proto) /* XXX: ${local.ethernet_proto.to_str()} */, |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1175 + self->skbuff->ip_summed, ip_summed_values[self->skbuff->ip_summed], |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1176 + self->skbuff->len, self->skbuff->data_len, skb_headlen(self->skbuff), |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1177 + shinfo->nr_frags, shinfo->gso_size, shinfo->gso_segs, shinfo->gso_type |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1178 + ); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1179 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1180 + |
88 | 1181 + static int rtx_socket_skbuff_map(struct rtx_socket_skbuff *self, |
1182 + struct device *dev, | |
1183 + enum dma_data_direction direction) | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1184 + { |
88 | 1185 + WARN_ON(!self->skbuff); |
1186 + WARN_ON(!self->skbuff->data); | |
1187 + WARN_ON(self->dma_handle); | |
1188 + | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1189 + self->dma_handle = dma_map_single( |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1190 + dev, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1191 + self->skbuff->data, |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1192 + skb_headlen(self->skbuff), |
88 | 1193 + direction); |
1194 + int err = dma_mapping_error(dev, self->dma_handle); | |
1195 + if (err) | |
1196 + { | |
1197 + self->dma_handle = 0; | |
1198 + return err; | |
1199 + } | |
1200 + return 0; | |
1201 + } | |
1202 + | |
1203 + static void rtx_socket_skbuff_unmap_and_free(struct rtx_socket_skbuff *self, | |
1204 + struct device *dev, | |
1205 + enum dma_data_direction direction) | |
1206 + { | |
1207 + WARN_ON(!self->skbuff); | |
1208 + WARN_ON(!self->skbuff->data); | |
1209 + | |
1210 + if (self->dma_handle) | |
1211 + { | |
1212 + dma_unmap_single(dev, | |
1213 + self->dma_handle, | |
1214 + skb_headlen(self->skbuff), | |
1215 + direction); | |
1216 + self->dma_handle = 0; | |
1217 + } | |
1218 + dev_kfree_skb_any(self->skbuff); | |
1219 + self->skbuff = 0; | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1220 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1221 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1222 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1223 + /* |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1224 + * XXX: the rathaxes argument kernel_skb is not actually bound to the |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1225 + * correct C variable from Ethernet::send() (so I named it as the C |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1226 + * variable I needed) |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1227 + */ |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1228 + chunk ::init(Socket::AbstractSKBuff kernel_skb) |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1229 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1230 + ${self}.skbuff = kernel_skb; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1231 + ${self}.dma_handle = 0; |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1232 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1233 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1234 + chunk dump_infos() |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1235 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1236 + rtx_socket_skbuff_dump_infos(${self}); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1237 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1238 + |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1239 + chunk map_to(Device::AbstractDevice dev) |
88 | 1240 + { |
1241 + rtx_socket_skbuff_map(${self}, ${dev}, DMA_TO_DEVICE); | |
1242 + } | |
1243 + | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1244 + chunk map_from(Device::AbstractDevice dev) |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1245 + { |
88 | 1246 + rtx_socket_skbuff_map(${self}, ${dev}, DMA_FROM_DEVICE); |
1247 + } | |
1248 + | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1249 + chunk unmap_to_and_free(Device::AbstractDevice dev) |
88 | 1250 + { |
1251 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev}, DMA_TO_DEVICE); | |
1252 + } | |
1253 + | |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1254 + chunk unmap_from_and_free(Device::AbstractDevice dev) |
88 | 1255 + { |
1256 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev}, DMA_FROM_DEVICE); | |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1257 } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1258 |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1259 map |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1260 diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1261 --- a/rathaxes/samples/e1000/socket.rti |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1262 +++ b/rathaxes/samples/e1000/socket.rti |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1263 @@ -1,8 +1,23 @@ |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1264 -interface Socket : LKM |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1265 +interface Socket : LKM, Device |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1266 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1267 - provided type Socket::SKBuff { |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1268 - chunk LKM::includes(); |
86
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1269 - method decl(); |
c99e69966dd3
WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
85
diff
changeset
|
1270 - method init(); |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1271 + /* The SKBuff type from the kernel */ |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1272 + provided type AbstractSKBuff |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1273 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1274 + chunk LKM::includes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1275 + method decl(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1276 + } |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1277 + |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1278 + provided type SKBuff |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1279 + { |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1280 + chunk LKM::includes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1281 + chunk LKM::prototypes(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1282 + chunk LKM::code(); |
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1283 + method decl(); |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1284 + method init(Socket::AbstractSKBuff); |
87
e9736ab70995
Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents:
86
diff
changeset
|
1285 + method dump_infos(); |
90
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1286 + method map_to(Device::AbstractDevice); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1287 + method map_from(Device::AbstractDevice); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1288 + method unmap_to_and_free(Device::AbstractDevice); |
4968acb39c7b
Finalize work on minimal TX
Louis Opter <louis@lse.epitech.net>
parents:
89
diff
changeset
|
1289 + method unmap_from_and_free(Device::AbstractDevice); |
84
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1290 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
1291 } |