|
The Pedigree Project 0.1
|
#include <NetworkStack.h>
Collaboration diagram for NetworkStack:Classes | |
| class | DeviceLease |
| struct | DeviceRegistration |
Public Member Functions | |
| void | receive (size_t nBytes, uintptr_t packet, Network *pCard, uint32_t offset) |
| void | receive (size_t nBytes, uintptr_t packet, const DeviceLease &device, uint32_t offset) |
| void | registerDevice (Network *pDevice) |
| MUST_USE_RESULT bool | acquireDevice (size_t n, DeviceLease &lease) |
| MUST_USE_RESULT bool | acquireDevice (Network *pDevice, DeviceLease &lease) |
| void | deRegisterDevice (Network *pDevice) |
| MemoryPool & | getMemPool () |
Static Public Member Functions | |
| static NetworkStack & | instance () |
| static NetworkStack * | instanceIfAvailable () |
Private Attributes | |
| Vector< Network * > | m_Children |
| MemoryPool | m_MemPool |
| Mutex | m_Lock |
| size_t | m_NextInterfaceNumber |
| Tree< Network *, DeviceRegistration * > | m_Registrations |
Static Private Attributes | |
| static NetworkStack * | stack = 0 |
The Pedigree network stack This function is the base for receiving packets, and provides functionality for keeping track of network devices in the system.
Definition at line 42 of file NetworkStack.h.
| NetworkStack::NetworkStack | ( | ) |
Definition at line 175 of file NetworkStack.cc.
|
virtual |
Definition at line 197 of file NetworkStack.cc.
| bool NetworkStack::acquireDevice | ( | Network * | pDevice, |
| DeviceLease & | lease | ||
| ) |
Pins a specific registered network device and interface.
Definition at line 349 of file NetworkStack.cc.
References m_Registrations, and OperationBarrier::tryAcquire().
| bool NetworkStack::acquireDevice | ( | size_t | n, |
| DeviceLease & | lease | ||
| ) |
Pins the n'th registered network device and interface.
Definition at line 329 of file NetworkStack.cc.
References Vector< T >::count(), m_Children, m_Registrations, and OperationBarrier::tryAcquire().
Referenced by VirtioNet::irq(), and receive().
Here is the caller graph for this function:| void NetworkStack::deRegisterDevice | ( | Network * | pDevice | ) |
Unregisters a given network device from the stack
Definition at line 364 of file NetworkStack.cc.
References Semaphore::acquire(), Vector< T >::begin(), OperationBarrier::close(), Vector< T >::end(), Vector< T >::erase(), ERR_OK, m_Children, m_Registrations, Semaphore::release(), tcpip_callback_wait(), and OperationBarrier::wait().
Referenced by Nic3C90x::Nic3C90x().
Here is the caller graph for this function:
|
inline |
Grabs the memory pool for networking use
Definition at line 115 of file NetworkStack.h.
|
inlinestatic |
For access to the stack without declaring an instance of it
Definition at line 88 of file NetworkStack.h.
Referenced by Dm9601::initialiseDriver(), Nic3C90x::irq(), VirtioNet::irq(), Ne2k::Ne2k(), and Nic3C90x::Nic3C90x().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 92 of file NetworkStack.h.
| void NetworkStack::receive | ( | size_t | nBytes, |
| uintptr_t | packet, | ||
| const DeviceLease & | device, | ||
| uint32_t | offset | ||
| ) |
Delivers a packet using a nonempty lease held for a driver receive batch.
Definition at line 240 of file NetworkStack.cc.
References Network::droppedPacket(), ERR_OK, ProcessorBase::inDeviceHardIrq(), netif::input, NetworkFilter::instance(), pbuf::len, pbuf::next, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_POOL, and PBUF_RAW.
| void NetworkStack::receive | ( | size_t | nBytes, |
| uintptr_t | packet, | ||
| Network * | pCard, | ||
| uint32_t | offset | ||
| ) |
Delivers a packet from a driver worker; must not run in a hard IRQ.
Definition at line 228 of file NetworkStack.cc.
References acquireDevice(), ProcessorBase::inDeviceHardIrq(), and receive().
Referenced by Nic3C90x::irq(), VirtioNet::irq(), and receive().
Here is the caller graph for this function:| void NetworkStack::registerDevice | ( | Network * | pDevice | ) |
Registers a given network device with the stack
Definition at line 286 of file NetworkStack.cc.
References ERR_OK, m_Children, m_NextInterfaceNumber, m_Registrations, netif::name, netif::num, Vector< T >::pushBack(), and tcpip_callback_wait().
Referenced by Dm9601::initialiseDriver(), Ne2k::Ne2k(), and Nic3C90x::Nic3C90x().
Here is the caller graph for this function:Network devices registered with the stack.
Definition at line 125 of file NetworkStack.h.
Referenced by acquireDevice(), deRegisterDevice(), and registerDevice().
|
private |
Definition at line 131 of file NetworkStack.h.
|
private |
Networking memory pool
Definition at line 128 of file NetworkStack.h.
|
private |
Next interface number to assign.
Definition at line 135 of file NetworkStack.h.
Referenced by registerDevice().
|
private |
Read-side lifetime state for registered devices and interfaces.
Definition at line 138 of file NetworkStack.h.
Referenced by acquireDevice(), acquireDevice(), deRegisterDevice(), and registerDevice().
|
staticprivate |
Definition at line 122 of file NetworkStack.h.