Lines Matching refs:qdisc
587 For more information on how to modify the qdisc of a link, see section
1317 - *Queueing disciplines (qdisc)* provide a mechanism to enqueue packets
1331 - *Classifiers (cls)* are used to decide which qdisc/class the packet
1342 The default qdisc used on all network devices is `pfifo_fast`.
1344 loopback device do not have a default qdisc attached. The `pfifo_fast`
1345 qdisc provides three bands to prioritize interactive traffic over bulk
1353 qdisc is used by default. It will automatically create a separate
1359 .Example of a customized classful qdisc setup
1369 Each type traffic control module (qdisc, class, classifier) is
1388 #include <netlink/route/qdisc.h>
1390 struct rtnl_qdisc *qdisc;
1392 /* Allocation of a qdisc object */
1393 qdisc = rtnl_qdisc_alloc();
1395 /* Cast the qdisc to a tc object using TC_CAST() to use rtnl_tc_ functions. */
1396 rtnl_tc_set_mpu(TC_CAST(qdisc), 64);
1398 /* Free the qdisc object */
1399 rtnl_qdisc_put(qdisc);
1442 The kind character string specifies the type of qdisc, class,
1496 qdisc, root classifier)
1546 drops = rtnl_tc_get_stat(TC_CAST(qdisc), RTNL_TC_DROPS);
1547 qlen = rtnl_tc_get_stat(TC_CAST(qdisc), RTNL_TC_QLEN);
1553 === Queueing Discipline (qdisc)
1557 The queueing discipline (qdisc) is used to implement fair queueing,
1561 will be enqueued to a qdisc unless the device is queueless. The
1563 for the same qdisc to eventually retrieve a packet which can be
1565 stack runs a watchdog which polls the qdisc regularly to dequeue and
1574 The figure illustrates a trivial example of a classless qdisc
1581 qdisc. There is no way of taking influence on the structure of its
1591 The figure above shows a classful qdisc with a classifier attached to
1603 | Blackhole | No | This qdisc will drop all packets passed to it.
1605 The CBQ (Class Based Queueing) is a classful qdisc which allows
1609 The DRR (Deficit Round Robin) scheduler is a classful qdisc
1639 void rtnl_qdisc_put(struct rtnl_qdisc *qdisc);
1646 int rtnl_qdisc_build_add_request(struct rtnl_qdisc *qdisc, int flags,
1648 int rtnl_qdisc_add(struct nl_sock *sock, struct rtnl_qdisc *qdisc,
1667 int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *qdisc,
1669 int rtnl_qdisc_delete(struct nl_sock *sock, struct rtnl_qdisc *qdisc);
1688 qdisc configuration in the kernel. It will construct a +RTM_GETQDISC+
1694 #include <netlink/route/qdisc.h>
1699 /* error while retrieving qdisc cfg */
1704 - Search qdisc with matching ifindex and handle:
1710 - Search qdisc with matching ifindex and parent:
1718 .Example: Search and print qdisc
1721 struct rtnl_qdisc *qdisc;
1726 /* search for qdisc on eth0 with handle 1:0 */
1727 if (!(qdisc = rtnl_qdisc_get(all_qdiscs, ifindex, TC_HANDLE(1, 0))))
1728 /* no such qdisc found */
1730 nl_object_dump(OBJ_CAST(qdisc), NULL);
1732 rtnl_qdisc_put(qdisc);
1738 In order to add a new qdisc to the kernel, a qdisc object needs to be
1739 allocated. It will hold all attributes of the new qdisc.
1743 #include <netlink/route/qdisc.h>
1745 struct rtnl_qdisc *qdisc;
1747 if (!(qdisc = rtnl_qdisc_alloc()))
1751 The next step is to specify all generic qdisc attributes using the tc
1761 /* Attach qdisc to device eth0 */
1762 rtnl_tc_set_link(TC_CAST(qdisc), eth0_obj);
1764 /* Make this the root qdisc */
1765 rtnl_tc_set_parent(TC_CAST(qdisc), TC_H_ROOT);
1767 /* Set qdisc identifier to 1:0, if left unspecified, a handle will be generated by the kernel. */
1768 rtnl_tc_set_handle(TC_CAST(qdisc), TC_HANDLE(1, 0));
1770 /* Make this a HTB qdisc */
1771 rtnl_tc_set_kind(TC_CAST(qdisc), "htb");
1774 After specyfing the qdisc kind (rtnl_tc_set_kind()) the qdisc type
1776 to the respective qdisc implementations:
1781 rtnl_htb_set_defcls(qdisc, TC_HANDLE(1, 5));
1784 Finally, the qdisc is ready to be added and can be passed on to the
1786 message requesting the addition of the new qdisc, sends the message to
1788 returns 0 if the qdisc has been added or updated successfully or a
1791 CAUTION: The kernel operation for updating and adding a qdisc is the
1793 qdisc with matching handle will be updated unless the flag
1798 NLM_F_CREATE:: Create qdisc if it does not exist, otherwise
1800 NLM_F_REPLACE:: If another qdisc is already attached to the same
1801 parent and their handles mismatch, replace the qdisc
1803 NLM_F_EXCL:: Return -NLE_EXISTS if a qdisc with matching handles
1812 err = rtnl_qdisc_add(sock, qdisc, NLM_F_CREATE);
1814 /* Return the qdisc object to free memory resources */
1815 rtnl_qdisc_put(qdisc);
1818 fprintf(stderr, "Unable to add qdisc: %s\n", nl_geterror(err));
1823 ==== Deleting a qdisc
1827 #include <netlink/route/qdisc.h>
1829 struct rtnl_qdisc *qdisc;
1831 qdisc = rtnl_qdisc_alloc();
1833 rtnl_tc_set_link(TC_CAST(qdisc), eth0_obj);
1834 rtnl_tc_set_parent(TC_CAST(qdisc), TC_H_ROOT);
1836 rtnl_qdisc_delete(sock, qdisc)
1838 rtnl_qdisc_put(qdisc);
1858 uint32_t rtnl_htb_get_defcls(struct rtnl_qdisc *qdisc);
1859 int rtnl_htb_set_defcls(struct rtnl_qdisc *qdisc, uint32_t defcls);
1867 uint32_t rtnl_htb_get_rate2quantum(struct rtnl_qdisc *qdisc);
1868 int rtnl_htb_set_rate2quantum(struct rtnl_qdisc *qdisc, uint32_t rate2quantum);
1945 qdisc =:: root-qdisc
1946 class =:: root-qdisc:0
1949 qdisc =:: pX:0
1953 qdisc =:: root-qdisc
1954 class =:: root-qdisc:hY
1957 qdisc =:: pX:0
1961 qdisc =:: hX:
1967 qdisc =:: hX: