Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _FIB_LOOKUP_H
0003 #define _FIB_LOOKUP_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/list.h>
0007 #include <net/inet_dscp.h>
0008 #include <net/ip_fib.h>
0009 #include <net/nexthop.h>
0010 
0011 struct fib_alias {
0012     struct hlist_node   fa_list;
0013     struct fib_info     *fa_info;
0014     dscp_t          fa_dscp;
0015     u8          fa_type;
0016     u8          fa_state;
0017     u8          fa_slen;
0018     u32         tb_id;
0019     s16         fa_default;
0020     u8          offload;
0021     u8          trap;
0022     u8          offload_failed;
0023     struct rcu_head     rcu;
0024 };
0025 
0026 #define FA_S_ACCESSED   0x01
0027 
0028 /* Don't write on fa_state unless needed, to keep it shared on all cpus */
0029 static inline void fib_alias_accessed(struct fib_alias *fa)
0030 {
0031     if (!(fa->fa_state & FA_S_ACCESSED))
0032         fa->fa_state |= FA_S_ACCESSED;
0033 }
0034 
0035 /* Exported by fib_semantics.c */
0036 void fib_release_info(struct fib_info *);
0037 struct fib_info *fib_create_info(struct fib_config *cfg,
0038                  struct netlink_ext_ack *extack);
0039 int fib_nh_match(struct net *net, struct fib_config *cfg, struct fib_info *fi,
0040          struct netlink_ext_ack *extack);
0041 bool fib_metrics_match(struct fib_config *cfg, struct fib_info *fi);
0042 int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
0043           const struct fib_rt_info *fri, unsigned int flags);
0044 void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len,
0045            u32 tb_id, const struct nl_info *info, unsigned int nlm_flags);
0046 size_t fib_nlmsg_size(struct fib_info *fi);
0047 
0048 static inline void fib_result_assign(struct fib_result *res,
0049                      struct fib_info *fi)
0050 {
0051     /* we used to play games with refcounts, but we now use RCU */
0052     res->fi = fi;
0053     res->nhc = fib_info_nhc(fi, 0);
0054 }
0055 
0056 struct fib_prop {
0057     int error;
0058     u8  scope;
0059 };
0060 
0061 extern const struct fib_prop fib_props[RTN_MAX + 1];
0062 
0063 #endif /* _FIB_LOOKUP_H */