annotate e1000_implement_the_frame_transmission_chunk.patch @ 90:4968acb39c7b

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