Received: by 10.213.65.68 with SMTP id h4csp2140907imn; Sun, 8 Apr 2018 20:45:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx499JRgsnazXtqH3mD0HEjOOMgmwF3sRGyDdc7525MDxLomud4Ycga75GnshHzlWe2HpqlXc X-Received: by 2002:a17:902:6547:: with SMTP id d7-v6mr37221809pln.253.1523245529308; Sun, 08 Apr 2018 20:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523245529; cv=none; d=google.com; s=arc-20160816; b=VJWI+AtwGkCaKihK14db4d+uugcr505OpEe8iGmVeO4GQCdXOhHYjH3wmyNiZOVaVX JvJYWFNEZWr8rz9zWfw+Fjb7+NhAZz9/S4nM5HzyO8V4jR0El9Lcn95CjryfCnao1gef ekat2sFEwQGBnUZw1Ym0BdVNd5NLIfSpcU6mpyboUsGgZiFpQRmKga29IVEtPDmOijXQ ZaJaZ93FzbRsCQ/z4H7APtEQJJzU6mX4C/WQXDei0aoB9JDu/PbplAn9x78Me/ArjtLB QRhU2ZHdnUTvwIrfHQ/I/iehQZ+zq4YBkfmTbvl9qMrBK0SdiiiEqn8XiOsWRiCrtQ8y I5Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=rtUeB7Kpp43NEoxG+OqBu7nSVhAbGkO61bIRDdbvnsE=; b=Ypw9HxAtu0oeJTHxJmivmmwG/k6b8vfRxAUdloHrLN5hmubAvj5J6Yn24ccpavl/sW wH3VcBK3hsVT2FQ4KV71Z27EMlllSToHNemV2XY2KzJWlcEJezI5wbtZdvruiu0T2NXc zWaXqVJ1kJqr+IgCWK+qx90xPBtXzWbEzVWwfBaFRXwSpzXasrAmcljH85Co6yXOMY2m hv/sJaZu525/4sy+45aCUpRmXs2wC6bI2qQgvGZaYMH3AlJmbA5nGb/Cgg10fHYkFXvc +lsJZWMOEqkMFUZh03u/bsCHao9t6fSTDze5SG4qpgMR5UfL2NbNl6rka1x+9cB2ZVS8 7Cmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=djQuwDbl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si11929218pfj.217.2018.04.08.20.44.52; Sun, 08 Apr 2018 20:45:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=djQuwDbl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754571AbeDIDgh (ORCPT + 99 others); Sun, 8 Apr 2018 23:36:37 -0400 Received: from mail-bn3nam01on0124.outbound.protection.outlook.com ([104.47.33.124]:4000 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754393AbeDIAVN (ORCPT ); Sun, 8 Apr 2018 20:21:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rtUeB7Kpp43NEoxG+OqBu7nSVhAbGkO61bIRDdbvnsE=; b=djQuwDblhvWznOxvaB/4iQ/TOX4AERy+Jc9tla3w9soS5Xx2wVJUeUDUBanjG1mD5u2fRTPsxS/jAExiqn6gr1ELDHgpCcuL6qnYZfAy3/61ARM7z+Cg3FdVj2tkL7mApeEBpOj6lgZ2JM7dyyvj7TerfxrGL0Ws1WxBoNqYSWg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1110.namprd21.prod.outlook.com (52.132.131.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:21:07 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:21:07 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: "Md. Islam" , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 165/189] sch_netem: Bug fixing in calculating Netem interval Thread-Topic: [PATCH AUTOSEL for 4.15 165/189] sch_netem: Bug fixing in calculating Netem interval Thread-Index: AQHTz5hb7x4hUgs8LkePNx6+3sNUTg== Date: Mon, 9 Apr 2018 00:19:00 +0000 Message-ID: <20180409001637.162453-165-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1110;7:tmZpXvwHsZm0315R6/BRhMFaCIjxds4PA681+Ng1QHGIG6/wReRztXJy1um3JtvLoXatsA9EvbVVzLdQ/vTDs4iCeFArItXi07L/5ZNHafyL5mZdx567cgbPkc+z+XG7FOkN3dSwflaKk3XUpbAti9pJmCrrpCFkbQOUMLAvRDogCoqYkfYk6/aV8OVWtfT5ufmTKFemAH1uDabI0dwDZUgrUS3fSQzxd4X9lMp5Y2Y49qmG4+JKqbNVJDGxmd21;20:DcjBQ2NzFX+8TdTWRpG3cJk66sB7pDwvaoZAgjrp0RIhkc33YiMiJQzfcaPUIo98070CPJhTTQKWO7fSvg69I+lnQRn3/xYwHTwn1kVUrgY6FV4UWdfvl1XBPBVGv5+Fd27iJwvZu299HQoBrE/QtDinXO1Dy4wuZ0C9ZGGf+10= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 36853079-c6d2-4b05-e182-08d59dafc9e2 x-microsoft-antispam: UriScan:(166340869730572);BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1110; x-ms-traffictypediagnostic: DM5PR2101MB1110: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(166340869730572); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1110;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1110; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(346002)(396003)(39380400002)(39860400002)(199004)(189003)(5660300001)(478600001)(86612001)(3846002)(6116002)(106356001)(6486002)(72206003)(25786009)(10290500003)(8936002)(6436002)(76176011)(2616005)(6506007)(2900100001)(97736004)(486006)(26005)(36756003)(10090500001)(81166006)(8676002)(81156014)(8666007)(59450400001)(102836004)(2906002)(99286004)(11346002)(476003)(3660700001)(66066001)(6512007)(86362001)(53936002)(105586002)(186003)(5250100002)(14454004)(22452003)(6666003)(2501003)(446003)(7736002)(316002)(1076002)(110136005)(3280700002)(54906003)(68736007)(107886003)(4326008)(305945005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1110;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 63tmw7sRm7cW+kJZlIfPenIoUT59HUdYeFqdumgvlz1wTROM25do3Si3ZepJEH6kxvnHF5pz5wvfhossT7RX8L3Qny7ZgqFy6aiRVTtau+AGoJ4Tx1xMUF3v5aCBI16Mm+KYC/E6lKPOSPXC9etVXfaOb89X18r8+8yqLvYNx5m7naLTvEboj2PMudchXCoV+JO1IHs8QC9vYiIDCCcy1szaMX5LxXSYD/JrmBl0pgNdiudAVlc+NTOK88iLZMgM3Vv73Ol7V7eKmB2lojgX6j/guCxUMBoqOPO7NBPnR3/m3J6BhtPjfFu0pMhtxfXDdBIVAtMLnkOZ7azDyekNWLMk6PBk/nqAeRQngUij/5wGVZAOANftDSEszDceDz2xqL7Dc17LH3eT4CXy1GsG3KLK3vWGDAnrBe0wRrkQrL8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36853079-c6d2-4b05-e182-08d59dafc9e2 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:19:00.2680 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Md. Islam" [ Upstream commit 043e337f555e610ad8237fd23522d97c968d72b9 ] In Kernel 4.15.0+, Netem does not work properly. Netem setup: tc qdisc add dev h1-eth0 root handle 1: netem delay 10ms 2ms Result: PING 172.16.101.2 (172.16.101.2) 56(84) bytes of data. 64 bytes from 172.16.101.2: icmp_seq=3D1 ttl=3D64 time=3D22.8 ms 64 bytes from 172.16.101.2: icmp_seq=3D2 ttl=3D64 time=3D10.9 ms 64 bytes from 172.16.101.2: icmp_seq=3D3 ttl=3D64 time=3D10.9 ms 64 bytes from 172.16.101.2: icmp_seq=3D5 ttl=3D64 time=3D11.4 ms 64 bytes from 172.16.101.2: icmp_seq=3D6 ttl=3D64 time=3D11.8 ms 64 bytes from 172.16.101.2: icmp_seq=3D4 ttl=3D64 time=3D4303 ms 64 bytes from 172.16.101.2: icmp_seq=3D10 ttl=3D64 time=3D11.2 ms 64 bytes from 172.16.101.2: icmp_seq=3D11 ttl=3D64 time=3D10.3 ms 64 bytes from 172.16.101.2: icmp_seq=3D7 ttl=3D64 time=3D4304 ms 64 bytes from 172.16.101.2: icmp_seq=3D8 ttl=3D64 time=3D4303 ms Patch: (rnd % (2 * sigma)) - sigma was overflowing s32. After applying the patch, I found following output which is desirable. PING 172.16.101.2 (172.16.101.2) 56(84) bytes of data. 64 bytes from 172.16.101.2: icmp_seq=3D1 ttl=3D64 time=3D21.1 ms 64 bytes from 172.16.101.2: icmp_seq=3D2 ttl=3D64 time=3D8.46 ms 64 bytes from 172.16.101.2: icmp_seq=3D3 ttl=3D64 time=3D9.00 ms 64 bytes from 172.16.101.2: icmp_seq=3D4 ttl=3D64 time=3D11.8 ms 64 bytes from 172.16.101.2: icmp_seq=3D5 ttl=3D64 time=3D8.36 ms 64 bytes from 172.16.101.2: icmp_seq=3D6 ttl=3D64 time=3D11.8 ms 64 bytes from 172.16.101.2: icmp_seq=3D7 ttl=3D64 time=3D8.11 ms 64 bytes from 172.16.101.2: icmp_seq=3D8 ttl=3D64 time=3D10.0 ms 64 bytes from 172.16.101.2: icmp_seq=3D9 ttl=3D64 time=3D11.3 ms 64 bytes from 172.16.101.2: icmp_seq=3D10 ttl=3D64 time=3D11.5 ms 64 bytes from 172.16.101.2: icmp_seq=3D11 ttl=3D64 time=3D10.2 ms Reviewed-by: Stephen Hemminger Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/sch_netem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 2aeca57f9bd0..73c4bea821cb 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -327,7 +327,7 @@ static s64 tabledist(s64 mu, s32 sigma, =20 /* default uniform distribution */ if (dist =3D=3D NULL) - return (rnd % (2 * sigma)) - sigma + mu; + return ((rnd % (2 * sigma)) + mu) - sigma; =20 t =3D dist->table[rnd % dist->size]; x =3D (sigma % NETEM_DIST_SCALE) * t; --=20 2.15.1