From patchwork Thu Dec 21 19:37:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin 'ldir' Darbyshire-Bryant X-Patchwork-Id: 852096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cRq7PJxq"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=darbyshire-bryant.me.uk header.i=@darbyshire-bryant.me.uk header.b="XU/5YRk+"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z2hly2kM0z9s84 for ; Fri, 22 Dec 2017 06:39:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hJNzGFkQEQUr7zprCJqULo0muiLzr0se3kNvcAzTv7c=; b=cRq7PJxqNrA8Zk JkdPZ/AIZiteEarsL1gIfnYPT9zrMSTK7xBSdx0Y/fRQn1caNMuT7grDRgcHP4zyIsOHk2CWOaA+2 C8cRTByUeZR1p2T18mBLMc80IupqpIxPg+WOzVg3TUyVG2EnysgzNkEoHxZ+h0rJQUsdIE0jCgLJ7 tP6dncsvSSWFOboGJcVGPxX868GM1yXZvM88XHOfL/cWqN4gXvbtgub7YWYlyDw4BfJ3ymzC599UC 9sCMTK8Q3O/UZ7LmsntOaOUiAWeZiQC85kWEaabDzu5vhyCaFzMRLZKdPpwQkJ8IAuQfz7nqR6iiP JB5ccEE4wj4dai/NF6pQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eS6gF-0002aY-Gn; Thu, 21 Dec 2017 19:38:59 +0000 Received: from mail-db5eur03on0618.outbound.protection.outlook.com ([2a01:111:f400:fe0a::618] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eS6fb-00028N-5V for lede-dev@lists.infradead.org; Thu, 21 Dec 2017 19:38:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=darbyshire-bryant.me.uk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kE39I//7dGO4oR7caIXSBL0WigZ068dsbMjfF+FIPKw=; b=XU/5YRk+AXT/zSJbIN92DwrhNiK2RccCff8sqzUJiC9rrKz6l9l3xJQU+24F3zXoQaNksP7qd8YJxqUjzJUcObyoJNtUuqUDsi5clyqMiWANOwQa1HWOsl+pnTpI5Tpc/ha90Bhy++QOybdkTTGSBRXqkUQ+DurqZ7c/p8fiRwo= Received: from Rowlf.darbyshire-bryant.me.uk (5.65.126.226) by AM6PR0702MB3735.eurprd07.prod.outlook.com (2603:10a6:209:12::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.3; Thu, 21 Dec 2017 19:38:08 +0000 From: Kevin Darbyshire-Bryant To: lede-dev@lists.infradead.org Date: Thu, 21 Dec 2017 19:37:25 +0000 Message-Id: <20171221193725.71861-3-ldir@darbyshire-bryant.me.uk> X-Mailer: git-send-email 2.14.3 (Apple Git-98) In-Reply-To: <20171221193725.71861-1-ldir@darbyshire-bryant.me.uk> References: <20171221193725.71861-1-ldir@darbyshire-bryant.me.uk> MIME-Version: 1.0 X-Originating-IP: [5.65.126.226] X-ClientProxiedBy: DB6PR04CA0019.eurprd04.prod.outlook.com (2603:10a6:6::32) To AM6PR0702MB3735.eurprd07.prod.outlook.com (2603:10a6:209:12::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5e3f858-5d60-4af4-e1e5-08d548aa5d10 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020018)(7021018)(5600026)(4604075)(4534038)(7022018)(4602075)(4603075)(7168020)(4627134)(201702281549075)(7023018)(2017052603307)(7153060); SRVR:AM6PR0702MB3735; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0702MB3735; 3:ANE3talX0FomvVpnqZPq01rwIZvz4HAON1J3is9c87GDrQjHauQVzVfhNPzGDtcNk+fJXkp2/dxnGQ95BOqw4xNOe99w9S078uk9YENHpSl5oBqpY1jQZoS+SBLd/VpFjyDsciet5ka3t/no7LiXedMNq35fUm22qdNzHjvdCRfqebGdMAEHOkofwCqnBF44akSAcbZJ4ZCVxTHMq1tgeT+gb0dv2oH1KCIvUqRK257cQ0Hepu2AkkgpEVO+dFIK; 25:8t9ZgURTLqbIkiT+Vkgq7stRPBEyb/tXfZcGLXcQtfEoxGJarBiIfyx5OsRs29ouOdQoWx04JL9WNPMan0AtgyWQhhfeuWcsHU0jmKl/2TosbgZ7WM/QtRfOVX7ti2Dl5W9P1669veYmeWbaFYetF2M52PqcHlTC49u1mahZivTIbkqv19BwOTicMFdQKccdSOlhBOFBEaVRhHLG6RnYhj4SKNnh9bUdF2RfSVZswfPhDWTPT7n7mQLw66Bp+ozJx9X9xjIOMXSMg3OQ+nXIatA/yOT0prC5grsCrgPfNqk2r5Es6Batootewe5xJWysr2YJzZrkm20z7Z47dxL3MQ==; 31:Evg8+/BdMJ476qZQvtMT2+ou6fI6OxASfqBpcaVffqnXPyw+ufEyqiHz6Em0hIZVganmiKn+i3I6cxXKqsJT0YLdO7KiH3bptVobngb3YC1j/lG/G2F6Tz7KiNCWoy7J3s+ycRFlyb98rp815AIYO7Yvan2/vUusaNiodqMShRe4+4o6se/SmZ6QxTJC8aYzhFJUARtOhIEoybzJtU6plgkGdyKUKbspV552dBZK7pE= X-MS-TrafficTypeDiagnostic: AM6PR0702MB3735: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kevin@darbyshire-bryant.me.uk; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501030)(10201501046)(3002001)(93006095)(93001095)(6041268)(2016111802025)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(6043046)(201708071742011); SRVR:AM6PR0702MB3735; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0702MB3735; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0702MB3735; 4:3Y7UQRB5HSB4Cu9Kx8cipcVgYRTrLTgo+MU8Cwj5JNWqJNTbId8OnyNvV/bzA9+xS1gA47A9Y3zgc00TRD0tZQinI0lLwyH8kEeneyp5UTEVTXTzEkOePO0BDA1YDpYcKsJ9GQBNVwaWU6pPQJwa38R2+0EiktoIqa+cfR62iKuwCb9L+ldqAu+fajhbOHZU0Rzo2GVYUPP21JryFu3PeV+AdgUQvZx0hvuAcYU6RgezVLqnrTIkugJyp6c72f2bMAFyrkyHMgPiiVSIATV72J5Mrmk097B9W2ILK/IpHQKS4jpPQ/7UL2tmJjy6dxj7 X-Forefront-PRVS: 0528942FD8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39830400003)(396003)(39380400002)(376002)(346002)(288314003)(199004)(189003)(316002)(48376002)(478600001)(305945005)(53416004)(50226002)(6116002)(16586007)(74482002)(71446004)(386003)(55236004)(6486002)(59450400001)(2361001)(2351001)(52116002)(7696005)(106356001)(105586002)(81166006)(5660300001)(8676002)(81156014)(1076002)(3846002)(50466002)(7736002)(575784001)(8936002)(51416003)(76176011)(36756003)(25786009)(4326008)(97736004)(53936002)(69596002)(107886003)(66066001)(16526018)(2950100002)(42882006)(6916009)(6666003)(68736007)(2906002)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0702MB3735; H:Rowlf.darbyshire-bryant.me.uk; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: darbyshire-bryant.me.uk does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR0702MB3735; 23:hB+NJI40DrRCwMOO57DFyCKltYUEZpGZUWvzdrW?= NA0JjOflUOxGtQ+QIaNiu4T97k6yQIDKPd4qwE2m9DXfP06L5d0con6nkOjv0aPhdgPo7J/3yhTg++kUFTGpxnQF87z9lqKdWb4IRIahyrwO0J3wMSiJlRDbH+3vQpQDS+Nv59wqT+qmI6jp3O7tfKwCYXTS/JH3Sw+Qk8rO1w7JCpGxNzsfAM80I/tULAtRDEcH/2OJldFRDbttsny4I33aRI32pBLrVbtiUH2lDuinsW0PbpJI6g3JsFnUnhg+K3srMLOe0+OxBfZdqvBrQwExSs6KIazvHxXdvqzKcFVhRMojlgN87brwxOuS/jVqW7UcMrqFmL5RxIQ1rjjMAUNQVokT0DErcGXll8uqGLqrKeFeGojkoeNWQWdNKDudaPlN/6dY06DOGreLXZO6sJcoIeUl7Q8Kg3iUxqz63sV9wC/aZ3jToleSzQsXlxBbwJde1TDImeyFAAeqw93DrYpqNvOl+GgDkHchOBTzM17GmbmVJK+LpuLAaJ9ymaGWOFdIDQHbYD0WTw9YZzpyjU+axWXY4+fqDfbrM1BWqCFsRhoWQormGOE1j68XeRKq7XWcuFZNML6F+CXZOpSOCKEo/gRmTDXPn9KSnJDlZqs8G3+yrl2PjVnvyPQVcYxQzk15C6mMp1J8umDdoujhpcVJZQF8Mv/o/fFiOm1haGsDjsUUlJkF3gOjSTg3CRvIKMPlZWl4KVg6ZvFoSmvypy7IJIc5uo3IKqknCvsM+DJHq1192qNDlzLoMUQyBMT8s+kYpaPkLiRZ/QyOuXGAlEwMWwSFY2HlhPP0CTnia1nGkImGJuRqAviYt/fVrsS8wWR0khr4u255RiYy3q8MYpctOEb90GgP2clkJtW3agRWZlaANoz4K1Y0MIT/Rz8CauW8OdqBu9lUDLGd0OQBPwYKxwnKGc3XIbBrhCvLy81SdYXYLqIzgtnZoo7wtwAsPE6VkB+VMcnMW5JHhSXnGY6ectJtqcy7e41WhtKS+cTeNXWfNmDQGCRlQt+qrHxh2BrOCYzEWvNI2n1/zaj0G1AXYxR0wY7ZIMvUIiACgaPtPhCHJWjPd3ulN2SyTzdzkIkzgIb7trgDYExpbmf/MY1SlXdDHew+yTVVozaOPOj2eMs8WwURlQMjXB7rC7sx2H+727+Z/a/ExveB8g4/EUne4Q6iVzr1UknGUu+YC9YWXrhsSBPmT6O2HwVHQuW/lSVV7LnbwGaOZAeVZgnyHieVcc0+Ui4s5K8pbCkNRcJOqdIAHsJcclCBU8dgKxaGE41o= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0702MB3735; 6:ank5WIawq4nXu/soJh3WmCRF7Yz+HX2U5iLS/1YCHEJ9wW2IUymNER9rlDaYz7Vad+Rv82qWHLS9tUBZ5qSgmZqQ3isBDLkmN9g5Td2Js3Rxnxuoj+c61g/I3+j6WBMGd/qeK9nkFJVISAal+34yqn0xeZv6gnupT0uyVFqMzYupZPGTdfkL6xcEzS4n0LITH85cYAw8KSH7JcgV+PCfNcCg4pmkrzRYJs1i1LheDggjR12oQQ0cJ/D/cX67XHjCesPRlEk0cdOWWeRzR1AeUs3z/4J1CtLRNstiJQSBe5kMREuZ981o8wBgaBa/RWvGvyigEEjgStATQapN5RJTHbd5MUqKB2jOmZF1ekV392M=; 5:HDMLSCZhYVkJxkhPMkGYVe+Lji0lCSseqjfA6h4+zussNLLbnZ1CGczl7rm0Ix6NnT11+4kgEZf61ayNUSijUHSgRRiSHK8fzOrV7+oBIXx0j5lBGwaM8ebGJ2liVxd9x5ejFuEixuaIXWs1pR4X2qX490mPCQz14gGNb/ZMBAk=; 24:RKuc2lAU5jXyqu6fYQiD9pOgA5BJ8tCshKBP18r06It3XNvLzf5nuRXqePmJh9wDHFrkWmvUHGUMmsBJwgcdlnXxHnabgmW48+VmAS+stjw=; 7:kNq9S+WS5WF9yfRoR7bskLFVLIQtrMyx+70vdqLG2//ZgWFQN7Ttk9p5hMUV7MIOhz6Mf+i4F/1S1RAQJ35BVHbpUyxekKlbg9Q0wuJ5CevBNA8evwT9c7zF3b9sSPwor2m7AnHROV0TCzc/eOSGSp1e97frgRgfdFowVdq7tZsskS3VsYHPUQl+Yv74adIi/vxCHHXAfGEYCuy4teCXWfJFQXEPDbbcVQLqV0Z4EvfZR9KgnaG9gm62fEP93J5n SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: darbyshire-bryant.me.uk X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 19:38:08.4102 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5e3f858-5d60-4af4-e1e5-08d548aa5d10 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 9151708b-c553-406f-8e56-694f435154a4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0702MB3735 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171221_113819_800477_E37D2F3E X-CRM114-Status: GOOD ( 15.69 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a01:111:f400:fe0a:0:0:0:618 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [LEDE-DEV] [PATCH v1 2/2] iproute2: cake: support new operating modes for 17.01 X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Darbyshire-Bryant Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org There has been recent significant activity with the cake qdisc of late Some of that effort is related to upstreaming to kernel & iproute2 mainline but we're not quite there yet. This commit teaches tc how to activate and interprete the latest cake operating modes, namely: ingress mode: Instead of only counting packets that make it past the shaper, include packets we've decided to drop as well, since they did arrive with us on the link and took link capacity. This mode is more suitable for shaping the ingress of a link (e.g. from ISP) rather than the more normal egress. ack-filter/ack-filter-aggressive: Filter excessive TCP ACKS. Useful in highly assymetric links (downstream v upstream capacity) where the majority of upstream link capacity is occupied with ACKS for downstream traffic. Signed-off-by: Kevin Darbyshire-Bryant --- package/network/utils/iproute2/Makefile | 2 +- .../iproute2/patches/950-add-cake-to-tc.patch | 154 ++++++++++++++++----- 2 files changed, 118 insertions(+), 38 deletions(-) diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 0fa88b674d..1f566f0c4d 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 PKG_VERSION:=4.4.0 -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 diff --git a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch b/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch index 8da17112be..17fe1605b0 100644 --- a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch +++ b/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch @@ -40,7 +40,7 @@ index 8d2530d..c55a9a8 100644 + __u8 tin_cnt; /* <= TC_CAKE_MAX_TINS */ + + __u32 threshold_rate [TC_CAKE_MAX_TINS]; -+ __u32 target_us [TC_CAKE_MAX_TINS]; ++ __u32 target_us [TC_CAKE_MAX_TINS]; + struct tc_cake_traffic_stats sent [TC_CAKE_MAX_TINS]; + struct tc_cake_traffic_stats dropped [TC_CAKE_MAX_TINS]; + struct tc_cake_traffic_stats ecn_marked[TC_CAKE_MAX_TINS]; @@ -49,17 +49,18 @@ index 8d2530d..c55a9a8 100644 + __u32 way_indirect_hits[TC_CAKE_MAX_TINS]; + __u32 way_misses [TC_CAKE_MAX_TINS]; + __u32 way_collisions [TC_CAKE_MAX_TINS]; -+ __u32 peak_delay_us [TC_CAKE_MAX_TINS]; /* ~= delay to bulk flows */ ++ __u32 peak_delay_us [TC_CAKE_MAX_TINS]; /* ~= bulk flow delay */ + __u32 avge_delay_us [TC_CAKE_MAX_TINS]; -+ __u32 base_delay_us [TC_CAKE_MAX_TINS]; /* ~= delay to sparse flows */ ++ __u32 base_delay_us [TC_CAKE_MAX_TINS]; /* ~= sparse flows delay */ + __u16 sparse_flows [TC_CAKE_MAX_TINS]; + __u16 bulk_flows [TC_CAKE_MAX_TINS]; -+ __u16 unresponse_flows [TC_CAKE_MAX_TINS]; /* v4 - was u32 last_len */ -+ __u16 spare [TC_CAKE_MAX_TINS]; /* v4 - split last_len */ ++ __u16 unresponse_flows [TC_CAKE_MAX_TINS]; /* v4 - was u32 last_len */ ++ __u16 spare [TC_CAKE_MAX_TINS]; /* v4 - split last_len */ + __u32 max_skblen [TC_CAKE_MAX_TINS]; + __u32 capacity_estimate; /* version 2 */ + __u32 memory_limit; /* version 3 */ -+ __u32 memory_used; /* version 3 */ ++ __u32 memory_used; /* version 3 */ ++ struct tc_cake_traffic_stats ack_drops [TC_CAKE_MAX_TINS]; /* v5 */ +}; + #endif @@ -80,7 +81,7 @@ new file mode 100644 index 0000000..acbe56c --- /dev/null +++ b/tc/q_cake.c -@@ -0,0 +1,692 @@ +@@ -0,0 +1,771 @@ +/* + * Common Applications Kept Enhanced -- CAKE + * @@ -144,9 +145,10 @@ index 0000000..acbe56c +" dual-srchost | dual-dsthost | triple-isolate* ]\n" +" [ nat | nonat* ]\n" +" [ wash | nowash * ]\n" ++" [ ack-filter | ack-filter-aggressive | no-ack-filter * ]\n" +" [ memlimit LIMIT ]\n" +" [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n" -+" [ mpu N ]\n" ++" [ mpu N ] [ ingress | egress* ]\n" +" (* marks defaults)\n"); +} + @@ -162,12 +164,14 @@ index 0000000..acbe56c + int overhead = 0; + bool overhead_set = false; + bool overhead_override = false; -+ int wash = -1; + int mpu = 0; + int flowmode = -1; + int nat = -1; + int atm = -1; + int autorate = -1; ++ int wash = -1; ++ int ingress = -1; ++ int ack_filter = -1; + struct rtattr *tail; + + while (argc > 0) { @@ -321,12 +325,22 @@ index 0000000..acbe56c + /* Typical VDSL2 framing schemes, both over PTM */ + /* PTM has 64b/65b coding which absorbs some bandwidth */ + } else if (strcmp(*argv, "pppoe-ptm") == 0) { ++ /* 2B PPP + 6B PPPoE + 6B dest MAC + 6B src MAC ++ * + 2B ethertype + 4B Frame Check Sequence ++ * + 1B Start of Frame (S) + 1B End of Frame (Ck) ++ * + 2B TC-CRC (PTM-FCS) = 30B ++ */ + atm = 2; -+ overhead += 27; ++ overhead += 30; + overhead_set = true; + } else if (strcmp(*argv, "bridged-ptm") == 0) { ++ /* 6B dest MAC + 6B src MAC + 2B ethertype ++ * + 4B Frame Check Sequence ++ * + 1B Start of Frame (S) + 1B End of Frame (Ck) ++ * + 2B TC-CRC (PTM-FCS) = 22B ++ */ + atm = 2; -+ overhead += 19; ++ overhead += 22; + overhead_set = true; + + } else if (strcmp(*argv, "via-ethernet") == 0) { @@ -339,8 +353,26 @@ index 0000000..acbe56c + * that automatically, and is thus ignored. + * + * It would be deleted entirely, but it appears in the -+ * stats output when the automatic compensation is active. ++ * stats output when the automatic compensation is ++ * active. ++ */ ++ ++ } else if (strcmp(*argv, "total_overhead") == 0) { ++ /* ++ * This is the overhead cake accounts for; added here so ++ * that cake's "tc -s qdisc" output can be directly ++ * pasted into the tc command to instantate a new cake.. ++ */ ++ NEXT_ARG(); ++ ++ } else if (strcmp(*argv, "hard_header_len") == 0) { ++ /* ++ * This is the overhead the kernel automatically ++ * accounted for; added here so that cake's "tc -s ++ * qdisc" output can be directly pasted into the tc ++ * command to instantiate a new cake.. + */ ++ NEXT_ARG(); + + } else if (strcmp(*argv, "ethernet") == 0) { + /* ethernet pre-amble & interframe gap & FCS @@ -357,7 +389,7 @@ index 0000000..acbe56c + + /* + * DOCSIS cable shapers account for Ethernet frame with FCS, -+ * but not interframe gap nor preamble. ++ * but not interframe gap or preamble. + */ + } else if (strcmp(*argv, "docsis") == 0) { + atm = 0; @@ -384,6 +416,18 @@ index 0000000..acbe56c + return -1; + } + ++ } else if (strcmp(*argv, "ingress") == 0) { ++ ingress = 1; ++ } else if (strcmp(*argv, "egress") == 0) { ++ ingress = 0; ++ ++ } else if (strcmp(*argv, "no-ack-filter") == 0) { ++ ack_filter = 0; ++ } else if (strcmp(*argv, "ack-filter") == 0) { ++ ack_filter = 0x0200; ++ } else if (strcmp(*argv, "ack-filter-aggressive") == 0) { ++ ack_filter = 0x0600; ++ + } else if (strcmp(*argv, "memlimit") == 0) { + NEXT_ARG(); + if(get_size(&memlimit, *argv)) { @@ -432,6 +476,10 @@ index 0000000..acbe56c + addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat)); + if (wash != -1) + addattr_l(n, 1024, TCA_CAKE_WASH, &wash, sizeof(wash)); ++ if (ingress != -1) ++ addattr_l(n, 1024, TCA_CAKE_INGRESS, &ingress, sizeof(ingress)); ++ if (ack_filter != -1) ++ addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter, sizeof(ack_filter)); + + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; + return 0; @@ -453,6 +501,8 @@ index 0000000..acbe56c + int nat = 0; + int autorate = 0; + int wash = 0; ++ int ingress = 0; ++ int ack_filter = 0; + SPRINT_BUF(b1); + SPRINT_BUF(b2); + @@ -558,6 +608,14 @@ index 0000000..acbe56c + RTA_PAYLOAD(tb[TCA_CAKE_MPU]) >= sizeof(__u32)) { + mpu = rta_getattr_u32(tb[TCA_CAKE_MPU]); + } ++ if (tb[TCA_CAKE_INGRESS] && ++ RTA_PAYLOAD(tb[TCA_CAKE_INGRESS]) >= sizeof(__u32)) { ++ ingress = rta_getattr_u32(tb[TCA_CAKE_INGRESS]); ++ } ++ if (tb[TCA_CAKE_ACK_FILTER] && ++ RTA_PAYLOAD(tb[TCA_CAKE_ACK_FILTER]) >= sizeof(__u32)) { ++ ack_filter = rta_getattr_u32(tb[TCA_CAKE_ACK_FILTER]); ++ } + if (tb[TCA_CAKE_ETHERNET] && + RTA_PAYLOAD(tb[TCA_CAKE_ETHERNET]) >= sizeof(__u32)) { + ethernet = rta_getattr_u32(tb[TCA_CAKE_ETHERNET]); @@ -570,6 +628,14 @@ index 0000000..acbe56c + if (wash) + fprintf(f,"wash "); + ++ if (ingress) ++ fprintf(f,"ingress "); ++ ++ if (ack_filter == 0x0600) ++ fprintf(f,"ack-filter-aggressive "); ++ else if (ack_filter) ++ fprintf(f,"ack-filter "); ++ + if (interval) + fprintf(f, "rtt %s ", sprint_time(interval, b2)); + @@ -585,12 +651,19 @@ index 0000000..acbe56c + + fprintf(f, "overhead %d ", overhead); + -+ // This is actually the *amount* of automatic compensation, but we only report -+ // its presence as a boolean for now. ++ /* This is actually the *amount* of automatic compensation, but ++ * we only report its presence as a boolean for now. ++ */ + if (ethernet) + fprintf(f, "via-ethernet "); + } + ++ /* unconditionally report the overhead and hard_header_len overhead the ++ * kernel added automatically ++ */ ++ fprintf(f, "total_overhead %d ", overhead); ++ fprintf(f, "hard_header_len %d ", ethernet); ++ + if (mpu) { + fprintf(f, "mpu %d ", mpu); + } @@ -602,7 +675,7 @@ index 0000000..acbe56c +} + +static int cake_print_xstats(struct qdisc_util *qu, FILE *f, -+ struct rtattr *xstats) ++ struct rtattr *xstats) +{ + /* fq_codel stats format borrowed */ + struct tc_fq_codel_xstats *st; @@ -657,109 +730,116 @@ index 0000000..acbe56c + + switch(stnc->tin_cnt) { + case 3: -+ fprintf(f, " Bulk Best Effort Voice\n"); ++ fprintf(f, " Bulk Best Effort Voice\n"); + break; + + case 4: -+ fprintf(f, " Bulk Best Effort Video Voice\n"); ++ fprintf(f, " Bulk Best Effort Video Voice\n"); + break; + + case 5: -+ fprintf(f, " Low Loss Best Effort Low Delay Bulk Net Control\n"); ++ fprintf(f, " Low Loss Best Effort Low Delay Bulk Net Control\n"); + break; + + default: + fprintf(f, " "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, " Tin %u", i); ++ fprintf(f, " Tin %u", i); + fprintf(f, "\n"); + }; + + fprintf(f, " thresh "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12s", sprint_rate(stnc->threshold_rate[i], b1)); ++ fprintf(f, " %12s", sprint_rate(stnc->threshold_rate[i], b1)); + fprintf(f, "\n"); + + fprintf(f, " target "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12s", sprint_time(stnc->target_us[i], b1)); ++ fprintf(f, " %12s", sprint_time(stnc->target_us[i], b1)); + fprintf(f, "\n"); + + fprintf(f, " interval"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12s", sprint_time(stnc->interval_us[i], b1)); ++ fprintf(f, " %12s", sprint_time(stnc->interval_us[i], b1)); + fprintf(f, "\n"); + + fprintf(f, " pk_delay"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12s", sprint_time(stnc->peak_delay_us[i], b1)); ++ fprintf(f, " %12s", sprint_time(stnc->peak_delay_us[i], b1)); + fprintf(f, "\n"); + + fprintf(f, " av_delay"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12s", sprint_time(stnc->avge_delay_us[i], b1)); ++ fprintf(f, " %12s", sprint_time(stnc->avge_delay_us[i], b1)); + fprintf(f, "\n"); + + fprintf(f, " sp_delay"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12s", sprint_time(stnc->base_delay_us[i], b1)); ++ fprintf(f, " %12s", sprint_time(stnc->base_delay_us[i], b1)); + fprintf(f, "\n"); + + fprintf(f, " pkts "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->sent[i].packets); ++ fprintf(f, " %12u", stnc->sent[i].packets); + fprintf(f, "\n"); + + fprintf(f, " bytes "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12llu", stnc->sent[i].bytes); ++ fprintf(f, " %12llu", stnc->sent[i].bytes); + fprintf(f, "\n"); + + fprintf(f, " way_inds"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->way_indirect_hits[i]); ++ fprintf(f, " %12u", stnc->way_indirect_hits[i]); + fprintf(f, "\n"); + + fprintf(f, " way_miss"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->way_misses[i]); ++ fprintf(f, " %12u", stnc->way_misses[i]); + fprintf(f, "\n"); + + fprintf(f, " way_cols"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->way_collisions[i]); ++ fprintf(f, " %12u", stnc->way_collisions[i]); + fprintf(f, "\n"); + + fprintf(f, " drops "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->dropped[i].packets); ++ fprintf(f, " %12u", stnc->dropped[i].packets); + fprintf(f, "\n"); + + fprintf(f, " marks "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->ecn_marked[i].packets); ++ fprintf(f, " %12u", stnc->ecn_marked[i].packets); + fprintf(f, "\n"); + ++ if(stnc->version >= 5) { ++ fprintf(f, " ack_drop"); ++ for(i=0; i < stnc->tin_cnt; i++) ++ fprintf(f, " %12u", stnc->ack_drops[i].packets); ++ fprintf(f, "\n"); ++ } ++ + fprintf(f, " sp_flows"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->sparse_flows[i]); ++ fprintf(f, " %12u", stnc->sparse_flows[i]); + fprintf(f, "\n"); + + fprintf(f, " bk_flows"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->bulk_flows[i]); ++ fprintf(f, " %12u", stnc->bulk_flows[i]); + fprintf(f, "\n"); + + if(stnc->version >= 4) { + fprintf(f, " un_flows"); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->unresponse_flows[i]); ++ fprintf(f, " %12u", stnc->unresponse_flows[i]); + fprintf(f, "\n"); + } + + fprintf(f, " max_len "); + for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, "%12u", stnc->max_skblen[i]); ++ fprintf(f, " %12u", stnc->max_skblen[i]); + fprintf(f, "\n"); + } else { + return -1;