On Tue, Dec 21, 2021 at 07:12:31AM +1000, David Gwynne wrote:
are you able to find a reference for this in any of the current specs? or in documentation from other vendors?

https://en.wikipedia.org/wiki/IEEE_P802.1p

i've faithfully maintained this behaviour, but the only place i've seen in with my own eyes is in our code. if we're doing it different to literally everyone else, then maybe we shouldnt?

We are not doing it different. But in my mind especially the mapping of PCP / prio 0 / 1 is not intuitive and may be confusing (but is correct!). That's why I think this should be documented in detail.

On 21 Dec 2021, at 00:54, Christopher Zimmermann <chr...@openbsd.org> wrote:

Hi,

it might be helpful for others to understand the meaning of codepoints 0 and 1 
of the vlan priority field. OK?

Christopher

Here is the formatted content:

The 802.1Q and 802.1ad protocols include a 3-bit priority code point
    (PCP):
       PCP 1 is defined as the lowest priority (“background”)
       PCP 0 is the default (“best effort”) - second lowest priority.
       PCPs 2-7 are increasing priority above best effort.
    The priority may be altered via pf.conf(5); see the prio option for more
    information.
       “prio 0” is mapped to PCP 1.
       “prio 1” is mapped to PCP 0.
       “prio 2-7” are mapped to PCP 2-7.
    Alternatively, the txprio property of an interface can set a specific
    priority for transmitted packets.


And here's the diff:

Index: vlan.4
===================================================================
RCS file: /cvs/src/share/man/man4/vlan.4,v
retrieving revision 1.51
diff -u -p -r1.51 vlan.4
--- vlan.4      4 Oct 2020 12:44:49 -0000       1.51
+++ vlan.4      20 Dec 2021 14:51:31 -0000
@@ -83,16 +83,38 @@ interfaces by their respective protocol  identifiers, and 
decapsulated for reception on the associated virtual
interfaces.
.Pp
-The 802.1Q and 802.1ad protocols include a priority field.
-By default, the 802.1p priority in a transmitted packet is based on the
-priority of packets sent over the interface, which may
-be altered via
+The 802.1Q and 802.1ad protocols include a 3-bit priority code point
+(PCP):
+.Bl -item -compact -offset MMM
+.It
+PCP 1 is defined as the lowest priority
+.Pq Dq background
+.It
+PCP 0 is the default
+.Pq Dq best effort
+- second lowest priority.
+.It
+PCPs 2-7 are increasing priority above best effort.
+.El
+The priority may be altered via
.Xr pf.conf 5 ;
see the
.Cm prio
option for more information.
-Alternatively,
+.Bl -item -compact -offset MMM
+.It
+.Dq prio 0
+is mapped to PCP 1.
+.It
+.Dq prio 1
+is mapped to PCP 0.
+.It
+.Dq prio 2-7
+are mapped to PCP 2-7.
+.El
+Alternatively, the
.Cm txprio
+property of an interface
can set a specific priority for transmitted packets.
.Pp
.Nm vlan



--
http://gmerlin.de
OpenPGP: http://gmerlin.de/christopher.pub
CB07 DA40 B0B6 571D 35E2  0DEF 87E2 92A7 13E5 DEE1

Reply via email to