Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5093103rwd; Tue, 30 May 2023 14:40:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pOT0h/Zwxfm0lcK4N9q+XlQ1kA+jeeboDZUjGsp+lHOPXwlJ46LT4gtHPr3Pa0DzBVcIq X-Received: by 2002:a05:6a20:43a2:b0:10a:a0e1:96fa with SMTP id i34-20020a056a2043a200b0010aa0e196famr3800768pzl.22.1685482845928; Tue, 30 May 2023 14:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685482845; cv=none; d=google.com; s=arc-20160816; b=Sv/BmZZHj7leCag9vE4B+Rzjv2J8bv6dRyO6aH3+jb+txjyl47yKVXQn8wbggUyJWs qFbqWqj9y4Iyv37MeCNOMLcOaSBCub6hMwdwtKWF1vv+4CrpK2lqUdYF+4pHqvL3NI8i I4A1fos+HW4Qjo4EYjX5wdj8nToliMCQBIoWmAU7MAWzEpey3XkeyR2cVepF4WZ5uldF BKjYxCglz5WvUhiQaoaRyUt5mmVltsEqL2zbqMmzIk0uhzeN82gRucTStbAXOHoj2Yia hIqjVHI9dpC2CaLMTucNTwLYaCwgEVVtr+0XI5L3gTSfR3pmI+L9qgvkBUhCn1D/eLz/ Q+FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=/32Jf2tM0lpyU+omQzMdNSWyGffKhZZ/1f1dWy5xctI=; b=ASd1Yiyy66fM7i8xrMa4ae9K76IzhmFqIavqk2ReH0AZJy/4J6deN1MmUHUNWNrZvL S2azjz4sFDTAj1VAy4JQiao2i349vFuP5d1esTTSgDXbnbuIvXlQSW45gj49TAcKTC+0 wgkoX96H+XxaJU8lcsiy4gLH6RHCvg5rscCtZLgAG0rE6jL6VEY6Ho4dP1e9d1/rSXt9 M1fFsm1vsc3lA3ZAzZqhByIazfYzQMatMrmdgDnZNNhVAuD2eaEI8H4zHIxY4vmYGh88 k3kqpHENqDrQ2lfl+wPxX8Rz+71rIjlEI5RFf+1zoJd5y4BCj8TyYPa0KufkQRujjp6E A0Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RZeyZ3QY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 195-20020a6300cc000000b0053f228ce43csi3556551pga.547.2023.05.30.14.40.17; Tue, 30 May 2023 14:40:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RZeyZ3QY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233477AbjE3VPM (ORCPT + 99 others); Tue, 30 May 2023 17:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233318AbjE3VPH (ORCPT ); Tue, 30 May 2023 17:15:07 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 871A9138; Tue, 30 May 2023 14:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685481291; x=1717017291; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=kP3IzRcNnl5fizRI+YuizgSNvrAVapWMHLTUNUcbfpE=; b=RZeyZ3QY41q45Cp8ZXpY4z/9ubGCzj6JiDZl8BeBezkZx0fuzgCDaijT u9v2QMrJ8Vo3NMMBYqmFS7DaIpMcLejJ1EWMFuNIZxIgBXUZv38tEue4Q GFztd7GBUje0z/tplGSnQzGR5/Fig/0ygbA4t+Y3eAxAZMFsVNom+bKwa RCGFVu5NOtQXXMLLDZmlkvYbNubmEBWZ9+edHccB/XyhAtdybq1uKNkZw 9rxRrmf33esfjOA/Fyvrkt4FACWNMWgwSMmZzFQbe3riAUxS9GZ9tFMQj IApuxVpY6GEq2J0GoOqDph2b4kKibw+i9ngcovYyRUTiHde4w/D753XoA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="335398994" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="335398994" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 14:14:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="850946373" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="850946373" Received: from vcostago-desk1.jf.intel.com (HELO vcostago-desk1) ([10.54.70.17]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 14:14:17 -0700 From: Vinicius Costa Gomes To: Vladimir Oltean , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , Giuseppe Cavallaro , Alexandre Torgue , Michael Sit Wei Hong , Mohammad Athari Bin Ismail , Oleksij Rempel , Jacob Keller , linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Jesse Brandeburg , Tony Nguyen , Horatiu Vultur , Jose Abreu , Maxime Coquelin , intel-wired-lan@lists.osuosl.org, Muhammad Husaini Zulkifli Subject: Re: [PATCH net-next 1/5] net/sched: taprio: don't overwrite "sch" variable in taprio_dump_class_stats() In-Reply-To: <20230530091948.1408477-2-vladimir.oltean@nxp.com> References: <20230530091948.1408477-1-vladimir.oltean@nxp.com> <20230530091948.1408477-2-vladimir.oltean@nxp.com> Date: Tue, 30 May 2023 14:14:17 -0700 Message-ID: <87edmxv7x2.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Vladimir Oltean writes: > In taprio_dump_class_stats() we don't need a reference to the root Qdisc > once we get the reference to the child corresponding to this traffic > class, so it's okay to overwrite "sch". But in a future patch we will > need the root Qdisc too, so create a dedicated "child" pointer variable > to hold the child reference. This also makes the code adhere to a more > conventional coding style. > > Signed-off-by: Vladimir Oltean > --- The patch looks good: Acked-by: Vinicius Costa Gomes But I have a suggestion, this "taprio_queue_get() -> dev_queue->qdisc_sleeping()" dance should have the same result as calling 'taprio_leaf()'. I am thinking of using taprio_leaf() here and in taprio_dump_class(). Could be a separate commit. > net/sched/sch_taprio.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c > index 76db9a10ef50..d29e6785854d 100644 > --- a/net/sched/sch_taprio.c > +++ b/net/sched/sch_taprio.c > @@ -2388,10 +2388,10 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, > __acquires(d->lock) > { > struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); > + struct Qdisc *child = dev_queue->qdisc_sleeping; > > - sch = dev_queue->qdisc_sleeping; > - if (gnet_stats_copy_basic(d, NULL, &sch->bstats, true) < 0 || > - qdisc_qstats_copy(d, sch) < 0) > + if (gnet_stats_copy_basic(d, NULL, &child->bstats, true) < 0 || > + qdisc_qstats_copy(d, child) < 0) > return -1; > return 0; > } > -- > 2.34.1 > -- Vinicius