# HG changeset patch # User Louis Opter # Date 1374966520 25200 # Node ID 6f600f83a7637655b6892217adde91c5dc02e117 # Parent cbd9b9a49b6377a47538c00966641606b31d2544 WIP, fix Ethernet::Device::alloc_rx_skbuff diff -r cbd9b9a49b63 -r 6f600f83a763 rathaxes_samples_e1000_add_alloc_sequences_in_socket.patch --- a/rathaxes_samples_e1000_add_alloc_sequences_in_socket.patch Fri Jul 26 21:06:45 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -# HG changeset patch -# Parent e06ebc5e25f35ad135ab454c3f157698e00e69ac -rathaxes: add an alloc_rx_skbuff method to Ethernet::Device in e1000 - -This will help to hide platform dependent code from -e1000::set_up_device. - -diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt ---- a/rathaxes/samples/e1000/e1000.blt -+++ b/rathaxes/samples/e1000/e1000.blt -@@ -752,8 +752,10 @@ - */ - for (i = 0; i != ${config.rx_ring_size}; ++i) - { -+ /* XXX #46: */ -+ // hw_ctx->rx_ring.skbuffs[i].skbuff = ${rtx_ether_ctx.net_device.alloc_rx_skb(${config.rx_buffer_len})}; - hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*)netdev_alloc_skb( -- ${rtx_ether_ctx.net_device.k_net_dev}, /* XXX: .k_net_dev isn't expanded here */ -+ ${rtx_ether_ctx.net_device.k_net_dev}, - ${config.rx_buffer_len}); - if (!hw_ctx->rx_ring.skbuffs[i].skbuff) - { -diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt ---- a/rathaxes/samples/e1000/ethernet.blt -+++ b/rathaxes/samples/e1000/ethernet.blt -@@ -107,6 +107,13 @@ - ${self}->net_dev = ${rtx_net_dev}; - } - -+ /* -+ method alloc_rx_skbuff(Builtin::number size) -+ { -+ ($(Socket::Skbuff.ref})netdev_alloc_skb(${self}, ${size}); -+ } -+ */ -+ - map - { - /* -diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti ---- a/rathaxes/samples/e1000/ethernet.rti -+++ b/rathaxes/samples/e1000/ethernet.rti -@@ -30,8 +30,10 @@ - { - chunk LKM::includes(); - decl data_types(); -+ pointcut Ethernet::HardwareContext(); -+ - method init(Ethernet::AbstractDevice, PCI::AbstractDevice); -- pointcut Ethernet::HardwareContext(); -+ //method alloc_rx_skbuff(Builtin::number); /* -> Socket::Skbuff.ref */ - - attribute Device::AbstractDevice.ref device; - attribute PCI::AbstractDevice.ref pci_device; -diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti ---- a/rathaxes/samples/e1000/socket.rti -+++ b/rathaxes/samples/e1000/socket.rti -@@ -1,4 +1,4 @@ --interface Socket : LKM, Device, DMA -+interface Socket : LKM, Device, DMA, Builtin - { - /* The SKBuff type from the kernel */ - provided type AbstractSKBuff -@@ -10,15 +10,15 @@ - - provided type SKBuff - { -- chunk LKM::prototypes(); -- chunk LKM::code(); -- decl data_types(); -- method init(Socket::AbstractSKBuff); -- method dump_infos(); -- method map_to(Device::AbstractDevice); -- method map_from(Device::AbstractDevice); -- method unmap_to_and_free(Device::AbstractDevice); -- method unmap_from_and_free(Device::AbstractDevice); -+ chunk LKM::prototypes(); -+ chunk LKM::code(); -+ decl data_types(); -+ method init(Socket::AbstractSKBuff); -+ method dump_infos(); -+ method map_to(Device::AbstractDevice); -+ method map_from(Device::AbstractDevice); -+ method unmap_to_and_free(Device::AbstractDevice); -+ method unmap_from_and_free(Device::AbstractDevice); - - attribute Socket::AbstractSKBuff.ref sk_buff; - attribute DMA::AbstractDMAHandle.scalar dma_handle; diff -r cbd9b9a49b63 -r 6f600f83a763 rathaxes_samples_e1000_add_ethernet_device_alloc_rx_skbuff.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rathaxes_samples_e1000_add_ethernet_device_alloc_rx_skbuff.patch Sat Jul 27 16:08:40 2013 -0700 @@ -0,0 +1,36 @@ +# HG changeset patch +# Parent 41459510ac5d22377872c977cbd635f93623c75e +rathaxes: add an alloc_rx_skbuff method to Ethernet::Device in e1000 + +This will help to hide platform dependent code from e1000::set_up_device. + +diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt +--- a/rathaxes/samples/e1000/ethernet.blt ++++ b/rathaxes/samples/e1000/ethernet.blt +@@ -107,6 +107,11 @@ + ${self}->net_dev = ${rtx_net_dev}; + } + ++ method alloc_rx_skbuff(Builtin::number size) ++ { ++ (${Socket::Skbuff.ref})netdev_alloc_skb(${self}, ${size}); ++ } ++ + map + { + /* +diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti +--- a/rathaxes/samples/e1000/ethernet.rti ++++ b/rathaxes/samples/e1000/ethernet.rti +@@ -30,8 +30,10 @@ + { + chunk LKM::includes(); + decl data_types(); ++ pointcut Ethernet::HardwareContext(); ++ + method init(Ethernet::AbstractDevice, PCI::AbstractDevice); +- pointcut Ethernet::HardwareContext(); ++ method alloc_rx_skbuff(Builtin::number); /* -> Socket::Skbuff.ref */ + + attribute Device::AbstractDevice.ref device; + attribute PCI::AbstractDevice.ref pci_device; diff -r cbd9b9a49b63 -r 6f600f83a763 rathaxes_samples_e1000_split_set_up_device.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rathaxes_samples_e1000_split_set_up_device.patch Sat Jul 27 16:08:40 2013 -0700 @@ -0,0 +1,20 @@ +# HG changeset patch +# Parent 069883bfa2ec71faaf7ab957bc35db087eacc3cc +rathaxes: split and refactor e1000::set_up_device in {Rx,Tx}Ring methods + + +diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt +--- a/rathaxes/samples/e1000/e1000.blt ++++ b/rathaxes/samples/e1000/e1000.blt +@@ -752,8 +752,10 @@ + */ + for (i = 0; i != ${config.rx_ring_size}; ++i) + { ++ /* XXX #46: */ ++ // hw_ctx->rx_ring.skbuffs[i].skbuff = ${rtx_ether_ctx.net_device.alloc_rx_skb(${config.rx_buffer_len})}; + hw_ctx->rx_ring.skbuffs[i].skbuff = (${Socket::AbstractSKBuff}*)netdev_alloc_skb( +- ${rtx_ether_ctx.net_device.k_net_dev}, /* XXX: .k_net_dev isn't expanded here */ ++ ${rtx_ether_ctx.net_device.k_net_dev}, + ${config.rx_buffer_len}); + if (!hw_ctx->rx_ring.skbuffs[i].skbuff) + { diff -r cbd9b9a49b63 -r 6f600f83a763 rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch --- a/rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch Fri Jul 26 21:06:45 2013 -0700 +++ b/rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch Sat Jul 27 16:08:40 2013 -0700 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent 8f0f99a85db3d5b034644962b33352a04c4eda59 +# Parent 4b0b03bb17b3c70e333fb3c637e199669a792b30 rathaxes: abstract away netdev_alloc_skb() from e1000::set_up_device By adding a new method to Ethernet::Device. @@ -206,14 +206,32 @@ +++ b/rathaxes/samples/e1000/socket.rti @@ -1,4 +1,4 @@ -interface Socket : LKM, Device -+interface Socket : LKM, Device, DMA ++interface Socket : LKM, Device, DMA, Builtin { /* The SKBuff type from the kernel */ provided type AbstractSKBuff -@@ -19,5 +19,8 @@ - method map_from(Device::AbstractDevice); - method unmap_to_and_free(Device::AbstractDevice); - method unmap_from_and_free(Device::AbstractDevice); +@@ -10,14 +10,17 @@ + + provided type SKBuff + { +- chunk LKM::prototypes(); +- chunk LKM::code(); +- decl data_types(); +- method init(Socket::AbstractSKBuff); +- method dump_infos(); +- method map_to(Device::AbstractDevice); +- method map_from(Device::AbstractDevice); +- method unmap_to_and_free(Device::AbstractDevice); +- method unmap_from_and_free(Device::AbstractDevice); ++ chunk LKM::prototypes(); ++ chunk LKM::code(); ++ decl data_types(); ++ method init(Socket::AbstractSKBuff); ++ method dump_infos(); ++ method map_to(Device::AbstractDevice); ++ method map_from(Device::AbstractDevice); ++ method unmap_to_and_free(Device::AbstractDevice); ++ method unmap_from_and_free(Device::AbstractDevice); + + attribute Socket::AbstractSKBuff.ref sk_buff; + attribute DMA::AbstractDMAHandle.scalar dma_handle; diff -r cbd9b9a49b63 -r 6f600f83a763 series --- a/series Fri Jul 26 21:06:45 2013 -0700 +++ b/series Sat Jul 27 16:08:40 2013 -0700 @@ -4,4 +4,5 @@ rathaxes_compiler_passes_hack_injection_of_chunks_into_rvalues.patch rathaxes_samples_e1000_add_a_dma_abstraction.patch rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch -rathaxes_samples_e1000_add_alloc_sequences_in_socket.patch +rathaxes_samples_e1000_add_ethernet_device_alloc_rx_skbuff.patch +rathaxes_samples_e1000_split_set_up_device.patch