libnl: Traffic Control

libnl 3.10.0

Topics | Macros | Enumerations
Traffic Control
Routing Library (libnl-route)

## Topics
| 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.
#define | TC_CAST(ptr) ((struct rtnl_tc *) (ptr))
| Macro to cast qdisc/class/classifier to tc object.

## 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.
int | rtnl_tc_calc_bufsize (int txtime, int rate)
| Calculate buffer size able to transmit in a specific time and rate.
int | rtnl_tc_calc_cell_log (int cell_size)
| Calculate the binary logarithm for a specific cell size.

## 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.
void | rtnl_tc_unregister (struct rtnl_tc_ops *ops)
| Unregister a traffic control module.
void * | rtnl_tc_data_peek (struct rtnl_tc *tc)
| Returns the private data of the traffic control object.
void * | rtnl_tc_data (struct rtnl_tc *tc)
| Return pointer to private data of traffic control object.
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.
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.
int | rtnl_tc_get_ifindex (struct rtnl_tc *tc)
| Return interface index of traffic control object.
void | rtnl_tc_set_link (struct rtnl_tc *tc, struct rtnl_link *link)
| Set link of traffic control object.
struct rtnl_link * | rtnl_tc_get_link (struct rtnl_tc *tc)
| Get link of traffic control object.
void | rtnl_tc_set_mtu (struct rtnl_tc *tc, uint32_t mtu)
| Set the Maximum Transmission Unit (MTU) of traffic control object.
uint32_t | rtnl_tc_get_mtu (struct rtnl_tc *tc)
| Return the MTU of traffic control object.
void | rtnl_tc_set_mpu (struct rtnl_tc *tc, uint32_t mpu)
| Set the Minimum Packet Unit (MPU) of a traffic control object.
uint32_t | rtnl_tc_get_mpu (struct rtnl_tc *tc)
| Return the Minimum Packet Unit (MPU) of a traffic control object.
void | rtnl_tc_set_overhead (struct rtnl_tc *tc, uint32_t overhead)
| Set per packet overhead of a traffic control object.
uint32_t | rtnl_tc_get_overhead (struct rtnl_tc *tc)
| Return per packet overhead of a traffic control object.
void | rtnl_tc_set_linktype (struct rtnl_tc *tc, uint32_t type)
| Set the linktype of a traffic control object.
uint32_t | rtnl_tc_get_linktype (struct rtnl_tc *tc)
| Return the linktype of a traffic control object.
void | rtnl_tc_set_handle (struct rtnl_tc *tc, uint32_t id)
| Set identifier of traffic control object.
uint32_t | rtnl_tc_get_handle (struct rtnl_tc *tc)
| Return identifier of a traffic control object.
void | rtnl_tc_set_parent (struct rtnl_tc *tc, uint32_t parent)
| Set the parent identifier of a traffic control object.
uint32_t | rtnl_tc_get_parent (struct rtnl_tc *tc)
| Return parent identifier of a traffic control object.
int | rtnl_tc_set_kind (struct rtnl_tc *tc, const char *kind)
| Define the type of traffic control object.
char * | rtnl_tc_get_kind (struct rtnl_tc *tc)
| Return kind of traffic control object.
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.
void | rtnl_tc_set_chain (struct rtnl_tc *tc, uint32_t chain)
| Set the chain index of a traffic control object.
int | rtnl_tc_get_chain (struct rtnl_tc *tc, uint32_t *out_value)
| Return chain index of traffic control object.

## 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.

## 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)

## Detailed Description

## Macro Definition Documentation

## ◆ TC_HANDLE

#define TC_HANDLE | ( |  | maj,
|  |  | min ) (TC_H_MAJ((maj) << 16) | TC_H_MIN(min))

Compute tc handle based on major and minor parts.

Definition at line 34 of file tc.h.

## ◆ TC_CAST

#define TC_CAST | ( |  | ptr | ) | ((struct rtnl_tc *) (ptr))

Macro to cast qdisc/class/classifier to tc object.

rtnl_tc_set_mpu(TC_CAST(qdisc), 40);
rtnl_tc_set_mpu
void rtnl_tc_set_mpu(struct rtnl_tc *tc, uint32_t mpu)
Set the Minimum Packet Unit (MPU) of a traffic control object.
Definition tc.c:398
TC_CAST
#define TC_CAST(ptr)
Macro to cast qdisc/class/classifier to tc object.
Definition tc.h:50

Definition at line 50 of file tc.h.

