Psyllid
v1.12.4
Project 8 Data Acquisisition Software
|
A producer to receive UDP packets via the fast-packet-acquisition interface and write them as raw blocks of memory. More...
#include <packet_receiver_fpa.hh>
Public Member Functions | |
packet_receiver_fpa () | |
virtual | ~packet_receiver_fpa () |
mv_accessible (uint64_t, length) | |
mv_accessible (uint32_t, max_packet_size) | |
mv_accessible (uint32_t, port) | |
mv_referrable (std::string, interface) | |
mv_accessible (unsigned, timeout_sec) | |
mv_accessible (unsigned, n_blocks) | |
Timeout in seconds for waiting on the network interface. More... | |
mv_accessible (unsigned, block_size) | |
Number of blocks in the mmap ring buffer. More... | |
mv_accessible (unsigned, frame_size) | |
Number of packets per block in the mmap ring buffer. More... | |
virtual void | initialize () |
Number of blocks per frame in the mmap ring buffer. More... | |
virtual void | execute (midge::diptera *a_midge=nullptr) |
virtual void | finalize () |
Private Member Functions | |
bool | process_packet (tpacket3_hdr *a_packet) |
void | cleanup_fpa () |
Private Attributes | |
int | f_net_interface_index |
int | f_socket |
receive_ring | f_ring |
uint64_t | f_packets_total |
uint64_t | f_bytes_total |
A producer to receive UDP packets via the fast-packet-acquisition interface and write them as raw blocks of memory.
Parameter setting is not thread-safe. Executing is thread-safe. Works in Linux only. Input: mmap ring buffer Following documentation of using mmap ring buffers in networking here: https://www.kernel.org/doc/Documentation/networking/packet_mmap.txt Understanding of tpacket3_hdr that I've pieced together: Defined in if_packet.h (my comments denoted with ///) struct tpacket_hdr_variant1 { __u32 tp_rxhash; /// __u32 tp_vlan_tci; /// }; struct tpacket3_hdr { __u32 tp_next_offset; /// Memory offset from the packet location to the next packet __u32 tp_sec; /// __u32 tp_nsec; /// __u32 tp_snaplen; /// Size of this packet in bytes __u32 tp_len; /// __u32 tp_status; /// Packet status (see values below) __u16 tp_mac; /// Memory offset from the packet location to the ethhdr object __u16 tp_net; ///
pkt_hdr variants union { struct tpacket_hdr_variant1 hv1; }; };
Available values for tp_status from if_packet.h:
Rx ring - header status #define TP_STATUS_KERNEL 0x0 /// Returned to the kernel? #define TP_STATUS_USER 0x1 /// Available to the user? #define TP_STATUS_COPY 0x2 #define TP_STATUS_LOSING 0x4 #define TP_STATUS_CSUMNOTREADY 0x8 #define TP_STATUS_VLAN_VALID 0x10 // auxdata has valid tp_vlan_tci #define TP_STATUS_BLK_TMO 0x20
Node type: "packet-receiver-fpa" Available configuration values: - "length": uint -- The size of the output buffer - "max-packet-size": uint -- Maximum number of bytes to be read for each packet; larger packets will be truncated - "port": uint -- UDP port to listen on for packets - "interface": string -- Name of the network interface to listen on for packets - "timeout-sec": uint -- Timeout (in seconds) while listening for incoming packets; listening for packets repeats after timeout - "n-blocks": uint -- Number of blocks in the mmap ring buffer - "block-size": uint -- Number of packets per block in the mmap ring buffer - "frame-size": uint -- Number of blocks per frame in the mmap ring buffer Output Streams: - 0: memory_block
Definition at line 114 of file packet_receiver_fpa.hh.
Definition at line 44 of file packet_receiver_fpa.cc.
|
virtual |
Definition at line 61 of file packet_receiver_fpa.cc.
|
private |
Definition at line 408 of file packet_receiver_fpa.cc.
|
virtual |
Definition at line 181 of file packet_receiver_fpa.cc.
|
virtual |
Definition at line 398 of file packet_receiver_fpa.cc.
|
virtual |
Number of blocks per frame in the mmap ring buffer.
Definition at line 66 of file packet_receiver_fpa.cc.
mv_accessible | ( | uint64_t | , |
length | |||
) |
mv_accessible | ( | uint32_t | , |
max_packet_size | |||
) |
mv_accessible | ( | uint32_t | , |
port | |||
) |
mv_accessible | ( | unsigned | , |
timeout_sec | |||
) |
mv_accessible | ( | unsigned | , |
n_blocks | |||
) |
Timeout in seconds for waiting on the network interface.
mv_accessible | ( | unsigned | , |
block_size | |||
) |
Number of blocks in the mmap ring buffer.
mv_accessible | ( | unsigned | , |
frame_size | |||
) |
Number of packets per block in the mmap ring buffer.
mv_referrable | ( | std::string | , |
interface | |||
) |
|
private |
Definition at line 287 of file packet_receiver_fpa.cc.
|
private |
Definition at line 146 of file packet_receiver_fpa.hh.
|
private |
Definition at line 139 of file packet_receiver_fpa.hh.
|
private |
Definition at line 145 of file packet_receiver_fpa.hh.
|
private |
Definition at line 143 of file packet_receiver_fpa.hh.
|
private |
Definition at line 141 of file packet_receiver_fpa.hh.