zynq: improve cache handling in nic_drv
Clean and invalidate caches in nic_drv before/after triggering DMA. Issue #3179
This commit is contained in:
parent
1d0a1e7937
commit
c1caeb7e70
|
@ -75,6 +75,9 @@ class Nic::Session_component : Communication_buffers, public Session_rpc_object
|
||||||
Genode::Signal_handler<Session_component> _packet_stream_dispatcher {
|
Genode::Signal_handler<Session_component> _packet_stream_dispatcher {
|
||||||
_ep, *this, &Session_component::_dispatch };
|
_ep, *this, &Session_component::_dispatch };
|
||||||
|
|
||||||
|
using Communication_buffers::_tx_ds;
|
||||||
|
using Communication_buffers::_rx_ds;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "rx_buffer_descriptor.h"
|
#include "rx_buffer_descriptor.h"
|
||||||
#include "marvell_phy.h"
|
#include "marvell_phy.h"
|
||||||
|
|
||||||
|
#include <kernel/interface.h>
|
||||||
|
|
||||||
namespace Genode
|
namespace Genode
|
||||||
{
|
{
|
||||||
|
@ -339,10 +340,13 @@ namespace Genode
|
||||||
Genode::Signal_handler<Cadence_gem> _irq_handler;
|
Genode::Signal_handler<Cadence_gem> _irq_handler;
|
||||||
Marvel_phy _phy;
|
Marvel_phy _phy;
|
||||||
|
|
||||||
|
addr_t _rx_buf_region;
|
||||||
|
addr_t _tx_buf_region;
|
||||||
|
size_t _rx_buf_size;
|
||||||
|
size_t _tx_buf_size;
|
||||||
|
|
||||||
void _init()
|
void _init()
|
||||||
{
|
{
|
||||||
// TODO checksum offloading and pause frames
|
|
||||||
/* see 16.3.2 Configure the Controller */
|
/* see 16.3.2 Configure the Controller */
|
||||||
|
|
||||||
/* 1. Program the Network Configuration register (gem.net_cfg) */
|
/* 1. Program the Network Configuration register (gem.net_cfg) */
|
||||||
|
@ -482,6 +486,16 @@ namespace Genode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _invalidate_rx_buffers()
|
||||||
|
{
|
||||||
|
Kernel::update_data_region(_rx_buf_region, _rx_buf_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _clean_tx_buffers()
|
||||||
|
{
|
||||||
|
Kernel::update_data_region(_tx_buf_region, _tx_buf_size);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void _handle_irq()
|
virtual void _handle_irq()
|
||||||
{
|
{
|
||||||
/* 16.3.9 Receiving Frames */
|
/* 16.3.9 Receiving Frames */
|
||||||
|
@ -489,6 +503,8 @@ namespace Genode
|
||||||
const Interrupt_status::access_t status = read<Interrupt_status>();
|
const Interrupt_status::access_t status = read<Interrupt_status>();
|
||||||
const Rx_status::access_t rxStatus = read<Rx_status>();
|
const Rx_status::access_t rxStatus = read<Rx_status>();
|
||||||
|
|
||||||
|
_invalidate_rx_buffers();
|
||||||
|
|
||||||
if ( Interrupt_status::Rx_complete::get(status) ) {
|
if ( Interrupt_status::Rx_complete::get(status) ) {
|
||||||
|
|
||||||
while (_rx_buffer.next_packet()) {
|
while (_rx_buffer.next_packet()) {
|
||||||
|
@ -589,7 +605,11 @@ namespace Genode
|
||||||
_rx_buffer(env, *_rx.source()),
|
_rx_buffer(env, *_rx.source()),
|
||||||
_irq(env, irq),
|
_irq(env, irq),
|
||||||
_irq_handler(env.ep(), *this, &Cadence_gem::_handle_irq),
|
_irq_handler(env.ep(), *this, &Cadence_gem::_handle_irq),
|
||||||
_phy(*this, _timer)
|
_phy(*this, _timer),
|
||||||
|
_rx_buf_region((addr_t)_tx_ds.local_addr<void>()),
|
||||||
|
_tx_buf_region((addr_t)_rx_ds.local_addr<void>()),
|
||||||
|
_rx_buf_size(_tx_ds.size()),
|
||||||
|
_tx_buf_size(_rx_ds.size())
|
||||||
{
|
{
|
||||||
_irq.sigh(_irq_handler);
|
_irq.sigh(_irq_handler);
|
||||||
_irq.ack_irq();
|
_irq.ack_irq();
|
||||||
|
@ -686,6 +706,8 @@ namespace Genode
|
||||||
{
|
{
|
||||||
_handle_acks();
|
_handle_acks();
|
||||||
|
|
||||||
|
_clean_tx_buffers();
|
||||||
|
|
||||||
while (_send());
|
while (_send());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
REQUIRES = cadence_gem
|
REQUIRES = cadence_gem
|
||||||
TARGET = nic_drv
|
TARGET = nic_drv
|
||||||
SRC_CC = main.cc
|
SRC_CC = main.cc
|
||||||
LIBS = base
|
LIBS = base syscall-hw
|
||||||
INC_DIR += $(PRG_DIR)
|
INC_DIR += $(PRG_DIR)
|
||||||
|
|
Loading…
Reference in New Issue