LCOV - code coverage report
Current view: top level - disco/net/sock - fd_sock_tile_private.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 1 0.0 %
Date: 2026-10-22 18:10:43 Functions: 0 0 -

          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 "../../metrics/generated/fd_metrics_enums.h"
       8             : #include <poll.h>
       9             : #include <sys/socket.h>
      10             : 
      11             : /* FD_SOCK_TILE_MAX_SOCKETS controls the max number of UDP ports that a
      12             :    sock tile can bind to. */
      13             : 
      14           0 : #define FD_SOCK_TILE_MAX_SOCKETS (9)
      15             : 
      16             : /* MAX_NET_INS controls the max number of TX links that a sock tile can
      17             :    serve. */
      18             : 
      19             : #define MAX_NET_INS (32UL)
      20             : 
      21             : /* MAX_NET_OUTS controls the max number of RX links that a sock tile can
      22             :    serve. */
      23             : 
      24             : #define MAX_NET_OUTS (7UL)
      25             : 
      26             : /* Local metrics.  Periodically copied to the metric_in shm region. */
      27             : 
      28             : struct fd_sock_tile_metrics {
      29             :   ulong sys_recvmmsg_cnt;
      30             :   ulong sys_sendmmsg_cnt[ FD_METRICS_ENUM_SENDMMSG_RESULT_CNT ];
      31             :   ulong rx_pkt_cnt;
      32             :   ulong tx_pkt_cnt;
      33             :   ulong tx_drop_cnt;
      34             :   ulong rx_bytes_total;
      35             :   ulong tx_bytes_total;
      36             : };
      37             : 
      38             : typedef struct fd_sock_tile_metrics fd_sock_tile_metrics_t;
      39             : 
      40             : /* Tile private state */
      41             : 
      42             : struct fd_sock_link_tx {
      43             :   void * base;
      44             :   ulong  chunk0;
      45             :   ulong  wmark;
      46             : };
      47             : 
      48             : typedef struct fd_sock_link_tx fd_sock_link_tx_t;
      49             : 
      50             : struct fd_sock_link_rx {
      51             :   void * base;
      52             :   ulong  chunk0;
      53             :   ulong  wmark;
      54             :   ulong  chunk;
      55             : };
      56             : 
      57             : typedef struct fd_sock_link_rx fd_sock_link_rx_t;
      58             : 
      59             : struct fd_sock_tile {
      60             :   /* RX SOCK_DGRAM sockets */
      61             :   struct pollfd pollfd[ FD_SOCK_TILE_MAX_SOCKETS ];
      62             :   uint          sock_cnt;
      63             :   uint          lo_ifindex;
      64             :   double        tick_per_ns;
      65             :   uchar         proto_id[ FD_SOCK_TILE_MAX_SOCKETS ];
      66             : 
      67             :   /* TX SOCK_RAW socket */
      68             :   int   tx_sock;
      69             :   uint  tx_idle_cnt;
      70             :   uint  bind_address;
      71             :   ulong tx_tile_idx;
      72             :   ulong tx_tile_cnt;
      73             : 
      74             :   /* RX/TX batches
      75             :      FIXME transpose arrays for better cache locality? */
      76             :   ulong                batch_cnt; /* <=STEM_BURST */
      77             :   struct iovec *       batch_iov;
      78             :   void *               batch_cmsg;
      79             :   ulong *              batch_frame_sz; /* full frame size, for PktTxBytes */
      80             :   struct sockaddr_in * batch_sa;
      81             :   struct mmsghdr *     batch_msg;
      82             : 
      83             :   /* RX links */
      84             :   ushort            rx_sock_port[ FD_SOCK_TILE_MAX_SOCKETS ];
      85             :   uchar             link_rx_map [ FD_SOCK_TILE_MAX_SOCKETS ];
      86             :   uchar             repair_rx;
      87             :   uint              repair_shred_sock_idx;
      88             :   ulong             link_rx_cnt;
      89             :   fd_sock_link_rx_t link_rx[ MAX_NET_OUTS ];
      90             : 
      91             :   /* TX links */
      92             :   fd_sock_link_tx_t link_tx[ MAX_NET_INS ];
      93             : 
      94             :   /* TX scratch memory */
      95             :   uchar * tx_scratch0;
      96             :   uchar * tx_scratch1;
      97             :   uchar * tx_ptr; /* in [tx_scratch0,tx_scratch1) */
      98             : 
      99             :   /* Values parsed from the current frag in during_frag, validated in
     100             :      after_frag */
     101             :   struct {
     102             :     int  invalid; /* set if the frag failed validation in during_frag */
     103             :     uint ip_version;
     104             :     uint ip_protocol;
     105             :   } parsed;
     106             : 
     107             :   fd_sock_tile_metrics_t metrics;
     108             : };
     109             : 
     110             : typedef struct fd_sock_tile fd_sock_tile_t;
     111             : 
     112             : #endif /* FD_HAS_HOSTED */
     113             : 
     114             : #endif /* HEADER_fd_src_disco_net_sock_fd_sock_tile_private_h */

Generated by: LCOV version 1.14