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