Mercurial > archived > louis > epitech > mq > rathaxes
annotate rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch @ 107:f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Sun, 24 Mar 2013 21:47:39 -0700 |
parents | 976a4b87803f |
children | 7efe3212db3a |
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 |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
2 # Parent 6122a310f97196aadba20973d9218aa24528bd3d |
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() |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
272 @@ -59,11 +59,16 @@ |
104
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 { |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
283 - netdev: ${self}->ndev; |
104
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}); |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
285 /* This could be another init method for Ethernet::Device: */ |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
286 - rtx_ether_ctx: netdev_priv(&${self}->ndev); |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
287 + 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
|
288 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
289 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
290 |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
291 @@ -90,25 +95,33 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
292 #include <linux/etherdevice.h> |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
293 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
294 |
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 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 + /* 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
|
297 + 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
|
298 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
299 - ${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
|
300 + ${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
|
301 /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
302 * 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
|
303 * 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
|
304 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
305 ${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
|
306 - ${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
|
307 + ${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
|
308 } |
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 map |
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 - 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
|
313 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
314 + * 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
|
315 + * 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
|
316 + * |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
317 + * 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
|
318 + * 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
|
319 + */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
320 + 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
|
321 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
|
322 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
|
323 - 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
|
324 - 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
|
325 - 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
|
326 + 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
|
327 + 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
|
328 + 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
|
329 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
330 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
331 |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
332 @@ -128,8 +141,17 @@ |
104
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 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
|
335 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
336 - ${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
|
337 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
338 + * 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
|
339 + * "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
|
340 + */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
341 + ${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
|
342 + ${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
|
343 + { /* 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
|
344 + ${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
|
345 + } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
346 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
347 + ${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
|
348 ${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
|
349 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
350 int error; |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
351 @@ -189,8 +211,13 @@ |
104
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 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
|
354 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
355 - ${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
|
356 + ${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
|
357 + ${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
|
358 + { /* 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
|
359 + ${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
|
360 + } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
361 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
362 + ${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
|
363 ${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
|
364 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
365 /* TODO: change this pointcut into a pointcut/adapter/callback: */ |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
366 @@ -225,6 +252,7 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
367 { |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
368 ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id; |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
369 ${cast local.rtx_net_dev as Ethernet::AbstractDevice}; |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
370 + |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
371 ${Ethernet::Device} *rtx_ether_ctx; |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
372 ${cast local.rtx_ether_ctx as Ethernet::Device}; |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
373 rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx}; |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
374 @@ -258,23 +286,26 @@ |
104
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 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
|
377 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
378 + ${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
|
379 ${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
|
380 - ${Ethernet::AbstractDevice} *net_dev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
381 - ${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
|
382 + ${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
|
383 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
384 - 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
|
385 - if (!net_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
386 + /* 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
|
387 + 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
|
388 + if (!rtx_net_dev) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
389 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
390 ${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
|
391 error = -ENOMEM; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
392 goto fail; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
393 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
394 - 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
|
395 - 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
|
396 - ${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
|
397 - ${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
|
398 + 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
|
399 + 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
|
400 + ${config.ifname}, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
401 + 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
|
402 + ${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
|
403 + ${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
|
404 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
405 - 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
|
406 + 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
|
407 if (error) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
408 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
409 ${Log::info("cannot register the driver in the net subsystem")}; |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
410 @@ -286,14 +317,11 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
411 * 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
|
412 * 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
|
413 * 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
|
414 - * |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
415 - * 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
|
416 - * 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
|
417 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
418 - { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
419 - ${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
|
420 - ${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
|
421 - ${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
|
422 + ${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
|
423 + ${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
|
424 + { /* 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
|
425 + ${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
|
426 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
427 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
428 /* Register ourselves in the parent context: */ |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
429 @@ -315,7 +343,7 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
430 ${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
|
431 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
|
432 ${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
|
433 - ${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
|
434 + ${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
|
435 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
436 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
437 /* This chunk should be removed (see #26) */ |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
438 @@ -332,15 +360,15 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
439 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
440 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
|
441 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
442 - ${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
|
443 - ${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
|
444 - |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
445 + ${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
|
446 + ${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
|
447 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
|
448 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
449 - ${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
|
450 - ${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
|
451 - 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
|
452 - 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
|
453 + ${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
|
454 + ${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
|
455 + |
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_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
|
457 + 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
|
458 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
459 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
460 /* 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
|
461 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
|
462 --- 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
|
463 +++ b/rathaxes/samples/e1000/ethernet.rti |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
464 @@ -16,13 +16,14 @@ |
104
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
465 provided type AbstractDevice |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
466 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
467 chunk LKM::includes(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
468 + method init(Builtin::symbol); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
469 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
|
470 - attribute Builtin::symbol.scalar netdev; |
107
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
471 + attribute Builtin::symbol.scalar k_net_dev; |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
472 /* |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
473 * XXX: should be a Ethernet::Device, but that causes a circular |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
474 * dependency: |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
475 */ |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
476 - attribute Builtin::symbol rtx_ether_ctx; |
f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
Louis Opter <louis@lse.epita.fr>
parents:
106
diff
changeset
|
477 + 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
|
478 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
479 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
480 provided type Device |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
481 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
|
482 --- 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
|
483 +++ 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
|
484 @@ -16,15 +16,15 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
485 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
486 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
487 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
488 - 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
|
489 + 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
|
490 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
491 - 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
|
492 + 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
|
493 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
494 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
495 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
496 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
497 - data: ${self}->data; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
498 - 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
|
499 + 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
|
500 + 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
|
501 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
502 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
503 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
504 @@ -52,13 +52,13 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
505 int error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
506 ${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
|
507 ${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
|
508 - 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
|
509 + 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
|
510 if (error) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
511 return error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
512 - 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
|
513 + 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
|
514 if (error) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
515 return error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
516 - 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
|
517 + 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
|
518 return 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
519 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
520 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
521 @@ -68,8 +68,8 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
522 ${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
|
523 if (self->ioaddr) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
524 iounmap(self->ioaddr); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
525 - 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
|
526 - 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
|
527 + 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
|
528 + 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
|
529 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
530 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
531 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
532 @@ -78,7 +78,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
533 ${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
|
534 ${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
|
535 ${self}->pdev = ${pdev}; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
536 - ${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
|
537 + ${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
|
538 ${self}->ioaddr = NULL; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
539 ${self}->context = NULL; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
540 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
541 @@ -97,20 +97,20 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
542 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
543 ${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
|
544 ${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
|
545 - ${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
|
546 + ${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
|
547 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
548 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
549 - 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
|
550 + 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
|
551 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
552 ${self}->context = ctx; |
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 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
555 map |
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 - context: ${self}->context; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
558 - 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
|
559 + 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
|
560 + 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
|
561 pci_device: ${self}->pdev; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
562 - 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
|
563 + 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
|
564 bars: ${self}->bars; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
565 ioaddr: ${self}->ioaddr; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
566 BAR_0: 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
567 @@ -151,7 +151,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
568 ${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
|
569 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
570 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
571 - /* ${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
|
572 + /* ${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
|
573 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
|
574 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
575 /* ${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
|
576 @@ -184,7 +184,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
577 return 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
578 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
579 fail: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
580 - /* ${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
|
581 + /* ${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
|
582 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
|
583 kfree(rtx_pci_dev); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
584 return error; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
585 @@ -210,7 +210,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
586 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
587 ${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
|
588 ${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
|
589 - ${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
|
590 + ${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
|
591 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
592 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
|
593 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
594 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
|
595 --- 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
|
596 +++ 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
|
597 @@ -10,10 +10,15 @@ |
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 chunk LKM::includes(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
600 method init(PCI::AbstractDevice); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
601 - 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
|
602 - |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
603 - 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
|
604 - 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
|
605 + /* |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
606 + * 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
|
607 + * dependency: |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
608 + */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
609 + 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
|
610 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
611 + 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
|
612 + /* 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
|
613 + 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
|
614 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
615 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
616 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
|
617 @@ -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
|
618 method enable(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
619 method disable(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
620 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
|
621 - 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
|
622 |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
623 - 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
|
624 + 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
|
625 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
105
diff
changeset
|
626 + 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
|
627 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
|
628 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
|
629 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
|
630 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
|
631 --- 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
|
632 +++ 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
|
633 @@ -14,7 +14,7 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
634 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
635 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
636 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
637 - data: ${self}->data; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
638 + 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
|
639 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
640 } |
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 @@ -46,11 +46,12 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
643 */ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
644 ${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
|
645 ${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
|
646 - ${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
|
647 + ${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
|
648 + |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
649 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
|
650 "none", "unnecessary", "complete", "partial" |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
651 }; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
652 - 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
|
653 + 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
|
654 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
655 pr_info( |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
656 "\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
|
657 @@ -59,8 +60,8 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
658 "\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
|
659 /* 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
|
660 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
|
661 - ${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
|
662 - ${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
|
663 + ${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
|
664 + ${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
|
665 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
|
666 ); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
667 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
668 @@ -72,14 +73,13 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
669 ${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
|
670 ${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
|
671 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
672 - WARN_ON(!skb); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
673 - 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
|
674 + 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
|
675 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
|
676 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
677 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
|
678 dev, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
679 - &${local.skb.data}.data, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
680 - 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
|
681 + ${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
|
682 + 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
|
683 direction); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
684 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
|
685 if (err) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
686 @@ -97,18 +97,17 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
687 ${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
|
688 ${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
|
689 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
690 - WARN_ON(!${local.skb}); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
691 - 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
|
692 + 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
|
693 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
694 if (self->dma_handle) |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
695 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
696 dma_unmap_single(dev, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
697 self->dma_handle, |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
698 - 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
|
699 + 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
|
700 direction); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
701 self->dma_handle = 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
702 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
703 - 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
|
704 + 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
|
705 self->skbuff = 0; |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
706 } |
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 @@ -131,22 +130,22 @@ |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
709 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
710 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
|
711 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
712 - 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
|
713 + 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
|
714 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
715 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
716 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
|
717 { |
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.data}, DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
719 + 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
|
720 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
721 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
722 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
|
723 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
724 - 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
|
725 + 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
|
726 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
727 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
728 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
|
729 { |
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.data}, DMA_FROM_DEVICE); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
731 + 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
|
732 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
733 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
734 map |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
735 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
|
736 --- 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
|
737 +++ 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
|
738 @@ -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
|
739 { |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
740 chunk LKM::includes(); |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
741 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
|
742 - 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
|
743 + 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
|
744 } |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
745 |
c4c33ac02b93
First try at splitting the type nightmare and the refactoring
Louis Opter <louis@lse.epita.fr>
parents:
diff
changeset
|
746 provided type SKBuff |