class Session
Defined at line 91 of file ../../src/connectivity/network/drivers/network-device/device/session.h
A client session with a network device interface.
Session will spawn a thread that will handle the
fuchsia.hardware.network.Session FIDL control plane calls and service the Tx
FIFO associated with the client session.
It is invalid to destroy a Session that has outstanding buffers, that is,
buffers that are currently owned by the interface's Rx or Tx queues.
Public Methods
void ~Session ()
Defined at line 90 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
zx::result<std::pair<std::unique_ptr<Session>, netdev::wire::Fifos>> Create (async_dispatcher_t *dispatcher,netdev::wire::SessionInfo &info,fidl::StringViewname,DeviceInterface *parent)
Creates a new session with the provided parameters.
The session will service fuchsia.hardware.network.Session FIDL calls on the
provided `control` channel.
All control plane calls are operated on the provided `dispatcher`, and a
dedicated thread will be spawned to handle data fast path operations (tx
data plane).
Returns the session and its data path FIFOs.
Defined at line 44 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
bool IsPaused ()
Defined at line 38 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
bool AllowRxLeaseDelegation ()
Defined at line 40 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void AssertParentControlLock (DeviceInterface & parent)
Helper functions with TA annotations that bridges the gap between parent's
locks and local locking requirements; TA is not otherwise able to tell that
the |parent| and |parent_| are the same entity.
Defined at line 119 of file ../../src/connectivity/network/drivers/network-device/device/session.h
void AssertParentControlLockShared (DeviceInterface & parent)
Defined at line 123 of file ../../src/connectivity/network/drivers/network-device/device/session.h
void AssertParentRxLock (DeviceInterface & parent)
Defined at line 127 of file ../../src/connectivity/network/drivers/network-device/device/session.h
void AssertParentTxLock (DeviceInterface & parent)
Defined at line 131 of file ../../src/connectivity/network/drivers/network-device/device/session.h
void TxTaken ()
Defined at line 183 of file ../../src/connectivity/network/drivers/network-device/device/session.h
void RxTaken ()
Defined at line 184 of file ../../src/connectivity/network/drivers/network-device/device/session.h
void StopRx ()
Defined at line 185 of file ../../src/connectivity/network/drivers/network-device/device/session.h
bool ShouldDestroy ()
Defined at line 186 of file ../../src/connectivity/network/drivers/network-device/device/session.h
const fbl::RefPtr<RefCountedFifo> & rx_fifo ()
Defined at line 198 of file ../../src/connectivity/network/drivers/network-device/device/session.h
const zx::fifo & tx_fifo ()
Defined at line 199 of file ../../src/connectivity/network/drivers/network-device/device/session.h
const char * name ()
Defined at line 200 of file ../../src/connectivity/network/drivers/network-device/device/session.h
bool IsDying ()
Defined at line 202 of file ../../src/connectivity/network/drivers/network-device/device/session.h
void InstallTx ()
Installs session tx listeners. Panics if called twice.
Defined at line 247 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void UninstallTx ()
Uninstalls session tx listeners. Must be called before destroying if
|InstallTx| was called. No-op if |InstallTx| was not called.
Defined at line 255 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void Attach (AttachRequestView request, AttachCompleter::Sync & _completer)
FIDL interface implementation:
Defined at line 592 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void Detach (DetachRequestView request, DetachCompleter::Sync & _completer)
Defined at line 602 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void Close (CloseCompleter::Sync & _completer)
Defined at line 611 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void WatchDelegatedRxLease (WatchDelegatedRxLeaseCompleter::Sync & completer)
Defined at line 613 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void RegisterForTx (RegisterForTxRequestView request, RegisterForTxCompleter::Sync & completer)
Defined at line 631 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void UnregisterForTx (UnregisterForTxRequestView request, UnregisterForTxCompleter::Sync & completer)
Defined at line 637 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
zx_status_t AttachPort (const netdev::wire::PortId & port_id, cpp20::span<const netdev::wire::FrameType> frame_types)
Defined at line 491 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
zx_status_t DetachPort (const netdev::wire::PortId & port_id)
Defined at line 535 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void MarkTxReturnResult (uint16_t descriptor, zx_status_t status)
Sets the return code for a tx descriptor.
Defined at line 643 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void ReturnTxDescriptors (const uint16_t * descriptors, size_t count)
Returns tx descriptors to the session client.
Defined at line 672 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void Kill ()
Signals the session thread to stop servicing the session channel and FIFOs.
When the session thread is finished, it notifies the DeviceInterface parent
through `NotifyDeadSession`.
Defined at line 745 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
zx_status_t LoadRxDescriptors (RxQueue::SessionTransaction & transact)
Loads rx descriptors into the provided session transaction, fetching more
from the rx FIFO if needed.
Defined at line 729 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
zx_status_t FillRxSpace (uint16_t descriptor_index, fuchsia_hardware_network_driver::wire::RxSpaceBuffer * buff)
Sets the data in the space buffer `buff` to region described by
`descriptor_index`.
Defined at line 755 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
bool CompleteRx (const RxFrameInfo & frame_info)
Completes rx for a single frame described by `frame_info`.
Returns true if the buffers comprising `frame_info` can immediately be
reused.
Defined at line 795 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
bool CompleteUnfulfilledRx ()
Marks a single rx space buffer as complete, but does not consume it as it
was unfulfilled. Returns true iff the session is active and space buffers
can be reused.
Defined at line 823 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void CommitRx ()
Commits pending rx buffers, sending them back to the session client.
Defined at line 884 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
bool IsSubscribedToFrameType (uint8_t port, netdev::wire::FrameType frame_type)
Returns true iff the session is subscribed to frame_type on port.
Defined at line 915 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
bool OnPortDestroyed (uint8_t port_id)
Notifies session of port destruction.
Returns true iff the session should be stopped after detaching from the
port.
Defined at line 578 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
zx_status_t FetchTx (TxQueue::SessionTransaction & transaction)
Fetch tx descriptors from the FIFO and queue them in the parent
|DeviceInterface|'s TxQueue.
Defined at line 266 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void Bind (fidl::ServerEnd<netdev::Session> channel)
Binds |channel| to this session. Must only be called once.
Defined at line 174 of file ../../src/connectivity/network/drivers/network-device/device/session.cc
void DelegateRxLease (netdev::DelegatedRxLease lease)
Delegates an rx lease to this session. The lease is assumed to be already
fulfilled during rx queue processing, the hold until frame is updated to
the latest frame delivered to this session and the lease is delegated up.
Defined at line 228 of file ../../src/connectivity/network/drivers/network-device/device/session.cc