From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47C3DC77B7A for ; Tue, 30 May 2023 21:14:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D067E417D6; Tue, 30 May 2023 21:14:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D067E417D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1685481266; bh=Wugr73/IPjn/rTdT77tW0QP/fe1mdK3v/eCXGUXYV5k=; h=From:To:In-Reply-To:References:Date:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=0VaxSSw0oh0eh4uA+jUTVTsmoOIJuQH3mlZ1ohDg5axQA8kt9yUsScB5STgQRgBEP 77QyxpCy6tQOY9lcuaiYAIprK0CLKcUOPKKrYAEG5Gi4nXfP6UFpeBwPJXfMuIqElg /Fv8c7UbuuzgRBGAgKmauYgUMOjI+UFmjINCi2ipcgGFNK2CLrjyFXLmDTpRBE2P99 wz595pAB00ORZ416AEYdkbP9cxwBONlRHKZTSU8jHcAgLKaP8NqiS2H7WMWWYB84nL rJBs+ETEvlpc2+Wzu/+xRFQD5j4/8S5uU4LWDUGJMsjYaQYjnNhEHLUNE4/VLOEMEP iVN0vRveeA5LQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WDlVRmo3tLBs; Tue, 30 May 2023 21:14:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id A56BA41828; Tue, 30 May 2023 21:14:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A56BA41828 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 4371B1BF5D7 for ; Tue, 30 May 2023 21:14:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 11E1C60F17 for ; Tue, 30 May 2023 21:14:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 11E1C60F17 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uoATiSIckvgm for ; Tue, 30 May 2023 21:14:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 16C6C60DE5 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by smtp3.osuosl.org (Postfix) with ESMTPS id 16C6C60DE5 for ; Tue, 30 May 2023 21:14:22 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="335399007" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="335399007" 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 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 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685481263; x=1717017263; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=kP3IzRcNnl5fizRI+YuizgSNvrAVapWMHLTUNUcbfpE=; b=G/vzxvHQaloucz/Msk0d1oCUPrRTxx+FBuXCJBYEpZnOklNRmiNGcFl7 jzWa5zfch4wHilwB51i2BtvxBLw9lWkExWsYz4HMqTl2zDqOft76ePewn C3So1w2DDPg4+IlUq8t0OGC5a9b4N7bWxEqAs2TVdIuCAimKJ9Kbfnq8a EvjqbG6WOYENOEFAzj3bhWTIX4pPmrS1nbP7amQStJ1Uj20k5gDJLZPYz F0A75KocyGkG/IbcatQ2OgojAWqej+Q8aF36YfkFZKU1vke6lF+TOQTAZ Yxk8wcVSXtR20Om03GLQ1UGOe+PDPNWVPCknS7zIhxqKSOSUdfR2z+jXT g==; X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=G/vzxvHQ Subject: Re: [Intel-wired-lan] [PATCH net-next 1/5] net/sched: taprio: don't overwrite "sch" variable in taprio_dump_class_stats() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Alexandre Belloni , Ferenc Fejes , Kurt Kanzenbach , Alexandre Torgue , Eric Dumazet , Tony Nguyen , Cong Wang , Gerhard Engleder , UNGLinuxDriver@microchip.com, Horatiu Vultur , Florian Fainelli , Xiaoliang Yang , Jesse Brandeburg , Mohammad Athari Bin Ismail , intel-wired-lan@lists.osuosl.org, Jakub Kicinski , Paolo Abeni , Pranavi Somisetty , Jiri Pirko , Jamal Hadi Salim , Roger Quadros , Claudiu Manoil , Giuseppe Cavallaro , Michael Sit Wei Hong , Harini Katakam , linux-kernel@vger.kernel.org, Jose Abreu , Oleksij Rempel , Maxime Coquelin , "David S. Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 284FDC77B73 for ; Tue, 30 May 2023 21:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233452AbjE3VPN (ORCPT ); Tue, 30 May 2023 17:15:13 -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 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