class DeviceInterface

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

Public Methods

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 99 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

TxQueue & tx_queue ()

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

SharedLock & control_lock ()

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

fbl::Mutex & rx_lock ()

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

fbl::Mutex & tx_lock ()

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

const netdriver::DeviceImplInfo & info ()

Defined at line 106 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 165 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.h

DiagnosticsService & diagnostics ()

Defined at line 189 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 200 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void ~DeviceInterface ()

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

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

Public NetworkDevice API.

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

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

Defined at line 368 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 377 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 395 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 419 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 478 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 498 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 506 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 514 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

uint16_t rx_fifo_depth ()

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

uint16_t tx_fifo_depth ()

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

zx_status_t LoadRxDescriptors (RxSessionTransaction & transact)

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

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

void SessionStarted (Session & session)

Operates workflow for when a session is started. If the session is eligible to take over the

primary spot, it'll be elected the new primary session. If there was no primary session before,

the data path will be started BEFORE the new session is elected as primary,

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

void SessionStopped (Session & session)

Operates workflow for when a session is stopped. If there's another session that is eligible to

take over the primary spot, it'll be elected the new primary session. Otherwise, the data path

will be stopped.

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

fbl::RefPtr<RefCountedFifo> primary_rx_fifo ()

If a primary session exists, primary_rx_fifo returns a reference-counted pointer to the primary

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

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

void CommitAllSessions ()

Commits all pending rx buffers in all active sessions.

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

void CopySessionData (const Session & owner, const RxFrameInfo & frame_info)

Copies the received data described by `buff` to all sessions other than `owner`.

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

void ListenSessionData (const Session & owner, cpp20::span<const uint16_t> descriptors)

Notifies all listening sessions of a new tx transaction from session `owner` and descriptor

`owner_index`.

Defined at line 1373 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 1245 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 1253 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 1265 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

bool IsDataPlaneOpen ()

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

void NotifyDeadSession (Session & dead_session)

Called by sessions when they're no longer running. If the dead session has any outstanding

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

are safely returned and we own all the buffers again.

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

void GetInfo (GetInfoCompleter::Sync & completer)

FIDL protocol implementation.

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

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

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

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

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

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

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

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

Defined at line 747 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 1158 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 1168 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 1428 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

void NotifyTxComplete ()

Event observer hook for Tx complete.

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

void DropDelegatedRxLease (netdev::DelegatedRxLease lease)

Defined at line 1432 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 primary session.

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

hold_until_frame value.

The primary 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 1443 of file ../../src/connectivity/network/drivers/network-device/device/device_interface.cc

Friends

class FakeNetworkDeviceImpl
class NetworkDeviceTest