Mercurial > archived > louis > epitech > mq > rathaxes
comparison rathaxes_sample_e1000_rewrite_device_dependent_code.patch @ 139:ab3a2aa22f95
Wip on cleaning up the existing code, now starting to build with gcc
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Sun, 19 Jan 2014 18:13:17 -0800 |
parents | 6527e078252c |
children | a291b41efb69 |
comparison
equal
deleted
inserted
replaced
138:6527e078252c | 139:ab3a2aa22f95 |
---|---|
4 | 4 |
5 diff --git a/notes.txt b/notes.txt | 5 diff --git a/notes.txt b/notes.txt |
6 new file mode 100644 | 6 new file mode 100644 |
7 --- /dev/null | 7 --- /dev/null |
8 +++ b/notes.txt | 8 +++ b/notes.txt |
9 @@ -0,0 +1,52 @@ | 9 @@ -0,0 +1,54 @@ |
10 +Remarks for David & Lionel: | 10 +Remarks for David & Lionel: |
11 + | 11 + |
12 +- Too much changes to not start over; | 12 +- Too much changes to not start over; |
13 +- Lack of methods is extremely annoying and requires a lot of workarounds (e.g: | 13 +- Lack of methods is extremely annoying and requires a lot of workarounds (e.g: |
14 + see the register read/write/set/unset methods on e1000::Context); | 14 + see the register read/write/set/unset methods on e1000::Context); |
30 +- Pointcuts are scoped by subsystems which is kinda weird because different | 30 +- Pointcuts are scoped by subsystems which is kinda weird because different |
31 + subsystems are going to share the same pointcuts (i.e: the PCI and USB | 31 + subsystems are going to share the same pointcuts (i.e: the PCI and USB |
32 + susystem are going to expose the same pointcuts that can be used by the | 32 + susystem are going to expose the same pointcuts that can be used by the |
33 + Ethernet subsystem); | 33 + Ethernet subsystem); |
34 +- The compiler adds a & when I try to expand e1000::Context.io_addr regardless | 34 +- The compiler adds a & when I try to expand e1000::Context.io_addr regardless |
35 + of whether the attribute is declared as Builtin::symbol.ref or .scalar. | 35 + of whether the attribute is declared as Builtin::symbol.ref or .scalar; |
36 +- No understanding of arrays, e.g: ${local.self.ring.buffs[local.i].sk_buffs} | |
37 + (I'm not saying this is the right syntax). | |
36 + | 38 + |
37 +Todo/Totry: | 39 +Todo/Totry: |
38 + | 40 + |
39 +- Use the rtx_ether_ctx attribute on AbstractDevice to initialize Device | 41 +- Use the rtx_ether_ctx attribute on AbstractDevice to initialize Device |
40 + objects in ethernet.bl; | 42 + objects in ethernet.bl; |
72 { | 74 { |
73 pushItem to_remove; | 75 pushItem to_remove; |
74 diff --git a/rathaxes/samples/e1000/CMakeLists.txt b/rathaxes/samples/e1000/CMakeLists.txt | 76 diff --git a/rathaxes/samples/e1000/CMakeLists.txt b/rathaxes/samples/e1000/CMakeLists.txt |
75 --- a/rathaxes/samples/e1000/CMakeLists.txt | 77 --- a/rathaxes/samples/e1000/CMakeLists.txt |
76 +++ b/rathaxes/samples/e1000/CMakeLists.txt | 78 +++ b/rathaxes/samples/e1000/CMakeLists.txt |
77 @@ -17,9 +17,9 @@ | 79 @@ -17,8 +17,8 @@ |
78 dma.blt | 80 dma.blt |
79 pci.blt | 81 pci.blt |
80 socket.blt | 82 socket.blt |
81 - e1000.blt | 83 - e1000.blt |
82 - ethernet.blt) | 84 - ethernet.blt) |
83 + ethernet.blt | 85 + ethernet.blt |
84 + e1000.blt) | 86 + e1000.blt) |
85 | 87 |
86 -IF (LINUX_KBUILD_DIR) | 88 IF (LINUX_KBUILD_DIR) |
87 - ADD_RATHAXES_LKM(e1000 e1000_src) | 89 ADD_RATHAXES_LKM(e1000 e1000_src) |
88 -ENDIF (LINUX_KBUILD_DIR) | |
89 +#IF (LINUX_KBUILD_DIR) | |
90 +# ADD_RATHAXES_LKM(e1000 e1000_src) | |
91 +#ENDIF (LINUX_KBUILD_DIR) | |
92 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt | 90 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt |
93 --- a/rathaxes/samples/e1000/e1000.blt | 91 --- a/rathaxes/samples/e1000/e1000.blt |
94 +++ b/rathaxes/samples/e1000/e1000.blt | 92 +++ b/rathaxes/samples/e1000/e1000.blt |
95 @@ -1,564 +1,8 @@ | 93 @@ -1,564 +1,8 @@ |
96 -with e1000, Ethernet, Socket, DMA, PCI, LKM, Log, Builtin | 94 -with e1000, Ethernet, Socket, DMA, PCI, LKM, Log, Builtin |
692 - decl data_types() | 690 - decl data_types() |
693 + decl data_types() | 691 + decl data_types() |
694 { | 692 { |
695 E1000_TXD_DTYP_D = 0x00100000, /* Data Descriptor */ | 693 E1000_TXD_DTYP_D = 0x00100000, /* Data Descriptor */ |
696 E1000_TXD_DTYP_C = 0x00000000, /* Context Descriptor */ | 694 E1000_TXD_DTYP_C = 0x00000000, /* Context Descriptor */ |
697 @@ -701,326 +140,703 @@ | 695 @@ -701,326 +140,721 @@ |
698 } | 696 } |
699 } | 697 } |
700 | 698 |
701 - /* TODO: make that a method of e1000::Context */ | 699 - /* TODO: make that a method of e1000::Context */ |
702 - template sequence e1000::print_status(Ethernet::Device rtx_ether_ctx) | 700 - template sequence e1000::print_status(Ethernet::Device rtx_ether_ctx) |
1014 + chunk Ethernet::adapter_enable_interrupts(Ethernet::Device rtx_ether_ctx) | 1012 + chunk Ethernet::adapter_enable_interrupts(Ethernet::Device rtx_ether_ctx) |
1015 + { | 1013 + { |
1016 + { | 1014 + { |
1017 + ${e1000::Context.ref} hw_ctx = &${rtx_ether_ctx}->hw_ctx; | 1015 + ${e1000::Context.ref} hw_ctx = &${rtx_ether_ctx}->hw_ctx; |
1018 + rtx_e1000_reg_write32( | 1016 + rtx_e1000_reg_write32( |
1019 + hw_ctx, | 1017 + ${local.hw_ctx}, |
1020 + E1000_IMS, | 1018 + E1000_IMS, |
1021 + E1000_INTR_TXDW|E1000_INTR_TXQE|E1000_INTR_LSC| | 1019 + E1000_INTR_TXDW|E1000_INTR_TXQE|E1000_INTR_LSC| |
1022 + E1000_INTR_RXO|E1000_INTR_RXT0 | 1020 + E1000_INTR_RXO|E1000_INTR_RXT0 |
1023 + ); | 1021 + ); |
1024 + | 1022 + |
1025 + // XXX We should probably move that elsewhere (it just used to | 1023 + // XXX We should probably move that elsewhere (it just used to |
1026 + // be done right after we enabled interrupts when this was | 1024 + // be done right after we enabled interrupts when this was |
1027 + // still in lkm.rtx): | 1025 + // still in lkm.rtx): |
1028 + // XXX #46: ${local.hw_ctx.print_status()}; | 1026 + // XXX #46: ${local.hw_ctx.print_status()}; |
1029 + rtx_e1000_print_status(hw_ctx); | 1027 + rtx_e1000_print_status(${local.hw_ctx}); |
1030 + } | 1028 + } |
1031 + } | 1029 + } |
1032 + | 1030 + |
1033 + chunk Ethernet::adapter_disable_interrupts(Ethernet::Device rtx_ether_ctx) | 1031 + chunk Ethernet::adapter_disable_interrupts(Ethernet::Device rtx_ether_ctx) |
1034 + { | 1032 + { |
1078 + { ${Log::info("adapter_disable_tx: TBD..")}; } | 1076 + { ${Log::info("adapter_disable_tx: TBD..")}; } |
1079 + } | 1077 + } |
1080 + | 1078 + |
1081 + chunk Ethernet::adapter_free_rx_tx(Ethernet::Device rtx_ether_ctx) | 1079 + chunk Ethernet::adapter_free_rx_tx(Ethernet::Device rtx_ether_ctx) |
1082 + { | 1080 + { |
1081 + ${e1000::Context.ref} hw_ctx = &${rtx_ether_ctx}->hw_ctx; | |
1082 + | |
1083 + { ${Log::info("adapter_free_rx_tx: TBD..")}; } | 1083 + { ${Log::info("adapter_free_rx_tx: TBD..")}; } |
1084 + | |
1085 + rtx_e1000_rx_ring_free_resources(${local.hw_ctx.rx_ring}); | |
1086 + rtx_e1000_tx_ring_free_ressources(${local.hw_ctx.tx_ring}); | |
1084 + } | 1087 + } |
1085 + | 1088 + |
1086 + method print_status() | 1089 + method print_status() |
1087 + { | 1090 + { |
1088 + rtx_e1000_print_status(${self}); | 1091 + rtx_e1000_print_status(${self}); |
1192 + chunk LKM::code() | 1195 + chunk LKM::code() |
1193 + { | 1196 + { |
1194 + static int rtx_e1000_rx_ring_alloc_resources(${e1000::RxRing.ref} self) | 1197 + static int rtx_e1000_rx_ring_alloc_resources(${e1000::RxRing.ref} self) |
1195 { | 1198 { |
1196 - iowrite32(value, ctx->ioaddr + reg_offset); | 1199 - iowrite32(value, ctx->ioaddr + reg_offset); |
1197 + // XXX Reread & Fix everything down there (data structure changes and so on) | |
1198 + | |
1199 + // 4. Setup the receive descriptor ring | 1200 + // 4. Setup the receive descriptor ring |
1200 + | 1201 + |
1201 + int i; | 1202 + int i; |
1202 + | 1203 + |
1203 + // Allocate the descriptors | 1204 + // Allocate the descriptors |
1209 + if (!${local.self.descs}) { | 1210 + if (!${local.self.descs}) { |
1210 + ${Log::info("adapter_init_rx: cannot allocate the descriptors for the rx ring")}; | 1211 + ${Log::info("adapter_init_rx: cannot allocate the descriptors for the rx ring")}; |
1211 + goto err_rx_ring_alloc; | 1212 + goto err_rx_ring_alloc; |
1212 + } | 1213 + } |
1213 + | 1214 + |
1214 + // XXX The generated code is completely scrambled if this is | 1215 + // XXX The generated code is totally wrong if this is not scoped: |
1215 + // not scoped: | |
1216 + { ${Log::info("adapter_init_rx: rx descriptors allocated")}; } | 1216 + { ${Log::info("adapter_init_rx: rx descriptors allocated")}; } |
1217 + | 1217 + |
1218 + // Allocate the skbuffs, map them for DMA, and write their address | 1218 + // Allocate the skbuffs, map them for DMA, and write their address |
1219 + // in the corresponding descriptor. | 1219 + // in the corresponding descriptor. |
1220 +// for (i = 0; i != ${config.rx_ring_size}; ++i) { | 1220 + for (i = 0; i != ${config.rx_ring_size}; ++i) { |
1221 +// ${Socket::SKBuff.ref} skbuff = &hw_ctx->rx_ring.skbuffs[i]; | 1221 + // XXX No support for arrays: |
1222 +// // XXX #46: ${rtx_ether_ctx.alloc_rx_skbuff(local.skbuff, config.rx_buffer_len)}; | 1222 + ${e1000::Buffer.ref} buff = &${local.self.buffs}[i]; |
1223 +// if (rtx_ethernet_alloc_rx_skbuff(ocal.skbuff, ${config.rx_buffer_len})) { | 1223 + // XXX #46: ${rtx_ether_ctx.alloc_rx_skbuff(local.buff.skbuff, config.rx_buffer_len)}; |
1224 +// ${Log::info("adapter_init_rx: cannot allocate a skbuff for the rx ring")}; | 1224 + if (rtx_ethernet_alloc_rx_skbuff(&${local.buff.sk_buff}, ${config.rx_buffer_len})) { |
1225 +// goto err_skbuffs_alloc; | 1225 + ${Log::info("adapter_init_rx: cannot allocate a skbuff for the rx ring")}; |
1226 +// } | 1226 + goto err_skbuffs_alloc; |
1227 +// /* TODO: recuperer le dma handle et le placer correctement dans le descripteur. */ | 1227 + } |
1228 +// ${DMA::map(rtx_ether_ctx.device, local.skbuff.data, local.skbuff.len, RTX_DMA_FROM_DEVICE)} | 1228 + // XXX I couldn't manage to get this call working: |
1229 +// if (${DMA::map(rtx_ether_ctx.device, local.skbuff.data, local.skbuff.len, RTX_DMA_FROM_DEVICE)}) { | 1229 + //${local.buff.dma.dma_handle} = ${DMA::map( |
1230 +// ${Log::info("adapter_init_rx: cannot dma-map a skbuff for the rx ring")}; | 1230 + // local.self.hw_ctx.net_dev.device, local.buff.sk_buff.data, |
1231 +// goto err_skbuffs_map; | 1231 + // config.rx_buffer_len, RTX_DMA_FROM_DEVICE |
1232 +// } | 1232 + //)}; |
1233 +// hw_ctx->rx_ring.base[i].buff_addr = cpu_to_le64(${local.skbuff.sk_buff}); | 1233 + ${local.buff.dma.dma_handle.k_dma_handle} = dma_map_single( |
1234 +// } | 1234 + ${local.self.hw_ctx.net_dev.device.k_device}, ${local.buff.sk_buff.data}, |
1235 + | 1235 + ${config.rx_buffer_len}, RTX_DMA_FROM_DEVICE |
1236 + // ${Log::info("adapter_init_rx: skbuffs allocated}; | 1236 + ); |
1237 + pr_info("rtx_e1k: adapter_init_rx: skbuffs allocated, headlen=%d", skb_headlen((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i - 1].skbuff)); | 1237 + int err = ${DMA::mapping_error( |
1238 + local.self.hw_ctx.net_dev.device, local.buff.dma.dma_handle | |
1239 + )}; | |
1240 + if (err) { | |
1241 + ${Log::info("adapter_init_rx: cannot dma-map a skbuff for the rx ring")}; | |
1242 + goto err_skbuffs_map; | |
1243 + } | |
1244 + ${local.self.descs}[i].buff_addr = cpu_to_le64(${local.buff.dma.dma_handle.k_dma_handle}); | |
1245 + } | |
1246 + | |
1247 + { ${Log::info("adapter_init_rx: skbuffs allocated")}; } | |
1248 + | |
1249 + return 0; | |
1238 + | 1250 + |
1239 + err_skbuffs_alloc: | 1251 + err_skbuffs_alloc: |
1240 + while (i--) { | 1252 + while (i--) { |
1241 +// XXX ${DMA::unmap( | 1253 + ${e1000::Buffer.ref} buff = &${local.self.buffs}[i]; |
1242 +// local.self.hw_ctx.net_dev.device, | 1254 + // XXX I couldn't manage to get this call working |
1243 +// // XXX Leaking cast because of the array: (TODO: the data structure changed) | 1255 + //${DMA::unmap( |
1244 +// *((dma_addr_t *)&(self->buffs[i].dma_handle)), | 1256 + // local.self.hw_ctx.net_dev.device, |
1245 +// config.rx_buffer_len, | 1257 + // local.buff.dma.dma_handle, |
1246 +// RTX_DMA_FROM_DEVICE | 1258 + // config.rx_buffer_len, |
1247 +// )}; | 1259 + // RTX_DMA_FROM_DEVICE |
1260 + //)}; | |
1261 + dma_unmap_single( | |
1262 + ${local.self.hw_ctx.net_dev.device.k_device}, | |
1263 + ${local.buff.dma.dma_handle.k_dma_handle}, | |
1264 + ${config.rx_buffer_len}, | |
1265 + RTX_DMA_FROM_DEVICE | |
1266 + ); | |
1248 + err_skbuffs_map: | 1267 + err_skbuffs_map: |
1249 + // XXX leaking cast: (TODO: the data structure changed) | 1268 + // XXX #46: ${local.buff.sk_buff.free()}; |
1250 + dev_kfree_skb((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i].skbuff); | 1269 + dev_kfree_skb(${local.buff.sk_buff.sk_buff.k_sk_buff}); |
1251 + } | 1270 + } |
1252 + | 1271 + |
1253 + void *descs = ${local.self.descs}; | 1272 + void *descs = ${local.self.descs}; |
1254 + ${cast local.descs as Builtin::symbol.ref}; | 1273 + ${cast local.descs as Builtin::symbol.ref}; |
1255 + ${DMA::free_coherent( | 1274 + ${DMA::free_coherent( |
1265 + ${Log::info("e1000_rx_ring_free_resources: TBD...")}; | 1284 + ${Log::info("e1000_rx_ring_free_resources: TBD...")}; |
1266 + } | 1285 + } |
1267 + | 1286 + |
1268 + static void rtx_e1000_rx_ring_configure(${e1000::RxRing.ref} self) | 1287 + static void rtx_e1000_rx_ring_configure(${e1000::RxRing.ref} self) |
1269 + { | 1288 + { |
1270 + // XXX Reread & Fix everything down there (data structure changes and so on) | |
1271 + | |
1272 + // Receive initialization (section 14.4): | 1289 + // Receive initialization (section 14.4): |
1273 + // | 1290 + // |
1274 + // 1. Program the receive address, in RAL/RAH; | 1291 + // 1. Program the receive address, in RAL/RAH; |
1275 + // 2. Initialize the Multicast Table Array; | 1292 + // 2. Initialize the Multicast Table Array; |
1276 + // 3. Program the interrupt mask register (done in | 1293 + // 3. Program the interrupt mask register (done in |
1314 + ${Log::info("rx_ring_configure: MTA init done")}; | 1331 + ${Log::info("rx_ring_configure: MTA init done")}; |
1315 + | 1332 + |
1316 + // 5. Save the emplacement and the size of the ring in RDBA/RDLEN | 1333 + // 5. Save the emplacement and the size of the ring in RDBA/RDLEN |
1317 + rtx_e1000_reg_write32( | 1334 + rtx_e1000_reg_write32( |
1318 + ${local.self.hw_ctx}, E1000_RDBAL, | 1335 + ${local.self.hw_ctx}, E1000_RDBAL, |
1319 + ${local.self.hw_ctx}->rx_ring.dma_base & 0xffffffff | 1336 + ${local.self.dma.dma_handle.k_dma_handle} & 0xffffffff |
1320 + ); | 1337 + ); |
1321 + rtx_e1000_reg_write32( | 1338 + rtx_e1000_reg_write32( |
1322 + ${local.self.hw_ctx}, E1000_RDBAH, | 1339 + ${local.self.hw_ctx}, E1000_RDBAH, |
1323 + ${local.self.hw_ctx}->rx_ring.dma_base >> 32 | 1340 + ${local.self.dma.dma_handle.k_dma_handle} >> 32 |
1324 + ); | 1341 + ); |
1325 + rtx_e1000_reg_write32( | 1342 + rtx_e1000_reg_write32( |
1326 + ${local.self.hw_ctx}, E1000_RDLEN, | 1343 + ${local.self.hw_ctx}, E1000_RDLEN, |
1327 + ${local.self.hw_ctx}->rx_ring.size | 1344 + ${local.self.size} |
1328 + ); | 1345 + ); |
1329 + | 1346 + |
1330 + // 6. Setup RDH/RDT | 1347 + // 6. Setup RDH/RDT |
1331 + rtx_e1000_reg_write32(${local.self.hw_ctx}, E1000_RDH, 0); | 1348 + rtx_e1000_reg_write32(${local.self.hw_ctx}, E1000_RDH, 0); |
1332 + rtx_e1000_reg_write32( | 1349 + rtx_e1000_reg_write32( |
1418 + ${Log::info("e1000_tx_ring_free_resources: TBD...")}; | 1435 + ${Log::info("e1000_tx_ring_free_resources: TBD...")}; |
1419 + } | 1436 + } |
1420 + | 1437 + |
1421 + static void rtx_e1000_tx_ring_configure(${e1000::TxRing.ref} self) | 1438 + static void rtx_e1000_tx_ring_configure(${e1000::TxRing.ref} self) |
1422 + { | 1439 + { |
1423 + // return ; XXX wtf fails with: | 1440 + ${Log::info("e1000_tx_ring_configure: TBD...")}; |
1424 + // function 'rtxPH_compile(local_node : node, compile : node, node_idx : value)' hasn't been implemented | |
1425 } | 1441 } |
1426 } | 1442 } |
1427 | 1443 |
1428 - chunk ::CALL() | 1444 - chunk ::CALL() |
1429 + method init(e1000::Context hw_ctx, Builtin::number desc_count) | 1445 + method init(e1000::Context hw_ctx, Builtin::number desc_count) |
1681 decl data_types(); | 1697 decl data_types(); |
1682 - method init(); | 1698 - method init(); |
1683 + | 1699 + |
1684 + method init(Socket::SKBuff, DMA::DMAHandle); | 1700 + method init(Socket::SKBuff, DMA::DMAHandle); |
1685 + | 1701 + |
1686 + attribute Socket::SKBuff.ref sk_buff; | 1702 + attribute Socket::SKBuff.scalar sk_buff; |
1687 + attribute DMA::DMAHandle.ref dma; | 1703 + attribute DMA::DMAHandle.scalar dma; |
1688 } | 1704 } |
1689 | 1705 |
1690 - provided type TxDescriptor | 1706 - provided type TxDescriptor |
1691 + provided type Context | 1707 + provided type Context |
1692 { | 1708 { |
2688 - static int rtx_socket_skbuff_map(${Socket::SKBuff.ref}, ${Device::AbstractDevice.ref}, ${DMA::DMADirection.scalar}); | 2704 - static int rtx_socket_skbuff_map(${Socket::SKBuff.ref}, ${Device::AbstractDevice.ref}, ${DMA::DMADirection.scalar}); |
2689 - static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff.ref}, ${Device::AbstractDevice.ref}, ${DMA::DMADirection.scalar}); | 2705 - static void rtx_socket_skbuff_unmap_and_free(${Socket::SKBuff.ref}, ${Device::AbstractDevice.ref}, ${DMA::DMADirection.scalar}); |
2690 } | 2706 } |
2691 | 2707 |
2692 chunk LKM::code() | 2708 chunk LKM::code() |
2693 @@ -52,98 +48,29 @@ | 2709 @@ -52,96 +48,32 @@ |
2694 * arguments yet. | 2710 * arguments yet. |
2695 */ | 2711 */ |
2696 pr_info( | 2712 pr_info( |
2697 - "\t protocol = %#-5x (%s) ip_summed = %d (%s)\n" | 2713 - "\t protocol = %#-5x (%s) ip_summed = %d (%s)\n" |
2698 - "\t len = %-5u data_len = %-5u head_len = %-5u\n" | 2714 - "\t len = %-5u data_len = %-5u head_len = %-5u\n" |
2777 { | 2793 { |
2778 rtx_socket_skbuff_dump_infos(${self}); | 2794 rtx_socket_skbuff_dump_infos(${self}); |
2779 } | 2795 } |
2780 | 2796 |
2781 - method map_to(Device::AbstractDevice dev) | 2797 - method map_to(Device::AbstractDevice dev) |
2782 - { | 2798 + method free() |
2799 { | |
2783 - rtx_socket_skbuff_map(${self}, ${dev}, RTX_DMA_TO_DEVICE); | 2800 - rtx_socket_skbuff_map(${self}, ${dev}, RTX_DMA_TO_DEVICE); |
2784 - } | 2801 - } |
2785 - | 2802 - |
2786 - method map_from(Device::AbstractDevice dev) | 2803 - method map_from(Device::AbstractDevice dev) |
2787 - { | 2804 - { |
2794 - } | 2811 - } |
2795 - | 2812 - |
2796 - method unmap_from_and_free(Device::AbstractDevice dev) | 2813 - method unmap_from_and_free(Device::AbstractDevice dev) |
2797 - { | 2814 - { |
2798 - rtx_socket_skbuff_unmap_and_free(${self}, ${dev}, RTX_DMA_FROM_DEVICE); | 2815 - rtx_socket_skbuff_unmap_and_free(${self}, ${dev}, RTX_DMA_FROM_DEVICE); |
2799 - } | 2816 + dev_kfree_skb(${self.sk_buff.k_sk_buff}); |
2800 - | 2817 } |
2818 | |
2801 map | 2819 map |
2802 { | 2820 @@ -151,13 +83,9 @@ |
2803 // Some work may have to be done here in order to access to some | |
2804 @@ -151,13 +78,9 @@ | |
2805 // management can be abstracted from the user. But this is at least | 2821 // management can be abstracted from the user. But this is at least |
2806 // useful for internal use: | 2822 // useful for internal use: |
2807 sk_buff: (${self})->skbuff; | 2823 sk_buff: (${self})->skbuff; |
2808 - // XXX: We need to cast here so we can do things like | 2824 - // XXX: We need to cast here so we can do things like |
2809 - // var.dma_handle = 0; but the type shouldn't be hardcoded (at the | 2825 - // var.dma_handle = 0; but the type shouldn't be hardcoded (at the |
2811 - // would yield to a struct type which you can't assign directly; | 2827 - // would yield to a struct type which you can't assign directly; |
2812 - // but maybe doing the ->data in that case would be acceptable). | 2828 - // but maybe doing the ->data in that case would be acceptable). |
2813 - dma_handle: (*((dma_addr_t *)&(${self})->dma_handle)); | 2829 - dma_handle: (*((dma_addr_t *)&(${self})->dma_handle)); |
2814 - size: (${self})->size; | 2830 - size: (${self})->size; |
2815 + | 2831 + |
2816 + data: ((struct sk_buff *)((${self})->sk_buff))->data; | 2832 + data: ((struct sk_buff *)((${self})->skbuff))->data; |
2817 + len: ((struct sk_buff *)((${self})->sk_buff))->len; | 2833 + len: ((struct sk_buff *)((${self})->skbuff))->len; |
2818 } | 2834 } |
2819 } | 2835 } |
2820 } | 2836 } |
2821 diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti | 2837 diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti |
2822 --- a/rathaxes/samples/e1000/socket.rti | 2838 --- a/rathaxes/samples/e1000/socket.rti |
2823 +++ b/rathaxes/samples/e1000/socket.rti | 2839 +++ b/rathaxes/samples/e1000/socket.rti |
2824 @@ -12,20 +12,14 @@ | 2840 @@ -12,20 +12,15 @@ |
2825 { | 2841 { |
2826 chunk LKM::prototypes(); | 2842 chunk LKM::prototypes(); |
2827 chunk LKM::code(); | 2843 chunk LKM::code(); |
2828 + | 2844 + |
2829 decl data_types(); | 2845 decl data_types(); |
2837 - */ | 2853 - */ |
2838 - method map_to(Device::AbstractDevice); | 2854 - method map_to(Device::AbstractDevice); |
2839 - method map_from(Device::AbstractDevice); | 2855 - method map_from(Device::AbstractDevice); |
2840 - method unmap_to_and_free(Device::AbstractDevice); | 2856 - method unmap_to_and_free(Device::AbstractDevice); |
2841 - method unmap_from_and_free(Device::AbstractDevice); | 2857 - method unmap_from_and_free(Device::AbstractDevice); |
2858 + method free(); | |
2842 | 2859 |
2843 - attribute Socket::AbstractSKBuff.ref sk_buff; | 2860 - attribute Socket::AbstractSKBuff.ref sk_buff; |
2844 - attribute DMA::AbstractDMAHandle.scalar dma_handle; | 2861 - attribute DMA::AbstractDMAHandle.scalar dma_handle; |
2845 - attribute Builtin::number.scalar size; | 2862 - attribute Builtin::number.scalar size; |
2846 + attribute Socket::AbstractSKBuff.ref sk_buff; | 2863 + attribute Socket::AbstractSKBuff.ref sk_buff; |