File: nh_common.h

package info (click to toggle)
iproute2 6.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,380 kB
  • sloc: ansic: 127,486; sh: 1,363; cpp: 946; makefile: 720; yacc: 421; lex: 145; python: 43
file content (65 lines) | stat: -rw-r--r-- 1,238 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NH_COMMON_H__
#define __NH_COMMON_H__ 1

#include <list.h>

#define NH_CACHE_SIZE		1024

struct nha_res_grp {
	__u16			buckets;
	__u32			idle_timer;
	__u32			unbalanced_timer;
	__u64			unbalanced_time;
};

struct nh_grp_stats {
	__u32			nh_id;
	__u64			packets;
	__u64			packets_hw;
};

struct nh_entry {
	struct hlist_node	nh_hash;

	__u32			nh_id;
	__u32			nh_oif;
	__u32			nh_flags;
	__u32			nh_resp_op_flags;
	__u16			nh_grp_type;
	__u8			nh_family;
	__u8			nh_scope;
	__u8			nh_protocol;

	bool			nh_blackhole;
	bool			nh_fdb;

	bool			nh_hw_stats_supported;
	bool			nh_hw_stats_enabled;
	bool			nh_hw_stats_used;

	int			nh_gateway_len;
	union {
		__be32		ipv4;
		struct in6_addr	ipv6;
	}			nh_gateway;

	struct rtattr		*nh_encap;
	union {
		struct rtattr   rta;
		__u8		_buf[RTA_LENGTH(sizeof(__u16))];
	}			nh_encap_type;

	bool			nh_has_res_grp;
	struct nha_res_grp	nh_res_grp;

	int			nh_groups_cnt;
	struct nexthop_grp	*nh_groups;
	struct nh_grp_stats	*nh_grp_stats;
};

void print_cache_nexthop_id(FILE *fp, const char *fp_prefix, const char *jsobj,
			    __u32 nh_id);
int print_cache_nexthop(struct nlmsghdr *n, void *arg, bool process_cache);

#endif /* __NH_COMMON_H__ */