Class IBVQueue

Inheritance Relationships

Base Type

Class Documentation

class IBVQueue : public ska::pst::recv::SocketReceive

Implementation for a UDP socket that uses Infiniband Verbs to bypass the kernel socket library.

Public Functions

IBVQueue() = default

Construct a new IBVQueue object.

~IBVQueue()

Destroy the IBVQueue object.

virtual void allocate_resources(size_t npackets, size_t packet_size)

Configure the memory queue.

Parameters
  • npackets – number of UDP packets in the memory queue

  • packet_size – maximum size of the UDP payload

virtual void configure(const std::string &ip_address, int port)

Allocate the receive queue memory slots.

virtual void deconfigure_beam()

Release all resources associated with the IBVQueue.

virtual size_t clear_buffered_packets()

Discard all packets that are waiting in the kernel’s socket buffer.

Returns

size_t number of bytes cleared.

void open(const std::string &ipv4_address, int port)

Open the IBV Queue at the specified endpoint.

Parameters
  • ipv4_address – IPv4 address of the local endpoint at which to receive packets

  • port – UDP port of the local endpoint at which to receive packets

virtual int acquire_packet()

Receive a single UDP packet. If the previously received packet was not consumed via consume_packet, then no packet is received. If the socket is blocking, this method will block until a packet is received. If the socket is non-blocking, this method will busy-wait until a packet is received. In the latter case, the busy-wait may be interrupted by setting SocketReceiver::keep_receiving to false.

Returns

int packet slot index of the acquired packet, less than 0 indicates error

virtual void release_packet(int index)

Release the most recently received packet.

Parameters

index – slot

virtual uint64_t process_sleeps()

Returns the number of busy-waits that queue has recorded. Resets the busy-wait counter to zero.

Returns

uint64_t number of busy-wait sleeps.

virtual char *get_buf_ptr(int slot_index)

Return a pointer to the packet that is received in the specified slot.

Parameters

slot_index

Returns

char *

Public Static Attributes

static constexpr size_t max_queue_length = 8192

Maximum number of packet slots in the IBVQueue. This maximum is chosen at a lower value to work with a larger number of Mellanox NICs.