Lines Matching refs:qdisc
587 For more information on how to modify the qdisc of a link, see section
1217 - *Queueing disciplines (qdisc)* provide a mechanism to enqueue packets
1231 - *Classifiers (cls)* are used to decide which qdisc/class the packet
1242 The default qdisc used on all network devices is `pfifo_fast`.
1244 loopback device do not have a default qdisc attached. The `pfifo_fast`
1245 qdisc provides three bands to prioritize interactive traffic over bulk
1253 qdisc is used by default. It will automatically create a separate
1259 .Example of a customized classful qdisc setup
1269 Each type traffic control module (qdisc, class, classifier) is
1288 #include <netlink/route/qdisc.h>
1290 struct rtnl_qdisc *qdisc;
1292 /* Allocation of a qdisc object */
1293 qdisc = rtnl_qdisc_alloc();
1295 /* Cast the qdisc to a tc object using TC_CAST() to use rtnl_tc_ functions. */
1296 rtnl_tc_set_mpu(TC_CAST(qdisc), 64);
1298 /* Free the qdisc object */
1299 rtnl_qdisc_put(qdisc);
1342 The kind character string specifies the type of qdisc, class,
1396 qdisc, root classifier)
1446 drops = rtnl_tc_get_stat(TC_CAST(qdisc), RTNL_TC_DROPS);
1447 qlen = rtnl_tc_get_stat(TC_CAST(qdisc), RTNL_TC_QLEN);
1453 === Queueing Discipline (qdisc)
1457 The queueing discipline (qdisc) is used to implement fair queueing,
1461 will be enqueued to a qdisc unless the device is queueless. The
1463 for the same qdisc to eventually retrieve a packet which can be
1465 stack runs a watchdog which polls the qdisc regularly to dequeue and
1474 The figure illustrates a trivial example of a classless qdisc
1481 qdisc. There is no way of taking influence on the structure of its
1491 The figure above shows a classful qdisc with a classifier attached to
1503 | Blackhole | No | This qdisc will drop all packets passed to it.
1505 The CBQ (Class Based Queueing) is a classful qdisc which allows
1509 The DRR (Deficit Round Robin) scheduler is a classful qdisc
1539 void rtnl_qdisc_put(struct rtnl_qdisc *qdisc);
1546 int rtnl_qdisc_build_add_request(struct rtnl_qdisc *qdisc, int flags,
1548 int rtnl_qdisc_add(struct nl_sock *sock, struct rtnl_qdisc *qdisc,
1567 int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *qdisc,
1569 int rtnl_qdisc_delete(struct nl_sock *sock, struct rtnl_qdisc *qdisc);
1588 qdisc configuration in the kernel. It will construct a +RTM_GETQDISC+
1594 #include <netlink/route/qdisc.h>
1599 /* error while retrieving qdisc cfg */
1604 - Search qdisc with matching ifindex and handle:
1610 - Search qdisc with matching ifindex and parent:
1618 .Example: Search and print qdisc
1621 struct rtnl_qdisc *qdisc;
1626 /* search for qdisc on eth0 with handle 1:0 */
1627 if (!(qdisc = rtnl_qdisc_get(all_qdiscs, ifindex, TC_HANDLE(1, 0))))
1628 /* no such qdisc found */
1630 nl_object_dump(OBJ_CAST(qdisc), NULL);
1632 rtnl_qdisc_put(qdisc);
1638 In order to add a new qdisc to the kernel, a qdisc object needs to be
1639 allocated. It will hold all attributes of the new qdisc.
1643 #include <netlink/route/qdisc.h>
1645 struct rtnl_qdisc *qdisc;
1647 if (!(qdisc = rtnl_qdisc_alloc()))
1651 The next step is to specify all generic qdisc attributes using the tc
1661 /* Attach qdisc to device eth0 */
1662 rtnl_tc_set_link(TC_CAST(qdisc), eth0_obj);
1664 /* Make this the root qdisc */
1665 rtnl_tc_set_parent(TC_CAST(qdisc), TC_H_ROOT);
1667 /* Set qdisc identifier to 1:0, if left unspecified, a handle will be generated by the kernel. */
1668 rtnl_tc_set_handle(TC_CAST(qdisc), TC_HANDLE(1, 0));
1670 /* Make this a HTB qdisc */
1671 rtnl_tc_set_kind(TC_CAST(qdisc), "htb");
1674 After specyfing the qdisc kind (rtnl_tc_set_kind()) the qdisc type
1676 to the respective qdisc implementations:
1681 rtnl_htb_set_defcls(qdisc, TC_HANDLE(1, 5));
1684 Finally, the qdisc is ready to be added and can be passed on to the
1686 message requesting the addition of the new qdisc, sends the message to
1688 returns 0 if the qdisc has been added or updated successfully or a
1691 CAUTION: The kernel operation for updating and adding a qdisc is the
1693 qdisc with matching handle will be updated unless the flag
1698 NLM_F_CREATE:: Create qdisc if it does not exist, otherwise
1700 NLM_F_REPLACE:: If another qdisc is already attached to the same
1701 parent and their handles mismatch, replace the qdisc
1703 NLM_F_EXCL:: Return -NLE_EXISTS if a qdisc with matching handles
1712 err = rtnl_qdisc_add(sock, qdisc, NLM_F_CREATE);
1714 /* Return the qdisc object to free memory resources */
1715 rtnl_qdisc_put(qdisc);
1718 fprintf(stderr, "Unable to add qdisc: %s\n", nl_geterror(err));
1723 ==== Deleting a qdisc
1727 #include <netlink/route/qdisc.h>
1729 struct rtnl_qdisc *qdisc;
1731 qdisc = rtnl_qdisc_alloc();
1733 rtnl_tc_set_link(TC_CAST(qdisc), eth0_obj);
1734 rtnl_tc_set_parent(TC_CAST(qdisc), TC_H_ROOT);
1736 rtnl_qdisc_delete(sock, qdisc)
1738 rtnl_qdisc_put(qdisc);
1758 uint32_t rtnl_htb_get_defcls(struct rtnl_qdisc *qdisc);
1759 int rtnl_htb_set_defcls(struct rtnl_qdisc *qdisc, uint32_t defcls);
1767 uint32_t rtnl_htb_get_rate2quantum(struct rtnl_qdisc *qdisc);
1768 int rtnl_htb_set_rate2quantum(struct rtnl_qdisc *qdisc, uint32_t rate2quantum);
1845 qdisc =:: root-qdisc
1846 class =:: root-qdisc:0
1849 qdisc =:: pX:0
1853 qdisc =:: root-qdisc
1854 class =:: root-qdisc:hY
1857 qdisc =:: pX:0
1861 qdisc =:: hX:
1867 qdisc =:: hX: