LCOV - code coverage report
Current view: top level - disco/netlink - fd_netlink_tile.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 8 14 57.1 %
Date: 2026-08-13 04:56:22 Functions: 1 8 12.5 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_netlink_fd_netlink_tile_h
       2             : #define HEADER_fd_src_disco_netlink_fd_netlink_tile_h
       3             : 
       4             : /* fd_netlink_tile.h provides APIs for working with the netlink tile. */
       5             : 
       6             : #include "../topo/fd_topo.h"
       7             : 
       8             : /* Hardcoded limits */
       9           3 : #define NETDEV_MAX      (256U)
      10           3 : #define BOND_MASTER_MAX (256U)
      11             : 
      12             : /* fd_tile_netlnk provides the netlink tile.
      13             : 
      14             :    Consult /book/guide/netlink.md for more information.
      15             :    Web mirror: https://docs.firedancer.io/guide/netlink.html */
      16             : 
      17             : extern fd_topo_run_tile_t fd_tile_netlnk;
      18             : 
      19             : /* fd_netlink_neigh4_solicit_link_t holds information required to send
      20             :    neighbor solicitation requests to the netlink tile. */
      21             : 
      22             : struct fd_netlink_neigh4_solicit_link {
      23             :   fd_frag_meta_t * mcache;
      24             :   ulong            depth;
      25             :   ulong            seq;
      26             : };
      27             : 
      28             : typedef struct fd_netlink_neigh4_solicit_link fd_netlink_neigh4_solicit_link_t;
      29             : 
      30           3 : #define FD_NETLINK_ROUTE4_SYNC_SIG (1UL<<63)
      31             : 
      32             : struct fdctl_config;
      33             : 
      34             : FD_PROTOTYPES_BEGIN
      35             : 
      36             : void
      37             : fd_netlink_topo_create( fd_topo_tile_t * netlink_tile,
      38             :                         fd_topo_t *      topo,
      39             :                         ulong            netlnk_max_routes,
      40             :                         ulong            netlnk_max_peer_routes,
      41             :                         ulong            netlnk_max_neighbors,
      42             :                         char const *     bind_interface );
      43             : 
      44             : void
      45             : fd_netlink_topo_join( fd_topo_t *      topo,
      46             :                       fd_topo_tile_t * netlink_tile,
      47             :                       fd_topo_tile_t * join_tile );
      48             : 
      49             : /* fd_netlink_neigh4_solicit requests a neighbor solicitation (i.e. ARP
      50             :    request) for an IPv4 address.  Safe to call at a high rate.  The
      51             :    netlink tile will deduplicate requests.  ip4_addr is big endian. */
      52             : 
      53             : static inline void
      54             : fd_netlink_neigh4_solicit( fd_netlink_neigh4_solicit_link_t * link,
      55             :                            uint                               ip4_addr,
      56             :                            uint                               if_idx,
      57           0 :                            ulong                              tspub_comp ) {
      58           0 :   ulong seq = link->seq;
      59           0 :   ulong sig = (ulong)ip4_addr | ( (ulong)if_idx<<32 );
      60           0 :   fd_mcache_publish( link->mcache, link->depth, seq, sig, 0UL, 0UL, 0UL, 0UL, tspub_comp );
      61           0 :   link->seq = fd_seq_inc( seq, 1UL );
      62           0 : }
      63             : 
      64             : /* fd_netlink_route4_sync requests a full route table sync. */
      65             : 
      66             : static inline void
      67             : fd_netlink_route4_sync( fd_netlink_neigh4_solicit_link_t * link,
      68           3 :                         ulong                              tspub_comp ) {
      69           3 :   ulong seq = link->seq;
      70           3 :   fd_mcache_publish( link->mcache, link->depth, seq, FD_NETLINK_ROUTE4_SYNC_SIG, 0UL, 0UL, 0UL, 0UL, tspub_comp );
      71           3 :   link->seq = fd_seq_inc( seq, 1UL );
      72           3 : }
      73             : 
      74             : FD_PROTOTYPES_END
      75             : 
      76             : #endif /* HEADER_fd_src_disco_netlink_fd_netlink_tile_h */

Generated by: LCOV version 1.14