Mercurial > archived > louis > epitech > mq > rathaxes
annotate e1000_implement_the_frame_transmission_chunk.patch @ 84:6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
author | Louis Opter <louis@lse.epitech.net> |
---|---|
date | Mon, 09 Jul 2012 06:44:51 +0200 |
parents | 27f0e70df342 |
children | 5dda73e7d728 |
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 |
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
|
2 # Parent 72f11dd4265bb367278f34b23ecb5afa0f7f6fb7 |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
3 rathaxes: start to queue up packets in the TX ring on the e1000 sample |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
4 |
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
|
5 diff --git a/maintainers/CMakeScripts/Templates/MakefileLKM.in b/maintainers/CMakeScripts/Templates/MakefileLKM.in |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
6 --- a/maintainers/CMakeScripts/Templates/MakefileLKM.in |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
7 +++ b/maintainers/CMakeScripts/Templates/MakefileLKM.in |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
8 @@ -1,6 +1,6 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
9 # Disable this "coding-style" warning (seriously, you have to compile with |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
10 # -pedantic to get it...) |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
11 -EXTRA_CFLAGS = -Wno-declaration-after-statement |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
12 +EXTRA_CFLAGS = -Wno-declaration-after-statement -std=gnu99 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
13 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
14 KDIR = /lib/modules/$(shell uname -r)/build |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
15 obj-m := @LKM_OBJECTS@ |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
16 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
|
17 --- 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
|
18 +++ b/rathaxes/samples/e1000/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
|
19 @@ -964,4 +964,20 @@ |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
20 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
21 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
22 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
23 + |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
24 + template sequence e1000::xmit(Ethernet::Device ctx, Socket::SKBuff skb) |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
25 + { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
26 + 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
|
27 + { |
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
|
28 + (void)1; // Issue 10 |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
29 + /* |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
30 + * 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
|
31 + * 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
|
32 + */ |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
33 + { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
34 + ${Log::info("xmit: skbuff details:")}; |
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
|
35 + ${skb.dump_infos()}; |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
36 + } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
37 + } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
38 + } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
39 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
40 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
|
41 --- 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
|
42 +++ b/rathaxes/samples/e1000/e1000.rti |
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
|
43 @@ -109,6 +109,11 @@ |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
44 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
|
45 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
46 |
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
|
47 + provided sequence xmit(Ethernet::Device, Socket::SKBuff) |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
48 + { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
49 + 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
|
50 + } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
51 + |
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
|
52 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
|
53 { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
54 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
|
55 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
|
56 --- 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
|
57 +++ 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
|
58 @@ -1,6 +1,51 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
59 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
|
60 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
61 - 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
|
62 + 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
|
63 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
64 + 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
|
65 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
66 + 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
|
67 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
68 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
69 + 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
|
70 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
71 + 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
|
72 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
73 + const unsigned short id; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
74 + const char *name; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
75 + } 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
|
76 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
77 + { 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
|
78 + { 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
|
79 + { 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
|
80 + }; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
81 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
82 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
83 + 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
|
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
|
85 + 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
|
86 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
87 + for (int i = 0; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
88 + i != sizeof(rtx_ethernet_proto_table[0]) / sizeof(rtx_ethernet_proto_table); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
89 + 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
|
90 + 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
|
91 + 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
|
92 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
93 + return "Other"; |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
94 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
95 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
96 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
97 + 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
|
98 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
99 + 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
|
100 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
101 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
102 + 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
|
103 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
104 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
105 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
106 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
107 + 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
|
108 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
109 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
|
110 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
111 @@ -17,11 +62,6 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
112 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
113 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
114 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
115 - /* |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
116 - * 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
|
117 - * 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
|
118 - * 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
|
119 - */ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
120 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
|
121 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
122 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
|
123 @@ -52,7 +92,7 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
124 } *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
|
125 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
126 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
127 - 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
|
128 + 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
|
129 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
130 ${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
|
131 /* |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
132 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
|
133 --- 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
|
134 +++ 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
|
135 @@ -1,11 +1,28 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
136 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
|
137 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
138 - provided type 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
|
139 + provided type 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
|
140 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
141 + 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
|
142 + 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
|
143 + 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
|
144 + method ::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
|
145 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
146 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
147 + /* |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
148 + * This is the abstract type used by the Kernel to represent an ethernet |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
149 + * 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
|
150 + */ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
151 + 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
|
152 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
153 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
|
154 chunk ::decl(); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
155 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
156 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
157 + /* |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
158 + * 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
|
159 + * 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
|
160 + * 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
|
161 + */ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
162 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
|
163 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
164 chunk LKM::includes(); |
83
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
165 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
|
166 --- 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
|
167 +++ 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
|
168 @@ -46,6 +46,7 @@ |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
169 Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb) |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
170 { |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
171 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
|
172 + 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
|
173 } |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
174 |
27f0e70df342
Wip on the transmission, tx init done, and tx hooked from Ethernet send
Louis Opter <louis@lse.epitech.net>
parents:
diff
changeset
|
175 LKM::init() |
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
|
176 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
|
177 --- 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
|
178 +++ 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
|
179 @@ -1,4 +1,4 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
180 -with Socket, 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
|
181 +with Socket, LKM, Ethernet |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
182 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
183 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
|
184 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
185 @@ -17,6 +17,32 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
186 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
187 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
188 |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
189 + chunk ::dump_infos() |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
190 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
191 + /* |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
192 + * We should use a Rathaxes log abstraction instead of pr_info here, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
193 + * but Rathaxes doesn't support functions with a variable number of |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
194 + * arguments yet. |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
195 + */ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
196 + unsigned short ethernet_proto = be16_to_cpu(${self}->protocol); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
197 + ${cast local.ethernet_proto as 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
|
198 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
199 + pr_info( |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
200 + "\tprotocol = %#-5x (%s)\n" |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
201 + "\t len = %-5u data_len = %-5u head_len = %-5u\n" |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
202 + "\tnr_frags = %u\n" |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
203 + "\tgso_size = %-5u gso_segs = %-5u gso_type = %-5u\n", |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
204 + ethernet_proto, "", // XXX: ${local.ethernet_proto.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
|
205 + ${self}->len, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
206 + ${self}->data_len, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
207 + skb_headlen(${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
|
208 + skb_shinfo(${self})->nr_frags, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
209 + skb_shinfo(${self})->gso_size, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
210 + skb_shinfo(${self})->gso_segs, |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
211 + skb_shinfo(${self})->gso_type |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
212 + ); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
213 + } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
214 + |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
215 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
|
216 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
217 // some work may have to be done here in order |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
218 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
|
219 --- 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
|
220 +++ 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
|
221 @@ -1,8 +1,10 @@ |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
222 interface Socket : 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
|
223 { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
224 - provided 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
|
225 - 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
|
226 - chunk ::decl(); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
227 - method ::init(); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
228 + provided 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
|
229 + { |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
230 + 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
|
231 + chunk ::decl(); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
232 + method ::init(); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
233 + method ::dump_infos(); |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
234 } |
6432998a8245
Finish the patches on the rx/tx init and wip on the actual tx
Louis Opter <louis@lse.epitech.net>
parents:
83
diff
changeset
|
235 } |