Lines Matching refs:nh
99 struct nexthop *nh; member
184 struct nh_notifier_single_info nh; member
212 struct nh_notifier_single_info *nh; member
232 static inline bool nexthop_get(struct nexthop *nh) in nexthop_get() argument
234 return refcount_inc_not_zero(&nh->refcnt); in nexthop_get()
237 static inline void nexthop_put(struct nexthop *nh) in nexthop_put() argument
239 if (refcount_dec_and_test(&nh->refcnt)) in nexthop_put()
240 call_rcu(&nh->rcu, nexthop_free_rcu); in nexthop_put()
249 static inline bool nexthop_is_fdb(const struct nexthop *nh) in nexthop_is_fdb() argument
251 if (nh->is_group) { in nexthop_is_fdb()
254 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_fdb()
259 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_is_fdb()
264 static inline bool nexthop_has_v4(const struct nexthop *nh) in nexthop_has_v4() argument
266 if (nh->is_group) { in nexthop_has_v4()
269 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_has_v4()
275 static inline bool nexthop_is_multipath(const struct nexthop *nh) in nexthop_is_multipath() argument
277 if (nh->is_group) { in nexthop_is_multipath()
280 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_multipath()
286 struct nexthop *nexthop_select_path(struct nexthop *nh, int hash);
288 static inline unsigned int nexthop_num_path(const struct nexthop *nh) in nexthop_num_path() argument
292 if (nh->is_group) { in nexthop_num_path()
295 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_num_path()
312 return nhg->nh_entries[nhsel].nh; in nexthop_mpath_select()
316 int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh, in nexthop_mpath_fill_node() argument
319 struct nh_group *nhg = rtnl_dereference(nh->nh_grp); in nexthop_mpath_fill_node()
323 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_mpath_fill_node()
336 static inline bool nexthop_is_blackhole(const struct nexthop *nh) in nexthop_is_blackhole() argument
340 if (nh->is_group) { in nexthop_is_blackhole()
343 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_blackhole()
347 nh = nh_grp->nh_entries[0].nh; in nexthop_is_blackhole()
350 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_is_blackhole()
357 struct nexthop *nh; in nexthop_path_fib_result() local
359 nh = nexthop_select_path(res->fi->nh, hash); in nexthop_path_fib_result()
360 nhi = rcu_dereference(nh->nh_info); in nexthop_path_fib_result()
366 struct fib_nh_common *nexthop_fib_nhc(struct nexthop *nh, int nhsel) in nexthop_fib_nhc() argument
373 if (nh->is_group) { in nexthop_fib_nhc()
376 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_fib_nhc()
378 nh = nexthop_mpath_select(nh_grp, nhsel); in nexthop_fib_nhc()
379 if (!nh) in nexthop_fib_nhc()
384 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fib_nhc()
390 struct fib_nh_common *nexthop_get_nhc_lookup(const struct nexthop *nh, in nexthop_get_nhc_lookup() argument
397 if (nh->is_group) { in nexthop_get_nhc_lookup()
398 struct nh_group *nhg = rcu_dereference(nh->nh_grp); in nexthop_get_nhc_lookup()
402 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_get_nhc_lookup()
411 nhi = rcu_dereference(nh->nh_info); in nexthop_get_nhc_lookup()
421 static inline bool nexthop_uses_dev(const struct nexthop *nh, in nexthop_uses_dev() argument
426 if (nh->is_group) { in nexthop_uses_dev()
427 struct nh_group *nhg = rcu_dereference(nh->nh_grp); in nexthop_uses_dev()
431 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_uses_dev()
438 nhi = rcu_dereference(nh->nh_info); in nexthop_uses_dev()
448 if (unlikely(fi->nh)) in fib_info_num_path()
449 return nexthop_num_path(fi->nh); in fib_info_num_path()
454 int fib_check_nexthop(struct nexthop *nh, u8 scope,
459 if (unlikely(fi->nh)) in fib_info_nhc()
460 return nexthop_fib_nhc(fi->nh, nhsel); in fib_info_nhc()
468 WARN_ON(fi->nh); in fib_info_nh()
476 int fib6_check_nexthop(struct nexthop *nh, struct fib6_config *cfg,
480 static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) in nexthop_fib6_nh() argument
484 if (nh->is_group) { in nexthop_fib6_nh()
487 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_fib6_nh()
488 nh = nexthop_mpath_select(nh_grp, 0); in nexthop_fib6_nh()
489 if (!nh) in nexthop_fib6_nh()
493 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fib6_nh()
503 static inline struct fib6_nh *nexthop_fib6_nh_bh(struct nexthop *nh) in nexthop_fib6_nh_bh() argument
507 if (nh->is_group) { in nexthop_fib6_nh_bh()
510 nh_grp = rcu_dereference_bh_rtnl(nh->nh_grp); in nexthop_fib6_nh_bh()
511 nh = nexthop_mpath_select(nh_grp, 0); in nexthop_fib6_nh_bh()
512 if (!nh) in nexthop_fib6_nh_bh()
516 nhi = rcu_dereference_bh_rtnl(nh->nh_info); in nexthop_fib6_nh_bh()
527 fib6_nh = f6i->nh ? nexthop_fib6_nh(f6i->nh) : f6i->fib6_nh; in fib6_info_nh_dev()
533 struct nexthop *nh = res->f6i->nh; in nexthop_path_fib6_result() local
536 nh = nexthop_select_path(nh, hash); in nexthop_path_fib6_result()
538 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_path_fib6_result()
542 res->nh = nexthop_fib6_nh(nh); in nexthop_path_fib6_result()
544 res->nh = &nhi->fib6_nh; in nexthop_path_fib6_result()
548 int nexthop_for_each_fib6_nh(struct nexthop *nh,
549 int (*cb)(struct fib6_nh *nh, void *arg),
552 static inline int nexthop_get_family(struct nexthop *nh) in nexthop_get_family() argument
554 struct nh_info *nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_get_family()
560 struct fib_nh_common *nexthop_fdb_nhc(struct nexthop *nh) in nexthop_fdb_nhc() argument
562 struct nh_info *nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fdb_nhc()
567 static inline struct fib_nh_common *nexthop_path_fdb_result(struct nexthop *nh, in nexthop_path_fdb_result() argument
573 nhp = nexthop_select_path(nh, hash); in nexthop_path_fdb_result()