tsnep: Inline small fragments within TX descriptor
Subsystems (2)
PATCH 1/1 tsnep: Inline small fragments within TX descriptor
The tsnep network controller is able to extend the descriptor directly with data to be transmitted. In this case no TX data DMA address is necessary. Instead of the TX data DMA address the TX data buffer is placed at the end of the descriptor.
The descriptor is read with a 64 bytes DMA read by the tsnep network controller. If the sum of descriptor data and TX data is less than or equal to 64 bytes, then no additional DMA read is necessary to read the TX data. Therefore, it makes sense to inline small fragments up to this limit within the descriptor ring.
Inlined fragments need to be copied to the descriptor ring. On the other hand DMA mapping is not necessary. At most 40 bytes are copied, so copying should be faster than DMA mapping.
For A53 1.2 GHz copying takes <100ns and DMA mapping takes >200ns. So inlining small fragments should result in lower CPU load. Performance improvement is small. Thus, comparision of CPU load with and without inlining of small fragments did not show any significant difference. With this optimization less DMA reads will be done, which decreases the load of the interconnect.
--- drivers/net/ethernet/engleder/tsnep_hw.h | 2 + drivers/net/ethernet/engleder/tsnep_main.c | 103 +++++++++++++++------ 2 files changed, 79 insertions(+), 26 deletions(-)
drivers/net/ethernet/engleder/tsnep_hw.h +2 -0
@@ -181,6 +181,8 @@ struct tsnep_gcl_operation {#define TSNEP_DESC_SIZE 256#define TSNEP_DESC_SIZE_DATA_AFTER 2048#define TSNEP_DESC_OFFSET 128 +#define TSNEP_DESC_SIZE_DATA_AFTER_INLINE (64 - sizeof(struct tsnep_tx_desc) + \ + sizeof_field(struct tsnep_tx_desc, tx))#define TSNEP_DESC_OWNER_COUNTER_MASK 0xC0000000#define TSNEP_DESC_OWNER_COUNTER_SHIFT 30#define TSNEP_DESC_LENGTH_MASK 0x00003FFF
drivers/net/ethernet/engleder/tsnep_main.c +77 -26
154 lines not on this page · raw message
Signature · 1 line
2.30.2
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 5 lines · On Wed, 11 Oct 2023 20:21:54 +0200 you wrote:
The tsnep network controller is able to extend the descriptor directly with data to be transmitted. In this case no TX data DMA address is necessary. Instead of the TX data DMA address the TX data buffer is placed at the end of the descriptor.
Quoted 7 lines
The descriptor is read with a 64 bytes DMA read by the tsnep network controller. If the sum of descriptor data and TX data is less than or equal to 64 bytes, then no additional DMA read is necessary to read the TX data. Therefore, it makes sense to inline small fragments up to this limit within the descriptor ring.
[...]
Here is the summary with links:
- [net-next] tsnep: Inline small fragments within TX descriptor
https://git.kernel.org/netdev/net-next/c/dccce1d7c040
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html