class DeviceInterface

Defined at line 67 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

Public Methods

bool IsDataVmoPrepared (uint8_t vmo_id)

Defined at line 102 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

uint16_t rx_notify_threshold ()

Returns the device-owned buffer count threshold at which we should trigger RxQueue work. If the

number of buffers on device is less than or equal to the threshold, we should attempt to fetch

more buffers.

Defined at line 113 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

TxQueue & tx_queue ()

Defined at line 115 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

SharedLock & control_lock ()

Defined at line 117 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

fbl::Mutex & rx_lock ()

Defined at line 118 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

fbl::Mutex & tx_lock ()

Defined at line 119 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

const netdriver::DeviceImplInfo & info ()

Defined at line 120 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

uint8_t GetPortSalt (uint8_t base_id)

Returns the current port salt for the provided base port ID.

If the port with |base_id| does not currently exist, returns the value of

the previously existing port with the same |base_id| or the initial salt

value.

Defined at line 173 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

DiagnosticsService & diagnostics ()

Defined at line 199 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

zx::result<std::unique_ptr<DeviceInterface>> Create (const DeviceInterfaceDispatchers & dispatchers, std::unique_ptr<NetworkDeviceImplBinder> && binder)

Defined at line 208 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void ~DeviceInterface ()

Defined at line 226 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void Teardown (fit::callback<void ()> callback)

Public NetworkDevice API.

Defined at line 357 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

zx_status_t Bind (fidl::ServerEnd<netdev::Device> req)

Defined at line 371 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

zx_status_t BindPort (uint8_t port_id, fidl::ServerEnd<netdev::Port> req)

Defined at line 380 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void PortStatusChanged (netdriver::wire::NetworkDeviceIfcPortStatusChangedRequest * request, fdf::Arena & arena, PortStatusChangedCompleter::Sync & completer)

NetworkDeviceIfc implementation.

Defined at line 398 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void AddPort (netdriver::wire::NetworkDeviceIfcAddPortRequest * request, fdf::Arena & arena, AddPortCompleter::Sync & completer)

Defined at line 422 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void RemovePort (netdriver::wire::NetworkDeviceIfcRemovePortRequest * request, fdf::Arena & arena, RemovePortCompleter::Sync & completer)

Defined at line 482 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void CompleteRx (netdriver::wire::NetworkDeviceIfcCompleteRxRequest * request, fdf::Arena & arena, CompleteRxCompleter::Sync & completer)

Defined at line 503 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void CompleteTx (netdriver::wire::NetworkDeviceIfcCompleteTxRequest * request, fdf::Arena & arena, CompleteTxCompleter::Sync & completer)

Defined at line 511 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void DelegateRxLease (netdriver::wire::NetworkDeviceIfcDelegateRxLeaseRequest * request, fdf::Arena & arena, DelegateRxLeaseCompleter::Sync & completer)

Defined at line 519 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void UpdateRxBufferParams (netdriver::wire::NetworkDeviceIfcUpdateRxBufferParamsRequest * request, fdf::Arena & arena, UpdateRxBufferParamsCompleter::Sync & completer)

Defined at line 544 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void RequestRxSpace (netdriver::wire::NetworkDeviceIfcRequestRxSpaceRequest * request, fdf::Arena & arena, RequestRxSpaceCompleter::Sync & completer)

Defined at line 560 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

uint16_t rx_fifo_depth ()

Defined at line 1431 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

uint16_t tx_fifo_depth ()

Defined at line 1435 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

zx_status_t LoadRxDescriptors (RxSessionTransaction & transact)

Loads rx path descriptors from the session into a session transaction.

Defined at line 1994 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void SessionStarted ()

Operates workflow for when the session is started. The data path will be started.

Defined at line 1439 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void SessionStopped ()

Operates workflow for when the session is stopped. The data path will be stopped.

Defined at line 1445 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

fbl::RefPtr<RefCountedFifo> rx_fifo ()

If a live session exists, rx_fifo returns a reference-counted pointer to the

session's Rx FIFO. Otherwise, the returned pointer is null.

Defined at line 1799 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void CommitSession ()

Commits all pending rx buffers in the active session.

Defined at line 1986 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void NotifyTxReturned (bool was_full)

Notifies that a batch of Tx frames has been returned.

If was_full is true, all active sessions are notified that device tx space has freed up.

