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 0 : #define NETDEV_MAX (256U) 10 0 : #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 : struct fdctl_config; 31 : 32 : FD_PROTOTYPES_BEGIN 33 : 34 : void 35 : fd_netlink_topo_create( fd_topo_tile_t * netlink_tile, 36 : fd_topo_t * topo, 37 : ulong netlnk_max_routes, 38 : ulong netlnk_max_neighbors, 39 : char const * bind_interface ); 40 : 41 : void 42 : fd_netlink_topo_join( fd_topo_t * topo, 43 : fd_topo_tile_t * netlink_tile, 44 : fd_topo_tile_t * join_tile ); 45 : 46 : /* fd_netlink_neigh4_solicit requests a neighbor solicitation (i.e. ARP 47 : request) for an IPv4 address. Safe to call at a high rate. The 48 : netlink tile will deduplicate requests. ip4_addr is big endian. */ 49 : 50 : static inline void 51 : fd_netlink_neigh4_solicit( fd_netlink_neigh4_solicit_link_t * link, 52 : uint ip4_addr, 53 : uint if_idx, 54 0 : ulong tspub_comp ) { 55 0 : ulong seq = link->seq; 56 0 : ulong sig = (ulong)ip4_addr | ( (ulong)if_idx<<32 ); 57 0 : fd_mcache_publish( link->mcache, link->depth, seq, sig, 0UL, 0UL, 0UL, 0UL, tspub_comp ); 58 0 : link->seq = fd_seq_inc( seq, 1UL ); 59 0 : } 60 : 61 : FD_PROTOTYPES_END 62 : 63 : #endif /* HEADER_fd_src_disco_netlink_fd_netlink_tile_h */