mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-21 00:23:16 +00:00
block_session: server-defined payload alignment
This patch replaces the formerly fixed 2 KiB data alignment within the packet-stream buffer by a server-defined alignment. This has two benefits. First, when using block servers that provide small block sizes like 512 bytes, we avoid fragmenting the packet-stream buffer, which occurs when aligning 512-byte requests at 2 KiB boundaries. This reduces meta data costs for the packet-stream allocator and also allows fitting more requests into the buffer. Second, block drivers with alignment constraints dictated by the hardware can now pass those constraints to the client, thereby easing the use of zero-copy DMA directly into the packet stream. The alignment is determined by the Block::Session_client at construction time and applied by the Block::Session_client::alloc_packet method. Block-session clients should always use this method, not the 'alloc_packet' method of the packet stream (tx source) directly. The latter merely applies a default alignment of 2 KiB. At the server side, the alignment is automatically checked by block/component.h (old API) and block/request_stream.h (new API). Issue #3274
This commit is contained in:
committed by
Christian Helmuth
parent
2208220c12
commit
bbe3ee8dc5
@ -220,6 +220,7 @@ class Block::Session_component : public Block::Session_rpc_object,
|
||||
{
|
||||
return Info { .block_size = _driver.blk_size(),
|
||||
.block_count = _partition->sectors,
|
||||
.align_log2 = Genode::log2(_driver.blk_size()),
|
||||
.writeable = _writeable && _driver.writeable() };
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ class Block::Driver
|
||||
? Block::Packet_descriptor::WRITE
|
||||
: Block::Packet_descriptor::READ;
|
||||
Genode::size_t const size = _info.block_size * cnt;
|
||||
Packet_descriptor p(_session.dma_alloc_packet(size),
|
||||
Packet_descriptor p(_session.alloc_packet(size),
|
||||
op, nr, cnt);
|
||||
Request *r = new (&_r_slab) Request(dispatcher, cli, p);
|
||||
_r_list.insert(r);
|
||||
|
@ -54,7 +54,7 @@ struct Block::Partition_table : Genode::Interface
|
||||
unsigned long count,
|
||||
bool write = false)
|
||||
: _session(driver.session()),
|
||||
_p(_session.dma_alloc_packet(driver.blk_size() * count),
|
||||
_p(_session.alloc_packet(driver.blk_size() * count),
|
||||
write ? Packet_descriptor::WRITE : Packet_descriptor::READ,
|
||||
blk_nr, count)
|
||||
{
|
||||
|
Reference in New Issue
Block a user