• Home
  • Raw
  • Download

Lines Matching refs:nh

67 	struct nexthop	*nh;  member
118 static inline bool nexthop_get(struct nexthop *nh) in nexthop_get() argument
120 return refcount_inc_not_zero(&nh->refcnt); in nexthop_get()
123 static inline void nexthop_put(struct nexthop *nh) in nexthop_put() argument
125 if (refcount_dec_and_test(&nh->refcnt)) in nexthop_put()
126 call_rcu(&nh->rcu, nexthop_free_rcu); in nexthop_put()
135 static inline bool nexthop_is_fdb(const struct nexthop *nh) in nexthop_is_fdb() argument
137 if (nh->is_group) { in nexthop_is_fdb()
140 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_fdb()
145 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_is_fdb()
150 static inline bool nexthop_has_v4(const struct nexthop *nh) in nexthop_has_v4() argument
152 if (nh->is_group) { in nexthop_has_v4()
155 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_has_v4()
161 static inline bool nexthop_is_multipath(const struct nexthop *nh) in nexthop_is_multipath() argument
163 if (nh->is_group) { in nexthop_is_multipath()
166 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_multipath()
172 struct nexthop *nexthop_select_path(struct nexthop *nh, int hash);
174 static inline unsigned int nexthop_num_path(const struct nexthop *nh) in nexthop_num_path() argument
178 if (nh->is_group) { in nexthop_num_path()
181 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_num_path()
198 return nhg->nh_entries[nhsel].nh; in nexthop_mpath_select()
202 int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh, in nexthop_mpath_fill_node() argument
205 struct nh_group *nhg = rtnl_dereference(nh->nh_grp); in nexthop_mpath_fill_node()
209 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_mpath_fill_node()
222 static inline bool nexthop_is_blackhole(const struct nexthop *nh) in nexthop_is_blackhole() argument
226 if (nh->is_group) { in nexthop_is_blackhole()
229 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_blackhole()
233 nh = nh_grp->nh_entries[0].nh; in nexthop_is_blackhole()
236 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_is_blackhole()
243 struct nexthop *nh; in nexthop_path_fib_result() local
245 nh = nexthop_select_path(res->fi->nh, hash); in nexthop_path_fib_result()
246 nhi = rcu_dereference(nh->nh_info); in nexthop_path_fib_result()
252 struct fib_nh_common *nexthop_fib_nhc(struct nexthop *nh, int nhsel) in nexthop_fib_nhc() argument
259 if (nh->is_group) { in nexthop_fib_nhc()
262 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_fib_nhc()
264 nh = nexthop_mpath_select(nh_grp, nhsel); in nexthop_fib_nhc()
265 if (!nh) in nexthop_fib_nhc()
270 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fib_nhc()
276 struct fib_nh_common *nexthop_get_nhc_lookup(const struct nexthop *nh, in nexthop_get_nhc_lookup() argument
283 if (nh->is_group) { in nexthop_get_nhc_lookup()
284 struct nh_group *nhg = rcu_dereference(nh->nh_grp); in nexthop_get_nhc_lookup()
288 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_get_nhc_lookup()
297 nhi = rcu_dereference(nh->nh_info); in nexthop_get_nhc_lookup()
307 static inline bool nexthop_uses_dev(const struct nexthop *nh, in nexthop_uses_dev() argument
312 if (nh->is_group) { in nexthop_uses_dev()
313 struct nh_group *nhg = rcu_dereference(nh->nh_grp); in nexthop_uses_dev()
317 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_uses_dev()
324 nhi = rcu_dereference(nh->nh_info); in nexthop_uses_dev()
334 if (unlikely(fi->nh)) in fib_info_num_path()
335 return nexthop_num_path(fi->nh); in fib_info_num_path()
340 int fib_check_nexthop(struct nexthop *nh, u8 scope,
345 if (unlikely(fi->nh)) in fib_info_nhc()
346 return nexthop_fib_nhc(fi->nh, nhsel); in fib_info_nhc()
354 WARN_ON(fi->nh); in fib_info_nh()
362 int fib6_check_nexthop(struct nexthop *nh, struct fib6_config *cfg,
366 static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) in nexthop_fib6_nh() argument
370 if (nh->is_group) { in nexthop_fib6_nh()
373 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_fib6_nh()
374 nh = nexthop_mpath_select(nh_grp, 0); in nexthop_fib6_nh()
375 if (!nh) in nexthop_fib6_nh()
379 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fib6_nh()
389 static inline struct fib6_nh *nexthop_fib6_nh_bh(struct nexthop *nh) in nexthop_fib6_nh_bh() argument
393 if (nh->is_group) { in nexthop_fib6_nh_bh()
396 nh_grp = rcu_dereference_bh_rtnl(nh->nh_grp); in nexthop_fib6_nh_bh()
397 nh = nexthop_mpath_select(nh_grp, 0); in nexthop_fib6_nh_bh()
398 if (!nh) in nexthop_fib6_nh_bh()
402 nhi = rcu_dereference_bh_rtnl(nh->nh_info); in nexthop_fib6_nh_bh()
413 fib6_nh = f6i->nh ? nexthop_fib6_nh(f6i->nh) : f6i->fib6_nh; in fib6_info_nh_dev()
419 struct nexthop *nh = res->f6i->nh; in nexthop_path_fib6_result() local
422 nh = nexthop_select_path(nh, hash); in nexthop_path_fib6_result()
424 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_path_fib6_result()
428 res->nh = nexthop_fib6_nh(nh); in nexthop_path_fib6_result()
430 res->nh = &nhi->fib6_nh; in nexthop_path_fib6_result()
434 int nexthop_for_each_fib6_nh(struct nexthop *nh,
435 int (*cb)(struct fib6_nh *nh, void *arg),
438 static inline int nexthop_get_family(struct nexthop *nh) in nexthop_get_family() argument
440 struct nh_info *nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_get_family()
446 struct fib_nh_common *nexthop_fdb_nhc(struct nexthop *nh) in nexthop_fdb_nhc() argument
448 struct nh_info *nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fdb_nhc()
453 static inline struct fib_nh_common *nexthop_path_fdb_result(struct nexthop *nh, in nexthop_path_fdb_result() argument
459 nhp = nexthop_select_path(nh, hash); in nexthop_path_fdb_result()