libnl 3.7.0
|
Modules | |
Action | |
ClassID Management | |
Classifiers | |
Packet Location Aliasing | |
Packet Location Aliasing. | |
Queueing Disciplines | |
Traffic Classes | |
Macros | |
#define | TC_HANDLE(maj, min) (TC_H_MAJ((maj) << 16) | TC_H_MIN(min)) |
Compute tc handle based on major and minor parts. More... | |
#define | TC_CAST(ptr) ((struct rtnl_tc *) (ptr)) |
Macro to cast qdisc/class/classifier to tc object. More... | |
Enumerations | |
enum | rtnl_tc_stat { RTNL_TC_PACKETS , RTNL_TC_BYTES , RTNL_TC_RATE_BPS , RTNL_TC_RATE_PPS , RTNL_TC_QLEN , RTNL_TC_BACKLOG , RTNL_TC_DROPS , RTNL_TC_REQUEUES , RTNL_TC_OVERLIMITS , __RTNL_TC_STATS_MAX } |
Traffic control statistical identifier. More... | |
Utilities | |
char * | rtnl_tc_stat2str (enum rtnl_tc_stat st, char *buf, size_t len) |
int | rtnl_tc_str2stat (const char *name) |
int | rtnl_tc_calc_txtime (int bufsize, int rate) |
Calculate time required to transmit buffer at a specific rate. More... | |
int | rtnl_tc_calc_bufsize (int txtime, int rate) |
Calculate buffer size able to transmit in a specific time and rate. More... | |
int | rtnl_tc_calc_cell_log (int cell_size) |
Calculate the binary logarithm for a specific cell size. More... | |
Modules API | |
struct nl_af_group | tc_groups [] |
struct rtnl_tc_ops * | rtnl_tc_lookup_ops (enum rtnl_tc_type type, const char *kind) |
struct rtnl_tc_ops * | rtnl_tc_get_ops (struct rtnl_tc *tc) |
int | rtnl_tc_register (struct rtnl_tc_ops *ops) |
Register a traffic control module. More... | |
void | rtnl_tc_unregister (struct rtnl_tc_ops *ops) |
Unregister a traffic control module. More... | |
void * | rtnl_tc_data_peek (struct rtnl_tc *tc) |
Returns the private data of the traffic control object. More... | |
void * | rtnl_tc_data (struct rtnl_tc *tc) |
Return pointer to private data of traffic control object. More... | |
void * | rtnl_tc_data_check (struct rtnl_tc *tc, struct rtnl_tc_ops *ops, int *err) |
Check traffic control object type and return private data section. More... | |
void | rtnl_tc_type_register (struct rtnl_tc_type_ops *ops) |
void | rtnl_tc_type_unregister (struct rtnl_tc_type_ops *ops) |
Attributes | |
void | rtnl_tc_set_ifindex (struct rtnl_tc *tc, int ifindex) |
Set interface index of traffic control object. More... | |
int | rtnl_tc_get_ifindex (struct rtnl_tc *tc) |
Return interface index of traffic control object. More... | |
void | rtnl_tc_set_link (struct rtnl_tc *tc, struct rtnl_link *link) |
Set link of traffic control object. More... | |
struct rtnl_link * | rtnl_tc_get_link (struct rtnl_tc *tc) |
Get link of traffic control object. More... | |
void | rtnl_tc_set_mtu (struct rtnl_tc *tc, uint32_t mtu) |
Set the Maximum Transmission Unit (MTU) of traffic control object. More... | |
uint32_t | rtnl_tc_get_mtu (struct rtnl_tc *tc) |
Return the MTU of traffic control object. More... | |
void | rtnl_tc_set_mpu (struct rtnl_tc *tc, uint32_t mpu) |
Set the Minimum Packet Unit (MPU) of a traffic control object. More... | |
uint32_t | rtnl_tc_get_mpu (struct rtnl_tc *tc) |
Return the Minimum Packet Unit (MPU) of a traffic control object. More... | |
void | rtnl_tc_set_overhead (struct rtnl_tc *tc, uint32_t overhead) |
Set per packet overhead of a traffic control object. More... | |
uint32_t | rtnl_tc_get_overhead (struct rtnl_tc *tc) |
Return per packet overhead of a traffic control object. More... | |
void | rtnl_tc_set_linktype (struct rtnl_tc *tc, uint32_t type) |
Set the linktype of a traffic control object. More... | |
uint32_t | rtnl_tc_get_linktype (struct rtnl_tc *tc) |
Return the linktype of a traffic control object. More... | |
void | rtnl_tc_set_handle (struct rtnl_tc *tc, uint32_t id) |
Set identifier of traffic control object. More... | |
uint32_t | rtnl_tc_get_handle (struct rtnl_tc *tc) |
Return identifier of a traffic control object. More... | |
void | rtnl_tc_set_parent (struct rtnl_tc *tc, uint32_t parent) |
Set the parent identifier of a traffic control object. More... | |
uint32_t | rtnl_tc_get_parent (struct rtnl_tc *tc) |
Return parent identifier of a traffic control object. More... | |
int | rtnl_tc_set_kind (struct rtnl_tc *tc, const char *kind) |
Define the type of traffic control object. More... | |
char * | rtnl_tc_get_kind (struct rtnl_tc *tc) |
Return kind of traffic control object. More... | |
uint64_t | rtnl_tc_get_stat (struct rtnl_tc *tc, enum rtnl_tc_stat id) |
Return value of a statistical counter of a traffic control object. More... | |
void | rtnl_tc_set_chain (struct rtnl_tc *tc, uint32_t chain) |
Set the chain index of a traffic control object. More... | |
int | rtnl_tc_get_chain (struct rtnl_tc *tc, uint32_t *out_value) |
Return chain index of traffic control object. More... | |
Rate Tables | |
int | rtnl_tc_build_rate_table (struct rtnl_tc *tc, struct rtnl_ratespec *spec, uint32_t *dst) |
Compute a transmission time lookup table. More... | |
TC implementation of cache functions | |
void | rtnl_tc_free_data (struct nl_object *obj) |
int | rtnl_tc_clone (struct nl_object *dstobj, struct nl_object *srcobj) |
void | rtnl_tc_dump_line (struct nl_object *obj, struct nl_dump_params *p) |
void | rtnl_tc_dump_details (struct nl_object *obj, struct nl_dump_params *p) |
void | rtnl_tc_dump_stats (struct nl_object *obj, struct nl_dump_params *p) |
uint64_t | rtnl_tc_compare (struct nl_object *aobj, struct nl_object *bobj, uint64_t attrs, int flags) |
#define TC_HANDLE | ( | maj, | |
min | |||
) | (TC_H_MAJ((maj) << 16) | TC_H_MIN(min)) |
#define TC_CAST | ( | ptr | ) | ((struct rtnl_tc *) (ptr)) |
Macro to cast qdisc/class/classifier to tc object.
enum rtnl_tc_stat |
Traffic control statistical identifier.
void rtnl_tc_set_ifindex | ( | struct rtnl_tc * | tc, |
int | ifindex | ||
) |
Set interface index of traffic control object.
tc | traffic control object |
ifindex | interface index. |
Sets the interface index of a traffic control object. The interface index defines the network device which this tc object is attached to. This function will overwrite any network device assigned with previous calls to rtnl_tc_set_ifindex() or rtnl_tc_set_link().
Definition at line 272 of file tc.c.
References rtnl_link_put().
Referenced by rtnl_class_foreach_child(), rtnl_class_foreach_cls(), rtnl_qdisc_build_update_request(), rtnl_qdisc_foreach_child(), and rtnl_qdisc_foreach_cls().
int rtnl_tc_get_ifindex | ( | struct rtnl_tc * | tc | ) |
void rtnl_tc_set_link | ( | struct rtnl_tc * | tc, |
struct rtnl_link * | link | ||
) |
Set link of traffic control object.
tc | traffic control object |
link | link object |
Sets the link of a traffic control object. This function serves the same purpose as rtnl_tc_set_ifindex() but due to the continued allowed access to the link object it gives it the possibility to retrieve sane default values for the the MTU and the linktype. Always prefer this function over rtnl_tc_set_ifindex() if you can spare to have an additional link object around.
Definition at line 304 of file tc.c.
References nl_object_get(), and rtnl_link_put().
struct rtnl_link * rtnl_tc_get_link | ( | struct rtnl_tc * | tc | ) |
Get link of traffic control object.
tc | traffic control object |
Returns the link of a traffic control object. The link is only returned if it has been set before via rtnl_tc_set_link() or if a link cache was available while parsing the tc object. This function may still return NULL even if an ifindex is assigned to the tc object. It will not look up the link by itself.
Definition at line 335 of file tc.c.
References nl_object_get().
void rtnl_tc_set_mtu | ( | struct rtnl_tc * | tc, |
uint32_t | mtu | ||
) |
Set the Maximum Transmission Unit (MTU) of traffic control object.
tc | traffic control object |
mtu | largest packet size expected |
Sets the MTU of a traffic control object. Not all traffic control objects will make use of this but it helps while calculating rate tables. This value is typically derived directly from the link the tc object is attached to if the link has been assigned via rtnl_tc_set_link(). It is usually not necessary to set the MTU manually, this function is provided to allow overwriting the derived value.
uint32_t rtnl_tc_get_mtu | ( | struct rtnl_tc * | tc | ) |
Return the MTU of traffic control object.
tc | traffic control object |
Returns the MTU of a traffic control object which has been set via:
Definition at line 373 of file tc.c.
Referenced by rtnl_tc_build_rate_table().
void rtnl_tc_set_mpu | ( | struct rtnl_tc * | tc, |
uint32_t | mpu | ||
) |
Set the Minimum Packet Unit (MPU) of a traffic control object.
tc | traffic control object |
mpu | minimum packet size expected |
Sets the MPU of a traffic contorl object. It specifies the minimum packet size to ever hit this traffic control object. Not all traffic control objects will make use of this but it helps while calculating rate tables.
uint32_t rtnl_tc_get_mpu | ( | struct rtnl_tc * | tc | ) |
Return the Minimum Packet Unit (MPU) of a traffic control object.
tc | traffic control object |
Definition at line 405 of file tc.c.
Referenced by rtnl_tc_build_rate_table().
void rtnl_tc_set_overhead | ( | struct rtnl_tc * | tc, |
uint32_t | overhead | ||
) |
Set per packet overhead of a traffic control object.
tc | traffic control object |
overhead | overhead per packet in bytes |
Sets the per packet overhead in bytes occuring on the link not seen by the kernel. This value can be used to correct size calculations if the packet size on the wire does not match the packet sizes seen in the network stack. Not all traffic control objects will make use this but it helps while calculating accurate packet sizes in the kernel.
uint32_t rtnl_tc_get_overhead | ( | struct rtnl_tc * | tc | ) |
Return per packet overhead of a traffic control object.
tc | traffic control object |
Definition at line 434 of file tc.c.
Referenced by rtnl_tc_build_rate_table().
void rtnl_tc_set_linktype | ( | struct rtnl_tc * | tc, |
uint32_t | type | ||
) |
Set the linktype of a traffic control object.
tc | traffic control object |
type | type of link (e.g. ARPHRD_ATM, ARPHRD_ETHER) |
Overwrites the type of link this traffic control object is attached to. This value is typically derived from the link this tc object is attached if the link has been assigned via rtnl_tc_set_link(). It is usually not necessary to set the linktype manually. This function is provided to allow overwriting the linktype.
uint32_t rtnl_tc_get_linktype | ( | struct rtnl_tc * | tc | ) |
Return the linktype of a traffic control object.
tc | traffic control object |
Returns the linktype of the link the traffic control object is attached to:
Definition at line 465 of file tc.c.
Referenced by rtnl_tc_build_rate_table().
void rtnl_tc_set_handle | ( | struct rtnl_tc * | tc, |
uint32_t | id | ||
) |
Set identifier of traffic control object.
tc | traffic control object |
id | unique identifier |
Definition at line 480 of file tc.c.
Referenced by rtnl_qdisc_build_update_request().
uint32_t rtnl_tc_get_handle | ( | struct rtnl_tc * | tc | ) |
void rtnl_tc_set_parent | ( | struct rtnl_tc * | tc, |
uint32_t | parent | ||
) |
Set the parent identifier of a traffic control object.
tc | traffic control object |
parent | identifier of parent traffif control object |
Definition at line 501 of file tc.c.
Referenced by rtnl_class_foreach_child(), rtnl_class_foreach_cls(), rtnl_qdisc_build_update_request(), rtnl_qdisc_foreach_child(), and rtnl_qdisc_foreach_cls().
uint32_t rtnl_tc_get_parent | ( | struct rtnl_tc * | tc | ) |
int rtnl_tc_set_kind | ( | struct rtnl_tc * | tc, |
const char * | kind | ||
) |
Define the type of traffic control object.
tc | traffic control object |
kind | name of the tc object type |
Definition at line 523 of file tc.c.
References rtnl_tc_data().
Referenced by rtnl_class_foreach_child(), and rtnl_qdisc_foreach_child().
char * rtnl_tc_get_kind | ( | struct rtnl_tc * | tc | ) |
uint64_t rtnl_tc_get_stat | ( | struct rtnl_tc * | tc, |
enum rtnl_tc_stat | id | ||
) |
void rtnl_tc_set_chain | ( | struct rtnl_tc * | tc, |
uint32_t | chain | ||
) |
int rtnl_tc_get_chain | ( | struct rtnl_tc * | tc, |
uint32_t * | out_value | ||
) |
char * rtnl_tc_stat2str | ( | enum rtnl_tc_stat | st, |
char * | buf, | ||
size_t | len | ||
) |
int rtnl_tc_calc_txtime | ( | int | bufsize, |
int | rate | ||
) |
Calculate time required to transmit buffer at a specific rate.
bufsize | Size of buffer to be transmited in bytes. |
rate | Transmit rate in bytes per second. |
Calculates the number of micro seconds required to transmit a specific buffer at a specific transmit rate.
int rtnl_tc_calc_bufsize | ( | int | txtime, |
int | rate | ||
) |
Calculate buffer size able to transmit in a specific time and rate.
txtime | Available transmit time in micro seconds. |
rate | Transmit rate in bytes per second. |
Calculates the size of the buffer that can be transmitted in a specific time period at a specific transmit rate.
int rtnl_tc_calc_cell_log | ( | int | cell_size | ) |
Calculate the binary logarithm for a specific cell size.
cell_size | Size of cell, must be a power of two. |
Definition at line 671 of file tc.c.
Referenced by rtnl_qdisc_tbf_set_rate().
int rtnl_tc_build_rate_table | ( | struct rtnl_tc * | tc, |
struct rtnl_ratespec * | spec, | ||
uint32_t * | dst | ||
) |
Compute a transmission time lookup table.
tc | traffic control object |
spec | Rate specification |
dst | Destination buffer of RTNL_TC_RTABLE_SIZE uint32_t[]. |
Computes a table of RTNL_TC_RTABLE_SIZE entries specyfing the transmission times for various packet sizes, e.g. the transmission time for a packet of size pktsize
could be looked up:
Definition at line 745 of file tc.c.
References nl_us2ticks(), rtnl_tc_get_linktype(), rtnl_tc_get_mpu(), rtnl_tc_get_mtu(), and rtnl_tc_get_overhead().
int rtnl_tc_clone | ( | struct nl_object * | dstobj, |
struct nl_object * | srcobj | ||
) |
void rtnl_tc_dump_line | ( | struct nl_object * | obj, |
struct nl_dump_params * | p | ||
) |
void rtnl_tc_dump_details | ( | struct nl_object * | obj, |
struct nl_dump_params * | p | ||
) |
void rtnl_tc_dump_stats | ( | struct nl_object * | obj, |
struct nl_dump_params * | p | ||
) |
uint64_t rtnl_tc_compare | ( | struct nl_object * | aobj, |
struct nl_object * | bobj, | ||
uint64_t | attrs, | ||
int | flags | ||
) |
struct rtnl_tc_ops * rtnl_tc_lookup_ops | ( | enum rtnl_tc_type | type, |
const char * | kind | ||
) |
int rtnl_tc_register | ( | struct rtnl_tc_ops * | ops | ) |
void rtnl_tc_unregister | ( | struct rtnl_tc_ops * | ops | ) |
void * rtnl_tc_data_peek | ( | struct rtnl_tc * | tc | ) |
Returns the private data of the traffic control object.
Contrary to rtnl_tc_data(), this returns NULL if the data is not yet allocated
tc | traffic control object |
Definition at line 1062 of file tc.c.
References nl_data_get().
Referenced by rtnl_vlan_get_action(), rtnl_vlan_get_mode(), rtnl_vlan_get_protocol(), rtnl_vlan_get_vlan_id(), and rtnl_vlan_get_vlan_prio().
void * rtnl_tc_data | ( | struct rtnl_tc * | tc | ) |
Return pointer to private data of traffic control object.
tc | traffic control object |
Allocates the private traffic control object data section as necessary and returns it.
Definition at line 1076 of file tc.c.
References nl_data_alloc(), and nl_data_get().
Referenced by rtnl_class_dsmark_get_bitmask(), rtnl_class_dsmark_get_value(), rtnl_class_dsmark_set_bitmask(), rtnl_class_dsmark_set_value(), rtnl_nat_set_flags(), rtnl_nat_set_mask(), rtnl_nat_set_new_addr(), rtnl_nat_set_old_addr(), rtnl_netem_get_corruption_correlation(), rtnl_netem_get_corruption_probability(), rtnl_netem_get_delay(), rtnl_netem_get_delay_correlation(), rtnl_netem_get_delay_distribution(), rtnl_netem_get_delay_distribution_size(), rtnl_netem_get_duplicate(), rtnl_netem_get_duplicate_correlation(), rtnl_netem_get_gap(), rtnl_netem_get_jitter(), rtnl_netem_get_limit(), rtnl_netem_get_loss(), rtnl_netem_get_loss_correlation(), rtnl_netem_get_reorder_correlation(), rtnl_netem_get_reorder_probability(), rtnl_netem_set_corruption_correlation(), rtnl_netem_set_corruption_probability(), rtnl_netem_set_delay(), rtnl_netem_set_delay_correlation(), rtnl_netem_set_delay_distribution_data(), rtnl_netem_set_duplicate(), rtnl_netem_set_duplicate_correlation(), rtnl_netem_set_gap(), rtnl_netem_set_jitter(), rtnl_netem_set_limit(), rtnl_netem_set_loss(), rtnl_netem_set_loss_correlation(), rtnl_netem_set_reorder_correlation(), rtnl_netem_set_reorder_probability(), rtnl_qdisc_dsmark_get_default_index(), rtnl_qdisc_dsmark_get_indices(), rtnl_qdisc_dsmark_get_set_tc_index(), rtnl_qdisc_dsmark_set_default_index(), rtnl_qdisc_dsmark_set_indices(), rtnl_qdisc_dsmark_set_set_tc_index(), rtnl_qdisc_fifo_get_limit(), rtnl_qdisc_fifo_set_limit(), rtnl_qdisc_fq_codel_get_ecn(), rtnl_qdisc_fq_codel_get_flows(), rtnl_qdisc_fq_codel_get_interval(), rtnl_qdisc_fq_codel_get_limit(), rtnl_qdisc_fq_codel_get_quantum(), rtnl_qdisc_fq_codel_get_target(), rtnl_qdisc_fq_codel_set_ecn(), rtnl_qdisc_fq_codel_set_flows(), rtnl_qdisc_fq_codel_set_interval(), rtnl_qdisc_fq_codel_set_limit(), rtnl_qdisc_fq_codel_set_quantum(), rtnl_qdisc_fq_codel_set_target(), rtnl_qdisc_plug_buffer(), rtnl_qdisc_plug_release_indefinite(), rtnl_qdisc_plug_release_one(), rtnl_qdisc_plug_set_limit(), rtnl_qdisc_prio_get_bands(), rtnl_qdisc_prio_get_priomap(), rtnl_qdisc_prio_set_bands(), rtnl_qdisc_prio_set_priomap(), rtnl_qdisc_tbf_get_limit(), rtnl_qdisc_tbf_get_peakrate(), rtnl_qdisc_tbf_get_peakrate_bucket(), rtnl_qdisc_tbf_get_peakrate_cell(), rtnl_qdisc_tbf_get_rate(), rtnl_qdisc_tbf_get_rate_bucket(), rtnl_qdisc_tbf_get_rate_cell(), rtnl_qdisc_tbf_set_limit(), rtnl_qdisc_tbf_set_limit_by_latency(), rtnl_qdisc_tbf_set_peakrate(), rtnl_qdisc_tbf_set_rate(), rtnl_red_get_limit(), rtnl_red_set_limit(), rtnl_sfq_get_divisor(), rtnl_sfq_get_limit(), rtnl_sfq_get_perturb(), rtnl_sfq_get_quantum(), rtnl_sfq_set_limit(), rtnl_sfq_set_perturb(), rtnl_sfq_set_quantum(), rtnl_tc_data_check(), rtnl_tc_set_kind(), rtnl_u32_add_key(), rtnl_u32_get_key(), rtnl_vlan_set_action(), rtnl_vlan_set_mode(), rtnl_vlan_set_protocol(), rtnl_vlan_set_vlan_id(), and rtnl_vlan_set_vlan_prio().
void * rtnl_tc_data_check | ( | struct rtnl_tc * | tc, |
struct rtnl_tc_ops * | ops, | ||
int * | err | ||
) |
Check traffic control object type and return private data section.
tc | traffic control object |
ops | expected traffic control object operations |
err | the place where saves the error code if fails |
Checks whether the traffic control object matches the type specified with the traffic control object operations. If the type matches, the private tc object data is returned. If type mismatches, APPBUG() will print a application bug warning.
Definition at line 1111 of file tc.c.
References rtnl_tc_data().