Commit 0c0dbfecbf217b47d0b508afb59b8b3639582a4c
1 parent
adcfe1964e
Exists in
master
and in
7 other branches
decnet: Remove unused FIB metric macros.
Unlike the ipv4 side, these are completely unused. Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 0 additions and 4 deletions Inline Diff
include/net/dn_fib.h
1 | #ifndef _NET_DN_FIB_H | 1 | #ifndef _NET_DN_FIB_H |
2 | #define _NET_DN_FIB_H | 2 | #define _NET_DN_FIB_H |
3 | 3 | ||
4 | /* WARNING: The ordering of these elements must match ordering | 4 | /* WARNING: The ordering of these elements must match ordering |
5 | * of RTA_* rtnetlink attribute numbers. | 5 | * of RTA_* rtnetlink attribute numbers. |
6 | */ | 6 | */ |
7 | struct dn_kern_rta { | 7 | struct dn_kern_rta { |
8 | void *rta_dst; | 8 | void *rta_dst; |
9 | void *rta_src; | 9 | void *rta_src; |
10 | int *rta_iif; | 10 | int *rta_iif; |
11 | int *rta_oif; | 11 | int *rta_oif; |
12 | void *rta_gw; | 12 | void *rta_gw; |
13 | u32 *rta_priority; | 13 | u32 *rta_priority; |
14 | void *rta_prefsrc; | 14 | void *rta_prefsrc; |
15 | struct rtattr *rta_mx; | 15 | struct rtattr *rta_mx; |
16 | struct rtattr *rta_mp; | 16 | struct rtattr *rta_mp; |
17 | unsigned char *rta_protoinfo; | 17 | unsigned char *rta_protoinfo; |
18 | u32 *rta_flow; | 18 | u32 *rta_flow; |
19 | struct rta_cacheinfo *rta_ci; | 19 | struct rta_cacheinfo *rta_ci; |
20 | struct rta_session *rta_sess; | 20 | struct rta_session *rta_sess; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | struct dn_fib_res { | 23 | struct dn_fib_res { |
24 | struct fib_rule *r; | 24 | struct fib_rule *r; |
25 | struct dn_fib_info *fi; | 25 | struct dn_fib_info *fi; |
26 | unsigned char prefixlen; | 26 | unsigned char prefixlen; |
27 | unsigned char nh_sel; | 27 | unsigned char nh_sel; |
28 | unsigned char type; | 28 | unsigned char type; |
29 | unsigned char scope; | 29 | unsigned char scope; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | struct dn_fib_nh { | 32 | struct dn_fib_nh { |
33 | struct net_device *nh_dev; | 33 | struct net_device *nh_dev; |
34 | unsigned nh_flags; | 34 | unsigned nh_flags; |
35 | unsigned char nh_scope; | 35 | unsigned char nh_scope; |
36 | int nh_weight; | 36 | int nh_weight; |
37 | int nh_power; | 37 | int nh_power; |
38 | int nh_oif; | 38 | int nh_oif; |
39 | __le16 nh_gw; | 39 | __le16 nh_gw; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct dn_fib_info { | 42 | struct dn_fib_info { |
43 | struct dn_fib_info *fib_next; | 43 | struct dn_fib_info *fib_next; |
44 | struct dn_fib_info *fib_prev; | 44 | struct dn_fib_info *fib_prev; |
45 | int fib_treeref; | 45 | int fib_treeref; |
46 | atomic_t fib_clntref; | 46 | atomic_t fib_clntref; |
47 | int fib_dead; | 47 | int fib_dead; |
48 | unsigned fib_flags; | 48 | unsigned fib_flags; |
49 | int fib_protocol; | 49 | int fib_protocol; |
50 | __le16 fib_prefsrc; | 50 | __le16 fib_prefsrc; |
51 | __u32 fib_priority; | 51 | __u32 fib_priority; |
52 | __u32 fib_metrics[RTAX_MAX]; | 52 | __u32 fib_metrics[RTAX_MAX]; |
53 | #define dn_fib_mtu fib_metrics[RTAX_MTU-1] | ||
54 | #define dn_fib_window fib_metrics[RTAX_WINDOW-1] | ||
55 | #define dn_fib_rtt fib_metrics[RTAX_RTT-1] | ||
56 | #define dn_fib_advmss fib_metrics[RTAX_ADVMSS-1] | ||
57 | int fib_nhs; | 53 | int fib_nhs; |
58 | int fib_power; | 54 | int fib_power; |
59 | struct dn_fib_nh fib_nh[0]; | 55 | struct dn_fib_nh fib_nh[0]; |
60 | #define dn_fib_dev fib_nh[0].nh_dev | 56 | #define dn_fib_dev fib_nh[0].nh_dev |
61 | }; | 57 | }; |
62 | 58 | ||
63 | 59 | ||
64 | #define DN_FIB_RES_RESET(res) ((res).nh_sel = 0) | 60 | #define DN_FIB_RES_RESET(res) ((res).nh_sel = 0) |
65 | #define DN_FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) | 61 | #define DN_FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
66 | 62 | ||
67 | #define DN_FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __dn_fib_res_prefsrc(&res)) | 63 | #define DN_FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __dn_fib_res_prefsrc(&res)) |
68 | #define DN_FIB_RES_GW(res) (DN_FIB_RES_NH(res).nh_gw) | 64 | #define DN_FIB_RES_GW(res) (DN_FIB_RES_NH(res).nh_gw) |
69 | #define DN_FIB_RES_DEV(res) (DN_FIB_RES_NH(res).nh_dev) | 65 | #define DN_FIB_RES_DEV(res) (DN_FIB_RES_NH(res).nh_dev) |
70 | #define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif) | 66 | #define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif) |
71 | 67 | ||
72 | typedef struct { | 68 | typedef struct { |
73 | __le16 datum; | 69 | __le16 datum; |
74 | } dn_fib_key_t; | 70 | } dn_fib_key_t; |
75 | 71 | ||
76 | typedef struct { | 72 | typedef struct { |
77 | __le16 datum; | 73 | __le16 datum; |
78 | } dn_fib_hash_t; | 74 | } dn_fib_hash_t; |
79 | 75 | ||
80 | typedef struct { | 76 | typedef struct { |
81 | __u16 datum; | 77 | __u16 datum; |
82 | } dn_fib_idx_t; | 78 | } dn_fib_idx_t; |
83 | 79 | ||
84 | struct dn_fib_node { | 80 | struct dn_fib_node { |
85 | struct dn_fib_node *fn_next; | 81 | struct dn_fib_node *fn_next; |
86 | struct dn_fib_info *fn_info; | 82 | struct dn_fib_info *fn_info; |
87 | #define DN_FIB_INFO(f) ((f)->fn_info) | 83 | #define DN_FIB_INFO(f) ((f)->fn_info) |
88 | dn_fib_key_t fn_key; | 84 | dn_fib_key_t fn_key; |
89 | u8 fn_type; | 85 | u8 fn_type; |
90 | u8 fn_scope; | 86 | u8 fn_scope; |
91 | u8 fn_state; | 87 | u8 fn_state; |
92 | }; | 88 | }; |
93 | 89 | ||
94 | 90 | ||
95 | struct dn_fib_table { | 91 | struct dn_fib_table { |
96 | struct hlist_node hlist; | 92 | struct hlist_node hlist; |
97 | u32 n; | 93 | u32 n; |
98 | 94 | ||
99 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, | 95 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, |
100 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 96 | struct dn_kern_rta *rta, struct nlmsghdr *n, |
101 | struct netlink_skb_parms *req); | 97 | struct netlink_skb_parms *req); |
102 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, | 98 | int (*delete)(struct dn_fib_table *t, struct rtmsg *r, |
103 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 99 | struct dn_kern_rta *rta, struct nlmsghdr *n, |
104 | struct netlink_skb_parms *req); | 100 | struct netlink_skb_parms *req); |
105 | int (*lookup)(struct dn_fib_table *t, const struct flowi *fl, | 101 | int (*lookup)(struct dn_fib_table *t, const struct flowi *fl, |
106 | struct dn_fib_res *res); | 102 | struct dn_fib_res *res); |
107 | int (*flush)(struct dn_fib_table *t); | 103 | int (*flush)(struct dn_fib_table *t); |
108 | int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); | 104 | int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); |
109 | 105 | ||
110 | unsigned char data[0]; | 106 | unsigned char data[0]; |
111 | }; | 107 | }; |
112 | 108 | ||
113 | #ifdef CONFIG_DECNET_ROUTER | 109 | #ifdef CONFIG_DECNET_ROUTER |
114 | /* | 110 | /* |
115 | * dn_fib.c | 111 | * dn_fib.c |
116 | */ | 112 | */ |
117 | extern void dn_fib_init(void); | 113 | extern void dn_fib_init(void); |
118 | extern void dn_fib_cleanup(void); | 114 | extern void dn_fib_cleanup(void); |
119 | 115 | ||
120 | extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, | 116 | extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, |
121 | unsigned long arg); | 117 | unsigned long arg); |
122 | extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, | 118 | extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, |
123 | struct dn_kern_rta *rta, | 119 | struct dn_kern_rta *rta, |
124 | const struct nlmsghdr *nlh, int *errp); | 120 | const struct nlmsghdr *nlh, int *errp); |
125 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, | 121 | extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, |
126 | const struct flowi *fl, | 122 | const struct flowi *fl, |
127 | struct dn_fib_res *res); | 123 | struct dn_fib_res *res); |
128 | extern void dn_fib_release_info(struct dn_fib_info *fi); | 124 | extern void dn_fib_release_info(struct dn_fib_info *fi); |
129 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); | 125 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); |
130 | extern void dn_fib_flush(void); | 126 | extern void dn_fib_flush(void); |
131 | extern void dn_fib_select_multipath(const struct flowi *fl, | 127 | extern void dn_fib_select_multipath(const struct flowi *fl, |
132 | struct dn_fib_res *res); | 128 | struct dn_fib_res *res); |
133 | 129 | ||
134 | /* | 130 | /* |
135 | * dn_tables.c | 131 | * dn_tables.c |
136 | */ | 132 | */ |
137 | extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat); | 133 | extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat); |
138 | extern struct dn_fib_table *dn_fib_empty_table(void); | 134 | extern struct dn_fib_table *dn_fib_empty_table(void); |
139 | extern void dn_fib_table_init(void); | 135 | extern void dn_fib_table_init(void); |
140 | extern void dn_fib_table_cleanup(void); | 136 | extern void dn_fib_table_cleanup(void); |
141 | 137 | ||
142 | /* | 138 | /* |
143 | * dn_rules.c | 139 | * dn_rules.c |
144 | */ | 140 | */ |
145 | extern void dn_fib_rules_init(void); | 141 | extern void dn_fib_rules_init(void); |
146 | extern void dn_fib_rules_cleanup(void); | 142 | extern void dn_fib_rules_cleanup(void); |
147 | extern unsigned dnet_addr_type(__le16 addr); | 143 | extern unsigned dnet_addr_type(__le16 addr); |
148 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); | 144 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); |
149 | 145 | ||
150 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); | 146 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); |
151 | 147 | ||
152 | extern void dn_fib_free_info(struct dn_fib_info *fi); | 148 | extern void dn_fib_free_info(struct dn_fib_info *fi); |
153 | 149 | ||
154 | static inline void dn_fib_info_put(struct dn_fib_info *fi) | 150 | static inline void dn_fib_info_put(struct dn_fib_info *fi) |
155 | { | 151 | { |
156 | if (atomic_dec_and_test(&fi->fib_clntref)) | 152 | if (atomic_dec_and_test(&fi->fib_clntref)) |
157 | dn_fib_free_info(fi); | 153 | dn_fib_free_info(fi); |
158 | } | 154 | } |
159 | 155 | ||
160 | static inline void dn_fib_res_put(struct dn_fib_res *res) | 156 | static inline void dn_fib_res_put(struct dn_fib_res *res) |
161 | { | 157 | { |
162 | if (res->fi) | 158 | if (res->fi) |
163 | dn_fib_info_put(res->fi); | 159 | dn_fib_info_put(res->fi); |
164 | if (res->r) | 160 | if (res->r) |
165 | fib_rule_put(res->r); | 161 | fib_rule_put(res->r); |
166 | } | 162 | } |
167 | 163 | ||
168 | #else /* Endnode */ | 164 | #else /* Endnode */ |
169 | 165 | ||
170 | #define dn_fib_init() do { } while(0) | 166 | #define dn_fib_init() do { } while(0) |
171 | #define dn_fib_cleanup() do { } while(0) | 167 | #define dn_fib_cleanup() do { } while(0) |
172 | 168 | ||
173 | #define dn_fib_lookup(fl, res) (-ESRCH) | 169 | #define dn_fib_lookup(fl, res) (-ESRCH) |
174 | #define dn_fib_info_put(fi) do { } while(0) | 170 | #define dn_fib_info_put(fi) do { } while(0) |
175 | #define dn_fib_select_multipath(fl, res) do { } while(0) | 171 | #define dn_fib_select_multipath(fl, res) do { } while(0) |
176 | #define dn_fib_rules_policy(saddr,res,flags) (0) | 172 | #define dn_fib_rules_policy(saddr,res,flags) (0) |
177 | #define dn_fib_res_put(res) do { } while(0) | 173 | #define dn_fib_res_put(res) do { } while(0) |
178 | 174 | ||
179 | #endif /* CONFIG_DECNET_ROUTER */ | 175 | #endif /* CONFIG_DECNET_ROUTER */ |
180 | 176 | ||
181 | static inline __le16 dnet_make_mask(int n) | 177 | static inline __le16 dnet_make_mask(int n) |
182 | { | 178 | { |
183 | if (n) | 179 | if (n) |
184 | return cpu_to_le16(~((1 << (16 - n)) - 1)); | 180 | return cpu_to_le16(~((1 << (16 - n)) - 1)); |
185 | return cpu_to_le16(0); | 181 | return cpu_to_le16(0); |
186 | } | 182 | } |
187 | 183 | ||
188 | #endif /* _NET_DN_FIB_H */ | 184 | #endif /* _NET_DN_FIB_H */ |
189 | 185 |