mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
os: explicit cache policy in Nic::Session_component
To enable the use of uncached DMA buffers as RX and TX communication buffers in between driver (service) and client, introduce a cache attribute in the constructor of Nic::Session_component Ref #3291
This commit is contained in:
parent
0b9916cae2
commit
c767f6ccf1
@ -104,7 +104,8 @@ class Ipxe_session_component : public Nic::Session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env)
|
||||
: Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env)
|
||||
{
|
||||
instance = this;
|
||||
|
||||
|
@ -174,7 +174,8 @@ Session_component::Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::Allocator & rx_block_md_alloc,
|
||||
Genode::Env & env,
|
||||
Genode::Session_label label)
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env),
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env),
|
||||
_ndev(_register_session_component(*this, label)),
|
||||
_has_link(_ndev ? !(_ndev->state & (1UL << __LINK_STATE_NOCARRIER)) : false)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ Session_component::Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::Allocator & rx_block_md_alloc,
|
||||
Genode::Env & env,
|
||||
Genode::Session_label label)
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env),
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, Genode::CACHED, rx_block_md_alloc, env),
|
||||
_ndev(_register_session_component(*this, label)),
|
||||
_has_link(_ndev ? !(_ndev->state & (1UL << __LINK_STATE_NOCARRIER)) : false)
|
||||
{
|
||||
|
@ -188,7 +188,8 @@ class Usb_nic::Session_component : public Nic::Session_component
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env,
|
||||
Device *device)
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env),
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env),
|
||||
_device(device)
|
||||
{ _device->session(this); }
|
||||
|
||||
|
@ -181,7 +181,8 @@ class Wifi_session_component : public Nic::Session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env, net_device *ndev)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env),
|
||||
: Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env),
|
||||
_ndev(ndev)
|
||||
{
|
||||
_ndev->lx_nic_device = this;
|
||||
|
@ -34,15 +34,16 @@ class Nic::Communication_buffers
|
||||
Nic::Packet_allocator _rx_packet_alloc;
|
||||
Genode::Attached_ram_dataspace _tx_ds, _rx_ds;
|
||||
|
||||
Communication_buffers(Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_allocator &ram,
|
||||
Genode::Region_map ®ion_map,
|
||||
Genode::size_t tx_size,
|
||||
Genode::size_t rx_size)
|
||||
Communication_buffers(Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_allocator &ram,
|
||||
Genode::Region_map ®ion_map,
|
||||
Genode::size_t tx_size,
|
||||
Genode::size_t rx_size,
|
||||
Genode::Cache_attribute cache_policy)
|
||||
:
|
||||
_rx_packet_alloc(&rx_block_md_alloc),
|
||||
_tx_ds(ram, region_map, tx_size),
|
||||
_rx_ds(ram, region_map, rx_size)
|
||||
_tx_ds(ram, region_map, tx_size, cache_policy),
|
||||
_rx_ds(ram, region_map, rx_size, cache_policy)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -91,13 +92,14 @@ class Nic::Session_component : Communication_buffers, public Session_rpc_object
|
||||
* resources and open connections from
|
||||
* within the Session_component
|
||||
*/
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Cache_attribute cache_policy,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
:
|
||||
Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(),
|
||||
tx_buf_size, rx_buf_size),
|
||||
tx_buf_size, rx_buf_size, cache_policy),
|
||||
Session_rpc_object(env.rm(),
|
||||
_tx_ds.cap(),
|
||||
_rx_ds.cap(),
|
||||
@ -123,14 +125,15 @@ class Nic::Session_component : Communication_buffers, public Session_rpc_object
|
||||
* within the Session_component
|
||||
* \param ep entrypoint for RPC
|
||||
*/
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env,
|
||||
Genode::Entrypoint &ep)
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Cache_attribute cache_policy,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env,
|
||||
Genode::Entrypoint &ep)
|
||||
:
|
||||
Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(),
|
||||
tx_buf_size, rx_buf_size),
|
||||
tx_buf_size, rx_buf_size, cache_policy),
|
||||
Session_rpc_object(env.rm(),
|
||||
_tx_ds.cap(),
|
||||
_rx_ds.cap(),
|
||||
|
@ -208,7 +208,7 @@ class Linux_session_component : public Nic::Session_component
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Server::Env &env)
|
||||
:
|
||||
Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env),
|
||||
Session_component(tx_buf_size, rx_buf_size, Genode::CACHED, rx_block_md_alloc, env),
|
||||
_config_rom(env, "config"),
|
||||
_tap_fd(_setup_tap_fd()), _rx_thread(env, _tap_fd, _packet_stream_dispatcher)
|
||||
{
|
||||
|
@ -309,7 +309,8 @@ class Lan9118 : public Nic::Session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env),
|
||||
: Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env),
|
||||
_mmio(env, mmio_base, mmio_size),
|
||||
_reg_base(_mmio.local_addr<Genode::uint32_t>()),
|
||||
_timer(env),
|
||||
|
@ -598,7 +598,8 @@ namespace Genode
|
||||
addr_t const base, size_t const size, const int irq)
|
||||
:
|
||||
Genode::Attached_mmio(env, base, size),
|
||||
Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env),
|
||||
Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env),
|
||||
_timer(env),
|
||||
_sys_ctrl(env, _timer),
|
||||
_tx_buffer(env, *_tx.sink(), _timer),
|
||||
|
@ -47,8 +47,8 @@ class Nic_loopback::Session_component : public Nic::Session_component
|
||||
Allocator &rx_block_md_alloc,
|
||||
Env &env)
|
||||
:
|
||||
Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
env)
|
||||
Nic::Session_component(tx_buf_size, rx_buf_size, CACHED,
|
||||
rx_block_md_alloc, env)
|
||||
{ }
|
||||
|
||||
Nic::Mac_address mac_address() override
|
||||
|
@ -134,7 +134,8 @@ class Openvpn_component : public Tuntap_device,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, env)
|
||||
: Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env)
|
||||
{
|
||||
char buf[] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x01 };
|
||||
_mac_addr = Nic::Mac_address((void*)buf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user