Lines Matching refs:nh

106 	struct nexthop	*nh;  member
198 struct nh_notifier_single_info nh; member
239 struct nh_notifier_single_info *nh; member
264 static inline bool nexthop_get(struct nexthop *nh) in nexthop_get() argument
266 return refcount_inc_not_zero(&nh->refcnt); in nexthop_get()
269 static inline void nexthop_put(struct nexthop *nh) in nexthop_put() argument
271 if (refcount_dec_and_test(&nh->refcnt)) in nexthop_put()
272 call_rcu_hurry(&nh->rcu, nexthop_free_rcu); in nexthop_put()
281 static inline bool nexthop_is_fdb(const struct nexthop *nh) in nexthop_is_fdb() argument
283 if (nh->is_group) { in nexthop_is_fdb()
286 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_fdb()
291 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_is_fdb()
296 static inline bool nexthop_has_v4(const struct nexthop *nh) in nexthop_has_v4() argument
298 if (nh->is_group) { in nexthop_has_v4()
301 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_has_v4()
307 static inline bool nexthop_is_multipath(const struct nexthop *nh) in nexthop_is_multipath() argument
309 if (nh->is_group) { in nexthop_is_multipath()
312 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_multipath()
318 struct nexthop *nexthop_select_path(struct nexthop *nh, int hash);
320 static inline unsigned int nexthop_num_path(const struct nexthop *nh) in nexthop_num_path() argument
324 if (nh->is_group) { in nexthop_num_path()
327 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_num_path()
344 return nhg->nh_entries[nhsel].nh; in nexthop_mpath_select()
348 int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh, in nexthop_mpath_fill_node() argument
351 struct nh_group *nhg = rcu_dereference_rtnl(nh->nh_grp); in nexthop_mpath_fill_node()
355 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_mpath_fill_node()
368 static inline bool nexthop_is_blackhole(const struct nexthop *nh) in nexthop_is_blackhole() argument
372 if (nh->is_group) { in nexthop_is_blackhole()
375 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_is_blackhole()
379 nh = nh_grp->nh_entries[0].nh; in nexthop_is_blackhole()
382 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_is_blackhole()
389 struct nexthop *nh; in nexthop_path_fib_result() local
391 nh = nexthop_select_path(res->fi->nh, hash); in nexthop_path_fib_result()
392 nhi = rcu_dereference(nh->nh_info); in nexthop_path_fib_result()
398 struct fib_nh_common *nexthop_fib_nhc(struct nexthop *nh, int nhsel) in nexthop_fib_nhc() argument
405 if (nh->is_group) { in nexthop_fib_nhc()
408 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_fib_nhc()
410 nh = nexthop_mpath_select(nh_grp, nhsel); in nexthop_fib_nhc()
411 if (!nh) in nexthop_fib_nhc()
416 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fib_nhc()
422 struct fib_nh_common *nexthop_get_nhc_lookup(const struct nexthop *nh, in nexthop_get_nhc_lookup() argument
429 if (nh->is_group) { in nexthop_get_nhc_lookup()
430 struct nh_group *nhg = rcu_dereference(nh->nh_grp); in nexthop_get_nhc_lookup()
434 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_get_nhc_lookup()
443 nhi = rcu_dereference(nh->nh_info); in nexthop_get_nhc_lookup()
453 static inline bool nexthop_uses_dev(const struct nexthop *nh, in nexthop_uses_dev() argument
458 if (nh->is_group) { in nexthop_uses_dev()
459 struct nh_group *nhg = rcu_dereference(nh->nh_grp); in nexthop_uses_dev()
463 struct nexthop *nhe = nhg->nh_entries[i].nh; in nexthop_uses_dev()
470 nhi = rcu_dereference(nh->nh_info); in nexthop_uses_dev()
480 if (unlikely(fi->nh)) in fib_info_num_path()
481 return nexthop_num_path(fi->nh); in fib_info_num_path()
486 int fib_check_nexthop(struct nexthop *nh, u8 scope,
491 if (unlikely(fi->nh)) in fib_info_nhc()
492 return nexthop_fib_nhc(fi->nh, nhsel); in fib_info_nhc()
500 WARN_ON(fi->nh); in fib_info_nh()
508 int fib6_check_nexthop(struct nexthop *nh, struct fib6_config *cfg,
512 static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) in nexthop_fib6_nh() argument
516 if (nh->is_group) { in nexthop_fib6_nh()
519 nh_grp = rcu_dereference_rtnl(nh->nh_grp); in nexthop_fib6_nh()
520 nh = nexthop_mpath_select(nh_grp, 0); in nexthop_fib6_nh()
521 if (!nh) in nexthop_fib6_nh()
525 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fib6_nh()
536 fib6_nh = f6i->nh ? nexthop_fib6_nh(f6i->nh) : f6i->fib6_nh; in fib6_info_nh_dev()
542 struct nexthop *nh = res->f6i->nh; in nexthop_path_fib6_result() local
545 nh = nexthop_select_path(nh, hash); in nexthop_path_fib6_result()
547 nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_path_fib6_result()
551 res->nh = nexthop_fib6_nh(nh); in nexthop_path_fib6_result()
553 res->nh = &nhi->fib6_nh; in nexthop_path_fib6_result()
557 int nexthop_for_each_fib6_nh(struct nexthop *nh,
558 int (*cb)(struct fib6_nh *nh, void *arg),
561 static inline int nexthop_get_family(struct nexthop *nh) in nexthop_get_family() argument
563 struct nh_info *nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_get_family()
569 struct fib_nh_common *nexthop_fdb_nhc(struct nexthop *nh) in nexthop_fdb_nhc() argument
571 struct nh_info *nhi = rcu_dereference_rtnl(nh->nh_info); in nexthop_fdb_nhc()
576 static inline struct fib_nh_common *nexthop_path_fdb_result(struct nexthop *nh, in nexthop_path_fdb_result() argument
582 nhp = nexthop_select_path(nh, hash); in nexthop_path_fdb_result()