Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1662013pxy; Mon, 2 Aug 2021 07:19:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2SmCIYMwnb5PGJ78zW8cZ7tUrW/fl03rORpKhCyKFNC7Dupj5TdiZeyGhqtVoQz1PxVwU X-Received: by 2002:a05:6402:518c:: with SMTP id q12mr2576709edd.205.1627913969819; Mon, 02 Aug 2021 07:19:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1627913969; cv=pass; d=google.com; s=arc-20160816; b=UKpafWFqzzqhcYwm04IDyeU8AZFYOhw8E49Ti8GvmsXl1hJriAPypN3+ivLZpTxMEK 0kLaRZw7xKe0guu56YiT7P9QW0zfbis9u6MpR80/VnuDdjV9JtJXszrMvk5aY0W4r3Lz V7zZMdrWNp6FVU6VCZ7d7jMeavcex6dUnd0mEvuzsqL8Qnw2vB6053L5Eu7dovddGdUn 59gorb9zxGnXp2E4POxmIOoHJFQ5eUVAv0Y/Tl4osR24Yku3aYsyT95IDGS2uOtMFMih K/zHbSvVz6w8lXP7sGBI2TWmz33SvlGfF1PXuUoNNkRoXMAXEl9HJDcdwTf41RxxhY1d C2jA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0SJ3yoNsdCIPNrr6rZDTIOM3bKzoM2LejY+DM/1guLQ=; b=QjOHuik9fWz/Cf98WulEMH8MOzXcg43ulPICuzbHbQWbpLngmsgjsL4+KjIjKCwhGg Z1KM40iEZy/jWjP7x2bwVuJnYNN9/IBXKUHIxyLbORzduFwYEpcEtUwIlkKUB109TwoX wDqonXCALbAvS8l8j6Jr6b6JcLdhIV4N9ObKv4onwA85hCNNC0EdoNypHMuroTF/BI4y /sYD2OvL65nZ9nELrczRA2rRWE9AdYmVk2ShML8y1G+Md3/u5SYQbDZhhCx68Zce/Yqm Ayj8Od+l0GVR6L7yocqw9iHQpc+QuPMY1cDUueCR1NubArhtuKoK3EKt8qtEspxQ0Gxr Y7/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=vJQ5Rqui; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si4454655ejo.79.2021.08.02.07.19.06; Mon, 02 Aug 2021 07:19:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=vJQ5Rqui; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238147AbhHBOQq (ORCPT + 99 others); Mon, 2 Aug 2021 10:16:46 -0400 Received: from mail-am6eur05on2093.outbound.protection.outlook.com ([40.107.22.93]:24320 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238230AbhHBOLH (ORCPT ); Mon, 2 Aug 2021 10:11:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jwlkSzQ+ZYz8Mpsges6/WIpinVFSLiPy+IA/jU2ts2qb5qw/WlYRoI2tP21AwZ4bpik0Eqs2v7MpMfAImjLr+l01QNBUxgITKpLSGOePDmK9m6S0DW6y/YN/NnfdWsMkEoOtDNLZkD5BJaEvk3XxrS1cpaHJLSOzVHNWpB2w7n8OXleSuHu83hLMg29NdabwYFQOjZgzMv5iU+UqvNqqmmPTTUQ2DN63ZOIs3bXD+Oufhk5keWMU+4ZHedtRyuP8n+Q7otHUevh/nutEGF6T0r0X1eWIhEQQROyMkNMAuGEyvMs6GOEiLyT8dDpYtEw2nUtlhW9BcbAWMaRT41zhyQ== 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-SenderADCheck; bh=0SJ3yoNsdCIPNrr6rZDTIOM3bKzoM2LejY+DM/1guLQ=; b=RLh1fMdX6ljS/1rSuQrmbjLJaKOclx6gZTQf653rIlh5WrfQMns95H95PlDEI46/N9nOCOXv5Nev23WwOKvhlLC9fqF0JcDriidXVjFBZWKSvIAVepU9AF6eBwD4X/oHN/jrFOWQioGbVeAdajjJ8GWnN1U3ScWKc82bKw812yUFAEiL+C84HVFSb3wEDmTjMwK0yG3raaA+CZCrw57wohiihIWIgPvmRsmnZFgjLGpGowZfcIKeQNGmh2VtmCwKfy5M1GxObt12AW1nwRMPgxo40cJxfYBJCpf0QBE4C+t2YNDLTvUb6aVjBN2b39Y6YspZ4CbbjI8FjKi3r3VVfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=plvision.eu; dmarc=pass action=none header.from=plvision.eu; dkim=pass header.d=plvision.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0SJ3yoNsdCIPNrr6rZDTIOM3bKzoM2LejY+DM/1guLQ=; b=vJQ5Rqui1snsNIzOjnvEer4TO9BBSfNwTxjlP8Krd7y0iL9AWr3InG1WLIEDxh6HJkxsC+fDlI0QmSAGqdvEYuxyT6qzTdrUL3BdfjS78jxLF5YbagJQlGDAsazECLzrVtrohncHiAwyiq1c8lWEiFIrpijisgRhi88weuidajk= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=plvision.eu; Received: from AS8P190MB1063.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e4::5) by AM5P190MB0306.EURP190.PROD.OUTLOOK.COM (2603:10a6:206:20::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.26; Mon, 2 Aug 2021 14:09:25 +0000 Received: from AS8P190MB1063.EURP190.PROD.OUTLOOK.COM ([fe80::380c:126f:278d:b230]) by AS8P190MB1063.EURP190.PROD.OUTLOOK.COM ([fe80::380c:126f:278d:b230%9]) with mapi id 15.20.4373.026; Mon, 2 Aug 2021 14:09:25 +0000 From: Vadym Kochan To: "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Andrew Lunn , Vladimir Oltean , Serhiy Boiko , Volodymyr Mytnyk , Taras Chornyi Cc: Vadym Kochan , Taras Chornyi , Mickey Rachamim , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vadym Kochan Subject: [PATCH net-next v2 3/4] net: sched: introduce __tc_classid_to_hwtc() helper Date: Mon, 2 Aug 2021 17:08:48 +0300 Message-Id: <20210802140849.2050-4-vadym.kochan@plvision.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210802140849.2050-1-vadym.kochan@plvision.eu> References: <20210802140849.2050-1-vadym.kochan@plvision.eu> Content-Type: text/plain X-ClientProxiedBy: AM6P193CA0066.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::43) To AS8P190MB1063.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e4::5) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc60716vkochan.x.ow.s (217.20.186.93) by AM6P193CA0066.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.17 via Frontend Transport; Mon, 2 Aug 2021 14:09:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57d62989-2202-46f0-afe5-08d955bf2240 X-MS-TrafficTypeDiagnostic: AM5P190MB0306: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OuUa0HfAMoYCRroFiRbe+Lv6YhaPTMU6A1MJXaC2k5TJXE0urqzosmkSyoqnoI8m/Rl2zdZc5COWsvUE/lvKwvJ5spnUODLo96070JIb97H7ezLnnGxs1aV6gCV4+vZAO79bUbu2P3rxYIcHPz4XtWWNHNOwaS8/a2OdJe1d8ZJa6l7GnTwOQ/zgy6Z/xK0FfOcCa/mCsQdZ/1msK79JQwxnsBYINroXoWPeIBQGNxSexeuul8VjcS5o3SI20o87aMYwmmnqqIyWqwqBJeHPDDt/o1GJxTp+gDMU77y9AcGn6USMJ7D/k/qM0Ds11SsYEe/NZq3IGw3FUbEkZsQTbgq4s3FzAY5TdP/eSD36QozXkDHOTrhwC/ul6ndwitShqqknAIFUaYcCUWHGuffjzjJnL/irZ35BnlCI14GbRBw8k/vivGQK9LZyofEWzeJVFvRrVr+kKiZpZQoI5CzwLuX2hkGkw9NURAEnsmbcdv7ds4eFNKDCJe4aXNLt7NilpwPOasprmdxmCkUAkLEj+9WB356HWx/rZP/t2+m0GwWiNBNdnjv4+2+Id9wDik2N3fjy6E03Z2eadBKGsf9YRZJqUCEN5ee3VnKAgX30tpUk2oWO4wAcm8NpBrJLm2akwnkunXjHbMua5OB479eXhs1ybuBeM29iqq9dSENNjdiSOABiLDO8CC3zA7/S9LEK6TOkrniHmKs6EZol7GDGuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8P190MB1063.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(376002)(39830400003)(136003)(4326008)(44832011)(2616005)(478600001)(8936002)(956004)(186003)(6486002)(5660300002)(86362001)(66476007)(8676002)(6636002)(66556008)(52116002)(66946007)(1076003)(2906002)(36756003)(6512007)(6506007)(7416002)(83380400001)(26005)(110136005)(54906003)(38350700002)(316002)(38100700002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?E8JjEthoZBs5umgH9+T+9wct9LQyE4uaZSzyR7mmJ56Xukuk7bZBR09yj9Il?= =?us-ascii?Q?3fEAtAuPUQqhmppriHVK/qoNLZDqRxJsryrjYcHCjWUBDjH4p2f2FAgexC6c?= =?us-ascii?Q?6H4P8G7UgdTKK0aUWbNfYwHIZGjlzp1OpDQ4ErNNzvjbIvPs/QWjcFAPFt5K?= =?us-ascii?Q?3kZr/awcp1PUPIZsm8dxK4u3VWCohjQ+3OptJhJTrXd+KXx79xvHXxKH4A79?= =?us-ascii?Q?ds1F+SuhCHChPY4WxKGNhwY+7fy1TjI6rOB88Z1RicR2wKCLVPQHOcl/zD0Y?= =?us-ascii?Q?N0K8Tomxw3iolJBNQtzQ/3woXcHPQ4dSEkmYbArptprWi9sZZo8ygCtMgeVo?= =?us-ascii?Q?JosjzxESpVfkUCarGalEB5PIoDZP0++mkgulcvgtAt2q5ixGgmxFwDYrkTXg?= =?us-ascii?Q?z/ZkLAPyQtCuwV6vA19Hf7CKlpdApnyKe01rhazGjfHkHfECN7PFn+dHDg8/?= =?us-ascii?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: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: 57d62989-2202-46f0-afe5-08d955bf2240 X-MS-Exchange-CrossTenant-AuthSource: AS8P190MB1063.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2021 14:09:25.2788 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NvsCmn3ULBCyfZto27fHJiVoOuWNzBjeiAZejdBdr0KMVE1wRXf06jdetGfGfVfHrgST7u/y5keBKExsLQzxBucO2q7waVd4pGp8Av1Vku8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5P190MB0306 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vadym Kochan There might be a case when the ingress HW queues are globally shared in ASIC and are not per port (netdev). So add a __tc_classid_to_hwtc() version which accepts number of tc instead of netdev. Signed-off-by: Vadym Kochan --- include/net/sch_generic.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index c0069ac00e62..df04f4035a4b 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -668,11 +668,16 @@ qdisc_class_find(const struct Qdisc_class_hash *hash, u32 id) return NULL; } -static inline int tc_classid_to_hwtc(struct net_device *dev, u32 classid) +static inline int __tc_classid_to_hwtc(u32 tc_num, u32 classid) { u32 hwtc = TC_H_MIN(classid) - TC_H_MIN_PRIORITY; - return (hwtc < netdev_get_num_tc(dev)) ? hwtc : -EINVAL; + return (hwtc < tc_num) ? hwtc : -EINVAL; +} + +static inline int tc_classid_to_hwtc(struct net_device *dev, u32 classid) +{ + return __tc_classid_to_hwtc(netdev_get_num_tc(dev), classid); } int qdisc_class_hash_init(struct Qdisc_class_hash *); -- 2.17.1