Re: [PATCH net-next v2 02/10] net: ieee8021q: add pcp_to_tt()

From: Luiz Angelo Daros de Luca

Date: Sat Nov 14 2026 - 14:57:41 EST


> Add a helper that maps an IEEE 802.1Q Priority Code Point (PCP) to the
> corresponding 802.1Q traffic type, complementing the existing
> ietf_dscp_to_ieee8021q_tt().
>
> It is very nearly an identity map, except that PCP 0 (Best Effort) and
> PCP 1 (Background) are swapped: per 802.1Q-2022 (Annex I, Table I-2)
> Background is a lower priority than Best Effort even though it carries
> the higher PCP value. PCP 2..7 map straight through to the matching
> traffic type, and values above 7 are rejected with -EINVAL. This decodes
> the 8P0D encoding (Table 6-3), where every PCP value is a priority and
> none carries drop eligibility.
>
> Drivers that classify ingress traffic by PCP need this to map into a
> priority-ordered internal space without misordering Best Effort and
> Background. The first consumer, the realtek rtl8365mb DSA driver, lands
> later in this series.
>
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
> ---
> Changes in v2:
> - use a lookup table instead of the switch (Luiz)
> - check the lookup table size at build time
> - kernel-doc: cite Table 6-3 instead of Table I-7, fix the sentence on
> 7P1D/6P2D/5P3D, document the stub's return value
> - commit message: cite Table 6-3 instead of Table I-7
> - reword the @IEEE8021Q_TT_BE kernel-doc and the enum title
> - keep Linus's Reviewed-by: the mapping is unchanged

Reviewed-by: Luiz Angelo Daros de Luca <luizluca@xxxxxxxxx>