Mercurial > archived > louis > epitech > mq > rathaxes
annotate rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch @ 106:976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
author | David Pineau <dav.pineau@gmail.com> |
---|---|
date | Mon, 25 Mar 2013 01:17:56 +0100 |
parents | fb20f01ea997 |
children | f42751b8ca99 |
rev | line source |
---|---|
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
1 # HG changeset patch |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
2 # Parent f046837f963dcba715cebe8b6dc40e7bbe2ce598 |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
3 rathaxes: change the abstract type notation in the e1000 sample |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
4 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
5 Starting with ra24db32bf134 Rathaxes types are generated differently: you |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
6 don't define entire structures anymore, but only the fields. And the |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
7 compiler generate a typedef'ed structure on top of it. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
8 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
9 This works fine, except for "abstract types" (the types defined by —and |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
10 used to interact with— the kernel). We need to define these types as |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
11 Rathaxes types to interact with them, in Rathaxes, but with |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
12 ra24db32bf134 it means that we loose (hide) the original type from the |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
13 kernel, making it very difficult to use "abstract types" with the |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
14 kernels APIs. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
15 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
16 For example, here the hypothetical generated struct for the abstract |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
17 type "struct net_device" from Linux would be: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
18 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
19 typedef struct { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
20 struct net_device data; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
21 } rtx_GeneratedType; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
22 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
23 And here is how we have to use it: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
24 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
25 rtx_GeneratedType *my_struct; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
26 kernel_api_function(&my_struct->data); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
27 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
28 This &my_struct->data is actually always a nop, but it's confusing and |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
29 hard to understand. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
30 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
31 This changeset changes the notation to: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
32 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
33 rtx_GeneratedType *my_struct; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
34 kernel_api_function((struct net_device *)my_struct); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
35 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
36 Which is, I believe, more intuitive and coherent with how you would |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
37 initialize the my_struct pointer here with a return value from the |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
38 kernel (i.e: with a cast into rtx_GeneratedType *). |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
39 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
40 diff --git a/rathaxes/samples/e1000/device.blt b/rathaxes/samples/e1000/device.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
41 --- a/rathaxes/samples/e1000/device.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
42 +++ b/rathaxes/samples/e1000/device.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
43 @@ -18,7 +18,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
44 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
45 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
46 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
47 - data: ${self}->data; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
48 + k_device: ((struct device *)${self}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
49 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
50 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
51 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
52 diff --git a/rathaxes/samples/e1000/device.rti b/rathaxes/samples/e1000/device.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
53 --- a/rathaxes/samples/e1000/device.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
54 +++ b/rathaxes/samples/e1000/device.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
55 @@ -5,6 +5,6 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
56 decl data_types(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
57 chunk LKM::includes(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
58 method init(); |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
59 - attribute Builtin::symbol.scalar data; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
60 + attribute Builtin::symbol.scalar k_device; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
61 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
62 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
63 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
64 --- a/rathaxes/samples/e1000/e1000.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
65 +++ b/rathaxes/samples/e1000/e1000.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
66 @@ -171,13 +171,17 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
67 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
68 static int rtx_e1000_tx_ring_tso_cksum_offload(${e1000::TxRing} *self, ${Socket::SKBuff} *skb) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
69 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
70 - ${Socket::AbstractSKBuff} *abs_skb = skb->skbuff; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
71 - ${cast local.abs_skb as Socket::AbstractSKBuff}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
72 - return skb_is_gso(&${local.abs_skb.data}) || ${local.abs_skb.data}.ip_summed == CHECKSUM_PARTIAL; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
73 + /* XXX We can't use ${skb} here because it's a pointer */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
74 + ${Socket::AbstractSKBuff} *k_skb = skb->skbuff; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
75 + ${cast local.k_skb as Socket::AbstractSKBuff}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
76 + return skb_is_gso(${local.k_skb.k_sk_buff}) || ${local.k_skb.k_sk_buff}->ip_summed == CHECKSUM_PARTIAL; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
77 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
78 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
79 static void rtx_e1000_tx_ring_put(${e1000::TxRing} *self, ${Socket::SKBuff} *skb) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
80 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
81 + /* XXX We can't use ${skb} here because it's a pointer */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
82 + ${Socket::AbstractSKBuff} *k_skb = skb->skbuff; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
83 + ${cast local.k_skb as Socket::AbstractSKBuff}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
84 WARN_ON(!skb); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
85 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
86 /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
87 @@ -188,17 +192,15 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
88 * code shouldn't be aware of it and use something more |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
89 * abstract. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
90 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
91 - ${Socket::AbstractSKBuff} *abs_skb = skb->skbuff; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
92 - ${cast local.abs_skb as Socket::AbstractSKBuff}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
93 ${e1000::TxDescriptor} *tx_desc = &self->base[self->tail]; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
94 tx_desc->lower.data = cpu_to_le32( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
95 E1000_TXD_CMD_EOP | |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
96 E1000_TXD_CMD_IFCS | |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
97 E1000_TXD_CMD_RS | |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
98 - skb_headlen(&${local.abs_skb.data})); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
99 + skb_headlen(${local.k_skb.k_sk_buff})); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
100 tx_desc->upper.data = 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
101 tx_desc->buff_addr = cpu_to_le64(skb->dma_handle); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
102 - memcpy(&self->skbuffs[self->tail], skb, sizeof(*skb)); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
103 + memcpy(&self->skbuffs[self->tail], ${local.k_skb.k_sk_buff}, sizeof(*${local.k_skb.k_sk_buff})); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
104 self->tail = (self->tail + 1) % ${config.tx_ring_size}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
105 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
106 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
107 @@ -733,7 +735,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
108 hw_ctx->rx_ring.size = ${config.rx_ring_size} * sizeof(*hw_ctx->rx_ring.base); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
109 hw_ctx->rx_ring.size = ALIGN(hw_ctx->rx_ring.size, 4096); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
110 hw_ctx->rx_ring.base = dma_alloc_coherent( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
111 - &${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
112 + ${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
113 hw_ctx->rx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
114 &hw_ctx->rx_ring.dma_base, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
115 GFP_KERNEL); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
116 @@ -751,12 +753,10 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
117 * Allocate the skbuffs, map them for DMA, and write their address |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
118 * in the corresponding descriptor. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
119 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
120 - ${Ethernet::AbstractDevice} *rtx_ether_dev = ${rtx_ether_ctx.net_device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
121 - ${cast local.rtx_ether_dev as Ethernet::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
122 for (i = 0; i != ${config.rx_ring_size}; ++i) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
123 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
124 - hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*) netdev_alloc_skb( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
125 - &${rtx_ether_dev.netdev}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
126 + hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*)netdev_alloc_skb( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
127 + ${rtx_ether_ctx.net_device.k_net_dev}, /* XXX: .k_net_dev isn't expanded here */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
128 ${config.rx_buffer_len}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
129 if (!hw_ctx->rx_ring.skbuffs[i].skbuff) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
130 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
131 @@ -764,11 +764,11 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
132 goto err_skbuffs_alloc; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
133 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
134 hw_ctx->rx_ring.skbuffs[i].dma_handle = dma_map_single( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
135 - &${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
136 - &hw_ctx->rx_ring.skbuffs[i].skbuff->data, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
137 + ${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
138 + (struct sk_buff *)hw_ctx->rx_ring.skbuffs[i].skbuff, /* XXX leaking cast */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
139 ${config.rx_buffer_len}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
140 DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
141 - int dma_error = dma_mapping_error(&${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
142 + int dma_error = dma_mapping_error(${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
143 hw_ctx->rx_ring.skbuffs[i].dma_handle); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
144 if (dma_error) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
145 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
146 @@ -820,7 +820,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
147 hw_ctx->tx_ring.size = ${config.tx_ring_size} * sizeof(*hw_ctx->tx_ring.base); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
148 hw_ctx->tx_ring.size = ALIGN(hw_ctx->tx_ring.size, 4096); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
149 hw_ctx->tx_ring.base = dma_alloc_coherent( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
150 - &${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
151 + ${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
152 hw_ctx->tx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
153 &hw_ctx->tx_ring.dma_base, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
154 GFP_KERNEL); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
155 @@ -863,15 +863,16 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
156 while (i--) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
157 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
158 dma_unmap_single( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
159 - &${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
160 + ${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
161 hw_ctx->rx_ring.skbuffs[i].dma_handle, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
162 ${config.rx_buffer_len}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
163 DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
164 err_skbuffs_map: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
165 - dev_kfree_skb(&hw_ctx->rx_ring.skbuffs[i].skbuff->data); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
166 + /* XXX leaking cast: */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
167 + dev_kfree_skb((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i].skbuff); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
168 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
169 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
170 - dma_free_coherent(&${rtx_ether_ctx.device}, hw_ctx->rx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
171 + dma_free_coherent(${rtx_ether_ctx.device}, hw_ctx->rx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
172 hw_ctx->rx_ring.base, hw_ctx->rx_ring.dma_base); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
173 err_rx_ring_alloc: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
174 return -ENOMEM; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
175 @@ -889,8 +890,13 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
176 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
177 chunk ::CALL() |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
178 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
179 - ${e1000::Context} *hw_ctx; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
180 - hw_ctx = &${rtx_ether_ctx}->hw_ctx; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
181 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
182 + * XXX: Not generated if named "hw_ctx" (which is funny because |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
183 + * it's used and works in the template right above this one): |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
184 + */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
185 + ${e1000::Context} *hw_ctx_; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
186 + ${cast local.hw_ctx_ as e1000::Context}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
187 + hw_ctx_ = &${rtx_ether_ctx}->hw_ctx; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
188 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
189 /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
190 * Free the rx ring: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
191 @@ -900,22 +906,23 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
192 for (int i = 0; i != ${config.rx_ring_size}; ++i) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
193 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
194 dma_unmap_single( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
195 - &${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
196 - (dma_addr_t)hw_ctx->rx_ring.skbuffs[i].dma_handle, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
197 + ${rtx_ether_ctx.device}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
198 + (dma_addr_t)hw_ctx_->rx_ring.skbuffs[i].dma_handle, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
199 ${config.rx_buffer_len}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
200 DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
201 - dev_kfree_skb(&hw_ctx->rx_ring.skbuffs[i].skbuff->data); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
202 + /* XXX Go through the rtx types (Socket::SKBuff, AbstractSKBuff) */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
203 + dev_kfree_skb(hw_ctx_->rx_ring.skbuffs[i].skbuff); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
204 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
205 - dma_free_coherent(&${rtx_ether_ctx.device}, hw_ctx->rx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
206 - hw_ctx->rx_ring.base, hw_ctx->rx_ring.dma_base); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
207 + dma_free_coherent(${rtx_ether_ctx.device}, hw_ctx_->rx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
208 + hw_ctx_->rx_ring.base, hw_ctx_->rx_ring.dma_base); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
209 ${Log::info("free_rx_tx: rx ring free'ed")}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
210 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
211 /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
212 * Free the tx ring: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
213 * - Free the descriptors array. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
214 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
215 - dma_free_coherent(&${rtx_ether_ctx.device}, hw_ctx->tx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
216 - hw_ctx->tx_ring.base, hw_ctx->tx_ring.dma_base); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
217 + dma_free_coherent(${rtx_ether_ctx.device}, hw_ctx_->tx_ring.size, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
218 + hw_ctx_->tx_ring.base, hw_ctx_->tx_ring.dma_base); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
219 ${Log::info("free_rx_tx: tx ring free'ed")}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
220 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
221 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
222 @@ -973,13 +980,13 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
223 ${local.skb.init(kernel_skb)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
224 hw_ctx = &${rtx_ether_ctx}->hw_ctx; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
225 tx_ring = &hw_ctx->tx_ring; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
226 - devp = (${Device::AbstractDevice}*) &${rtx_ether_ctx.device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
227 + devp = (${Device::AbstractDevice}*)${rtx_ether_ctx.device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
228 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
229 ${Log::info("xmit: skbuff details:")}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
230 /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
231 - * skb is not expand on the bound C variable (should be rtx_skbuff), |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
232 - * which is funny because it works for the sequence template call |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
233 - * right after. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
234 + * skb does not expand on the bound C variable (should be |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
235 + * rtx_skbuff), which is funny because it works for the |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
236 + * sequence template call right after. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
237 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
238 /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
239 * XXX: doesn't work (I tried to pass self explicitely too): |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
240 @@ -1012,8 +1019,8 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
241 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
242 /* 2. Map the data */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
243 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
244 - /* XXX: ${local.skb.map_to(local.devp)}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
245 - if (rtx_socket_skbuff_map(&skb, &${devp.data}, DMA_TO_DEVICE)) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
246 + /* XXX: ${local.skb.map_to(devp.k_device)}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
247 + if (rtx_socket_skbuff_map(&skb, ${devp.k_device}, DMA_TO_DEVICE)) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
248 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
249 ${Log::info("xmit: can't DMA map a SKbuff")}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
250 goto err_skb_map_to; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
251 @@ -1032,7 +1039,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
252 err_offload: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
253 err_skb_map_to: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
254 /* XXX: ${local.skb.unmap_to_and_free(local.dev)}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
255 - rtx_socket_skbuff_unmap_and_free(&skb, &${devp.data}, DMA_TO_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
256 + rtx_socket_skbuff_unmap_and_free(&skb, ${devp.k_device}, DMA_TO_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
257 return NETDEV_TX_OK; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
258 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
259 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
260 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
261 --- a/rathaxes/samples/e1000/ethernet.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
262 +++ b/rathaxes/samples/e1000/ethernet.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
263 @@ -51,7 +51,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
264 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
265 decl data_types() |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
266 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
267 - struct net_device ndev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
268 + struct net_device data; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
269 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
270 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
271 chunk LKM::includes() |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
272 @@ -59,9 +59,15 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
273 #include <linux/netdevice.h> |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
274 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
275 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
276 + method init(Builtin::symbol dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
277 + { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
278 + ${self} = (${Ethernet::AbstractDevice} *)${dev}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
279 + } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
280 + |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
281 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
282 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
283 - netdev: ${self}->ndev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
284 + k_net_dev: ((struct net_device *)${self}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
285 + rtx_ether_ctx: netdev_priv((struct net_device *)${self}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
286 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
287 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
288 |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
289 @@ -88,25 +94,33 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
290 #include <linux/etherdevice.h> |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
291 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
292 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
293 - method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
294 + /* XXX: if the first arg is not called rtx_net_dev, it breaks. */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
295 + method init(Ethernet::AbstractDevice rtx_net_dev, PCI::AbstractDevice pci_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
296 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
297 - ${self} = netdev_priv(&${net_dev.netdev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
298 + ${self} = ${rtx_net_dev.rtx_ether_ctx}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
299 /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
300 * We can use -> because we know that ${self} will be always a |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
301 * pointer, but the ambiguity sucks. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
302 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
303 ${self}->pci_dev = ${pci_dev}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
304 - ${self}->net_dev = ${net_dev}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
305 + ${self}->net_dev = ${rtx_net_dev}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
306 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
307 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
308 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
309 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
310 - device: ${self}->pci_dev->data.dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
311 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
312 + * XXX: I'd like to be able to do things like: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
313 + * device: ${self.pci_dev.k_pci_dev}->dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
314 + * |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
315 + * Also, using ${PCI::AbstractDevice} instead of directly struct |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
316 + * pci_dev doesn't work. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
317 + */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
318 + device: (&((struct pci_dev *)(${self})->pci_dev)->dev); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
319 pci_device: ${self}->pci_dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
320 net_device: ${self}->net_dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
321 - perm_addr: ${self}->net_dev->ndev.perm_addr; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
322 - dev_addr: ${self}->net_dev->ndev.dev_addr; |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
323 - irq: ${self}->pci_dev->data.irq; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
324 + perm_addr: ((struct net_device *)(${self})->net_dev)->perm_addr; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
325 + dev_addr: ((struct net_device *)(${self})->net_dev)->dev_addr; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
326 + irq: ((struct pci_dev *)(${self})->pci_dev)->irq; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
327 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
328 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
329 |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
330 @@ -126,8 +140,17 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
331 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
332 static int rtx_ethernet_open(struct net_device *dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
333 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
334 - ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
335 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
336 + * XXX The casts are here because the compiler doesn't resolve |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
337 + * "enclosed" type (e.g: local.var.enclosed) correctly. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
338 + */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
339 + ${Ethernet::AbstractDevice} *rtx_net_dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
340 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
341 + { /* XXX: I end up with a placeholder if I don't open a scope */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
342 + ${local.rtx_net_dev.init(local.dev)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
343 + } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
344 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
345 + ${Ethernet::Device} *rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
346 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
347 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
348 int error; |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
349 @@ -187,8 +210,13 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
350 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
351 static int rtx_ethernet_close(struct net_device *dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
352 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
353 - ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
354 + ${Ethernet::AbstractDevice} *rtx_net_dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
355 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
356 + { /* XXX: I end up with a placeholder if I don't open a scope */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
357 + ${local.rtx_net_dev.init(local.dev)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
358 + } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
359 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
360 + ${Ethernet::Device} *rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
361 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
362 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
363 /* TODO: change this pointcut into a pointcut/adapter/callback: */ |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
364 @@ -221,9 +249,13 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
365 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
366 static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
367 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
368 - ${Ethernet::Device} *rtx_ether_ctx = dev_id; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
369 + ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
370 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
371 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
372 + ${Ethernet::Device} *rtx_ether_ctx; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
373 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
374 + rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
375 + |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
376 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
377 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
378 return IRQ_NONE; |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
379 @@ -253,23 +285,26 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
380 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
381 chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
382 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
383 + ${Ethernet::AbstractDevice} *rtx_net_dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
384 ${Ethernet::Device} *rtx_ether_ctx; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
385 - ${Ethernet::AbstractDevice} *net_dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
386 - ${cast local.net_dev as Ethernet::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
387 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
388 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
389 - net_dev = (${Ethernet::AbstractDevice}*) alloc_etherdev(sizeof(*rtx_ether_ctx)); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
390 - if (!net_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
391 + /* Cast the result back into our "transparent wrapper" type */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
392 + rtx_net_dev = (${Ethernet::AbstractDevice}*)alloc_etherdev(sizeof(*rtx_ether_ctx)); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
393 + if (!rtx_net_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
394 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
395 ${Log::info("cannot allocate the ethernet device context")}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
396 error = -ENOMEM; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
397 goto fail; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
398 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
399 - SET_NETDEV_DEV(&${local.net_dev.netdev}, ${rtx_pci_dev.device}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
400 - strlcpy(${local.net_dev.netdev}.name, ${config.ifname}, sizeof(${local.net_dev.netdev}.name)); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
401 - ${local.net_dev.netdev}.irq = ${rtx_pci_dev.irq}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
402 - ${local.net_dev.netdev}.netdev_ops = &rtx_ether_ops; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
403 + SET_NETDEV_DEV(${local.rtx_net_dev.k_net_dev}, ${rtx_pci_dev.device}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
404 + strlcpy(${local.rtx_net_dev.k_net_dev}->name, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
405 + ${config.ifname}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
406 + sizeof(${local.rtx_net_dev.k_net_dev}->name)); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
407 + ${local.rtx_net_dev.k_net_dev}->irq = ${rtx_pci_dev.irq}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
408 + ${local.rtx_net_dev.k_net_dev}->netdev_ops = &rtx_ether_ops; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
409 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
410 - error = register_netdev(&${local.net_dev.netdev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
411 + error = register_netdev(${local.rtx_net_dev.k_net_dev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
412 if (error) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
413 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
414 ${Log::info("cannot register the driver in the net subsystem")}; |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
415 @@ -281,14 +316,11 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
416 * XXX: the cast is here because the compiler resolve the |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
417 * type of rtx_pci_dev.pci_device to the type of |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
418 * rtx_pci_dev instead of the type of rtx_pci_dev.pci_device. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
419 - * |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
420 - * Also, I'm getting placeholder in the generated code if |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
421 - * I don't open a scope here. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
422 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
423 - { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
424 - ${PCI::AbstractDevice} *rtx_pdev = ${rtx_pci_dev.pci_device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
425 - ${cast local.rtx_pdev as PCI::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
426 - ${local.rtx_ether_ctx.init(local.net_dev, local.rtx_pdev)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
427 + ${PCI::AbstractDevice} *workaround = ${rtx_pci_dev.pci_device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
428 + ${cast local.workaround as PCI::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
429 + { /* XXX: I end up with a placeholder if I don't open a scope */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
430 + ${local.rtx_ether_ctx.init(local.rtx_net_dev, local.workaround)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
431 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
432 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
433 /* Register ourselves in the parent context: */ |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
434 @@ -310,7 +342,7 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
435 ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
436 memcpy(${local.rtx_ether_ctx.perm_addr}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
437 ${local.rtx_ether_ctx.dev_addr}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
438 - ${local.net_dev.netdev}.addr_len); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
439 + ${local.rtx_net_dev.k_net_dev}->addr_len); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
440 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
441 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
442 /* This chunk should be removed (see #26) */ |
105
fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
Louis Opter <louis@lse.epita.fr>
parents:
104
diff
changeset
|
443 @@ -327,15 +359,15 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
444 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
445 chunk PCI::pci_remove_hook(PCI::Device rtx_pci_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
446 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
447 - ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.context}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
448 - ${Ethernet::AbstractDevice} *rtx_ether_dev = (${Ethernet::AbstractDevice}*) ${local.rtx_ether_ctx.net_device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
449 - |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
450 + ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.rtx_drv_context}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
451 + ${cast local.rtx_ether_ctx as Ethernet::Device}; /* XXX */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
452 BUG_ON(!rtx_ether_ctx); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
453 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
454 - ${cast local.rtx_ether_ctx as Ethernet::Device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
455 - ${cast local.rtx_ether_dev as Ethernet::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
456 - unregister_netdev(&${local.rtx_ether_dev.netdev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
457 - free_netdev(&${local.rtx_ether_dev.netdev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
458 + ${Ethernet::AbstractDevice} *rtx_net_dev = ${local.rtx_ether_ctx.net_device}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
459 + ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; /* XXX */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
460 + |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
461 + unregister_netdev(${local.rtx_net_dev.k_net_dev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
462 + free_netdev(${local.rtx_net_dev.k_net_dev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
463 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
464 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
465 /* This chunk should be removed (see #26) */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
466 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
467 --- a/rathaxes/samples/e1000/ethernet.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
468 +++ b/rathaxes/samples/e1000/ethernet.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
469 @@ -16,8 +16,15 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
470 provided type AbstractDevice |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
471 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
472 chunk LKM::includes(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
473 + method init(Builtin::symbol); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
474 decl data_types(); |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
475 - attribute Builtin::symbol.scalar netdev; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
476 + |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
477 + attribute Builtin::symbol.scalar k_net_dev; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
478 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
479 + * XXX: should be a Ethernet::Device, but that causes a circular |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
480 + * dependency. |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
481 + */ |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
482 + attribute Builtin::symbol.scalar rtx_ether_ctx; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
483 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
484 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
485 provided type Device |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
486 diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
487 --- a/rathaxes/samples/e1000/pci.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
488 +++ b/rathaxes/samples/e1000/pci.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
489 @@ -16,15 +16,15 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
490 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
491 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
492 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
493 - method set_context(Builtin::symbol ctx) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
494 + method set_rtx_context(Builtin::symbol ctx) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
495 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
496 - pci_set_drvdata(&${self}->data, ${ctx}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
497 + pci_set_drvdata(${self.k_pci_dev}, ${ctx}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
498 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
499 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
500 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
501 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
502 - data: ${self}->data; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
503 - drv_data: pci_get_drvdata(&${self}->data); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
504 + k_pci_dev: ((struct pci_dev *)${self}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
505 + rtx_pci_ctx: pci_get_drvdata((struct pci_dev *)${self}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
506 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
507 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
508 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
509 @@ -52,13 +52,13 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
510 int error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
511 ${PCI::AbstractDevice} *enable_pdev = self->pdev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
512 ${cast local.enable_pdev as PCI::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
513 - error = pci_enable_device(&${local.enable_pdev.data}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
514 + error = pci_enable_device(${local.enable_pdev.k_pci_dev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
515 if (error) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
516 return error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
517 - error = pci_request_selected_regions(&${local.enable_pdev.data}, self->bars, ${config.name}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
518 + error = pci_request_selected_regions(${local.enable_pdev.k_pci_dev}, self->bars, ${config.name}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
519 if (error) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
520 return error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
521 - pci_set_master(&${local.enable_pdev.data}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
522 + pci_set_master(${local.enable_pdev.k_pci_dev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
523 return 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
524 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
525 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
526 @@ -68,8 +68,8 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
527 ${cast local.disable_pdev as PCI::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
528 if (self->ioaddr) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
529 iounmap(self->ioaddr); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
530 - pci_release_selected_regions(&${local.disable_pdev.data}, self->bars); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
531 - pci_disable_device(&${local.disable_pdev.data}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
532 + pci_release_selected_regions(${local.disable_pdev.k_pci_dev}, self->bars); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
533 + pci_disable_device(${local.disable_pdev.k_pci_dev}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
534 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
535 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
536 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
537 @@ -78,7 +78,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
538 ${PCI::AbstractDevice} * workaround = (${PCI::AbstractDevice}*)pdev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
539 ${cast local.workaround as PCI::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
540 ${self}->pdev = ${pdev}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
541 - ${self}->bars = pci_select_bars(&${local.workaround.data}, IORESOURCE_MEM); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
542 + ${self}->bars = pci_select_bars(${local.workaround.k_pci_dev}, IORESOURCE_MEM); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
543 ${self}->ioaddr = NULL; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
544 ${self}->context = NULL; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
545 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
546 @@ -97,20 +97,20 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
547 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
548 ${PCI::AbstractDevice} *select_ioaddr_pdev = ${self}->pdev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
549 ${cast local.select_ioaddr_pdev as PCI::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
550 - ${self}->ioaddr = pci_ioremap_bar(&${local.select_ioaddr_pdev.data}, ${bar}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
551 + ${self}->ioaddr = pci_ioremap_bar(${local.select_ioaddr_pdev.k_pci_dev}, ${bar}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
552 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
553 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
554 - method set_context(Builtin::symbol ctx) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
555 + method set_rtx_drv_context(Builtin::symbol ctx) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
556 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
557 ${self}->context = ctx; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
558 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
559 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
560 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
561 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
562 - context: ${self}->context; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
563 - device: &${self}->pdev->data.dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
564 + rtx_drv_context: ${self}->context; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
565 + device: &((struct pci_dev *)(${self})->pdev)->dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
566 pci_device: ${self}->pdev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
567 - irq: ${self}->pdev->data.irq; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
568 + irq: ((struct pci_dev *)(${self})->pdev)->irq; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
569 bars: ${self}->bars; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
570 ioaddr: ${self}->ioaddr; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
571 BAR_0: 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
572 @@ -151,7 +151,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
573 ${local.rtx_pci_dev.init(local.rtx_pdev)}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
574 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
575 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
576 - /* ${local.pdev.set_context(local.rtx_pci_dev)}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
577 + /* ${local.pdev.set_rtx_context(local.rtx_pci_dev)}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
578 pci_set_drvdata(pdev, rtx_pci_dev); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
579 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
580 /* ${local.rtx_pci_dev.enable()}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
581 @@ -184,7 +184,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
582 return 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
583 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
584 fail: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
585 - /* ${local.pdev.set_context(NULL)}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
586 + /* ${local.pdev.set_rtx_drv_context(NULL)}; */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
587 pci_set_drvdata(pdev, NULL); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
588 kfree(rtx_pci_dev); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
589 return error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
590 @@ -210,7 +210,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
591 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
592 ${PCI::AbstractDevice} *rtx_pdev = (${PCI::AbstractDevice}*)pdev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
593 ${cast local.rtx_pdev as PCI::AbstractDevice}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
594 - ${PCI::Device} *rtx_pci_dev = ${rtx_pdev.drv_data}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
595 + ${PCI::Device} *rtx_pci_dev = ${rtx_pdev.rtx_pci_ctx}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
596 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
597 BUG_ON(!rtx_pci_dev); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
598 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
599 diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
600 --- a/rathaxes/samples/e1000/pci.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
601 +++ b/rathaxes/samples/e1000/pci.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
602 @@ -10,10 +10,15 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
603 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
604 chunk LKM::includes(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
605 method init(PCI::AbstractDevice); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
606 - method set_context(Builtin::symbol); |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
607 - |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
608 - attribute Builtin::symbol.scalar data; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
609 - attribute Builtin::symbol.scalar drv_data; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
610 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
611 + * XXX: the argument should be a PCI::Device but that causes a circular |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
612 + * dependency: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
613 + */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
614 + method set_rtx_context(Builtin::symbol); |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
615 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
616 + attribute Builtin::symbol.scalar k_pci_dev; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
617 + /* XXX: should be PCI::Device (see above point) */ |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
618 + attribute Builtin::symbol.scalar rtx_pci_ctx; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
619 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
620 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
621 provided type PCI::Device |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
622 @@ -27,9 +32,10 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
623 method enable(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
624 method disable(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
625 method select_ioaddr(Builtin::number); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
626 - method set_context(Builtin::symbol); |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
627 |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
628 - attribute Builtin::symbol.scalar context; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
629 + method set_rtx_drv_context(Builtin::symbol); |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
630 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
631 + attribute Builtin::symbol.scalar rtx_drv_context; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
632 attribute Device::AbstractDevice.ref device; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
633 attribute PCI::AbstractDevice.ref pci_device; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
634 attribute Builtin::symbol.ref ioaddr; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
635 diff --git a/rathaxes/samples/e1000/socket.blt b/rathaxes/samples/e1000/socket.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
636 --- a/rathaxes/samples/e1000/socket.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
637 +++ b/rathaxes/samples/e1000/socket.blt |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
638 @@ -14,7 +14,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
639 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
640 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
641 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
642 - data: ${self}->data; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
643 + k_sk_buff: ((struct sk_buff *)${self}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
644 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
645 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
646 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
647 @@ -46,11 +46,12 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
648 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
649 ${Socket::AbstractSKBuff} *skb = self->skbuff; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
650 ${cast local.skb as Socket::AbstractSKBuff}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
651 - ${Ethernet::ProtocolId} ethernet_proto = { .id = be16_to_cpu(${local.skb.data}.protocol) }; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
652 + ${Ethernet::ProtocolId} ethernet_proto = { .id = be16_to_cpu(${local.skb.k_sk_buff}->protocol) }; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
653 + |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
654 static const char * const ip_summed_values[] = { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
655 "none", "unnecessary", "complete", "partial" |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
656 }; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
657 - struct skb_shared_info *shinfo = skb_shinfo(&${local.skb.data}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
658 + struct skb_shared_info *shinfo = skb_shinfo(${local.skb.k_sk_buff}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
659 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
660 pr_info( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
661 "\t protocol = %#-5x (%s) ip_summed = %d (%s)\n" |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
662 @@ -59,8 +60,8 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
663 "\t gso_size = %-5u gso_segs = %-5u gso_type = %-5u", |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
664 /* XXX: can't use ${local.ethernet_proto.id} here (issue #52): */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
665 ethernet_proto.id, ${local.ethernet_proto.str}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
666 - ${local.skb.data}.ip_summed, ip_summed_values[${local.skb.data}.ip_summed], |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
667 - ${local.skb.data}.len, ${local.skb.data}.data_len, skb_headlen(&${local.skb.data}), |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
668 + ${local.skb.k_sk_buff}->ip_summed, ip_summed_values[${local.skb.k_sk_buff}->ip_summed], |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
669 + ${local.skb.k_sk_buff}->len, ${local.skb.k_sk_buff}->data_len, skb_headlen(${local.skb.k_sk_buff}), |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
670 shinfo->nr_frags, shinfo->gso_size, shinfo->gso_segs, shinfo->gso_type |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
671 ); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
672 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
673 @@ -72,14 +73,13 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
674 ${Socket::AbstractSKBuff} *skb = self->skbuff; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
675 ${cast local.skb as Socket::AbstractSKBuff}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
676 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
677 - WARN_ON(!skb); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
678 - WARN_ON(!${local.skb.data}.data); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
679 + WARN_ON(!${local.skb.k_sk_buff}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
680 WARN_ON(self->dma_handle); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
681 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
682 self->dma_handle = dma_map_single( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
683 dev, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
684 - &${local.skb.data}.data, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
685 - skb_headlen(&${local.skb.data}), |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
686 + ${local.skb.k_sk_buff}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
687 + skb_headlen(${local.skb.k_sk_buff}), |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
688 direction); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
689 int err = dma_mapping_error(dev, self->dma_handle); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
690 if (err) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
691 @@ -97,18 +97,17 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
692 ${Socket::AbstractSKBuff} *skb = self->skbuff; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
693 ${cast local.skb as Socket::AbstractSKBuff}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
694 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
695 - WARN_ON(!${local.skb}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
696 - WARN_ON(!${local.skb.data}.data); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
697 + WARN_ON(!${local.skb.k_sk_buff}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
698 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
699 if (self->dma_handle) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
700 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
701 dma_unmap_single(dev, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
702 self->dma_handle, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
703 - skb_headlen(&${local.skb.data}), |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
704 + skb_headlen(${local.skb.k_sk_buff}), |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
705 direction); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
706 self->dma_handle = 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
707 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
708 - dev_kfree_skb_any(&${local.skb.data}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
709 + dev_kfree_skb_any(${local.skb.k_sk_buff}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
710 self->skbuff = 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
711 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
712 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
713 @@ -131,22 +130,22 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
714 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
715 method map_to(Device::AbstractDevice dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
716 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
717 - rtx_socket_skbuff_map(${self}, &${dev.data}, DMA_TO_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
718 + rtx_socket_skbuff_map(${self}, ${dev.k_device}, DMA_TO_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
719 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
720 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
721 method map_from(Device::AbstractDevice dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
722 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
723 - rtx_socket_skbuff_map(${self}, &${dev.data}, DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
724 + rtx_socket_skbuff_map(${self}, ${dev.k_device}, DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
725 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
726 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
727 method unmap_to_and_free(Device::AbstractDevice dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
728 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
729 - rtx_socket_skbuff_unmap_and_free(${self}, &${dev.data}, DMA_TO_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
730 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, DMA_TO_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
731 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
732 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
733 method unmap_from_and_free(Device::AbstractDevice dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
734 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
735 - rtx_socket_skbuff_unmap_and_free(${self}, &${dev.data}, DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
736 + rtx_socket_skbuff_unmap_and_free(${self}, ${dev.k_device}, DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
737 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
738 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
739 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
740 diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
741 --- a/rathaxes/samples/e1000/socket.rti |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
742 +++ b/rathaxes/samples/e1000/socket.rti |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
743 @@ -5,7 +5,7 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
744 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
745 chunk LKM::includes(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
746 decl data_types(); |
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
747 - attribute Builtin::symbol.scalar data; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
748 + attribute Builtin::symbol.scalar k_sk_buff; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
749 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
750 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
751 provided type SKBuff |