Received: by 10.213.65.68 with SMTP id h4csp1864671imn; Mon, 19 Mar 2018 15:39:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELtQp+vXf3l1wo8zQ4xz5vL6coZ0Bds6Oq7/5BALJINXfW1rDbn0cui7y/I0nY9s/8V5QiNw X-Received: by 10.98.82.144 with SMTP id g138mr11474667pfb.239.1521499145249; Mon, 19 Mar 2018 15:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521499145; cv=none; d=google.com; s=arc-20160816; b=DvcDbip2M7sMoorhvNjFX04qpkQfmND0tP23koGZaJSrtXHcXT0AORE1hfm4h/SHRS 30cyUeIm8S8ZFbiDStR79dSvp9Mo8s+dKqghnB8L/4csqU0Wh0Eh2KNk9PTxVazq/vCC TCWk61ilN2WdxcEVV5Ivlztj+KL5pHajiK2tN/BEIf/74/UvGhOqASn65Ts+0Y2sPcAr EzacYCJYhZZm++jDbZnGlw77gp2NRYNZgBPypaWJJsJiLkwPogj/G6uIrXih4K08ASXE XtLPD7EJn6ux04JOxQN12qZa1yC4mR5Ie4kCG4ALWuyziw2iamTLk9eOeaVMd2PZR3Pw Kyaw== 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=WmilduhO5Lr/xhZJUKYzNXPdz+do/8gEWwqKZjtvDGc=; b=XQw/TBGP68WJFZv8HTr316BDEbL92ErcjtrEjkBJDS+7NuQos+QwF6GhibIa+zyRPY 9v0mVVihuG9Y/+LfxcIvxvx5Rw5AT2MRP6LEDAKC1Qeyrst0UstlCl+3kfB8xvk0WHfl l0VEQEch/s0BAJQRuvrRREnRqkC1nHCVLaNngwDYEqBX8vOxm/+S9kzz2DE5tnpdjUb8 grauN0Tq1oYQALlR+b864Uix7TsyV56D0SZrE6LtitbWpZtKwhwuTvnAQyTXnkmhxO+m bOdt1MhBtwI8F4uApMn84mieRxboqt1E8hg4mlw0emgajV/4zuAOGdgUqhB88rXDOL+b 5J/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=DGA9KNRA; 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 j15si176351pga.418.2018.03.19.15.38.49; Mon, 19 Mar 2018 15:39:05 -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=DGA9KNRA; 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 S936664AbeCSWhC (ORCPT + 99 others); Mon, 19 Mar 2018 18:37:02 -0400 Received: from mail-cys01nam02on0090.outbound.protection.outlook.com ([104.47.37.90]:61852 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933475AbeCSPrj (ORCPT ); Mon, 19 Mar 2018 11:47:39 -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=WmilduhO5Lr/xhZJUKYzNXPdz+do/8gEWwqKZjtvDGc=; b=DGA9KNRAs/dBm0PH951+rB+5pmFhbbzBmezhlTHKBAB0kE3YNd9fUxOfxI3VjIKrd27BV/CnS7AQ50LSK/MkTHeCN5t/HdLniUacAF+P+42zeqhcKhzMs78qb3bTXf9Ww1RO5KIj/n/0syCN+9GmQP+GUKLlB4dPq5SyS63AQtI= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.0; Mon, 19 Mar 2018 15:47:30 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:47:30 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Nogah Frankel , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 028/124] net_sch: red: Fix the new offload indication Thread-Topic: [PATCH AUTOSEL for 4.15 028/124] net_sch: red: Fix the new offload indication Thread-Index: AQHTv5mVOCWwk/zA3k2VvMqw+YHN+Q== Date: Mon, 19 Mar 2018 15:47:27 +0000 Message-ID: <20180319154645.11350-28-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-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;DM5PR2101MB0998;7:szgAN3X2h5wzyFW6P2EoFh0hiGWNaok9SwKLq02o679GzrN1sPWy0aHchIL5cytiToMxRjWIhlTmYJJyDDuKlSSJOJ7efhYQ+A431gE/sCBKOlUS0a9E8SBEM/17+C8/aw/9MxAsc3kxnSYd6quH+YUr6zTYC5tvRxoEPVOWOigvZGw28cFo/79h/s0Xo7d7Av2myn2oU+4YWTetwtKbv5D+hH+F8z6IgQ+dhzGByIzDmRp89Hi5LqxbpZxj7j+D;20:SrHSTfQPIsfDMisF5yLfmkXOtgllk4Bn5PdetHbTw5EwFCfob1rkjtETcikFHmloib1cijU8nsUtQhK6zxzqht/1j0FN2pzs8u4grCFpPGY5uZqbZ0fkkIgRO78LunPFs7bQLKu59NsH2Uu1O+nwgAZsS3KGKwNl4NdOCFirk5U= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b40aab72-b366-4bbd-5cf4-08d58db0b90c x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: 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); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0998;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0998; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(366004)(376002)(396003)(346002)(199004)(189003)(3846002)(6116002)(8936002)(6486002)(102836004)(68736007)(6506007)(2900100001)(22452003)(25786009)(3660700001)(7736002)(76176011)(6512007)(72206003)(86362001)(53936002)(8676002)(81156014)(6436002)(81166006)(305945005)(478600001)(99286004)(2950100002)(14454004)(6666003)(10290500003)(186003)(107886003)(2501003)(106356001)(26005)(86612001)(97736004)(5660300001)(10090500001)(110136005)(54906003)(316002)(2906002)(66066001)(105586002)(4326008)(36756003)(3280700002)(1076002)(5250100002)(59450400001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0998;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: aNAiyHbaK6WP7tk+G3xbMj+klZdkNToK3lIbby/hGHDFkiwYPHFhauO2433uq3AMXlF+m222nPqwDhIy4ky+iAeDTBPi4T7s9bGOP0Zx97hrEux1XhTBv2u+DC/H1RPJ975jVMxinm2xgsYxeyhdi1eoUSMwqYxhitErCE8Amtlr+XQiSuRgOk2MYvY1LIUXF6nixylOOrSwTFQvyDwRgiN3tZ9IN4bgGSvWIyvGufn7ihaD5Eoep0bZsIEWBj5zJmMp7HlWsbKafUScNkzbB7hJltRJz0wcXf3OFTLFxZog/ffZgzwMN2BlLREmB859uF7t8/08A3I28tE23sMjPg== 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: b40aab72-b366-4bbd-5cf4-08d58db0b90c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:47:27.8383 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nogah Frankel [ Upstream commit 8234af2db3614d78b49e77ef46ea8cfab6586568 ] Update the offload flag, TCQ_F_OFFLOADED, in each dump call (and ignore the offloading function return value in relation to this flag). This is done because a qdisc is being initialized, and therefore offloaded before being grafted. Since the ability of the driver to offload the qdisc depends on its location, a qdisc can be offloaded and un-offloaded by graft calls, that doesn't effect the qdisc itself. Fixes: 428a68af3a7c ("net: sched: Move to new offload indication in RED" Signed-off-by: Nogah Frankel Reviewed-by: Yuval Mintz Acked-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/sch_red.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index f0747eb87dc4..cca57e93a810 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c @@ -157,7 +157,6 @@ static int red_offload(struct Qdisc *sch, bool enable) .handle =3D sch->handle, .parent =3D sch->parent, }; - int err; =20 if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) return -EOPNOTSUPP; @@ -172,14 +171,7 @@ static int red_offload(struct Qdisc *sch, bool enable) opt.command =3D TC_RED_DESTROY; } =20 - err =3D dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt); - - if (!err && enable) - sch->flags |=3D TCQ_F_OFFLOADED; - else - sch->flags &=3D ~TCQ_F_OFFLOADED; - - return err; + return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, &opt); } =20 static void red_destroy(struct Qdisc *sch) @@ -294,12 +286,22 @@ static int red_dump_offload_stats(struct Qdisc *sch, = struct tc_red_qopt *opt) .stats.qstats =3D &sch->qstats, }, }; + int err; + + sch->flags &=3D ~TCQ_F_OFFLOADED; =20 - if (!(sch->flags & TCQ_F_OFFLOADED)) + if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) + return 0; + + err =3D dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, + &hw_stats); + if (err =3D=3D -EOPNOTSUPP) return 0; =20 - return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_RED, - &hw_stats); + if (!err) + sch->flags |=3D TCQ_F_OFFLOADED; + + return err; } =20 static int red_dump(struct Qdisc *sch, struct sk_buff *skb) --=20 2.14.1