Article View: linux.kernel.netdev
Article #17418[PATCH net-next v3 03/10] net: ieee8021q: clarify the tt_to_tc() traffic-class mapping
From: Oleksij Rempel
Date: Mon, 16 Nov 2026 19:10
Date: Mon, 16 Nov 2026 19:10
90 lines
14220 bytes
14220 bytes
Document that the tt_to_tc() traffic-class numbers are the pre-computed
composition of Table I-2 (traffic type -> priority) with Table 8-5
(priority -> traffic class). Note that Table 8-5 is the mapping for
implementations without the credit-based shaper, so the helper's scope
is clear; credit-based-shaper implementations use Table 34-1/34-2
instead.
The existing kdoc cited Annex I Table I-1 as the mapping basis, but
Table I-1 only partitions traffic types into classes; it does not assign
the class numbers.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Reviewed-by: Alvin ล ipraga <alvin.sipraga@analog.com>
---
Q: Luiz: does make htmldocs build cleanly and render the diagram?
A: No .rst under Documentation/ includes net/core/ieee8021q_helpers.c
today, so make htmldocs does not render it. scripts/kernel-doc -rst
-Wall on the file is clean, and an htmldocs build with the file added
to Documentation/networking/kapi.rst produced no new warning. Adding it
to kapi.rst will follow as a separate patch.
Changes in v3:
- No changes.
Changes in v2:
- make the mapping diagram an RST literal block (Luiz)
- call Tables 8-5 and 34-1/34-2 the recommended mappings, as 802.1Q does
- keep the Reviewed-by tags: only the kdoc wording and the diagram
format changed
---
net/core/ieee8021q_helpers.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/net/core/ieee8021q_helpers.c b/net/core/ieee8021q_helpers.c
index b052120e67c525ac5a45b26de4cb879a0d758d17..8fd3ea87c7bcb6d7f34a4cf5969530633edd6abb 100644
--- a/net/core/ieee8021q_helpers.c
+++ b/net/core/ieee8021q_helpers.c
@@ -13,10 +13,10 @@
compiletime_assert(ARRAY_SIZE(tbl) == IEEE8021Q_TT_MAX, \
#tbl " size mismatch")
-/* The following arrays map Traffic Types (TT) to traffic classes (TC) for
- * different number of queues as shown in the example provided by
- * IEEE 802.1Q-2022 in Annex I "I.3 Traffic type to traffic class mapping" and
- * Table I-1 "Traffic type to traffic class mapping".
+/* The following arrays map a traffic type (TT) to a traffic class (TC) for
+ * each supported number of queues. The mapping is the traffic-type -> priority
+ * -> traffic-class composition documented in the ieee8021q_tt_to_tc() kdoc
+ * below, reduced for the given number of queues.
*/
static const u8 ieee8021q_8queue_tt_tc_map[] = {
[IEEE8021Q_TT_BK] = 0,
@@ -85,17 +85,22 @@ static const u8 ieee8021q_1queue_tt_tc_map[] = {
};
/**
- * ieee8021q_tt_to_tc - Map IEEE 802.1Q Traffic Type to Traffic Class
- * @tt: IEEE 802.1Q Traffic Type
- * @num_queues: Number of queues
+ * ieee8021q_tt_to_tc - Map an IEEE 802.1Q traffic type to a traffic class
+ * @tt: IEEE 802.1Q traffic type
+ * @num_queues: number of traffic classes (queues) available, 1..8
*
- * This function maps an IEEE 802.1Q Traffic Type to a Traffic Class (TC) based
- * on the number of queues configured on the NIC. The mapping is based on the
- * example provided by IEEE 802.1Q-2022 in Annex I "I.3 Traffic type to traffic
- * class mapping" and Table I-1 "Traffic type to traffic class mapping".
+ * Return the traffic-class number for @tt. It is the pre-computed composition
+ * of two IEEE 802.1Q-2022 mappings::
*
- * Return: Traffic Class corresponding to the given Traffic Type or negative
- * value in case of error.
+ * traffic type --[Table I-2]--> priority --[Table 8-5]--> traffic class
+ *
+ * Table 8-5 is the recommended priority-to-traffic-class mapping for
+ * implementations that do NOT support the credit-based shaper (8.6.8.2).
+ * Credit-based-shaper implementations have a different recommended mapping
+ * (Table 34-1 for SR classes A and B, or Table 34-2 for SR class B only),
+ * which this helper does not implement.
+ *
+ * Return: the traffic class, or a negative value on error.
*/
int ieee8021q_tt_to_tc(enum ieee8021q_traffic_type tt, unsigned int num_queues)
{
--
2.47.3
Technical Details
Message-ID:
<20261116-rtl8365mb-dcb-ingress-v3-3-657f5fdb4db7@pengutronix.de>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364664-linux-kernel-netdev=dewy.ruReferences:
<20261116-rtl8365mb-dcb-ingress-v3-0-657f5fdb4db7@pengutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364664-linux-kernel-netdev=dewy.ru From: o.rempel@pengutronix.de (Oleksij Rempel) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v3 03/10] net: ieee8021q: clarify the tt_to_tc() traffic-class mapping Date: Mon, 16 Nov 2026 20:10:14 +0100 Organization: Usenet Network Message-ID: <20261116-rtl8365mb-dcb-ingress-v3-3-657f5fdb4db7@pengutronix.de> References: <20261116-rtl8365mb-dcb-ingress-v3-0-657f5fdb4db7@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2145962"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:yMHW7KZ5TtvFvZoNyS1qEfZZemU= sha256:owd5NEwKMUZl5efDcZRTfb+Kuwaj7pOwBZWaLaKUAjY= sha1:mnFA57xFC0NlBCuUyn/HDEeSl5Y= sha256:mW9N7/iMadu7l+jkVO6JeZjrA3biaVZmkKyTJ1374CU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 60043114D4E; Mon, 16 Nov 2026 22:10:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=pengutronix.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ONWYxKy1glxT; Mon, 16 Nov 2026 22:10:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-364664-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=pengutronix.de X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 05F54114D46; Mon, 16 Nov 2026 22:10:33 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id EAE1260204C; Mon, 16 Nov 2026 19:10:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794856223; b=NxjiIwjiNK3PQmAn0Dr03tDI2mJLEgrAYV+qNVs1EapEAJLAaZiMcwl+jrih06tf0rCG nPZrchH5nXyQlTOhif22vRfppG+SoVk3nw7X9eyHXQK4t4sxhUMJFqWxwM/WBLJ9C+oY1 JU/puN0DYHz8hqEmiZ1QsaVtJSu7bEhR+i8O3rnegPJyjJxu6Ra5jJ3WTN8KguPG67I74 gklpR11hSo1YzusIasDOTaghm3uMvu/v+FYwBJVYCQHx9YVDPztONlHNV8nTQNeSITDBU AfkWLzBW9i9icRIrodFDAilBQ1eDHqqp6SrnnYZ9j+IHe6ZJMtUjd4QrXlBjsuI3DgQ== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794856223; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received: From:Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer; bh=MWn0K85N+ZeqSnbsLKHm706qLEbyvRyCHmz09C8OYvg=; b=zhyStP1zgo9YphjqAdzVkm/u0FP4F6ALMDevF7n2y0EhchOg31RklqJgRTKJ1ke0BXOa ctXVn4qBkRHeqOOMkZjNIPGB+SjQN0tvqVk9yUW7Wz3Pe1beXljGjbxwWxRb9/t9Dnm3x fQ4gjscJ6yp2rNaWxZIramS74DWp80W+TgfcysQ1dWNrYUtRec/n8PFuULOWpNr4bJusx 8rq5fBtasoGssjqd1MaDY6wsSpD9TVEk2dZifMk7/ghmohUvWjgTvcoqnlCpwxBwWI75p Nkm370mLyh7foM2NrcaSN76Hsl12yQCNyHgJbEP0jSlyRgi1tx6S3iFe06CPoHxC4Aw== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=MLXqvDMp; dmarc=none header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5BF260A2609; Mon, 16 Nov 2026 19:10:23 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=MLXqvDMp X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794856222; b=kgW5SU8XMTDyEo8k65Kh3owcrqyc8wnJVAu1l1K+ofoCc60NzDpCtKmDtgAyJod2rnFI hqeQ4jQ0HApBINihlewQmk0HFgDyg5hdMpItg8JAQAOBbdeV9KXAjbzBo6lh9xzvfZJRR 2Mxku+RocWukW1zQ2FpW1MilpKRwO81MdsQ9kuSEm50oe13ntU1TS33Von9bpI6Gqmd6i ktZDT2yUl03/ZnKsNaNuun+mPYdZnZHEqh6KxaZ3lVlBUkjWDCHuLQmn3zUIfv/ist6/r XZqcs1WXSZnwvQZYCTlNyvAwilAhvPEbP4nTyo0R+ydfBvqx3zddQ0f0JodjYO6DNdQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794856222; h=DMARC-Filter:Received:DKIM-Signature:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer; bh=MWn0K85N+ZeqSnbsLKHm706qLEbyvRyCHmz09C8OYvg=; b=X4Bb1gEorbRDtYuc+MiPFdHb0GNx5IUCcJgfJQXXCOLviaZgsM5B48lB4hJuxmfOWZk0 Vd6MQUjiQKXqU0sIz+GK4kCyVUhciqXfWTgH2EevIkG5u13eMHWqo9nrH/Wi4ESnjum9S hA6nm8dTF1ZYv9rooKGpyCX3bJJB6TZFu4fiD2nE2zoDk3L4hHS+6OsZHaacT4sx9+BG1 tirvjtxh3q/vgekefeRxIpi+s6D3V+N/bZzzpPj73Rm3C8iJbPkxAdBBUkLbWR1okqV4s IptKXLt6x6Th6DPupn4hRTp24QA+cKqC7fPlnChcyjr9rmOKlzVV6x0gPqsAzkvPwtg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=MLXqvDMp; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13 X-Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D331E606A323; Mon, 16 Nov 2026 19:10:21 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D331E606A323 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de X-Received: from dude04.red.stw.pengutronix.de (dude04.red.stw.4.pengutronix.de [10.17.1.12]) (Authenticated sender: relay-from-dude04.red.stw.pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id C2D36202963; Mon, 16 Nov 2026 20:10:15 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1794856215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MWn0K85N+ZeqSnbsLKHm706qLEbyvRyCHmz09C8OYvg=; b=MLXqvDMp4Gz7ObZa6lIGo7YjqWn63OHKVBQs1DWpnV7q7eiE5n+2iSnI6uUzq7X/3Sfii9 f6B02gf/1fNNZEBH1XTu2S6+eeApcfkLEUHnVxk9g1wS7L9okOv5tWIwfxsX84pIPLqsgf V5krfx0wghKsMHJ8y8tpjNZPVoZWRBhydrMxz7AMZ2E1gegyl9P064UOcXdp1I1BrgOcZH xxrg7E2cLxPZ98MEi3iRVnUt13Ss5g1dgXFq20rXJr9QfAQHRTsSZxNYs4TCadJZKVG9SG tQx8CLJfXsS3D4Aoo/nyzzqd/jvCy4bQCxePSyftZcKhqECHThaMDkUFhH00jA== X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1794856215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MWn0K85N+ZeqSnbsLKHm706qLEbyvRyCHmz09C8OYvg=; b=PG5PB6gKkqEHOe5QDlizWEi7/3fvdUrc8dIZ89+11HnwOVQk4vLx9701i/7GIv8AvWQxUK 8CyAyVT0i7jiki7R+yw43oFV8mn/Oz99Yra+UdorP4frj7CmqzlqkJzZueqE+zrrZ0RjNt 6hxzvDRWcunuXKNtCR9QwoJYcUbLzusiJCm9YXUb8I1gXD/DttCf2WCgH2lkgiB5dl6KcO FQh0tLp/uMaOXqBZWUk3D/pfamWYPT77/HDM6imneDezhK0jHamYGK9Q7IE9GuflgJmPnH Fx3VHIqTkNTEdUo4hFvBbukunfHLRpm6+ySOXhLaaOYazTIOJUMVSXUi7K1WlQ== X-ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1794856215; a=rsa-sha256; cv=none; b=Q1mwoX4BeUWmo4QfTUnoFzW3Ko3pu4M8L5hwANuzmNCObNplVhOivPaJ/cnJrKGDjzx86D NLT3fR8f1zX48A8aPTVRk9IPiXzVLP8vhrXEGcoqbf2lTIq6QD/7CGDDiEAObJpiBPWw7A Htef65R/gsx8yEwwr/fIiaX1gmYdtLuXXdWVIslThgsDDvpyUoAGz8+6NmUBhfWJgBwTyh 2Iq1i+r5gIldFS5YGumr7BV54dyd91Q6jN7YAc3JXISED4OKlhCkFYDQ4/lqBIas25hUD6 W2p9jvqncfqEDnGnWyC0hczJfLzvPS0185ZoPT9PJZolxk4fj+AVxM5bjq4Y3Q== X-ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=relay-from-dude04.red.stw.pengutronix.de smtp.mailfrom=ore@pengutronix.de X-Received: by dude04.red.stw.pengutronix.de (Postfix, from userid 1058) id AEE1E381265; Mon, 16 Nov 2026 20:10:15 +0100 (CET) X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261116-rtl8365mb-dcb-ingress-v3-0-657f5fdb4db7@pengutronix.de> X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Oleksij Rempel <o.rempel@pengutronix.de> X-Mailer: b4 0.14.2