summaryrefslogtreecommitdiff
path: root/netlink/route/tc.h
blob: 3cb876f5f6ecd0e6867dd9df5b09902e482a44cc (plain)
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
/*
 * netlink/route/tc.h		Traffic Control
 *
 *	This library is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation version 2.1
 *	of the License.
 *
 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
 */

#ifndef NETLINK_TC_H_
#define NETLINK_TC_H_

#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/data.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * TC statistics identifiers
 * @ingroup tc
 */
enum rtnl_tc_stats_id {
	RTNL_TC_PACKETS,	/**< Packets seen */
	RTNL_TC_BYTES,		/**< Bytes seen */
	RTNL_TC_RATE_BPS,	/**< Current bits/s (rate estimator) */
	RTNL_TC_RATE_PPS,	/**< Current packet/s (rate estimator) */
	RTNL_TC_QLEN,		/**< Queue length */
	RTNL_TC_BACKLOG,	/**< Backlog length */
	RTNL_TC_DROPS,		/**< Packets dropped */
	RTNL_TC_REQUEUES,	/**< Number of requeues */
	RTNL_TC_OVERLIMITS,	/**< Number of overlimits */
	__RTNL_TC_STATS_MAX,
};

#define RTNL_TC_STATS_MAX (__RTNL_TC_STATS_MAX - 1)

extern int rtnl_tc_calc_txtime(int, int);
extern int rtnl_tc_calc_bufsize(int, int);
extern int rtnl_tc_calc_cell_log(int);

/**
 * Number of entries in a transmission time lookup table
 * @ingroup tc
 */
#define RTNL_TC_RTABLE_SIZE	256

extern int rtnl_tc_build_rate_table(uint32_t *, uint8_t, uint8_t, int, int);


/* TC Handle Translations */
extern char *		rtnl_tc_handle2str(uint32_t, char *, size_t);
extern int		rtnl_tc_str2handle(const char *, uint32_t *);

#ifdef __cplusplus
}
#endif

#endif