From patchwork Wed Feb 15 22:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 57758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp462918wrn; Wed, 15 Feb 2023 14:57:42 -0800 (PST) X-Google-Smtp-Source: AK7set85dQcWWHS1kpfx54PmYOIR7dxtO9CPJk/x2y+LPlBK9hZyQ4Q6ARz55owxOTtt+AHNGE9f X-Received: by 2002:a17:906:cec3:b0:8ae:30bb:a12c with SMTP id si3-20020a170906cec300b008ae30bba12cmr4031648ejb.28.1676501862790; Wed, 15 Feb 2023 14:57:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676501862; cv=pass; d=google.com; s=arc-20160816; b=uSM2gRIwTLPeBgf8u9DpDM9Ug007jwVFsMPXf/rEgmo5Aoa2iCInp7Zx+TCKsJuspn 9E73i3JNxL1uvprkh/43g4rv8IiPGmF0rOlpnDTt68rWulR9bbmC9uM1x6y/ZM6igltl wHPbeuQTGovvnHOvLsG1ArfnuZqiNzV0828SFMURwacGTWc+dhflWsZ8rP8UtOoKUPPC xpMzjCk68ATQTbidwY5+UuVeDhkNbN+ozhh3mYnG+w9CiC6X7/zt8tChmvIQLnglQMyh A2eM9IhvEj6ckMjwaCoXKpwwbB1YIje1uufxzeJrXSFfp4sfEqx8UEFmO4b6FuwpdK4O N0Aw== 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=OcfqCb+n5sNTVWdr3UHmaLjGSkxj7vmXWvMcpPgUSrs=; b=y+GAN8mlS2JlzA6lmFaxJofantN36swqe+E4rwwCJmFKfv1bEaIzM2k24KQ7JT6+Cr APYQX7IlA5zeKJUbFbFzz1WF+aY9rHd+BbcLZYADImzxSJMhRPGcYnvdVFPfS4gSUlQR NDJHvYSnpfRaMAr5qb5BO5GT4N8+zWL74awlFTw8K1S1/a6Sn83oh3q0/Do6t+jz20XV HgsnISr4zWYM7bXPx2/GnYSsnM+tQMaQNgJi8xv4HboSFZ68Os/x0vkqXF6aPNJ5+imh C2HCoSsnbMD563AefQ3YivU7gfVTqjIlJbQ+5bBmvIBPdKMFKTPz0EU4n08JJcHL4bRB fskQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DmDvYyxN; 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 mt31-20020a170907619f00b008b11939568dsi10582380ejc.365.2023.02.15.14.57.19; Wed, 15 Feb 2023 14:57:42 -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=DmDvYyxN; 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 S229815AbjBOWqy (ORCPT + 99 others); Wed, 15 Feb 2023 17:46:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbjBOWqw (ORCPT ); Wed, 15 Feb 2023 17:46:52 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2055.outbound.protection.outlook.com [40.107.6.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73DD123850; Wed, 15 Feb 2023 14:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BmpVpZsk8L3hT/ieEaxXUbbcEmhjzmGtkkvo9lCBBeQz0g3cjFMIbcx5xMhHqjCxIXdjPNAojp2peBk0FVOGrhZ1TzlbvNGjHrdGIJez/86GgPp6Lz69jBVB3tlJdSA2Vv+PjA9nugbUgev7pp0ChPk2JtsAnEwcTNOtCEVvfJXLrRjEESg0qEJnoJjqP8ytrmIPwWOe/yuVzMMP7mbW5G6RnmHtU2BBZ41hL3ECTuCOdO5Pq8rZZYrhbTs8MzFHG5zpH2Dh4Q1IzArcCMo+DOE1t1URIhgYQXS29CAzDDgv/mdhOO9CjPyXZezus5Bl/xAUwWE+aZds+xLrWYaq8A== 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=OcfqCb+n5sNTVWdr3UHmaLjGSkxj7vmXWvMcpPgUSrs=; b=DpIqziKH14d64d96MM1FWRLY/eJkCtgHcB92/ISJr96Ju2QoLCXxxOoKzwlxK9v0YHE5xhzRXeAcZabp876kG4OGHPH3gdND4apoAJrqckKT31IpVBt1hxTSJQ/GFar4eohNU2/Wqq7Ejw6CW7M//7k/CShZEoR0QB4/PhecxLFZ/CAfiW33zQDAebkjs0AIY13ggkHTaU3oOxb6/CHObRxs6g6C5V3KNWW02qHAJlXvNlUII7dKrCmM4RKshfA+rHAtmKnA+Ur6/MRX9J8eHB28v8VfKaDYniaQ7mjwl3/vp152QKf4H20l2F2o1GwUup15tLhrBvJWDYZ87t4U/A== 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=OcfqCb+n5sNTVWdr3UHmaLjGSkxj7vmXWvMcpPgUSrs=; b=DmDvYyxNKG3dcyd9JOjJ2aVPVJgupDOc7mBnP9XzJ0nB8hhzyKzl2rp60cF2i0bBRb6xFruhBxZLv02y9W3pjJR8ugKgDuJUKVbskp1HDeZmfcSILgbpSl9LsWhSoyfFW9v452MLTrqZ4nbgD2KV4a5VNtOpPmG/TuG6iwo0wMA= 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 AM9PR04MB8748.eurprd04.prod.outlook.com (2603:10a6:20b:409::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 22:46:48 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Wed, 15 Feb 2023 22:46:48 +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 , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/3] net/sched: taprio: fix calculation of maximum gate durations Date: Thu, 16 Feb 2023 00:46:30 +0200 Message-Id: <20230215224632.2532685-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230215224632.2532685-1-vladimir.oltean@nxp.com> References: <20230215224632.2532685-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM3PR04CA0138.eurprd04.prod.outlook.com (2603:10a6:207::22) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AM9PR04MB8748:EE_ X-MS-Office365-Filtering-Correlation-Id: 429af7f4-87f4-4883-034f-08db0fa685c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8CvxwKzVmIXjlT3NTI8VB4u62/EgOmLE4lVot9nbOs+bgB1aWlfvu0tjM/DYcmw+kVVTG+qDP8g9eSffh8tMu0VIci/9CWLw5cqmebOEqH+/mfUdw4ebVWSh1O1g7x4jQdyOYUJp8yLbsMAJKSDJO+IQMq2RP2cAtU8Lhc9nxny7e4EIIZ98GBD5waDDq7QZiRTdbw5YUzE16ZstR2w7LPxVW+Be4noAeFaObpodWu98d1feHKNTr/k3Pa21NTCmtkDKaQbLKBp/NhrjfTs9OcNZgqU9BmIUDxxlku3be33okZ6xR5K1BgF4KvMIhlUDEC6gmxp8SuPxy56hd4HInejDXGSwH5s7YlBXDOROHXxjbXyYUDtHXNWm6P4np0Xjhi0er+qKYphh7MeU+r2ENAlPC6lEYW7dRBPs70RPqWqp77/2HQQ9lpDC87ZWY1jFt/w6LwuyjeZw+f2dqdAQtqOwUhCkygS9ubWFfxsuDt/rmKjbtbXGI+3tx8ZtJa/KKL84r9Kijw9GnJv3JCObu0wher80lTs1lLTmovO4G/khzSdUR23qOMzQW+M9Z2i3CjGuqbBbnmminPqIvS+IXoEsijuNLubiOkE7qURlIhVBWOVhtT6cDGFnCjbtXYjpSZfG1Xai/SxHNTu77KBcwiB1V4MxBmwpKXZM1FMfUTw64N89JZaV/XHRvYNi9JWu 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)(136003)(39860400002)(366004)(396003)(376002)(346002)(451199018)(478600001)(6666004)(6512007)(26005)(966005)(38100700002)(1076003)(186003)(6506007)(54906003)(6486002)(83380400001)(38350700002)(52116002)(41300700001)(2616005)(2906002)(86362001)(36756003)(4326008)(8676002)(6916009)(66476007)(66946007)(66556008)(316002)(44832011)(5660300002)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PKYFKPMhNBaybkRFSUZbGEN5R6uLKoA1HsnLEn1W1Em9mGHecAWeZ+jFJz2v+spdl7ZuTWqltFYha+w2iRleyG4F7FaLWoGb9GE7ZHBoWpjEbytj5lUNzLSHdyMz+y1cNYIb60jeDWCc5eVF5wf3HeyaTbUu07J8ZTddgKHqtRNcaI5PFPDGyhOW/+C9NfAeiN+pYkoHyW0IaF5hIqG7NPxWkS45I3RwvwSL01orNcheVuOuerdaSzbTHdT1x3kwh+p4keDtO15UYJG10DJS16JiVdA7WOql7fcZZP5YjIvLsdGcJIc/iBVvKxGFtF5UiVxCzj0VoU3FDBlRUm/2Szc7y6BTWRkLZde482nel8LdzxcTCSU1w0HFbdyS2oJN0LU+/WBctrsD58wJMMXnKKpJIKSCRBI1UWZ+6ekQgpeAFFjUaRD5G7AL2IHkL5KorCoRFaGjjsnXeIEj0cowClJxkmuN+0I6LuFSm1L5SR9e+yoESWGYqmV6txTC97kulk7nmPubPVaEpUMMLkYThdlegQlCt547HsAlyXmNMcF0uwM4GXyeNBtZiFTEdm+TZom/qOW9SGXkrprkj57585keH0mD8Fn1Gl+WEVoMJcdcdYg930Z4YIzge1alopx/j1ZsRthNVW16IHbkZOxojq5x0XyyPUzdqxknGm17/s1PV6qUDgrqjfAsDD2ELkS+2QEoQBoiMpGlspcuri1j/y40ePE3wD2yc0mi4uBTc8LxZkA1qSYb9BUj2OmDTZH3hHakBnzaHpoMHrHgfa4NUpFfdk43ni+3V8NLklyzb+TciQq7A0o+IPob0OCSgL/tti3KQKxFrsXScZO3v2MpB05eYZ4zvo/pzQkwbhyvSz8P6nC0GEWRttcr717e/yORWUP8udYE2/2JTEnkIBEFmb/JJstTGs4C5dlrXgRmSHhy1AGcZue6zJyu/vaxV4ExAfdgaR7zLXP29dC+IBReOlMTJOEOK/NT8t8E1A9MEe5IjhVG93sWWhDjlPozPGf1ZOS2MvmHw/gD8kTosvKPZ9dTLQWZG7REix/rK8Yz6V761Avvqe8uqBmizBO6WOu8OqyHgADL0XX40p+vmVjnNokC/+k6r5HMge/rnXt70H+3iTah1ol8t7LMHHwUAQ5BK5kWTYNQH3yCCnXiXovOCufUz/WwJbQiSOBaWBMCvSwdXO31PJXhHYpgATPJs8hWLUeeCp2Vifg9D0R9cjp0CPXhpUkKar4TM8BHroyXz9TMGTg+ZEUEfL91kbKVAYFyVDV7+TaYph4E/Bxv/f0oxUcCmmwXLB0c63TMYwmNhNQNIhOxqlI8M4N9Zq+DytaQSU6rYqTWAEQeGyHOYq1zLzuTITCTV4kKsR4Olaz/TC8lzd0AwCoesoi+8ooIrDfNkUo+E1tASfVABGURMeJGoj6evAYCffRKS5cK84kX7K8ovalTCONj5f+78g7HukoUXDr/N4Bct50Nb3JUr4NAB2jz+QkBc9zHaT7Cuu8YW2swFFLk2e12d/DFAdvX1xRIpOO3HkPWbSGj8f4JK+S8mLoruhxXJz4RQZaiu4FLlLrrn3TCnCiAK7FTJ2m+I1fTviKBtPNtU7B+u7uNCaz1Eg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 429af7f4-87f4-4883-034f-08db0fa685c3 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 22:46:48.8382 (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: x3f+6eotfawQy/x38LiU7m0vQiqtiFmSBput6NxttyHZp8VBnt70RLCCQG+pbUWAA+Dmf5ujL7i2yKCQQuHYmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8748 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?1757939616946371639?= X-GMAIL-MSGID: =?utf-8?q?1757939616946371639?= taprio_calculate_gate_durations() depends on netdev_get_num_tc() and this returns 0. So it calculates the maximum gate durations for no traffic class. I had tested the blamed commit only with another patch in my tree, one which in the end I decided isn't valuable enough to submit ("net/sched: taprio: mask off bits in gate mask that exceed number of TCs"). The problem is that having this patch threw off my testing. By moving the netdev_set_num_tc() call earlier, we implicitly gave to taprio_calculate_gate_durations() the information it needed. Extract only the portion from the unsubmitted change which applies the mqprio configuration to the netdev earlier. Link: https://patchwork.kernel.org/project/netdevbpf/patch/20230130173145.475943-15-vladimir.oltean@nxp.com/ Fixes: a306a90c8ffe ("net/sched: taprio: calculate tc gate durations") Signed-off-by: Vladimir Oltean Reviewed-by: Kurt Kanzenbach --- net/sched/sch_taprio.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 9781b47962bb..556e72ec0f38 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1833,23 +1833,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, goto free_sched; } - err = parse_taprio_schedule(q, tb, new_admin, extack); - if (err < 0) - goto free_sched; - - if (new_admin->num_entries == 0) { - NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule"); - err = -EINVAL; - goto free_sched; - } - - err = taprio_parse_clockid(sch, tb, extack); - if (err < 0) - goto free_sched; - - taprio_set_picos_per_byte(dev, q); - taprio_update_queue_max_sdu(q, new_admin, stab); - if (mqprio) { err = netdev_set_num_tc(dev, mqprio->num_tc); if (err) @@ -1867,6 +1850,23 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, mqprio->prio_tc_map[i]); } + err = parse_taprio_schedule(q, tb, new_admin, extack); + if (err < 0) + goto free_sched; + + if (new_admin->num_entries == 0) { + NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule"); + err = -EINVAL; + goto free_sched; + } + + err = taprio_parse_clockid(sch, tb, extack); + if (err < 0) + goto free_sched; + + taprio_set_picos_per_byte(dev, q); + taprio_update_queue_max_sdu(q, new_admin, stab); + if (FULL_OFFLOAD_IS_ENABLED(q->flags)) err = taprio_enable_offload(dev, q, new_admin, extack); else From patchwork Wed Feb 15 22:46:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 57759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp462988wrn; Wed, 15 Feb 2023 14:57:54 -0800 (PST) X-Google-Smtp-Source: AK7set/K6BYbBLTQO4zQXCUyHFaFd30NX14tUVMd4HqMlsrxdbV2Uj9/N2kIMn6gEJBpVxlHqMfb X-Received: by 2002:a17:907:c17:b0:8b1:3d04:7b9a with SMTP id ga23-20020a1709070c1700b008b13d047b9amr196397ejc.38.1676501874364; Wed, 15 Feb 2023 14:57:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676501874; cv=pass; d=google.com; s=arc-20160816; b=Jl5dDoS2tY5iQIVyYZdlFDb7IJ2sOKrudGUWuu80wS5GPo20jPWL70oErgH6Eluj3W o84auYmUI5wORd8qDaNRRzKk7HMyVzgxWjrB2xG0+OHJyPazAxI8NqWa5uzF41p8bhu7 klMffG2LgsB0mZsDSHZlmuPcGKIyjUbbLFrwg+4JtA/omIeRBYgPm9DW1P5e/xwKe7ls N2IUikuiBD8oKgAJFLcdcmFNy9z0NCu9ay3cgQj3EKMw2aqRuWdw+zp2kEffP1CtbhzW B0XCudhTb6Q8ltqvKdNunq7kzNjcHAGoxiL3UfS6sENhjfjZlvYO0vrGp/aCHViirHCZ 1hhQ== 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=lp+bsTyAopi70tU4J8WcgcfETW/aUyO2Rd5PKteqqR0=; b=dWVs/Ptb+nR1jdi1NZVce+PqK5wb2q8GStpM0TeItXmdtEcmFjmdCbuMH+U7imbutT DkDoo0x2mnfIOkKGZUlGyz2fplElT7NL0FS/8NZwa2XwpnAL5QukFjJpSMMWQnYc7EYD 1uZqMAvWldKkdNnaU6b8+KBTm/3uWQTPcmgpaI8e/PzUgPmn1jD9eH3zqktow9rB9inh 6VMHumkSxBnqz4nA41zyJWEYzKRZTEfttIOSdoD9ie97Qhi9Mr4GS1rUtAAaVyH9V9a1 npwf5687WBqDnNR2RrcQX+XNQhlsaaJp7vRo8Ro7S3NiAm1EDfWuonNyQwAaD2T9dwZ7 OFMw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="QcCF+uH/"; 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 23-20020a170906209700b008b1279f1fe7si7918941ejq.769.2023.02.15.14.57.31; Wed, 15 Feb 2023 14:57:54 -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="QcCF+uH/"; 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 S229904AbjBOWq7 (ORCPT + 99 others); Wed, 15 Feb 2023 17:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjBOWqx (ORCPT ); Wed, 15 Feb 2023 17:46:53 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2055.outbound.protection.outlook.com [40.107.6.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D6E623DAA; Wed, 15 Feb 2023 14:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nrxs2vAWpX1GrwYWriJYsfBPfGUV7NInIOITFzZyCd587tjkBZ0hbJtr1tJWgfapslvXCqcCqRCgiX1jPjeqf6likXYpvbL0jOtCoioQL8Kd+zOOIl7oYqSFj2Ij3N6hfUwyuHB2VT5L7rUHo51SP9Wv6uSGgUYMXNut60bzsnj8NejtIbHqmqWPqnuGP8zmBqhZmozYhZ2F/JrkN62DnuNPDhMdVA2J3rGoCckfe8sr6tyOPSb4Mr7IXOD8p3m6kdHoZCjAyufdmP8vkAdCmFOvIFQeCVN6FluL1Sz0F8Q3IaXzjT+sPxuWf5dQHDESDIcbpbXjhivcusma/Yv82g== 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=lp+bsTyAopi70tU4J8WcgcfETW/aUyO2Rd5PKteqqR0=; b=dQbgP3XqvKMvsXZ90oKAuaweOGwyfKmYjlIurRsMWuvi8VbrTyplcDf3wFZ7SUqAU0nqRIk9lgQvl1Z9zMokfKKG1niMYGKLnL7RKor7riTlMmqMo5FBAF5wk0iYildUGh4g07C8szwjuo5ZLuZQqmhe/BgKZyKsLT83y5bQxOE60B89KFo391p/xdorledHpcMaFJvNHsfzKGFLxntPVlfJR+7sZaeJ7sSphLbyiTNVmCMLxERtG6ViCNqVr0ECKW3bh5yO6Ebl1bDr/Jt5QsyxiWCOZi8bg2V4Y1uLstos61RQCtwy06rAeTqnxwDAxpk39Ac5553u79+i/+dkEg== 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=lp+bsTyAopi70tU4J8WcgcfETW/aUyO2Rd5PKteqqR0=; b=QcCF+uH/d9l/qKyPZLXYS+5+7bNwwMFp03qHR5kAlqrcqmWUh8x+M//0FLKiOko7dC27lnu1efJSH7zrCyRGqnwQNLWBrI/IjxwGBmVNG76yP0CGInlncTx3Q5vCHqsOM0cPhreLogm4/cnWFUI+4r7tpAUGbJSQ308fyV0HG+c= 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 AM9PR04MB8748.eurprd04.prod.outlook.com (2603:10a6:20b:409::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 22:46:50 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Wed, 15 Feb 2023 22:46:50 +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 , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/3] net/sched: taprio: don't allow dynamic max_sdu to go negative after stab adjustment Date: Thu, 16 Feb 2023 00:46:31 +0200 Message-Id: <20230215224632.2532685-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230215224632.2532685-1-vladimir.oltean@nxp.com> References: <20230215224632.2532685-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM3PR04CA0138.eurprd04.prod.outlook.com (2603:10a6:207::22) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AM9PR04MB8748:EE_ X-MS-Office365-Filtering-Correlation-Id: 47dc1550-53b1-44d1-9319-08db0fa68699 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FDdXLfIxW/tJyNTh/dXDZCdEFVrwESPfm2cCTKn4exbaruVRZSXrcMxCIRTxLQdZ00KTC79yg1x5N2vPCylrS2yJI661HqB7Yqst5k2k/3j6e3Qe5UDI9sgZ9RlfudoesAp22/+DK2YCwEby5Jyk3LVShz+C9mMsQbnylNN8O6nZxSJaU85YlxDFXAfcAKTneTl0RqAQABTR33A8H5LBg/31aYZSb/NYqXuPCuKxxWDE5hRAZfy9VzR7b41txDdX+3XXfMWiNXJr/p5j9oCPWy70TExI2jrLR6I4V/qFozUTD449Mxyj0AKx/QrOmam9r/dFWuSzzVTtM+juXClujVc9JeSrW4Onin/Dbrfe8WEFley0/ZhTzmvhFSEtWKUJJ6Xo2hdM+ROAspQxayWOa0Jrn2Rxc0SkVby8bbRkzmog5H73k0U6l9a+JB9Xk3cb9T/JRzg6jY1xRAjc1mTPspEFi0ydGnVV5dSyP5svOxLnnBHWTeF34grRnHMTeXoSjDQWfuvXUIKhnc5i+ZegiVLumA8iOZe3YBU5+MTXnUXGlP0vX2FjFSuNaHBCiGA6ID1/UTcJR/9q/Cm5oga9ATzalwlfE6WRsVIVRoTcGeB0vwi5soPE4gCBGcB9X6/4wEMR2B0ybs6jdORSumbaRoEX8Kg/oiETY4Pd4Lj1tPEizEYHNyxl820wNUGy9GyxPAvXvTd6XGkQ42RFRgo45w== 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)(136003)(39860400002)(366004)(396003)(376002)(346002)(451199018)(478600001)(6666004)(6512007)(26005)(38100700002)(1076003)(186003)(6506007)(54906003)(6486002)(83380400001)(38350700002)(52116002)(41300700001)(2616005)(2906002)(86362001)(36756003)(4326008)(8676002)(6916009)(66476007)(66946007)(66556008)(316002)(44832011)(5660300002)(8936002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bvYTNHMyULvpfAAkC31qZrV0hWKX/7smfid03xcnzB/SjLuh7FPVWxIcQ88gELTymWBQGH/OKLuYMltrUpXSjD8Ukb3W1uiOK0JG6+rySsp7Wi12uxHG+Pvhr/rm/kiEb3M1r4FokNrf0YZkcH4X3Gfgeu1/kRrguM9D0k9LmFaDRztHKJB4yvl7sm/dP4RUmJGDrFSEv/8do7Cbyaxgr/JEUne2kw8Q4bm9ciRpRXD8ShSWG8F2E8IuJpQgDUe0gGezHCvJ3GcTNfy0y8AXShEbhiiC/6Ma7NIySw1mPUFDnn+2/K0YST9rCkCfjmCkkOnu/XzQDBE9IZtGUgfJe3umE/BBhZ0HkbZZfdczL0GPIUtSUfdG9QCcOFDc1aqna+ALq4hGFdCS3spj/ksonn/8QEBU9oyYculCrFJ1Ta0e2PLt956Tw0jj3ShF5OnI0ZHZhy/nfBVY70U3DLLUEkvnFMvsb2NTHzZyxG/S9v1jQI7qU6n0O5XlR25CembhAeTLLJMP0/NBcymSSNhf10qGZYYceQB5XvynRSyJQQIT48JuVTU4ZtQANYGJ3CFVLdAwDGO+A1UdS6Esz9iaBy+LQXtGMWAw99hqEVey/u9LDAMyAsBZuzXi1wolMJsOChsnBP6IkVrC1DTCyzHQxXmVgNNawffYqockg1LaXBYzpFVGMJcScikM2QIR5Ay6clAhlC/pXRao9uTtmQvPgYFst88/PzI1DeOvcbUosxwJZslM+kruGNKR4Vp3lFVIdltdh4b9senxHTenyCxpgZdVtab56ZguJcfiuzl8n+AfeNuEZrnE7QWjnfxVDhE0tEGCqh8moPko51bJxTtH4Cq186MPpoza4P8HsDZrW5ozGqj04Bh98lEHJDPBZ1TvWEQ8wbcS8IJYTxvce1h0P7sljWgvE19pQafk5A6QGH7AX7r1aUkExD1Q/vQmyYq41ZnEjIjgi6AMHZxbzXxMtAco78Dcrg2vQ/+NShxqUFLhgGzNfGSGn/oWhfpOIkWbYIChUZpk1m3szshDzQdNFRmzdzKuS2qSXZS/ffd99SmlOlz4GL6cuvMaHdTTRK/q5sObca95Zk/8+4AOYPNfk1BI86K6tzECKPtYVgApClecvNyFoe+3cuaAGP9VM0w7/xmzM19fUZxGHEONUe6PqtopTSiIEv+7xrW0X3QVvJY7pAB9f8EYOvxtrOsQwES9Nvb4g89vN/BSFYdzRLYOFReKDBcqTaA24Zkxzx/IByVJl8/DhmzKFBwo59ABTmUIFkQGxIc7eUid4Uw2+aq0zJWSup0KwS8APtOXTmXbTU2rzMda9kWMCNgW5xbilHNqLNuo+2NRsEfQP+Z7Z5KNho0o8MldrN47xgSUHLQ+xeeRyJbL1+BPCayiUFlR+IyhXoSVet8i7Vyl+2kj+ozrOIwckmCkzwrtfjC2VQy+c5DgiXBgG9HpWJviiSRCiH5L7JKF4LR2HpPyhEneL4LF9xZ7By8qC09ErE6tzn1iiy7z67CvrkUWXvwv+FU2UCuIQsz79bAQQOMqlgxEfUO49LaQKc+TaZpDChvvmm8BRHiyRvSBdGdR0AtGk5xcGuVYlBVnRBISINhDdFa/LsmcXA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47dc1550-53b1-44d1-9319-08db0fa68699 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 22:46:50.2131 (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: Ji0bvSbknheIjZZQSo7oJC9czJHoTp5RUVtTwmJKoP4v4tW+kqATIHs5vE8qzJYF5W2JJA5U+zay2Qi0m1A5Gw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8748 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?1757939629368173066?= X-GMAIL-MSGID: =?utf-8?q?1757939629368173066?= The overhead specified in the size table comes from the user. With small time intervals (or gates always closed), the overhead can be larger than the max interval for that traffic class, and their difference is negative. What we want to happen is for max_sdu_dynamic to have the smallest non-zero value possible (1) which means that all packets on that traffic class are dropped on enqueue. However, since max_sdu_dynamic is u32, a negative is represented as a large value and oversized dropping never happens. Use max_t with int to force a truncation of max_frm_len to no smaller than dev->hard_header_len + 1, which in turn makes max_sdu_dynamic no smaller than 1. Fixes: fed87cc6718a ("net/sched: taprio: automatically calculate queueMaxSDU based on TC gate durations") Signed-off-by: Vladimir Oltean Reviewed-by: Kurt Kanzenbach --- net/sched/sch_taprio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 556e72ec0f38..53ba4d6b0218 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -279,8 +279,14 @@ static void taprio_update_queue_max_sdu(struct taprio_sched *q, u32 max_frm_len; max_frm_len = duration_to_length(q, sched->max_open_gate_duration[tc]); - if (stab) + /* Compensate for L1 overhead from size table, + * but don't let the frame size go negative + */ + if (stab) { max_frm_len -= stab->szopts.overhead; + max_frm_len = max_t(int, max_frm_len, + dev->hard_header_len + 1); + } max_sdu_dynamic = max_frm_len - dev->hard_header_len; } From patchwork Wed Feb 15 22:46:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 57760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp463410wrn; Wed, 15 Feb 2023 14:59:09 -0800 (PST) X-Google-Smtp-Source: AK7set/oHZYrEXqUvy6GjsyjoVoTEq7d4ZNJBf2MS4lqD1ACsvKL9TCL+tBXAGjrDTHuxrIYch5w X-Received: by 2002:a17:906:ad98:b0:8b1:3002:bd6d with SMTP id la24-20020a170906ad9800b008b13002bd6dmr3487924ejb.31.1676501948789; Wed, 15 Feb 2023 14:59:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676501948; cv=pass; d=google.com; s=arc-20160816; b=ErPdXTE91r09iBZyi3TLN20/Bh72FcrI7346nCdSMMOgEaOciM03eT2hRDpmzr08rd lewv5paFSxQpo139b0EXbI7XMQ1V9EyVxGn7PydPYoRCTv09PfBD1wcS5jBcyDTbI5NO U/jvuN8XilgE0hlIl5khW3+67ZQv65H3swPt+3w0x0wk8x6q3b1o8dQ2+4DkrXg0xS6h xdVCdwjcRzJI+/pc6/K2wLGVSMhid6Dk2S8IfLY7N5YxS2ox09JQrqWA8QQfXODBAA9K n37Z23KmKoQedLQpuNUfNf6qFfKCyreDSayaHlzMBIL5rWs8a40TtK7/S0ClnqrRDfvZ MFmQ== 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=CKOohzS/K/Dlch2P5S9NgV1EZmt31rFp1v7O+O8wuy4=; b=Yyt0bdoDkbmjPxA9VhobHFLls+Qg7E5quRZ+AUyksBUmxNV+tSMnoOZHhq0y5KPHJs QcH9XUU5sVlBxRBXLyfyfPMjyJm2qHzkCNdEfgeXw10iXOjlVCZCbuSNqJcJ5ZxTEC3U UZBxqbdvb3SNPoDgSlhSslp2HvdIjSvKSzcgCEIVcczpUSYXFwPVwQlyKCBCq+x4YnIb Eg/JbgqHE88urfxr9GgJz11j44sQPpPo+6uHPfImDcsVDYGHG422KEwk0rV61xuZOZE+ DTEn5BL8efMTqgXazL7em5aYHlwQoOgiZdCT2HyPEYa9mET6bvKp3JuucDmiNvWAx4PA p8Qg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="L/9bEDQl"; 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 j27-20020a170906535b00b008b1412e2558si4517200ejo.190.2023.02.15.14.58.45; Wed, 15 Feb 2023 14:59:08 -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="L/9bEDQl"; 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 S229915AbjBOWrC (ORCPT + 99 others); Wed, 15 Feb 2023 17:47:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229845AbjBOWqy (ORCPT ); Wed, 15 Feb 2023 17:46:54 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2055.outbound.protection.outlook.com [40.107.6.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5F3233E1; Wed, 15 Feb 2023 14:46:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X3HiwfvSEpwNDCujSoyi8J8v2du9N+I6cKJVeWPwW979v2CY4F+iKgshAlcS9m6ZjJRXyGlYoaD7X7MhY5oHcN2drCt5s4AdGKIzypguep0krDTEIHNaZ9g8OqPWRyVD0vpby73E4fSESOSt40vUcQ+m3u2+lAYOhkNcmosmd6R6h573ZH9MAD7GfWR9HOF+axZPBohfp3lV4QHK9rLuK+jYB+Ng8KT1WRBKZ4lhka+9JojEB6xNU19g8DXja/cfGeDG6ZkvOKprzYLUOLVv3/qtCFvfS+hrL9fkPT4VBYeSZZiQKbm1yIGGXpzjQ/Wdt6nD77xm0oy2ceEZHK4PNA== 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=CKOohzS/K/Dlch2P5S9NgV1EZmt31rFp1v7O+O8wuy4=; b=MDASfZeVI8xlPKFIcOxscorkx8Uy9s2ubIeVw566A08J32KKlAdzszN4roh00p0WFBdaPzLWEnUHqQ7LAk1qfKw3AIFcUr7ohzmTgrv+963SSD7pbzCw60SL1bcfAGAJ8tykhQFS91aY1GOpm2JF22v4VpE1EVnFvYPnhMgNa7sSmqVHJF2z5iq/IUG0+HrEUDIgxmAwKDDDCk6WYVU7WnLXAWjCEzzF4/VtOJgM8TM8p3JK/A2Z4vgEKnbGPhZOborPqhX27Gn4sFQOwIRqvWmz7zbJz+aa2ROlgEDd29LZ02az7Goq6VIXUBIiZDj14sjgqI5KP4L3cskdVQ1B9g== 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=CKOohzS/K/Dlch2P5S9NgV1EZmt31rFp1v7O+O8wuy4=; b=L/9bEDQlDYITc54RwqLdXMl0Ei27vGnoG4Ny7rXP1QMEHA7NYMOFn8ZOcQVZI8e5EGp0Q5MABGz9RmGc9sPrnAyQXovVURPB6OwUqg9BX8alqmMUcFejQceJ76N8hgs1fjEbqVGtkwROIr0i7qIw/B0UlyPwtFwW53A05USnziw= 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 AM9PR04MB8748.eurprd04.prod.outlook.com (2603:10a6:20b:409::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 22:46:51 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Wed, 15 Feb 2023 22:46:51 +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 , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/3] net/sched: taprio: dynamic max_sdu larger than the max_mtu is unlimited Date: Thu, 16 Feb 2023 00:46:32 +0200 Message-Id: <20230215224632.2532685-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230215224632.2532685-1-vladimir.oltean@nxp.com> References: <20230215224632.2532685-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM3PR04CA0138.eurprd04.prod.outlook.com (2603:10a6:207::22) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AM9PR04MB8748:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c5b5a5e-bb09-4035-fc0d-08db0fa68768 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E+53zfQKAYrgenVGUC0Cbg3FgpOpZE/08x5BoGQ+Gu/lGM6nnHmQF28MZZQ9DvCq2mHgfDZyMLPKfu7b8RyoRyOwC4YeVVQEBOw7mvOyMUpK6zLh4kBmRp+L9OXrg8OIn85YzKATAVQcYVvzgU1VoqYwxbg/I5DhA0JNcxWN11qThte6jh4IoYG+LLuZtA3upmoIInja17omaqvnhoeM1bdsd09pAKOCKHekEI2DhYKMQVpSM8p7R5XB01c7Jwnx6Lh884z58Q9e3oD/f6oq8N5FajPyrsp7t9eOP3LcJUDzmnawC/cruVVGhESTW9UiYR565E+ea9yN0O5oY7Iuls/HnIueagRZMKGY3rrzViznH5Mz3HyYbi3Mb8uEojg/FU6AImjgFIiNnGwVuLcgCk1IBZrNRhL11SHW1iwvgH8iGFUpbOZ8sViCOzpbWHoECQyUmCJVwU2BvgqAkpY5YMfIJHjnvxdXu9FekfJRc9hcqiC2MkUWMkD+KY+k4Rr287McdSyWJghBx/8VEMpBofuqtwKZmH9J5gaJzLwIYA3Vcn1TDBRt03IcOHK/Un9dk+74hpI+EVHWCeHyTKzN7R8Bp7Mrwkz7ijcSNKydiGhjF1rZI618E+rtZOFAaDIdyRZ70jQIT99EecXUFJZyEl/CN+/8Hi9SdX5ZENj3gqo2gf0yE8QcfMMmJH8LN/z9/etOUpMowXXF3urACLiLMQ== 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)(136003)(39860400002)(366004)(396003)(376002)(346002)(451199018)(478600001)(6666004)(6512007)(26005)(38100700002)(1076003)(186003)(6506007)(54906003)(6486002)(83380400001)(38350700002)(52116002)(41300700001)(2616005)(2906002)(86362001)(36756003)(4326008)(8676002)(6916009)(66476007)(66946007)(66556008)(316002)(44832011)(5660300002)(8936002)(7416002)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UqfawYAKzkHPb5AmYnTqXSbQAOGQZrcUqH3JLG5FdYuAk0r0tbg9s2GScb1mX4gFjjXpL7CqPSEU/shx19X+HdUJOS2YQQ0J+/boETC3D+1mUXyKGLldw5d0IVGH0q4VStXKYMedryEuju0fuTCjFUADDr9sRgCq2MZPtr4tDWfmjBFdkkPqe2Zg7gTUPxqyBV1nF5fc/Ydl1LJlZslTqZ8Usel0nbdV9U43ff/VPEy9N0t/iGafBQRwcVrbu3cfdQJrgjxiAIwt7dJKlfprF8Kbzs98It0N741P1S5EOdaqp45CG6FQANTrbWe4TSkfwOIjI/tCoJu1V5AFn//ZoK8YytYRUCrKWcuReAPlpHom5iIun9zv/Z6m88UZ8S0TY/vhQ1TpdJ9L1EF+8r6DPrk0FABrhCpgbnHZgzMWAG7ZB6sWhUecBgzztb1cOvAlEFCiC6IuaL0Am76Ka6vu9Yq5niGQZL7doGu9lyjNq8Q9wvrRoHR0irsdzD78J/RjvSLAVfO8jYmzGGux1KbqR1HvwvSl8uXJTcnMBVO+2FTJtOAO0hAKPjlBb0u/XLpiEsNdUV7cBu0Q9sxBoZz9p+yPlb3mOYqsWB3KbU8FaRnVJgUjbtqi0+OdJGvcat5vtBbpWn/yIo9OVJtUVjGtllOqbA7JrXnNPXbGXyG3ENldN8zJ8ORSrQ/Yd2EIpHW0SWxNYpiIlQTMmuLFNl7UlTMpvr55EgvbzkLwCcjQXZIhJmlkYNOCu1C9b1X84CepY/yl7a42173xMZf2TfkVqq7lOif5kObydbD+D6fkJ/9p5GS2rSy7w8K3L5GK6doGdAwmxQJwhfj9PEv+5dPEQXZUcxfgxiZKGb0xYMXq0hTcYnIF0oWa1MRWXNaqIznwjh+AEdccAW1kP1uLQvvKpQaZw00RjtxKRhHML3tVmHQ0u2qT15/MinlhUiOBJsnqjzRdgB+03bP4fG5XjZwqUSl+ok/GL1OVSXNCIAuMam+krYwp32kgranY+Pf6SPtoII2ndW/1FaH1ETTxzqEZQLoxQsp7yrB0H5EG2t6abW8itZ85rg8Bf6l93Pw5/+ZSh3grnEwN+k5HnJPtB05jIyezB5C46xvrgQkdNlc/NYKWwBPq8w5kF7o2oDxSWPqovT0DFacHGBMdzji5LGwjnH2H/wKelbflCuAvuSnioax+qk6Yos5qwYTVNtadMs182T/SgKD6b8YVvP+wqV75O6fLSCbW8OPZARdu5EdRoMGTvjxPaHv/iRD9HeDAutLgU/W30q5IB0+y5ebc3i375QeWMWqAWghccKPBxn8KI/yYt50EmYZ9O9JSgadPfJO/XNC6txGxRs3T48MPpI8i85lxU3xVn87sEnSxBvXmEhVGAPRkkb1im/l4lqGzH9Aj8zvsq26ab4XSptIbsupq4bBnmoOetov1xL/VQhvZwIVJVsvY3TSwpsetGvm90kj7hFuODeMyxRULyQeiSB1pRo5kqPSrYa+rWgkMo3d9m1B56Bzn5GFX8lxvmzmAUYzc3/8IN12Bi/50imyH8+JGeelMFS2Nph5IawK+ogfAk+HfGpyslK1S0mDt2a2FSI1XLYrViQk2JzHRqxa0pdWjjQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c5b5a5e-bb09-4035-fc0d-08db0fa68768 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 22:46:51.6817 (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: AjqdVoJKmSvENpp1v7TgpzKQ0cAIgR3T9OuJrzKJUOMYxG0AHUAVARqau/SYYkfzqJb9+r1BxXkdBiHb9XBMwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8748 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?1757939707284600478?= X-GMAIL-MSGID: =?utf-8?q?1757939707284600478?= It makes no sense to keep randomly large max_sdu values, especially if larger than the device's max_mtu. These are visible in "tc qdisc show". Such a max_sdu is practically unlimited and will cause no packets for that traffic class to be dropped on enqueue. Just set max_sdu_dynamic to U32_MAX, which in the logic below causes taprio to save a max_frm_len of U32_MAX and a max_sdu presented to user space of 0 (unlimited). Signed-off-by: Vladimir Oltean Reviewed-by: Kurt Kanzenbach --- net/sched/sch_taprio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 53ba4d6b0218..1f469861eae3 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -288,6 +288,8 @@ static void taprio_update_queue_max_sdu(struct taprio_sched *q, dev->hard_header_len + 1); } max_sdu_dynamic = max_frm_len - dev->hard_header_len; + if (max_sdu_dynamic > dev->max_mtu) + max_sdu_dynamic = U32_MAX; } max_sdu = min(max_sdu_dynamic, max_sdu_from_user);