annotate e1000_implement_the_frame_transmission_chunk.patch @ 89:a9b47a2f8b98

Wip on tx, fix ioaddr being incorrectly generated
author Louis Opter <louis@lse.epitech.net>
date Thu, 04 Oct 2012 19:33:43 +0200
parents 8ffcdd6aa410
children 4968acb39c7b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
83
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
3 rathaxes: start to queue up packets in the TX ring on the e1000 sample
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
4
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
5 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
6 --- 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
7 +++ 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
8 @@ -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
9 -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
10 - 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
11 - 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
12 +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
13 + 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
14 + 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
15 + 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
16 + 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
17 + 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
18 + 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
19 + 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
20 + 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
21 + 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
22 + 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
23 + 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
24 + 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
25 + 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
26 + 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
27 + 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
28 + 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
29 + 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
30 + 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
31
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
32 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
33 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
34 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
35 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
36 --- /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
37 +++ 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
38 @@ -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
39 +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
40 +{
e9736ab70995 Add a couple of patches to 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 + template type Device::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
42 + {
e9736ab70995 Add a couple of patches to 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 + 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
44 + {
e9736ab70995 Add a couple of patches to 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 + #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
46 +
e9736ab70995 Add a couple of patches to 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 + static const ${Device::Device} force_rtx_device_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
48 + }
e9736ab70995 Add a couple of patches to 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 +
e9736ab70995 Add a couple of patches to 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 + 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
51 + {
e9736ab70995 Add a couple of patches to 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 + 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
53 + }
e9736ab70995 Add a couple of patches to 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 +
e9736ab70995 Add a couple of patches to 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 + 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
56 + {
e9736ab70995 Add a couple of patches to 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 + }
e9736ab70995 Add a couple of patches to 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 +
e9736ab70995 Add a couple of patches to 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 + 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
60 + {
e9736ab70995 Add a couple of patches to 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 + }
e9736ab70995 Add a couple of patches to 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 + }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
63 +}
e9736ab70995 Add a couple of patches to 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 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
65 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
66 --- /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
67 +++ 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
68 @@ -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
69 +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
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 + provided type 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
72 + {
e9736ab70995 Add a couple of patches to 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 + 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
74 + 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
75 + 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
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 +}
83
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
78 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
79 --- 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
80 +++ b/rathaxes/samples/e1000/e1000.blt
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
81 @@ -11,16 +11,15 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
82
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
83 chunk ::decl()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
84 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
85 - typedef struct rtx_e1000_rx_descriptor
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
86 + struct rtx_e1000_rx_descriptor
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
87 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
88 - /* actual types are in comments */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
89 - unsigned long int /* __le64 */ buff_addr;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
90 - unsigned short /* __le16 */ length;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
91 - unsigned short /* __le16 */ csum;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
92 - unsigned char status;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
93 - unsigned char errors;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
94 - unsigned short /* __le16 */ special;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
95 - } *rtx_e1000_rx_descriptor_p;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
96 + __le64 buff_addr;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
97 + __le16 length;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
98 + __le16 csum;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
99 + unsigned char status;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
100 + unsigned char errors;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
101 + __le16 special;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
102 + };
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
103 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
104
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
105 chunk ::init()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
106 @@ -50,30 +49,30 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
107
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
108 chunk ::decl()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
109 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
110 - typedef struct rtx_e1000_tx_descriptor
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
111 + struct rtx_e1000_tx_descriptor
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
112 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
113 - unsigned long int /* __le64 */ buff_addr;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
114 + __le64 buff_addr;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
115 union
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
116 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
117 - unsigned int /* __le32 */ data;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
118 + __le32 data;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
119 struct
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
120 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
121 - unsigned short /* __le16 */ length;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
122 - unsigned char csum_offset; /* CSO */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
123 - unsigned char cmd;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
124 - } fields;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
125 - } lower;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
126 + __le16 length;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
127 + unsigned char csum_offset; /* CSO */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
128 + unsigned char cmd;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
129 + } fields;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
130 + } lower;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
131 union
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
132 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
133 - unsigned int /* __le32 */ data;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
134 + __le32 data;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
135 struct
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
136 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
137 - unsigned char status;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
138 - unsigned char csum_start; /* CSS */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
139 - unsigned short /* __le16 */ special;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
140 - } fields;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
141 - } upper;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
142 - } *rtx_e1000_tx_descriptor_p;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
143 + unsigned char status;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
144 + unsigned char csum_start; /* CSS */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
145 + __le16 special;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
146 + } fields;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
147 + } upper;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
148 + };
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
149 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
150
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
151 chunk ::init()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
152 @@ -93,9 +92,8 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
153 * CNorm unstrict);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
154 * - dma_base: (physical) address of the ring where the device can access
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
155 * the different descriptors;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
156 - * - skbuffs: array of the skbuffs associated with each descriptor;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
157 - * - dma_skbuffs: (physical) address of each skbuff where the device can
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
158 - * write the received packets;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
159 + * - skbuffs: array of the skbuffs and their dma (physical) address
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
160 + * associated with each descriptor.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
161 */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
162 template type e1000::RxRing()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
163 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
164 @@ -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
165 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
166 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
167 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
168 - void* /* dma_addr_t */ dma_base;
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
169 - struct sk_buff *skbuffs[256 /* ${config.rx_ring_size} */];
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
170 - 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
171 + dma_addr_t dma_base;
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
172 + ${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
173 };
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
174 }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
175
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
176 @@ -134,7 +131,13 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
177 * - base: address of the ring (we can't use the typedef here until we get
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
178 * CNorm unstrict);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
179 * - dma_base: (physical) address of the ring where the device can access
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
180 - * the different descriptors.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
181 + * the different descriptors;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
182 + * - skbuffs: the skbuffs associated with each descriptor of the ring;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
183 + * - head: index on the head of the ring;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
184 + * - tail: index on the tail of the ring.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
185 + *
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
186 + * Keep in mind that the head and tail fields are, obviously, not
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
187 + * synchronized with TDT/TDH on the device.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
188 */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
189 template type e1000::TxRing()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
190 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
191 @@ -148,11 +151,88 @@
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
192 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
193 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
194 unsigned int size;
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
195 - 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
196 - void* /* dma_addr_t */ dma_base;
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
197 + /* XXX: can't use ${e1000::TxDescriptor} here: */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
198 + 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
199 + dma_addr_t dma_base;
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
200 + ${Socket::SKBuff} skbuffs[${config.tx_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
201 + unsigned int 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
202 + unsigned int 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
203 };
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
204 }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
205
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
206 + 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
207 + {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
208 + 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
209 + static int rtx_e1000_tx_ring_tso_cksum_offload(struct rtx_e1000_tx_ring *, struct rtx_socket_skbuff *);
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
210 + static void rtx_e1000_tx_ring_put(struct rtx_e1000_tx_ring *, struct rtx_socket_skbuff *);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
211 + 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
212 + }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
213 +
e9736ab70995 Add a couple of patches to 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 + 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
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 + 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
217 + {
e9736ab70995 Add a couple of patches to 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 + 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
219 + 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
220 + 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
221 + /* 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
222 + 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
223 + 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
224 + }
e9736ab70995 Add a couple of patches to 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 + 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
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 + 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
229 + }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
230 +
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
231 + 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
232 + {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
233 + WARN_ON(!skb);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
234 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
235 + /*
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
236 + * Mark it as the last buffer (EOP) and ask the card to
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
237 + * insert the Ethernet FCS (Frame Check Sequence).
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
238 + *
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
239 + * XXX: it sucks to use skb_headlen() here (this part of the
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
240 + * code shouldn't be aware of it and use something more
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
241 + * abstract.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
242 + */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
243 + struct rtx_e1000_tx_descriptor *tx_desc = &self->base[self->tail];
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
244 + tx_desc->lower.data = cpu_to_le32(
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
245 + E1000_TXD_CMD_EOP |
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
246 + E1000_TXD_CMD_IFCS |
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
247 + skb_headlen(skb->skbuff));
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
248 + tx_desc->upper.data = 0;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
249 + tx_desc->buff_addr = cpu_to_le64(skb->dma_handle);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
250 + memcpy(&self->skbuffs[self->tail], skb, sizeof(*skb));
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
251 + self->tail = (self->tail + 1) % 256 /* XXX: ${config.tx_ring_size} */;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
252 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
253 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
254 + static void rtx_e1000_tx_ring_start_xmit(struct rtx_e1000_tx_ring *self, const struct rtx_e1000_ctx *hw_ctx)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
255 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
256 + 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
257 + }
e9736ab70995 Add a couple of patches to 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 + }
e9736ab70995 Add a couple of patches to 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 +
e9736ab70995 Add a couple of patches to 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 + 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
261 + {
e9736ab70995 Add a couple of patches to 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 + 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
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 + 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
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 + }
e9736ab70995 Add a couple of patches to 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 + 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
270 + {
e9736ab70995 Add a couple of patches to 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 + 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
272 + }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
273 +
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
274 + chunk start_xmit(e1000::Context ctx)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
275 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
276 + rtx_e1000_tx_ring_start_xmit(${self}, ${ctx});
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
277 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
278 +
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
279 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
280 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
281 }
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
282 @@ -334,6 +414,45 @@
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
283 }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
284 }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
285
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
286 + template type e1000::TxDescriptorFlags()
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
287 + {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
288 + chunk LKM::includes()
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
289 + {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
290 + 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
291 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
292 +
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
293 + chunk ::decl()
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
294 + {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
295 + enum rtx_e1000_tx_descriptor_flags
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
296 + {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
297 + E1000_TXD_DTYP_D = 0x00100000, /* Data Descriptor */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
298 + E1000_TXD_DTYP_C = 0x00000000, /* Context Descriptor */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
299 + E1000_TXD_POPTS_IXSM = 0x01, /* Insert IP checksum */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
300 + E1000_TXD_POPTS_TXSM = 0x02, /* Insert TCP/UDP checksum */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
301 + E1000_TXD_CMD_EOP = 0x01000000, /* End of Packet */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
302 + E1000_TXD_CMD_IFCS = 0x02000000, /* Insert FCS (Ethernet CRC) */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
303 + E1000_TXD_CMD_IC = 0x04000000, /* Insert Checksum */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
304 + E1000_TXD_CMD_RS = 0x08000000, /* Report Status */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
305 + E1000_TXD_CMD_RPS = 0x10000000, /* Report Packet Sent */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
306 + E1000_TXD_CMD_DEXT = 0x20000000, /* Descriptor extension (0 = legacy) */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
307 + E1000_TXD_CMD_VLE = 0x40000000, /* Add VLAN tag */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
308 + E1000_TXD_CMD_IDE = 0x80000000, /* Enable Tidv register */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
309 + E1000_TXD_STAT_DD = 0x00000001, /* Descriptor Done */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
310 + E1000_TXD_STAT_EC = 0x00000002, /* Excess Collisions */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
311 + E1000_TXD_STAT_LC = 0x00000004, /* Late Collisions */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
312 + E1000_TXD_STAT_TU = 0x00000008, /* Transmit underrun */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
313 + E1000_TXD_CMD_TCP = 0x01000000, /* TCP packet */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
314 + E1000_TXD_CMD_IP = 0x02000000, /* IP packet */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
315 + E1000_TXD_CMD_TSE = 0x04000000, /* TCP Seg enable */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
316 + E1000_TXD_STAT_TC = 0x00000004, /* Tx Underrun */
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
317 + };
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
318 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
319 +
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
320 + map
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
321 + {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
322 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
323 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
324 +
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
325 template sequence e1000::create_device()
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
326 {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
327 chunk Ethernet::create_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx)
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
328 @@ -376,8 +495,7 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
329 udelay(10);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
330
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
331 /* Now we can load its mac address (thanks minix code) */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
332 - int i = 0;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
333 - for (i = 0 /* < this is not generated! (cnorm bug) */; i < 3; ++i)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
334 + for (int i = 0; i < 3; ++i)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
335 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
336 rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_EEPROM_READ, (i << 8) | 1);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
337
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
338 @@ -420,6 +538,7 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
339 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
340 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
341
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
342 + /* TODO: make that a method of e1000::Context */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
343 template sequence e1000::print_status(Ethernet::Device ctx)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
344 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
345 chunk LKM::prototypes()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
346 @@ -466,17 +585,19 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
347 * ${e1000.init(E1000_STATUS); // didn't work, so we used the next line
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
348 * reg_status = E1000_STATUS;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
349 * ${e1000::register_read32(rtx_ether_ctx->hw_ctx, reg_status)};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
350 + *
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
351 + * TODO: make them methods of e1000::Context
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
352 */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
353 template sequence e1000::register_read32(e1000::Context ctx, e1000::Register reg_offset)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
354 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
355 chunk LKM::prototypes()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
356 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
357 - static unsigned int rtx_e1000_register_read32(struct rtx_e1000_ctx *, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
358 + static unsigned int rtx_e1000_register_read32(const struct rtx_e1000_ctx *, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
359 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
360
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
361 chunk LKM::code()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
362 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
363 - static unsigned int rtx_e1000_register_read32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
364 + static unsigned int rtx_e1000_register_read32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
365 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
366 return ioread32(ctx->ioaddr + reg_offset);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
367 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
368 @@ -492,12 +613,12 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
369 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
370 chunk LKM::prototypes()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
371 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
372 - static void rtx_e1000_register_write32(struct rtx_e1000_ctx *, unsigned int, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
373 + static void rtx_e1000_register_write32(const struct rtx_e1000_ctx *, unsigned int, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
374 }
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
375
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
376 chunk LKM::code()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
377 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
378 - static void rtx_e1000_register_write32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
379 + static void rtx_e1000_register_write32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
380 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
381 iowrite32(value, ctx->ioaddr + reg_offset);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
382 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
383 @@ -513,12 +634,12 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
384 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
385 chunk LKM::prototypes()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
386 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
387 - static void rtx_e1000_register_set32(struct rtx_e1000_ctx *, unsigned int, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
388 + static void rtx_e1000_register_set32(const struct rtx_e1000_ctx *, unsigned int, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
389 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
390
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
391 chunk LKM::code()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
392 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
393 - static void rtx_e1000_register_set32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
394 + static void rtx_e1000_register_set32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
395 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
396 iowrite32(rtx_e1000_register_read32(ctx, reg_offset) | value, ctx->ioaddr + reg_offset);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
397 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
398 @@ -534,12 +655,12 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
399 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
400 chunk LKM::prototypes()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
401 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
402 - static void rtx_e1000_register_unset32(struct rtx_e1000_ctx *, unsigned int, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
403 + static void rtx_e1000_register_unset32(const struct rtx_e1000_ctx *, unsigned int, unsigned int);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
404 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
405
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
406 chunk LKM::code()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
407 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
408 - static void rtx_e1000_register_unset32(struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
409 + static void rtx_e1000_register_unset32(const struct rtx_e1000_ctx *ctx, unsigned int reg_offset, unsigned int value)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
410 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
411 iowrite32(rtx_e1000_register_read32(ctx, reg_offset) & ~value, ctx->ioaddr + reg_offset);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
412 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
413 @@ -626,12 +747,18 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
414 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
415 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
416
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
417 + /* TODO: refactor
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
418 + *
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
419 + * Split into two method methods:
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
420 + * - e1000::RxRing::init_rx()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
421 + * - e1000::TxRing::init_tx()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
422 + *
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
423 + * Also it should use the new methods in Socket::SKbuff.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
424 + */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
425 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
426 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
427 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
428 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
429 - 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
430 -
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
431 /*
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
432 * 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
433 * Software Developper manual. (You can find it in the doc/hardware
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
434 @@ -663,6 +790,8 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
435 * E1000_CRCERRS to E1000_TSCTFC.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
436 */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
437
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
438 + int i;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
439 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
440 rtx_e1000_register_set32(hw_ctx, E1000_CTRL,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
441 E1000_CMD_ASDE |
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
442 E1000_CMD_SLU);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
443 @@ -676,7 +805,6 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
444 rtx_e1000_register_write32(hw_ctx, E1000_FCAL, 0);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
445 rtx_e1000_register_write32(hw_ctx, E1000_FCT, 0);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
446 rtx_e1000_register_write32(hw_ctx, E1000_FCTTV, 0);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
447 - int i = 0; /* CNorm workaround, the init part of for isn't generated */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
448 for (i = 0; i != 64; ++i)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
449 rtx_e1000_register_write32(hw_ctx, E1000_CRCERRS + i * 4, 0);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
450
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
451 @@ -719,7 +847,6 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
452
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
453 /* 2. Initialize the MTA */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
454
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
455 - i = 0; /* CNorm workaround, the init part of for isn't generated */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
456 for (i = 0; i != 128; ++i)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
457 rtx_e1000_register_write32(hw_ctx, E1000_MTA + i * 4, 0);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
458
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
459 @@ -733,7 +860,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
460 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
461 &${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
462 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
463 - (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
464 + &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
465 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
466 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
467 {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
468 @@ -747,41 +874,37 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
469 * Allocate the skbuffs, map them for DMA, and write their address
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
470 * in the corresponding descriptor.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
471 */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
472 - i = 0;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
473 for (i = 0; i != ${config.rx_ring_size}; ++i)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
474 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
475 - hw_ctx->rx_ring.skbuffs[i] = netdev_alloc_skb(
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
476 + hw_ctx->rx_ring.skbuffs[i].skbuff = netdev_alloc_skb(
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
477 ${ctx}->net_dev,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
478 ${config.rx_buffer_len});
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
479 - if (!hw_ctx->rx_ring.skbuffs[i])
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
480 + if (!hw_ctx->rx_ring.skbuffs[i].skbuff)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
481 {
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
482 ${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
483 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
484 }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
485 - hw_ctx->rx_ring.dma_skbuffs[i] = (void *)dma_map_single(
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
486 + 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
487 &${ctx}->pci_dev->dev,
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
488 - hw_ctx->rx_ring.skbuffs[i]->data,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
489 + 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
490 ${config.rx_buffer_len},
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
491 DMA_FROM_DEVICE);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
492 - /*
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
493 - * Either this fails because, when compiling with gcc because
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
494 - * the last argument is not of the correct type (dma_addr_t).
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
495 - * Or it fails because of the lack of CNorm Unstrict.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
496 - */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
497 - if (dma_mapping_error(&${ctx}->pci_dev->dev, (dma_addr_t)hw_ctx->rx_ring.dma_skbuffs[i]))
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
498 + int dma_error = dma_mapping_error(&${ctx}->pci_dev->dev,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
499 + hw_ctx->rx_ring.skbuffs[i].dma_handle);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
500 + if (dma_error)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
501 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
502 ${Log::info("cannot dma-map a skbuff for the rx ring")};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
503 goto err_skbuffs_map;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
504 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
505 - hw_ctx->rx_ring.base[i].buff_addr = (unsigned long int)cpu_to_le64(
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
506 - hw_ctx->rx_ring.dma_skbuffs[i]);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
507 + hw_ctx->rx_ring.base[i].buff_addr = cpu_to_le64(
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
508 + hw_ctx->rx_ring.skbuffs[i].skbuff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
509 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
510
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
511 ${Log::info("setup_device: skbuffs allocated")};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
512
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
513 /* 5. Save the emplacement and the size of the ring in RDBA/RDLEN */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
514 - rtx_e1000_register_write32(hw_ctx, E1000_RDBAL, (dma_addr_t)hw_ctx->rx_ring.dma_base & 0xffffffff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
515 - rtx_e1000_register_write32(hw_ctx, E1000_RDBAH, (dma_addr_t)hw_ctx->rx_ring.dma_base >> 32);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
516 + rtx_e1000_register_write32(hw_ctx, E1000_RDBAL, hw_ctx->rx_ring.dma_base & 0xffffffff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
517 + rtx_e1000_register_write32(hw_ctx, E1000_RDBAH, hw_ctx->rx_ring.dma_base >> 32);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
518 rtx_e1000_register_write32(hw_ctx, E1000_RDLEN, hw_ctx->rx_ring.size);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
519
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
520 /* 6. Setup RDH/RDT */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
521 @@ -820,7 +943,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
522 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
523 &${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
524 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
525 - (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
526 + &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
527 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
528 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
529 {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
530 @@ -831,13 +954,15 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
531 ${Log::info("setup_device: tx descriptors allocated")};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
532
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
533 /* 2. Save the emplacement and the size of the ring in TDBA/TDLEN */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
534 - rtx_e1000_register_write32(hw_ctx, E1000_TDBAL, (dma_addr_t)hw_ctx->tx_ring.dma_base & 0xffffffff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
535 - rtx_e1000_register_write32(hw_ctx, E1000_TDBAH, (dma_addr_t)hw_ctx->tx_ring.dma_base >> 32);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
536 + rtx_e1000_register_write32(hw_ctx, E1000_TDBAL, hw_ctx->tx_ring.dma_base & 0xffffffff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
537 + rtx_e1000_register_write32(hw_ctx, E1000_TDBAH, hw_ctx->tx_ring.dma_base >> 32);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
538 rtx_e1000_register_write32(hw_ctx, E1000_TDLEN, hw_ctx->tx_ring.size);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
539
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
540 /* 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
541 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
542 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
543 + 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
544 + 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
545
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
546 /* 4. Set TCTL.PSP and enable the transmitter */
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
547 rtx_e1000_register_set32(hw_ctx, E1000_TCTL, E1000_TCTL_PSP|E1000_TCTL_PSP);
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
548 @@ -860,15 +985,15 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
549 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
550 dma_unmap_single(
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
551 &${ctx}->pci_dev->dev,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
552 - (dma_addr_t)hw_ctx->rx_ring.dma_skbuffs[i],
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
553 + hw_ctx->rx_ring.skbuffs[i].dma_handle,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
554 ${config.rx_buffer_len},
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
555 DMA_FROM_DEVICE);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
556 err_skbuffs_map:
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
557 - dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i]);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
558 + dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i].skbuff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
559 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
560
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
561 dma_free_coherent(&${ctx}->pci_dev->dev, hw_ctx->rx_ring.size,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
562 - hw_ctx->rx_ring.base, (dma_addr_t)hw_ctx->rx_ring.dma_base);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
563 + hw_ctx->rx_ring.base, hw_ctx->rx_ring.dma_base);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
564 err_rx_ring_alloc:
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
565 return -ENOMEM;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
566
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
567 @@ -876,12 +1001,15 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
568 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
569 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
570
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
571 + /* TODO:
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
572 + *
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
573 + * Refactor into two methods (one in RxRing and one in TxRing) and make use
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
574 + * of the new methods in Socket::SKBuff.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
575 + */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
576 template sequence free_rx_tx(Ethernet::Device ctx)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
577 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
578 chunk ::CALL()
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
579 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
580 - typedef unsigned long int dma_addr_t;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
581 -
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
582 ${e1000::Context} *hw_ctx;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
583 hw_ctx = &${ctx}->hw_ctx;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
584
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
585 @@ -890,18 +1018,17 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
586 * - Unmap and free the skbuffs;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
587 * - Free the descriptors array.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
588 */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
589 - int i = 0;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
590 - for (i = 0; i != ${config.rx_ring_size}; ++i)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
591 + for (int i = 0; i != ${config.rx_ring_size}; ++i)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
592 {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
593 dma_unmap_single(
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
594 &${ctx}->pci_dev->dev,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
595 - (dma_addr_t)hw_ctx->rx_ring.dma_skbuffs[i],
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
596 + (dma_addr_t)hw_ctx->rx_ring.skbuffs[i].dma_handle,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
597 ${config.rx_buffer_len},
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
598 DMA_FROM_DEVICE);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
599 - dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i]);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
600 + dev_kfree_skb(hw_ctx->rx_ring.skbuffs[i].skbuff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
601 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
602 dma_free_coherent(&${ctx}->pci_dev->dev, hw_ctx->rx_ring.size,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
603 - hw_ctx->rx_ring.base, (dma_addr_t)hw_ctx->rx_ring.dma_base);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
604 + hw_ctx->rx_ring.base, hw_ctx->rx_ring.dma_base);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
605 ${Log::info("free_rx_tx: rx ring free'ed")};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
606
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
607 /*
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
608 @@ -909,7 +1036,7 @@
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
609 * - Free the descriptors array.
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
610 */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
611 dma_free_coherent(&${ctx}->pci_dev->dev, hw_ctx->tx_ring.size,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
612 - hw_ctx->tx_ring.base, (dma_addr_t)hw_ctx->tx_ring.dma_base);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
613 + hw_ctx->tx_ring.base, hw_ctx->tx_ring.dma_base);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
614 ${Log::info("free_rx_tx: tx ring free'ed")};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
615 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
616 }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
617 @@ -930,4 +1057,92 @@
83
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
618 }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
619 }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
620 }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
621 +
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
622 + 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
623 + {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
624 + chunk ::CALL()
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
625 + {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
626 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
627 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
628 +
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
629 + template sequence e1000::xmit(Ethernet::Device ctx, Socket::KernelSKBuff kernel_skb)
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
630 + {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
631 + chunk ::CALL()
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
632 + {
83
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
633 + /*
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
634 + * 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
635 + * 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
636 + */
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
637 +
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
638 + ${Socket::SKBuff} skb;
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
639 + ${e1000::Context} *hw_ctx;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
640 + ${e1000::TxRing} *tx_ring;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
641 + ${Device::Device} 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
642 +
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
643 + ${local.skb.init(kernel_skb)};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
644 + hw_ctx = &${ctx}->hw_ctx;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
645 + tx_ring = &hw_ctx->tx_ring;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
646 + 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
647 +
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
648 + ${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
649 + /*
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
650 + * 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
651 + * 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
652 + * 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
653 + */
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
654 + /*
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
655 + * 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
656 + * ${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
657 + */
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
658 + 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
659 +
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
660 + /*
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
661 + * 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
662 + * 1. TCP Segmentation Offload & Checksum Offloading: pick a
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
663 + * 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
664 + * 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
665 + * according to the MSS;
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
666 + * 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
667 + * 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
668 + */
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
669 +
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
670 + /* 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
671 + 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
672 + 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
673 +
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
674 + /* 1. Offloading */
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
675 +
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
676 + /* 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
677 + 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
678 + {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
679 + ${Log::info("xmit: the packet needs to be fragmented and/or checksummed but this not implemented yet!")};
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
680 + goto err_offload;
85
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
681 + }
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
682 +
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
683 + /* 2. Map the data */
85
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
684 +
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
685 + /* XXX: ${local.skb.map_to(local.dev)}; */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
686 + if (rtx_socket_skbuff_map(&skb, dev, DMA_TO_DEVICE))
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
687 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
688 + ${Log::info("xmit: can't DMA map a SKbuff")};
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
689 + goto err_skb_map_to;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
690 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
691 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
692 + /* 3. Update the TX Ring and signal the hardware */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
693 +
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
694 + /* 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
695 + 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
696 +
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
697 + /* XXX: ${local.tx_ring.start_xmit(hw_ctx)}; */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
698 + rtx_e1000_tx_ring_start_xmit(tx_ring, hw_ctx);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
699 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
700 + return NETDEV_TX_OK;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
701 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
702 + err_offload:
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
703 + err_skb_map_to:
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
704 + /* XXX: ${local.skb.unmap_to_and_free(local.dev)}; */
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
705 + 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
706 + 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
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 + }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
709 }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
710 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
711 --- 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
712 +++ b/rathaxes/samples/e1000/e1000.rti
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
713 @@ -31,8 +31,15 @@
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
714 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
715 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
716 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
717 + 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
718 + 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
719 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
720 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
721 +
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
722 + 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
723 + 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
724 + method put(Socket::SKBuff);
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
725 + 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
726 }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
727
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
728 /*
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
729 @@ -51,6 +58,12 @@
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
730 method decl();
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
731 }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
732
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
733 + provided type TxDescriptorFlags
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
734 + {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
735 + chunk LKM::includes();
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
736 + chunk ::decl();
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
737 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
738 +
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
739 provided sequence create_device()
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
740 {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
741 provided chunk Ethernet::create_device(PCI::Device, Ethernet::Device);
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
742 @@ -109,6 +122,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
743 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
744 }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
745
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
746 + 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
747 + {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
748 + provided chunk ::CALL();
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
749 + }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
750 +
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
751 + provided sequence xmit(Ethernet::Device, Socket::KernelSKBuff)
83
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
752 + {
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
753 + 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
754 + }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
755 +
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
756 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
757 {
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
758 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
759 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
760 --- 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
761 +++ 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
762 @@ -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
763 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
764 {
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
765 - 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
766 + 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
767 + {
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
768 + 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
769 + {
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
770 + 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
771 + }
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
772 +
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
773 + 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
774 + {
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
775 + 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
776 + {
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
777 + const unsigned short 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
778 + const char *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
779 + } 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
780 + {
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
781 + { 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
782 + { 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
783 + { 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
784 + };
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
785 + }
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
786 +
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
787 + 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
788 + {
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
789 + 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
790 + {
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
791 + for (int i = 0;
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
792 + i != sizeof(rtx_ethernet_proto_table[0]) / sizeof(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
793 + 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
794 + 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
795 + 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
796 +
85
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
797 + 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
798 + }
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
799 + }
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
800 +
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 + 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
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 + 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
804 + }
e9736ab70995 Add a couple of patches to 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 +
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
806 + 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
807 + {
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
808 + 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
809 + }
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
810 +
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
811 + 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
812 + {
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
813 + }
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
814 + }
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
815 +
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
816 + 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
817 {
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
818 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
819 {
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
820 @@ -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
821 }
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
822 }
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
823
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
824 - /*
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
825 - * 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
826 - * 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
827 - * 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
828 - */
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
829 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
830 {
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
831 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
832 @@ -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
833 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
834 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
835
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
836 - /* 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
837 - //${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
838 - // 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
839 - // 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
840 + /*
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
841 + * 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
842 + * 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
843 + */
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
844 ${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
845 } *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
846 }
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
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
848 - 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
849 + 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
850 {
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 ${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
852 /*
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 @@ -82,9 +127,8 @@
85
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
854 {
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
855 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
856 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
857 - 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
858 + ${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
859
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
860 - ${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
861 ${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
862
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
863 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
864 @@ -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
865 }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
866 }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
867
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
868 - template sequence Ethernet::send(Ethernet::Device dev, 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
869 + template sequence Ethernet::send(Ethernet::Device dev, Socket::KernelSKBuff 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
870 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
871 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
872 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
873 @@ -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
874
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
875 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
876 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
877 - 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
878 + 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
879 {
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
880 - ${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
881 - ${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
882 - ${pointcut ::IMPLEMENTATION(local.dev, local.skb)};
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
883 -
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
884 - 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
885 + ${Ethernet::Device} rtx_ethernet_dev = netdev_priv(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
886 + ${cast local.kernel_skb as Socket::KernelSKBuff};
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
887 + ${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
888 }
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
889 }
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
890 }
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
891 @@ -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
892 {
e9736ab70995 Add a couple of patches to 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 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
894 {
e9736ab70995 Add a couple of patches to 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 - 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
896 + ${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
897
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
898 - ${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
899 ${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
900
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
901 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
902 @@ -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
903 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
904 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
905 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
906 - 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
907 - 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
908 + ${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
909
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
910 - 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
911 - ${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
912 ${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
913
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
914 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
915 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
916 --- 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
917 +++ 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
918 @@ -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
919 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
920 {
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 - 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
922 + 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
923 + {
e9736ab70995 Add a couple of patches to 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 + 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
925 + 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
926 + 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
927 + 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
928 + 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
929 + }
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
930 +
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
931 + 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
932 {
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
933 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
934 - 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
935 + 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
936 }
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 + * 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
940 + * 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
941 + * 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
942 + */
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 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
944 {
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
945 chunk LKM::includes();
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
946 method decl();
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
947 - method init(Ethernet::Net, PCI::Device);
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
948 + 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
949 pointcut Ethernet::SubContext();
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
950 }
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
951
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
952 @@ -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
953 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
954 }
e9736ab70995 Add a couple of patches to 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
e9736ab70995 Add a couple of patches to 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 - required sequence send(Ethernet::Device dev, 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
957 + required sequence send(Ethernet::Device, Socket::KernelSKBuff)
e9736ab70995 Add a couple of patches to 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 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
960 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
961 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
962 --- 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
963 +++ 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
964 @@ -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
965 -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
966 +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
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 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
969 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
970 @@ -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
971 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
972 }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
973
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
974 - Ethernet::send(Ethernet::Device dev, 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
975 + Ethernet::send(Ethernet::Device dev, Socket::KernelSKBuff 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
976 {
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
977 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
978 + 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
979 }
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
980
27f0e70df342 Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
981 LKM::init()
85
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
982 @@ -79,4 +80,10 @@
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
983 * 4096, 8192 and 16384 bytes:
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
984 */
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
985 e1000::rx_buffer_len = 2048;
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
986 + /*
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
987 + * 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
988 + * 2048 on Minix and HelenOS, I can't find why. If I understand the Intel
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
989 + * man correctly, the maximum should be 16288 (see section 3.3.3).
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
990 + */
5dda73e7d728 Add my WIP on the actual tx
Louis Opter <louis@lse.epitech.net>
parents: 84
diff changeset
991 + 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
992 }
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
993 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
994 --- 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
995 +++ b/rathaxes/samples/e1000/socket.blt
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
996 @@ -1,20 +1,153 @@
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
997 -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
998 +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
999 {
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
1000 + template type Socket::KernelSKBuff()
e9736ab70995 Add a couple of patches to 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 + {
e9736ab70995 Add a couple of patches to 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 + 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
1003 + {
e9736ab70995 Add a couple of patches to 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 + #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
1005 +
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1006 + static const ${Socket::KernelSKBuff} force_rtx_socket_kernel_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
1007 + }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1008 +
e9736ab70995 Add a couple of patches to 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 + 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
1010 + {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1011 + 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
1012 + }
e9736ab70995 Add a couple of patches to 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 +
e9736ab70995 Add a couple of patches to 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 + 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
1015 + {
e9736ab70995 Add a couple of patches to 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 + }
e9736ab70995 Add a couple of patches to 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 + }
e9736ab70995 Add a couple of patches to 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 +
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
1019 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
1020 {
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
1021 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
1022 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1023 - #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
1024 - 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
1025 + 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
1026 }
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
1027
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
1028 chunk ::decl()
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
1029 {
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
1030 - 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
1031 + 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
1032 + {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1033 + 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
1034 + 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
1035 + };
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
1036 }
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
1037
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
1038 - 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
1039 + 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
1040 {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1041 + static void rtx_socket_skbuff_dump_infos(struct rtx_socket_skbuff *);
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1042 + static int rtx_socket_skbuff_map(struct rtx_socket_skbuff *, struct device *, enum dma_data_direction);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1043 + 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
1044 + }
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
1045 +
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
1046 + 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
1047 + {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1048 + 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
1049 + {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1050 + WARN_ON(!self->skbuff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1051 +
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
1052 + /*
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1053 + * 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
1054 + * 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
1055 + * 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
1056 + */
e9736ab70995 Add a couple of patches to 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 + ${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
1058 + 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
1059 + "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
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 + 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
1062 +
e9736ab70995 Add a couple of patches to 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 + pr_info(
e9736ab70995 Add a couple of patches to 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 + "\t protocol = %#-5x (%s)\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
1065 + "\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
1066 + "\t nr_frags = %u\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
1067 + "\t gso_size = %-5u gso_segs = %-5u gso_type = %-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
1068 + "\tip_summed = %d (%s)",
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1069 + ethernet_proto, rtx_ethernet_protocol_id_to_str(ethernet_proto) /* XXX: ${local.ethernet_proto.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
1070 + self->skbuff->len, self->skbuff->data_len, skb_headlen(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
1071 + shinfo->nr_frags, shinfo->gso_size, shinfo->gso_segs, shinfo->gso_type,
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1072 + self->skbuff->ip_summed, ip_summed_values[self->skbuff->ip_summed]
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1073 + );
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1074 + }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1075 +
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1076 + static int rtx_socket_skbuff_map(struct rtx_socket_skbuff *self,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1077 + struct device *dev,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1078 + 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
1079 + {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1080 + WARN_ON(!self->skbuff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1081 + WARN_ON(!self->skbuff->data);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1082 + WARN_ON(self->dma_handle);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1083 +
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
1084 + 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
1085 + 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
1086 + 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
1087 + skb_headlen(self->skbuff),
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1088 + direction);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1089 + int err = dma_mapping_error(dev, self->dma_handle);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1090 + if (err)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1091 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1092 + self->dma_handle = 0;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1093 + return err;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1094 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1095 + return 0;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1096 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1097 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1098 + static void rtx_socket_skbuff_unmap_and_free(struct rtx_socket_skbuff *self,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1099 + struct device *dev,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1100 + enum dma_data_direction direction)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1101 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1102 + WARN_ON(!self->skbuff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1103 + WARN_ON(!self->skbuff->data);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1104 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1105 + if (self->dma_handle)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1106 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1107 + dma_unmap_single(dev,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1108 + self->dma_handle,
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1109 + skb_headlen(self->skbuff),
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1110 + direction);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1111 + self->dma_handle = 0;
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1112 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1113 + dev_kfree_skb_any(self->skbuff);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1114 + 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
1115 + }
e9736ab70995 Add a couple of patches to 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 +
e9736ab70995 Add a couple of patches to 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 + * 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
1120 + * 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
1121 + * 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
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 + chunk ::init(Socket::KernelSKBuff 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
1124 + {
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1125 + ${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
1126 + ${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
1127 + }
e9736ab70995 Add a couple of patches to 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 + 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
1130 + {
e9736ab70995 Add a couple of patches to 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 + 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
1132 + }
e9736ab70995 Add a couple of patches to the build system and WIP on the e1000 code architecture to implement the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 86
diff changeset
1133 +
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1134 + chunk map_to(Device::Device dev)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1135 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1136 + rtx_socket_skbuff_map(${self}, ${dev}, DMA_TO_DEVICE);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1137 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1138 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1139 + chunk map_from(Device::Device 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
1140 + {
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1141 + rtx_socket_skbuff_map(${self}, ${dev}, DMA_FROM_DEVICE);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1142 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1143 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1144 + chunk unmap_to_and_free(Device::Device dev)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1145 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1146 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev}, DMA_TO_DEVICE);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1147 + }
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1148 +
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1149 + chunk unmap_from_and_free(Device::Device dev)
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1150 + {
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1151 + 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
1152 }
e9736ab70995 Add a couple of patches to 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
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
1154 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
1155 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
1156 --- 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
1157 +++ b/rathaxes/samples/e1000/socket.rti
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1158 @@ -1,8 +1,22 @@
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
1159 -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
1160 +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
1161 {
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
1162 - 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
1163 - chunk LKM::includes();
86
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
1164 - method decl();
c99e69966dd3 WIP/Cleanup on the tranmission
Louis Opter <louis@lse.epitech.net>
parents: 85
diff changeset
1165 - method init();
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
1166 + provided type KernelSKBuff
e9736ab70995 Add a couple of patches to 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 + {
e9736ab70995 Add a couple of patches to 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 + 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
1169 + 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
1170 + }
e9736ab70995 Add a couple of patches to 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 +
e9736ab70995 Add a couple of patches to 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 + 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
1173 + {
e9736ab70995 Add a couple of patches to 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 + 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
1175 + 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
1176 + 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
1177 + 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
1178 + method init(Socket::KernelSKBuff);
e9736ab70995 Add a couple of patches to 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 + method dump_infos();
88
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1180 + method map_to(Device::Device);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1181 + method map_from(Device::Device);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1182 + method unmap_to_and_free(Device::Device);
8ffcdd6aa410 WIP on refactoring + tx
Louis Opter <louis@lse.epitech.net>
parents: 87
diff changeset
1183 + method unmap_from_and_free(Device::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
1184 }
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
1185 }