Checks if dead sessions are ready to be destroyed due to buffers returning.

Defined at line 1827 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void QueueRxSpace (cpp20::span<netdriver::wire::RxSpaceBuffer> rx)

Sends the provided space buffers in `rx` to the device implementation.

Defined at line 1835 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void QueueTx (cpp20::span<netdriver::wire::TxBuffer> tx)

Sends the provided transmit buffers in `tx` to the device implementation.

Defined at line 1847 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

bool IsDataPlaneOpen ()

Defined at line 2001 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void NotifyDeadSession ()

Called by the session when it's no longer running. If the dead session has any outstanding

buffers with the device implementation, it'll be kept until all the buffers

are safely returned and we own all the buffers again.

Defined at line 1859 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void GetInfo (GetInfoCompleter::Sync & completer)

FIDL protocol implementation.

Defined at line 573 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void OpenSession (OpenSessionRequestView request, OpenSessionCompleter::Sync & completer)

Defined at line 657 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void RegisterForTx (cpp20::span<const VmoId> vmos, fidl::WireServer<netdev::Session>::RegisterForTxCompleter::Async completer)

Defined at line 961 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void UnregisterForTx (cpp20::span<const VmoId> vmos, fidl::WireServer<netdev::Session>::UnregisterForTxCompleter::Async completer)

Defined at line 1088 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void GetPort (GetPortRequestView request, GetPortCompleter::Sync & _completer)

Defined at line 1220 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void GetPortWatcher (GetPortWatcherRequestView request, GetPortWatcherCompleter::Sync & _completer)

Defined at line 1232 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void Clone (CloneRequestView request, CloneCompleter::Sync & _completer)

Defined at line 1271 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void NotifyPortRxFrame (uint8_t base_id, uint64_t frame_length)

Notifies of |frame_length| bytes received on port with |base_id|.

Defined at line 1752 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

zx::result<AttachedPort> AcquirePort (netdev::wire::PortId port_id, cpp20::span<const netdev::wire::FrameType> rx_frame_types)

Acquires a port for use in a Session.

Sessions are notified of ports that are no longer safe to use by the DeviceInterface through

Session::DetachPort.

NB: The validity of the returned AttachedPort is not really guaranteed by the type system, but

by the fact that DeviceInterface will detach all ports from sessions before continuing.

Defined at line 1762 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void NotifyRxQueuePacket (uint64_t key)

Event observer hook for Rx queue packets.

Defined at line 2020 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void NotifyRxVmoOpFinished (zx_status_t status)

Event observer hook for Rx VMO operation finish.

Defined at line 2022 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void NotifyTxComplete ()

Event observer hook for Tx complete.

Defined at line 2026 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void DropDelegatedRxLease (netdev::DelegatedRxLease lease)

Defined at line 2028 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void TryDelegateRxLease (uint64_t completed_frame_index)

Delegates a pending lease to the session.

The lease is delegated if |completed_frame_index| is larger than the lease's

hold_until_frame value.

The session receives the lease if one exists _and_ the session is

opted in to receive leases. Drops the pending lease immediately otherwise.

Defined at line 2039 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void DecommitVmo (netdev::VmoId vmo_id)

Decommits the VMO by its ID. The VMO must be released from the device impl and all the buffers

from this Rx VMO must be withheld.

Defined at line 1277 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

bool PrepareRxVmos (RxVmoList::iterator start, RxVmoList::iterator * in_out_end, fit::callback<void (fit::result<std::tuple<zx_status_t, DataVmoList>>)> cb)

Submits a batch of Rx VMOs for preparation. It skips any VMO that has already been prepared.

Returns whether the batch is already prepared.

|in_out_end| specifies the end of the range on input, and on output is set to the iterator

past the last VMO submitted for preparation before any lock is released, or to |start| if

nothing could be prepared.

Defined at line 1298 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

bool ReleaseRxVmo (DataVmoMeta & vmo)

Attempts to release the Rx VMO. Returns true if the VMO has successfully transitioned to

VmoState::kReleasing (meaning a release operation is now pending or starting). Returns false if

the release attempt failed (e.g., the VMO is also registered for Tx, not currently prepared,

or the session is invalid).

Defined at line 1382 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

Friends

class FakeNetworkDeviceImpl
class NetworkDeviceTest