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 : /* fd_tile_netlnk provides the netlink tile. 9 : 10 : Consult /book/guide/netlink.md for more information. 11 : Web mirror: https://docs.firedancer.io/guide/netlink.html */ 12 : 13 : FD_PROTOTYPES_BEGIN 14 : extern fd_topo_run_tile_t fd_tile_netlnk; 15 : FD_PROTOTYPES_END 16 : 17 : /* fd_netlink_neigh4_solicit_link_t holds information required to send 18 : neighbor solicitation requests to the netlink tile. */ 19 : 20 : struct fd_netlink_neigh4_solicit_link { 21 : fd_frag_meta_t * mcache; 22 : ulong depth; 23 : ulong seq; 24 : }; 25 : 26 : typedef struct fd_netlink_neigh4_solicit_link fd_netlink_neigh4_solicit_link_t; 27 : 28 : struct fdctl_config; 29 : 30 : FD_PROTOTYPES_BEGIN 31 : 32 : void 33 : fd_netlink_topo_create( fd_topo_tile_t * netlink_tile, 34 : fd_topo_t * topo, 35 : ulong netlnk_max_routes, 36 : ulong netlnk_max_neighbors, 37 : char const * bind_interface ); 38 : 39 : void 40 : fd_netlink_topo_join( fd_topo_t * topo, 41 : fd_topo_tile_t * netlink_tile, 42 : fd_topo_tile_t * join_tile ); 43 : 44 : /* fd_netlink_neigh4_solicit requests a neighbor solicitation (i.e. ARP 45 : request) for an IPv4 address. Safe to call at a high rate. The 46 : netlink tile will deduplicate requests. ip4_addr is big endian. */ 47 : 48 : static inline void 49 : fd_netlink_neigh4_solicit( fd_netlink_neigh4_solicit_link_t * link, 50 : uint ip4_addr, 51 : uint if_idx, 52 0 : ulong tspub_comp ) { 53 0 : ulong seq = link->seq; 54 0 : ulong sig = (ulong)ip4_addr | ( (ulong)if_idx<<32 ); 55 0 : fd_mcache_publish( link->mcache, link->depth, seq, sig, 0UL, 0UL, 0UL, 0UL, tspub_comp ); 56 0 : link->seq = fd_seq_inc( seq, 1UL ); 57 0 : } 58 : 59 : FD_PROTOTYPES_END 60 : 61 : #endif /* HEADER_fd_src_disco_netlink_fd_netlink_tile_h */