Home | History | Annotate | Download | only in route
      1 /*
      2  * netlink/route/tc.h		Traffic Control
      3  *
      4  *	This library is free software; you can redistribute it and/or
      5  *	modify it under the terms of the GNU Lesser General Public
      6  *	License as published by the Free Software Foundation version 2.1
      7  *	of the License.
      8  *
      9  * Copyright (c) 2003-2006 Thomas Graf <tgraf (at) suug.ch>
     10  */
     11 
     12 #ifndef NETLINK_TC_H_
     13 #define NETLINK_TC_H_
     14 
     15 #include <netlink/netlink.h>
     16 #include <netlink/cache.h>
     17 #include <netlink/data.h>
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23 /**
     24  * TC statistics identifiers
     25  * @ingroup tc
     26  */
     27 enum rtnl_tc_stats_id {
     28 	RTNL_TC_PACKETS,	/**< Packets seen */
     29 	RTNL_TC_BYTES,		/**< Bytes seen */
     30 	RTNL_TC_RATE_BPS,	/**< Current bits/s (rate estimator) */
     31 	RTNL_TC_RATE_PPS,	/**< Current packet/s (rate estimator) */
     32 	RTNL_TC_QLEN,		/**< Queue length */
     33 	RTNL_TC_BACKLOG,	/**< Backlog length */
     34 	RTNL_TC_DROPS,		/**< Packets dropped */
     35 	RTNL_TC_REQUEUES,	/**< Number of requeues */
     36 	RTNL_TC_OVERLIMITS,	/**< Number of overlimits */
     37 	__RTNL_TC_STATS_MAX,
     38 };
     39 
     40 #define RTNL_TC_STATS_MAX (__RTNL_TC_STATS_MAX - 1)
     41 
     42 extern int rtnl_tc_calc_txtime(int, int);
     43 extern int rtnl_tc_calc_bufsize(int, int);
     44 extern int rtnl_tc_calc_cell_log(int);
     45 
     46 /**
     47  * Number of entries in a transmission time lookup table
     48  * @ingroup tc
     49  */
     50 #define RTNL_TC_RTABLE_SIZE	256
     51 
     52 extern int rtnl_tc_build_rate_table(uint32_t *, uint8_t, uint8_t, int, int);
     53 
     54 
     55 /* TC Handle Translations */
     56 extern char *		rtnl_tc_handle2str(uint32_t, char *, size_t);
     57 extern int		rtnl_tc_str2handle(const char *, uint32_t *);
     58 
     59 #ifdef __cplusplus
     60 }
     61 #endif
     62 
     63 #endif
     64