From patchwork Tue Feb 7 13:54:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 53900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2862213wrn; Tue, 7 Feb 2023 05:58:21 -0800 (PST) X-Google-Smtp-Source: AK7set/+SQ6AJXucrcNBk1nMW0xcW9X0D+hpdjxqFjHcsTzgmmT2p8ITPgZhRjJZ0CPQJnrsN9FD X-Received: by 2002:a50:9b13:0:b0:4aa:a856:e2d6 with SMTP id o19-20020a509b13000000b004aaa856e2d6mr3369367edi.37.1675778301459; Tue, 07 Feb 2023 05:58:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675778301; cv=pass; d=google.com; s=arc-20160816; b=gLN1Tz02r7LNlZWjKSxH97Sxifx3wPtgc6/ml2fDTsieRP7prf5AqvEtyNoYvLJLEE MISnjAi/9M9Ift0pK0BmFPnmz+c4BlfCitF6n9XjKWChjVXB3Z5JCKHaRqCzALQ/RFlR AIYxPPcWp3K379DKDJUH8J/St5XWztMgPT81udarHvcPzeu8FfwTrpV1tt+h9ZgKLR30 Qbzxv9LBkv36N8HZE3BX11L/6sLbblC3/30i7DawF3AqEvhzqhTpx0XrjO36EK6Rbur/ aQXsRC9zIGhLYqQaitq9o4A8n97oLg81j9luLtbzPFjqtaLRKMPPnb6Wae7r6rJJd2xl 6apg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JGPCc0HrFlOBWwNUYy9zVP6x9GjYLQMVOZ6bc3/woHA=; b=zYC54UNt0JkCKpB3LDT6CzuSjbZyDZ2v1gXuRdRNAV5z47DyiFIZ/5bWxcbA5zvDDq TxwI1dI2fSBWAfSjWr9NOdluJOP7M5jkqkmzMWMGP/Z1TgF3M/bQfYBfGrcs+tMCU5Zs TgfEwUyWurNqLQljjFXWPRZou9qWHjo6oXQ6uFQ+qtJWPdZ/h01z3b2LnMLL9y5n924T zu17Mebn4tANTLEQWnWxbNNU1v/jzQ9SUnKZbCUj1bz+WXDBdq83/g6n06y0O21ug34J /9RgYpSpkbG7FFcTA5qubeKYWoRVJBOYMxr7R7ddFORb0cWELMcszaVmLww73ZjbY+8j o1UQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="cuaKGE/0"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020aa7ccca000000b004aab1a86bffsi7485296edt.405.2023.02.07.05.57.58; Tue, 07 Feb 2023 05:58:21 -0800 (PST) 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=@nxp.com header.s=selector2 header.b="cuaKGE/0"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbjBGNzv (ORCPT + 99 others); Tue, 7 Feb 2023 08:55:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232261AbjBGNzj (ORCPT ); Tue, 7 Feb 2023 08:55:39 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2081.outbound.protection.outlook.com [40.107.7.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D7737B57; Tue, 7 Feb 2023 05:55:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J/kxGlbpXNMdcQTuJ6M3Ja68UO2/dx8Ux42gBBfIeVLILUIuZu/I9fHp1eP8WbmnCYz5yYksJMsAU+V/YjiUJbs5NXkOoP/Gju3m3bSg2RzWVoNwoT+HRRNceA9bZ8zPzVEJTOTap4yjXDUVaSdJXAdbsqEX2GXtSJYFJxlWc2f6K5Y6cJBQGBfN1Q4/y3Z8gBPA+ipK3n3UqoRyRnR28QU4A4+lkJ1FyEPks+7DCyCnTzsJPQDisxovDsX/ahXCh3IdSYa7xu99iGA9kBpQJTsJyquCgwyHC7vNcXyTcqzSx19bpwdu8aZWojOCGD97gJbfyCnQgS3IKhZann06eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JGPCc0HrFlOBWwNUYy9zVP6x9GjYLQMVOZ6bc3/woHA=; b=cX0vogpp/Im+QL2fq4TXxT5/GBvLjMPoxD6M93YgFVGpDv3gqwKY/0IkirJU652DlpC1Tlxw2zrqmHQn0EFZ1WA4rp9jWKsS08osQCRbVbkpbVFfmqWR6K8ZzzPBXICLpJBTShiWz5yG24GLQ8rdp1sjG9tcDRCl17Sk9lkXeoWY6aU3mtZedeSWF4QYIDYCNCmiiivxXeVKHbBun/jHOeOLAly3Z+/4HDOLa4YzDxUMAqPdBQgNqNC+E+47wS+kNcuHPuvdFsar870ELvmEidQWjS8zxHUVh9F1djom8kVRF/uKoyaMhZkpaVFKZCWk8un5f+g3YSqaZ9Y1b9y9NA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JGPCc0HrFlOBWwNUYy9zVP6x9GjYLQMVOZ6bc3/woHA=; b=cuaKGE/0KtexwpY7GpruTJ13cQmHqRFs039SK9A83Pau8DOAzv1N4dbLqhK/86lkbP9kr3nQ/Crqmfg/FcTfTDLbIMCDBbmDdthGaO6WkiMWR0XIpyVh/SViZ+EGWHzxFsccRKezjzKe9+eed/ZTQJD9quKPYsAu6xdIoERZMko= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AM9PR04MB8115.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Tue, 7 Feb 2023 13:55:11 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%5]) with mapi id 15.20.6064.034; Tue, 7 Feb 2023 13:55:11 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Jacob Keller , Gerhard Engleder , Jesse Brandeburg , Tony Nguyen , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 04/15] net/sched: taprio: avoid calling child->ops->dequeue(child) twice Date: Tue, 7 Feb 2023 15:54:29 +0200 Message-Id: <20230207135440.1482856-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207135440.1482856-1-vladimir.oltean@nxp.com> References: <20230207135440.1482856-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR10CA0023.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::15) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AM9PR04MB8115:EE_ X-MS-Office365-Filtering-Correlation-Id: c5aa62ae-90ed-4b21-613a-08db0912eda4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: igXzlynyrJ5FhF9x16TyzzzKc2DDbIvoLLuWCn+I4B5D8AwLhC3fKIX4fTorlgdVivuBrwGeZp7yloezR71VT7N5FEaZHgtF42MOWViu5MtEczM6+qJ/72CeRAE9jtxshWhTleYh6gBRilMf8p39WIyxL5KypOZVxsp0IwtK7Q4wUbDVHrPpDBrHRtwxawZmhCYRpPmqnEf5dmoDxCFQv71uZ+VLyau6rSwc0tldGJbQdGfafo7DWCDZuEbDTo5w7hGw4xxywNWVaPeH+uvx6n5d4ptqUbfXkTPrRQCqgw5mr2yco4u2DwSq9TqcpxnxB7Lb+4L1dNZAdwHwlV+qUjyFGzJAjJW/4piPwYHdfCV+tMM6M9OANGEXVeqtRRt+Hk1+h63o+jxqH2dcrJ+vil9wtf/JS3b/UJc1Eq28xDjBeXO0KJbKIwjPYJ2pO/zH4XmNrDACSHmtlm6aE07XNXC4RJQ4WABHyIsR5o28JphQE8nWzzCVrcRqTOcgLH9H61QInoeMpK0hCHYhQLCVQFiX7kZvFOM/hfgmcGKp+sWkAx4/p0O6mJqwsB/JAazmQKFRljn8vaE04KmP+RGfLrcw3cFVrIiwCZLmVHFK8UeSLtxG8WcpozdrmMaYrKtPH9RwSaDe43z8QKh0vqyVIofVh38t6bfyYHCw/wuC0jq8Mrd+SM7nGunwU5CdritKb3eaDT1rzM/dBo8CxRDWHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(396003)(346002)(366004)(136003)(376002)(451199018)(2906002)(8676002)(38350700002)(38100700002)(316002)(83380400001)(6916009)(66556008)(66476007)(8936002)(4326008)(41300700001)(44832011)(5660300002)(7416002)(66946007)(2616005)(6666004)(1076003)(6506007)(478600001)(6486002)(186003)(26005)(6512007)(86362001)(54906003)(52116002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 69Pp796jHKetVYRB8SjFEqOcfTahwcRze0v4hXE8liLfFgJOUvfy/5gkBA/5f3JoVtth48dAIVBnoxg3G7Y4eulfWVtAoQMuBXspltK6NFR9x3y3LhzN9LSX08/2A8GDOEL5t1sAaIeNRNhq6BpG/i6iJFFhce8rRZ4rtsKxGdvfhnstIEiilohMBJL1XllRklgCIgz7nluVIDFeikXHL7yJ0VBJyxtbEpn+TQ8YaHPcFtIeJ3Y4x+PEliRDNwWXaLZKxKqbKHuUdSOP0QqI0g9KtbUSk3epmcNyVY4o8t65Pdi8Uati3/pQn/G9K7UAGWXUolmPdOUXl0DmMHcwmOHjQq4tmFjR5uOtha8j+CTEF5zvlkWSAE2K/pPt0F+dIEeC4y+S5CkI/m0rKV+YbF+qPHoe1q+PQmBHS1hc544cwOON2kYuTNbsa02EFKEHDkSZVk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EDbS8MbvmXpQ3Qtjoko+RCOFn71rgR5wRjpTbjA1fa4MQRGpEiSD8CCQ1Ih/MhbpjMMYTPFi35cl427P9ESZ71Xhz+BpYTQ6gQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5aa62ae-90ed-4b21-613a-08db0912eda4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2023 13:55:10.9716 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QlUnC3V7+OEF51OieHrwdJ8BndOTEQNMdXOzcvQEKvQlx5r6JvDTrvMJjKXjIsReSxCHOL3uiF6GGTVVM5AlKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8115 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757180908540327872?= X-GMAIL-MSGID: =?utf-8?q?1757180908540327872?= Simplify taprio_dequeue_from_txq() by noticing that we can goto one call earlier than the previous skb_found label. This is possible because we've unified the treatment of the child->ops->dequeue(child) return call, we always try other TXQs now, instead of abandoning the root dequeue completely if we failed in the peek() case. Signed-off-by: Vladimir Oltean Reviewed-by: Kurt Kanzenbach --- v1->v2: none net/sched/sch_taprio.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 272a8b7c0f9f..a3770d599a84 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -528,12 +528,8 @@ static struct sk_buff *taprio_dequeue_from_txq(struct Qdisc *sch, int txq, if (unlikely(!child)) return NULL; - if (TXTIME_ASSIST_IS_ENABLED(q->flags)) { - skb = child->ops->dequeue(child); - if (!skb) - return NULL; - goto skb_found; - } + if (TXTIME_ASSIST_IS_ENABLED(q->flags)) + goto skip_peek_checks; skb = child->ops->peek(child); if (!skb) @@ -560,11 +556,11 @@ static struct sk_buff *taprio_dequeue_from_txq(struct Qdisc *sch, int txq, atomic_sub_return(len, &entry->budget) < 0) return NULL; +skip_peek_checks: skb = child->ops->dequeue(child); if (unlikely(!skb)) return NULL; -skb_found: qdisc_bstats_update(sch, skb); qdisc_qstats_backlog_dec(sch, skb); sch->q.qlen--;