Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4415698rwr; Mon, 8 May 2023 07:24:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/n09848bFhzFRJDfBdGQQnTUTHM8pZexCvOuaYh/1n9Wkdl0NeTSa4viVlhxwY9K7vHfa X-Received: by 2002:a05:6a00:883:b0:63b:2320:a39f with SMTP id q3-20020a056a00088300b0063b2320a39fmr13852058pfj.19.1683555845273; Mon, 08 May 2023 07:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683555845; cv=none; d=google.com; s=arc-20160816; b=lBXoKJzZntFvxpTJFhdK+IOZdC00lN33M4K5BR0BPYkrn55qGtG8qEPIRbKrVDx0uD BYtRgclyLkvz2Lc6vx8rltK2H4DYN22kAo4XccMjFdtW1Lmz6UHNVl+qJMYjBdvG3Ay2 Af83sTczox2amrCypoVBTtDdlUxO9SzjBeQfCX64urxAseTSAtBASambxl9JsLhlEw64 cI/CHUgEne+nC5hQkwbUwDgMlcHHcCOy6StLSXn09MeBHzN4q8v7fcV+NMvdvhPdsqNF UDBocMo5iaMxA3b1bDLiuSAajH8aizQk97Eu4jHi9rscBkcrtoKkykg1CNzNOM3bKbo/ Nj5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=h773zB7L3Z4YOeGFM9KPDGaeyVeWxA0sAUEnP9BjGoE=; b=SuzmhIKMNBassuO3bMks1K8pRZI4MEI6l0x80UwqMGEZpmZuI5W6U/+4VGURslrf75 mb9eIHsh/qp9tWzE4D0Y/ogWNuattRi5L9FS8GfAoZa+o2+ucRC5KEpVY5f7fMYpIDqi vflwbjRmT62KxhoREtk0ladH32IfBvftUMxvvAMsbhtMSUa3jv3epqKkj6UIwV2ZWrMU l+rLAqqpMW2z3ZBjJxkTVduNzWhEj3S091BKTT9dalqOyNIITfFSfPR4crNlPkCcXelo HAvWlq8+eUfnsPCm/6/6nHsg4k/FH9OnGAgMoI/Sv2o9hP0cTYr/MgV2RiSSFML6a76v ajPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=CDLnus2h; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020aa79561000000b0064398136d6esi54879pfq.132.2023.05.08.07.23.53; Mon, 08 May 2023 07:24:05 -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=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=CDLnus2h; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234459AbjEHOME (ORCPT + 99 others); Mon, 8 May 2023 10:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233971AbjEHOMB (ORCPT ); Mon, 8 May 2023 10:12:01 -0400 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C78E126774 for ; Mon, 8 May 2023 07:12:00 -0700 (PDT) Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-54cac3ba705so2220024eaf.0 for ; Mon, 08 May 2023 07:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1683555120; x=1686147120; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=h773zB7L3Z4YOeGFM9KPDGaeyVeWxA0sAUEnP9BjGoE=; b=CDLnus2hjYndcrrc2sdHBBtORtAE00i4C5k9ZdE25vTcxpQE/qmvJKLAo5/2eKGIzQ nTf/00fL9cwSjcgyl4FVTSr8S4A3l/Ep7dGPOi/3PFKt2Ur/cLxQuO1rMCjlRpD9cLHI 3gSDkdSs9Ml3hwjSl2HHA9ogFj99yD9DaImMDi1rNMtBXH4/JUSCFmmOfWRcxtGj2TMi 8Jy3rnzij55sda6h4wQvtX518daTYiCXJnZ4v9RRV3R70kuv0JY528eYyBMY8MwbAldB SS0cOSrLUniwLYSvhyRCLQd4L28jrW7xVFVXFaYDkbEhkDX1qyCpeumA5GfMqbFB/kX9 c7Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683555120; x=1686147120; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h773zB7L3Z4YOeGFM9KPDGaeyVeWxA0sAUEnP9BjGoE=; b=N2/aEh73xcafSTxlQJK8d6WVaSE8Xk7W04bQnj7zG9BaTf7j5skBzs3G0MeyXLWWFH vuyCd78BrqQ150EfpcGiLhZeObifO9SGGHai08IN5SQNFQG6CR7uQouBm9LLSQS1pyNC zoi4cDzjVQj0luTggwUPn3qWA19QX7fbzNEVelJXHxEQ7QKqgrC4vKqLWM8VwHj6H9hk uIncvWYKi0KeC15oz5N7TiwoBSIAaE1OaTvarwNcWfcsddhQCEgOWjxbyDpb9j708cxE 5FqHVA5E2fQeoM94EodlZXZp6rxmSgCqaAgaVv8sb1fkBwRuEcprl3ntLuDppJNonRct 0RWg== X-Gm-Message-State: AC+VfDw8PHzK5r+mAarUpa4j65+ZbbMomsQ7kCUdS4nxQ4dVWKKOeEVr zn8bmuEkfcG0IVXpwLsSEbrSRA== X-Received: by 2002:a05:6808:317:b0:386:a643:1576 with SMTP id i23-20020a056808031700b00386a6431576mr4903529oie.46.1683555120164; Mon, 08 May 2023 07:12:00 -0700 (PDT) Received: from ?IPV6:2804:14d:5c5e:44fb:d672:f891:23e9:e156? ([2804:14d:5c5e:44fb:d672:f891:23e9:e156]) by smtp.gmail.com with ESMTPSA id k203-20020aca3dd4000000b0039232a8a1a3sm30925oia.13.2023.05.08.07.11.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 May 2023 07:11:59 -0700 (PDT) Message-ID: <58261cfa-7cba-5cc6-92ac-de155a813df7@mojatatu.com> Date: Mon, 8 May 2023 11:11:53 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH net 5/6] net/sched: Refactor qdisc_graft() for ingress and clsact Qdiscs To: Peilin Ye , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: Peilin Ye , Daniel Borkmann , John Fastabend , Vlad Buslov , Hillf Danton , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang References: <1cd15c879d51e38f6b189d41553e67a8a1de0250.1683326865.git.peilin.ye@bytedance.com> Content-Language: en-US From: Pedro Tammela In-Reply-To: <1cd15c879d51e38f6b189d41553e67a8a1de0250.1683326865.git.peilin.ye@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On 05/05/2023 21:15, Peilin Ye wrote: > Grafting ingress and clsact Qdiscs does not need a for-loop in > qdisc_graft(). Refactor it. No functional changes intended. > > Signed-off-by: Peilin Ye Just a FYI: If you decide to keep this refactoring, it will need to be back ported together with the subsequent fix. I would personally leave it to net-next. Thanks for chasing this! Tested-by: Pedro Tammela > --- > net/sched/sch_api.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c > index 49b9c1bbfdd9..f72a581666a2 100644 > --- a/net/sched/sch_api.c > +++ b/net/sched/sch_api.c > @@ -1073,12 +1073,12 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, > > if (parent == NULL) { > unsigned int i, num_q, ingress; > + struct netdev_queue *dev_queue; > > ingress = 0; > num_q = dev->num_tx_queues; > if ((q && q->flags & TCQ_F_INGRESS) || > (new && new->flags & TCQ_F_INGRESS)) { > - num_q = 1; > ingress = 1; > if (!dev_ingress_queue(dev)) { > NL_SET_ERR_MSG(extack, "Device does not have an ingress queue"); > @@ -1094,18 +1094,18 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, > if (new && new->ops->attach && !ingress) > goto skip; > > - for (i = 0; i < num_q; i++) { > - struct netdev_queue *dev_queue = dev_ingress_queue(dev); > - > - if (!ingress) > + if (!ingress) { > + for (i = 0; i < num_q; i++) { > dev_queue = netdev_get_tx_queue(dev, i); > + old = dev_graft_qdisc(dev_queue, new); > > - old = dev_graft_qdisc(dev_queue, new); > - if (new && i > 0) > - qdisc_refcount_inc(new); > - > - if (!ingress) > + if (new && i > 0) > + qdisc_refcount_inc(new); > qdisc_put(old); > + } > + } else { > + dev_queue = dev_ingress_queue(dev); > + old = dev_graft_qdisc(dev_queue, new); > } > > skip: