Class Netio3ZerocopyPublisher

Inheritance Relationships

Base Type

Class Documentation

class Netio3ZerocopyPublisher : public Publisher

Wrapper around netio3 publisher for zero-copy sending.

Provides zero-copy send functionality and keeps track which data has been successfully published to advance the read pointer.

Public Functions

template<Netio3EventLoopType EventLoopType>
inline explicit Netio3ZerocopyPublisher(const std::string &ip, uint32_t port, NetworkMode network_mode, unsigned int netio_pn, unsigned int netio_ps, unsigned int max_msg_size, uint64_t dma_buffer_vaddr, size_t dma_size, std::chrono::milliseconds mon_frequency, const std::string &publisher_info, Netio3EventLoop::type_tag<EventLoopType> type_tag)

Constructor constructing its own event loop.

Parameters:
  • ip -- Local IP address

  • port -- Local port

  • bus -- Reference to the bus

  • network_mode -- Network mode (RDMA or TCP)

  • netio_pn -- Number of buffers (to write into bus for receiver)

  • netio_ps -- Size of each buffer (to write into bus for receiver)

  • max_msg_size -- Maximum message size

  • dma_buffer_vaddr -- Virtual address of the DMA buffer (registered as MR)

  • dma_size -- Size of the DMA buffer

  • mon_frequency -- Frequency of monitoring the publisher

  • type_tag -- Tag to select the event loop type (asio or native)

explicit Netio3ZerocopyPublisher(const std::string &ip, uint32_t port, NetworkMode network_mode, unsigned int netio_pn, unsigned int netio_ps, unsigned int max_msg_size, uint64_t dma_buffer_vaddr, size_t dma_size, std::chrono::milliseconds mon_frequency, Netio3EventLoop &evloop)

Constructor using an existing event loop (should not be required)

virtual Result publish(felix_id_t fid, std::span<iovec> iovs, size_t bytes, uint32_t block_addr, std::uint8_t status) override

Publish data to all subscribers.

Keep track of the key to advance the progress pointer on completion.

Parameters:
  • fid -- FELIX ID

  • iovs -- Array of iovecs

  • bytes -- Number of bytes in total (all iovecs)

  • block_addr -- Address of the first block

  • status -- Status byte

Returns:

Result of the operation

virtual Result publish(felix_id_t fid, uint8_t *data, size_t len) override

Publish data to all subscribers.

Warning

Does not correctly track the progress pointer

virtual Result flush(felix_id_t fid) override

Flush the publisher (does nothing)

Does nothing for zero-copy publisher

Parameters:

fid -- FELIX ID

Returns:

OK

virtual void set_periodic_callback(uint32_t period_us, Callback callback) override

Set callback and start timer.

Sets the callback and starts the timer (typically read available data from DMA buffer).

Parameters:
  • period_us -- Period in microseconds

  • callback -- Callback to call

virtual void set_asynch_callback(Callback callback) override

Set callback.

Sets the callback for used by both the timer and the signal (

See also

fire_async_callback) callback (typically read available data from operations buffer). Signal fires itself recursively as long as callback returns true.

Parameters:

callback -- Callback to call

virtual void fire_asynch_callback() override

Fire the asynchronous callback.

inline virtual const CompletionTable *get_completion_table() override

zero-copy specific function to determine the DMA read pointer on the basis of outstanding network transfers.

Returns:

pointer to completion table.

inline virtual uint32_t get_resource_counter() override

Get the number of send operations that can currently still be performed.

Returns:

Number of available resources

inline virtual uint32_t get_subscription_number() override

Get the number of subscriptions.

Returns:

Number of subscriptions

inline virtual uint64_t get_resource_available_calls() override

Get the number of calls to on_resource_available.

Returns:

Number of calls to on_resource_available

inline virtual uint16_t get_port() const override

Get the port number.

Returns:

Port number