Line data Source code
1 : #ifndef HEADER_fd_src_disco_net_sock_fd_sock_tile_private_h 2 : #define HEADER_fd_src_disco_net_sock_fd_sock_tile_private_h 3 : 4 : #if FD_HAS_HOSTED 5 : 6 : #include "../../../util/fd_util_base.h" 7 : #include <poll.h> 8 : #include <sys/socket.h> 9 : 10 : /* FD_SOCK_TILE_MAX_SOCKETS controls the max number of UDP ports that a 11 : sock tile can bind to. */ 12 : 13 0 : #define FD_SOCK_TILE_MAX_SOCKETS (8) 14 : 15 : /* MAX_NET_INS controls the max number of TX links that a sock tile can 16 : serve. */ 17 : 18 : #define MAX_NET_INS (32UL) 19 : 20 : /* MAX_NET_OUTS controls the max number of RX links that a sock tile can 21 : serve. */ 22 : 23 : #define MAX_NET_OUTS (4UL) 24 : 25 : /* Local metrics. Periodically copied to the metric_in shm region. */ 26 : 27 : struct fd_sock_tile_metrics { 28 : ulong sys_recvmmsg_cnt; 29 : ulong sys_sendmmsg_cnt; 30 : ulong rx_pkt_cnt; 31 : ulong tx_pkt_cnt; 32 : ulong tx_drop_cnt; 33 : }; 34 : 35 : typedef struct fd_sock_tile_metrics fd_sock_tile_metrics_t; 36 : 37 : /* Tile private state */ 38 : 39 : struct fd_sock_link_tx { 40 : void * base; 41 : ulong chunk0; 42 : ulong wmark; 43 : }; 44 : 45 : typedef struct fd_sock_link_tx fd_sock_link_tx_t; 46 : 47 : struct fd_sock_link_rx { 48 : void * base; 49 : ulong chunk0; 50 : ulong wmark; 51 : ulong chunk; 52 : }; 53 : 54 : typedef struct fd_sock_link_rx fd_sock_link_rx_t; 55 : 56 : struct fd_sock_tile { 57 : /* RX SOCK_DGRAM sockets */ 58 : struct pollfd pollfd[ FD_SOCK_TILE_MAX_SOCKETS ]; 59 : uint sock_cnt; 60 : uchar proto_id[ FD_SOCK_TILE_MAX_SOCKETS ]; 61 : 62 : /* TX SOCK_RAW socket */ 63 : int tx_sock; 64 : uint tx_idle_cnt; 65 : 66 : /* RX/TX batches 67 : FIXME transpose arrays for better cache locality? */ 68 : ulong batch_cnt; /* <=STEM_BURST */ 69 : struct iovec * batch_iov; 70 : void * batch_cmsg; 71 : struct sockaddr_in * batch_sa; 72 : struct mmsghdr * batch_msg; 73 : 74 : /* RX links */ 75 : ushort rx_sock_port[ FD_SOCK_TILE_MAX_SOCKETS ]; 76 : uchar link_rx_map [ FD_SOCK_TILE_MAX_SOCKETS ]; 77 : fd_sock_link_rx_t link_rx[ MAX_NET_OUTS ]; 78 : 79 : /* TX links */ 80 : fd_sock_link_tx_t link_tx[ MAX_NET_INS ]; 81 : 82 : /* TX scratch memory */ 83 : uchar * tx_scratch0; 84 : uchar * tx_scratch1; 85 : uchar * tx_ptr; /* in [tx_scratch0,tx_scratch1) */ 86 : 87 : fd_sock_tile_metrics_t metrics; 88 : }; 89 : 90 : typedef struct fd_sock_tile fd_sock_tile_t; 91 : 92 : #endif /* FD_HAS_HOSTED */ 93 : 94 : #endif /* HEADER_fd_src_disco_net_sock_fd_sock_tile_private_h */