{"id":3587,"date":"2022-12-20T17:09:05","date_gmt":"2022-12-20T20:09:05","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/stab-man8\/"},"modified":"2022-12-20T17:09:05","modified_gmt":"2022-12-20T20:09:05","slug":"stab-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/stab-man8\/","title":{"rendered":"STAB (man8)"},"content":{"rendered":"<h1 align=\"center\">STAB<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#TYPICAL OVERHEADS\">TYPICAL OVERHEADS<\/a><br \/> <a href=\"#ETHERNET CARDS CONSIDERATIONS\">ETHERNET CARDS CONSIDERATIONS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">tc\u2212stab \u2212 Generic size table manipulations<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">tc qdisc add &#8230; stab<\/p>\n<p style=\"margin-left:17%;\">[ <b>mtu<\/b> BYTES ] [ <b>tsize<\/b> SLOTS ] <br \/> [ <b>mpu<\/b> BYTES ] [ <b>overhead<\/b> BYTES ] <br \/> [ <b>linklayer<\/b> { adsl | atm | ethernet } ] &#8230;<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For the description of BYTES \u2212 please refer to the <b>UNITS<\/b> section of <b>tc<\/b>(8).<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p><b>mtu<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>maximum packet size we create size table for, assumed 2048 if not specified explicitly<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>tsize<\/b><\/p>\n<p style=\"margin-left:17%;\">required table size, assumed 512 if not specified explicitly<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p><b>mpu<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"61%\">\n<p>minimum packet size used in computations<\/p>\n<\/td>\n<td width=\"22%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>overhead<\/b><\/p>\n<p style=\"margin-left:17%;\">per\u2212packet size overhead (can be negative) used in computations<\/p>\n<p style=\"margin-left:11%;\"><b>linklayer<\/b><\/p>\n<p style=\"margin-left:17%;\">required linklayer specification.<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Size tables allow manipulation of packet sizes, as seen by the whole scheduler framework (of course, the actual packet size remains the same). Adjusted packet size is calculated only once \u2212 when a qdisc enqueues the packet. Initial root enqueue initializes it to the real packet\u2019s size.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Each qdisc can use a different size table, but the adjusted size is stored in an area shared by whole qdisc hierarchy attached to the interface. The effect is that if you have such a setup, the last qdisc with a stab in a chain &#8220;wins&#8221;. For example, consider HFSC with simple pfifo attached to one of its leaf classes. If that pfifo qdisc has stab defined, it will override lengths calculated during HFSC\u2019s enqueue; and in turn, whenever HFSC tries to dequeue a packet, it will use a potentially invalid size in its calculations. Normal setups will usually include stab defined only on root qdisc, but further overriding gives extra flexibility for less usual setups.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The initial size table is calculated by <b>tc<\/b> tool using <b>mtu<\/b> and <b>tsize<\/b> parameters. The algorithm sets each slot\u2019s size to the smallest power of 2 value, so the whole <b>mtu<\/b> is covered by the size table. Neither <b>tsize<\/b>, nor <b>mtu<\/b> have to be power of 2 value, so the size table will usually support more than is required by <b>mtu<\/b>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For example, with <b>mtu\u00a0<\/b>=\u00a01500 and <b>tsize\u00a0<\/b>=\u00a0128, a table with 128 slots will be created, where slot 0 will correspond to sizes 0\u221216, slot 1 to 17\u00a0\u2212\u00a032, &#8230;, slot 127 to 2033\u00a0\u2212\u00a02048. Sizes assigned to each slot depend on <b>linklayer<\/b> parameter.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Stab calculation is also safe for an unusual case, when a size assigned to a slot would be larger than 2^16\u22121 (you will lose the accuracy though).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">During the kernel part of packet size adjustment, <b>overhead<\/b> will be added to original size, and then slot will be calculated. If the size would cause overflow, more than 1 slot will be used to get the final size. This of course will affect accuracy, but it\u2019s only a guard against unusual situations.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Currently there are two methods of creating values stored in the size table \u2212 ethernet and atm (adsl): <br \/> ethernet<\/p>\n<p style=\"margin-left:17%;\">This is basically 1\u22121 mapping, so following our example from above (disregarding <b>mpu<\/b> for a moment) slot 0 would have 8, slot 1 would have 16 and so on, up to slot 127 with 2048. Note, that <b>mpu\u00a0<\/b>>\u00a00 must be specified, and slots that would get less than specified by <b>mpu<\/b> will get <b>mpu<\/b> instead. If you don\u2019t specify <b>mpu<\/b>, the size table will not be created at all (it wouldn\u2019t make any difference), although any <b>overhead<\/b> value will be respected during calculations.<\/p>\n<p style=\"margin-left:11%;\">atm, adsl<\/p>\n<p style=\"margin-left:17%;\">ATM linklayer consists of 53 byte cells, where each of them provides 48 bytes for payload. Also all the cells must be fully utilized, thus the last one is padded if\/as necessary.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">When the size table is calculated, adjusted size that fits properly into lowest amount of cells is assigned to a slot. For example, a 100 byte long packet requires three 48\u2212byte payloads, so the final size would require 3 ATM cells \u2212 159 bytes.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">For ATM size tables, 16\u00a0bytes sized slots are perfectly enough. The default values of <b>mtu<\/b> and <b>tsize<\/b> create 4\u00a0bytes sized slots.<\/p>\n<h2>TYPICAL OVERHEADS <a name=\"TYPICAL OVERHEADS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following values are typical for different adsl scenarios (based on <b>[1]<\/b> and <b>[2]<\/b>):<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">LLC based:<\/p>\n<p style=\"margin-left:17%;\">PPPoA \u2212 14 (PPP \u2212 2, ATM \u2212 12) <br \/> PPPoE \u2212 40+ (PPPoE \u2212 8, ATM \u2212 18, ethernet 14, possibly FCS \u2212 4+padding) <br \/> Bridged \u2212 32 (ATM \u2212 18, ethernet 14, possibly FCS \u2212 4+padding) <br \/> IPoA \u2212 16 (ATM \u2212 16)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">VC Mux based:<\/p>\n<p style=\"margin-left:17%;\">PPPoA \u2212 10 (PPP \u2212 2, ATM \u2212 8) <br \/> PPPoE \u2212 32+ (PPPoE \u2212 8, ATM \u2212 10, ethernet 14, possibly FCS \u2212 4+padding) <br \/> Bridged \u2212 24+ (ATM \u2212 10, ethernet 14, possibly FCS \u2212 4+padding) <br \/> IPoA \u2212 8 (ATM \u2212 8)<\/p>\n<p style=\"margin-left:11%;\">There are a few important things regarding the above overheads:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>IPoA in LLC case requires SNAP, instead of LLC\u2212NLPID (see rfc2684) \u2212 this is the reason why it actually takes more space than PPPoA.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>In rare cases, FCS might be preserved on protocols that include Ethernet frames (Bridged and PPPoE). In such situation, any Ethernet specific padding guaranteeing 64 bytes long frame size has to be included as well (see RFC2684). In the other words, it also guarantees that any packet you send will take minimum 2 atm cells. You should set <b>mpu<\/b> accordingly for that.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>When the size table is consulted, and you\u2019re shaping traffic for the sake of another modem\/router, an Ethernet header (without padding) will already be added to initial packet\u2019s length. You should compensate for that by subtracting 14 from the above overheads in this case. If you\u2019re shaping directly on the router (for example, with speedtouch usb modem) using ppp daemon, you\u2019re using raw ip interface without underlying layer2, so nothing will be added.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">For more thorough explanations, please see <b>[1]<\/b> and <b>[2]<\/b>.<\/p>\n<h2>ETHERNET CARDS CONSIDERATIONS <a name=\"ETHERNET CARDS CONSIDERATIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">It\u2019s often forgotten that modern network cards (even cheap ones on desktop motherboards) and\/or their drivers often support different offloading mechanisms. In the context of traffic shaping, \u2019tso\u2019 and \u2019gso\u2019 might cause undesirable effects, due to massive TCP segments being considered during traffic shaping (including stab calculations). For slow uplink interfaces, it\u2019s good to use <b>ethtool<\/b> to turn off offloading features.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tc<\/b>(8), <b>tc\u2212hfsc<\/b>(7), <b>tc\u2212hfsc<\/b>(8), <b><br \/> [1]<\/b> http:\/\/ace\u2212host.stuart.id.au\/russell\/files\/tc\/tc\u2212atm\/ <b><br \/> [2]<\/b> http:\/\/www.faqs.org\/rfcs\/rfc2684.html<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Please direct bugreports and patches to: <netdev@vger.kernel.org><\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Manpage created by Michal Soltys (soltys@ziu.info)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  tc\u2212stab \u2212 Generic size table manipulations <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,704],"class_list":["post-3587","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-tc-stab"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3587"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3587\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}