Referenced by rtnl_class_dsmark_get_bitmask(), rtnl_class_dsmark_get_value(), rtnl_class_dsmark_set_bitmask(), rtnl_class_dsmark_set_value(), rtnl_class_foreach_child(), 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_build_update_request(), 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_foreach_child(), rtnl_qdisc_foreach_cls(), 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_u32_add_key(), rtnl_u32_get_key(), rtnl_vlan_get_action(), rtnl_vlan_get_mode(), rtnl_vlan_get_protocol(), rtnl_vlan_get_vlan_id(), rtnl_vlan_get_vlan_prio(), rtnl_vlan_set_action(), rtnl_vlan_set_mode(), rtnl_vlan_set_protocol(), rtnl_vlan_set_vlan_id(), and rtnl_vlan_set_vlan_prio().

## Enumeration Type Documentation

## ◆ rtnl_tc_stat

enum rtnl_tc_stat

Traffic control statistical identifier.

uint64_t n = rtnl_tc_get_stat(TC_CAST(class), RTNL_TC_PACKETS);
rtnl_tc_get_stat
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.
Definition tc.c:568
RTNL_TC_PACKETS
@ RTNL_TC_PACKETS
Number of packets seen.
Definition tc.h:61

Enumerator
RTNL_TC_PACKETS | Number of packets seen.
RTNL_TC_BYTES | Total bytes seen.
RTNL_TC_RATE_BPS | Current bits/s (rate estimator)
RTNL_TC_RATE_PPS | Current packet/s (rate estimator)
RTNL_TC_QLEN | Current queue length.
RTNL_TC_BACKLOG | Current backlog length.
RTNL_TC_DROPS | Total number of packets dropped.
RTNL_TC_REQUEUES | Total number of requeues.
RTNL_TC_OVERLIMITS | Total number of overlimits.

Definition at line 60 of file tc.h.

## Function Documentation

## ◆ rtnl_tc_set_ifindex()

void rtnl_tc_set_ifindex | ( | struct rtnl_tc * | tc,
|  | int | ifindex )

Set interface index of traffic control object.

Parameters

  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 277 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().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ rtnl_tc_get_ifindex()

int rtnl_tc_get_ifindex | ( | struct rtnl_tc * | tc | ) |

Return interface index of traffic control object.

Parameters

  tc | traffic control object

Definition at line 292 of file tc.c.

## ◆ rtnl_tc_set_link()

void rtnl_tc_set_link | ( | struct rtnl_tc * | tc,
|  | struct rtnl_link * | link )

Set link of traffic control object.

Parameters

  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 309 of file tc.c.

References nl_object_get(), and rtnl_link_put().

Here is the call graph for this function:

## ◆ rtnl_tc_get_link()

struct rtnl_link * rtnl_tc_get_link | ( | struct rtnl_tc * | tc | ) |

Get link of traffic control object.

Parameters

  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.

Note
  The returned link will have its reference counter incremented. It is in the responsibility of the caller to return the reference.

Returns
  link object or NULL if not set.

Definition at line 340 of file tc.c.

References nl_object_get().

Here is the call graph for this function:

## ◆ rtnl_tc_set_mtu()

void rtnl_tc_set_mtu | ( | struct rtnl_tc * | tc,
|  | uint32_t | mtu )

Set the Maximum Transmission Unit (MTU) of traffic control object.

Parameters

  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.

Definition at line 363 of file tc.c.

## ◆ rtnl_tc_get_mtu()

uint32_t rtnl_tc_get_mtu | ( | struct rtnl_tc * | tc | ) |

Return the MTU of traffic control object.

Parameters

  tc | traffic control object

Returns the MTU of a traffic control object which has been set via:

1. User specified value set via rtnl_tc_set_mtu()
2. Dervied from link set via rtnl_tc_set_link()
3. Fall back to default: ethernet = 1500

Definition at line 378 of file tc.c.

Referenced by rtnl_tc_build_rate_table().

Here is the caller graph for this function:

## ◆ rtnl_tc_set_mpu()

void rtnl_tc_set_mpu | ( | struct rtnl_tc * | tc,
|  | uint32_t | mpu )

Set the Minimum Packet Unit (MPU) of a traffic control object.

Parameters

  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.

Definition at line 398 of file tc.c.

## ◆ rtnl_tc_get_mpu()

uint32_t rtnl_tc_get_mpu | ( | struct rtnl_tc * | tc | ) |

Return the Minimum Packet Unit (MPU) of a traffic control object.

Parameters

  tc | traffic control object

Returns
  The MPU previously set via rtnl_tc_set_mpu() or 0.

Definition at line 410 of file tc.c.

Referenced by rtnl_tc_build_rate_table().

Here is the caller graph for this function:

## ◆ rtnl_tc_set_overhead()

void rtnl_tc_set_overhead | ( | struct rtnl_tc * | tc,
|  | uint32_t | overhead )

Set per packet overhead of a traffic control object.

Parameters

  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.

Definition at line 427 of file tc.c.

## ◆ rtnl_tc_get_overhead()

uint32_t rtnl_tc_get_overhead | ( | struct rtnl_tc * | tc | ) |

Return per packet overhead of a traffic control object.

Parameters

  tc | traffic control object

Returns
  The overhead previously set by rtnl_tc_set_overhead() or 0.

Definition at line 439 of file tc.c.

Referenced by rtnl_tc_build_rate_table().

Here is the caller graph for this function:

## ◆ rtnl_tc_set_linktype()

void rtnl_tc_set_linktype | ( | struct rtnl_tc * | tc,
|  | uint32_t | type )

Set the linktype of a traffic control object.

Parameters

  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.

Definition at line 455 of file tc.c.

## ◆ rtnl_tc_get_linktype()

uint32_t rtnl_tc_get_linktype | ( | struct rtnl_tc * | tc | ) |

Return the linktype of a traffic control object.

Parameters

  tc | traffic control object

Returns the linktype of the link the traffic control object is attached to:

1. User specified value via rtnl_tc_set_linktype()
2. Value derived from link set via rtnl_tc_set_link()
3. Default fall-back: ARPHRD_ETHER

Definition at line 470 of file tc.c.

Referenced by rtnl_tc_build_rate_table().

Here is the caller graph for this function:

## ◆ rtnl_tc_set_handle()

void rtnl_tc_set_handle | ( | struct rtnl_tc * | tc,
|  | uint32_t | id )

Set identifier of traffic control object.

Parameters

  tc | traffic control object
  id | unique identifier

Definition at line 485 of file tc.c.

Referenced by rtnl_qdisc_build_update_request().

Here is the caller graph for this function:

## ◆ rtnl_tc_get_handle()

uint32_t rtnl_tc_get_handle | ( | struct rtnl_tc * | tc | ) |

Return identifier of a traffic control object.

Parameters

  tc | traffic control object

Definition at line 495 of file tc.c.

## ◆ rtnl_tc_set_parent()

void rtnl_tc_set_parent | ( | struct rtnl_tc * | tc,
|  | uint32_t | parent )

Set the parent identifier of a traffic control object.

Parameters

  tc | traffic control object
  parent | identifier of parent traffif control object

Definition at line 506 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().

Here is the caller graph for this function:

## ◆ rtnl_tc_get_parent()

uint32_t rtnl_tc_get_parent | ( | struct rtnl_tc * | tc | ) |

Return parent identifier of a traffic control object.

Parameters

  tc | traffic control object

Definition at line 516 of file tc.c.

## ◆ rtnl_tc_set_kind()

int rtnl_tc_set_kind | ( | struct rtnl_tc * | tc,
|  | const char * | kind )

Define the type of traffic control object.

Parameters

  tc | traffic control object
  kind | name of the tc object type

Returns
  0 on success or a negative error code

Definition at line 528 of file tc.c.

References rtnl_tc_data().

Referenced by rtnl_class_foreach_child(), and rtnl_qdisc_foreach_child().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ rtnl_tc_get_kind()

char * rtnl_tc_get_kind | ( | struct rtnl_tc * | tc | ) |

Return kind of traffic control object.

Parameters

  tc | traffic control object

Returns
  Kind of traffic control object or NULL if not set.

Definition at line 553 of file tc.c.

## ◆ rtnl_tc_get_stat()

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.

Parameters

  tc | traffic control object
  id | identifier of statistical counter

Returns
  Value of requested statistic counter or 0.

Definition at line 568 of file tc.c.

## ◆ rtnl_tc_set_chain()

void rtnl_tc_set_chain | ( | struct rtnl_tc * | tc,
|  | uint32_t | chain )

Set the chain index of a traffic control object.

Parameters

  tc | traffic control object
  chain | chain index of traffic control object

Definition at line 582 of file tc.c.

## ◆ rtnl_tc_get_chain()

int rtnl_tc_get_chain | ( | struct rtnl_tc * | tc,
|  | uint32_t * | out_value )

Return chain index of traffic control object.

Parameters

  tc | traffic control object
  out_value | output argument.

Returns
  0 of the output value was successfully returned, or a negative error code on failure.

Definition at line 596 of file tc.c.

## ◆ rtnl_tc_stat2str()

char * rtnl_tc_stat2str | ( | enum rtnl_tc_stat | st,
|  | char * | buf,
|  | size_t | len )

Definition at line 623 of file tc.c.

## ◆ rtnl_tc_str2stat()

int rtnl_tc_str2stat | ( | const char * | name | ) |

Definition at line 628 of file tc.c.

## ◆ rtnl_tc_calc_txtime()

int rtnl_tc_calc_txtime | ( | int | bufsize,
|  | int | rate )

Calculate time required to transmit buffer at a specific rate.

Parameters

  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.

Returns
  Required transmit time in micro seconds.

Definition at line 647 of file tc.c.

## ◆ rtnl_tc_calc_bufsize()

int rtnl_tc_calc_bufsize | ( | int | txtime,
|  | int | rate )

Calculate buffer size able to transmit in a specific time and rate.

Parameters

  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.

Returns
  Size of buffer in bytes.

Definition at line 666 of file tc.c.

## ◆ rtnl_tc_calc_cell_log()

int rtnl_tc_calc_cell_log | ( | int | cell_size | ) |

Calculate the binary logarithm for a specific cell size.

Parameters

  cell_size | Size of cell, must be a power of two.

Returns
  Binary logarithm of cell size or a negative error code.

Definition at line 676 of file tc.c.

Referenced by rtnl_qdisc_tbf_set_rate().

Here is the caller graph for this function:

## ◆ rtnl_tc_build_rate_table()

int rtnl_tc_build_rate_table | ( | struct rtnl_tc * | tc,
|  | struct rtnl_ratespec * | spec,
|  | uint32_t * | dst )

Compute a transmission time lookup table.

Parameters

  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:

txtime = table[pktsize >> log2(mtu)];

Definition at line 750 of file tc.c.

References nl_us2ticks(), rtnl_tc_get_linktype(), rtnl_tc_get_mpu(), rtnl_tc_get_mtu(), and rtnl_tc_get_overhead().

Here is the call graph for this function:

## ◆ rtnl_tc_free_data()

void rtnl_tc_free_data | ( | struct nl_object * | obj | ) |

Definition at line 792 of file tc.c.

## ◆ rtnl_tc_clone()

int rtnl_tc_clone | ( | struct nl_object * | dstobj,
|  | struct nl_object * | srcobj )

Definition at line 810 of file tc.c.

## ◆ rtnl_tc_dump_line()

void rtnl_tc_dump_line | ( | struct nl_object * | obj,
|  | struct nl_dump_params * | p )

Definition at line 886 of file tc.c.

## ◆ rtnl_tc_dump_details()

void rtnl_tc_dump_details | ( | struct nl_object * | obj,
|  | struct nl_dump_params * | p )

Definition at line 921 of file tc.c.

## ◆ rtnl_tc_dump_stats()

void rtnl_tc_dump_stats | ( | struct nl_object * | obj,
|  | struct nl_dump_params * | p )

Definition at line 943 of file tc.c.

## ◆ rtnl_tc_compare()

uint64_t rtnl_tc_compare | ( | struct nl_object * | aobj,
|  | struct nl_object * | bobj,
|  | uint64_t | attrs,
|  | int | flags )

Definition at line 972 of file tc.c.

## ◆ rtnl_tc_lookup_ops()

struct rtnl_tc_ops * rtnl_tc_lookup_ops | ( | enum rtnl_tc_type | type,
|  | const char * | kind )

Definition at line 995 of file tc.c.

## ◆ rtnl_tc_get_ops()

struct rtnl_tc_ops * rtnl_tc_get_ops | ( | struct rtnl_tc * | tc | ) |

Definition at line 1006 of file tc.c.

## ◆ rtnl_tc_register()

int rtnl_tc_register | ( | struct rtnl_tc_ops * | ops | ) |

Register a traffic control module.

Parameters

  ops | traffic control module operations

Definition at line 1018 of file tc.c.

## ◆ rtnl_tc_unregister()

void rtnl_tc_unregister | ( | struct rtnl_tc_ops * | ops | ) |

Unregister a traffic control module.

Parameters

  ops | traffic control module operations

Definition at line 1052 of file tc.c.

## ◆ rtnl_tc_data_peek()

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

Parameters

  tc | traffic control object

Returns
  pointer to the private data or NULL if not allocated.

Definition at line 1065 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().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ rtnl_tc_data()

void * rtnl_tc_data | ( | struct rtnl_tc * | tc | ) |

Return pointer to private data of traffic control object.

Parameters

  tc | traffic control object

Allocates the private traffic control object data section as necessary and returns it.

Returns
  Pointer to private tc data or NULL if allocation failed.

Definition at line 1079 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().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ rtnl_tc_data_check()

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.

Parameters

  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.

See also
  rtnl_tc_data()

Returns
  Pointer to private tc data or NULL if type mismatches.

Definition at line 1114 of file tc.c.

References rtnl_tc_data().

Here is the call graph for this function:

## ◆ rtnl_tc_type_register()

void rtnl_tc_type_register | ( | struct rtnl_tc_type_ops * | ops | ) |

Definition at line 1146 of file tc.c.

## ◆ rtnl_tc_type_unregister()

void rtnl_tc_type_unregister | ( | struct rtnl_tc_type_ops * | ops | ) |

Definition at line 1154 of file tc.c.

## Variable Documentation

## ◆ tc_groups

struct nl_af_group tc_groups[]

Initial value:
= {
{ AF_UNSPEC, RTNLGRP_TC },
{ END_OF_GROUP_LIST },
}

Definition at line 1140 of file tc.c.