Re: explain priority codepoints and their mapping in vlan.4

2021-12-30 Thread Jason McIntyre
On Thu, Dec 30, 2021 at 12:34:14PM -0800, Chris Cappuccio wrote:
> Christopher Zimmermann [chr...@openbsd.org] wrote:
> > On Mon, Dec 20, 2021 at 04:41:07PM -0700, Theo de Raadt wrote:
> > > You say it twice.  But my eyes still glazed over it, not seeing what was
> > > going on the first two times.
> > > 
> > > Maybe something more like
> > > 
> > >  prio 0 and 1 are mapped out of order to PCP 1 and 0, but prio 2 to
> > >  7 are mapped directly to PCP 2 to 7.
> > > 
> > > No that still doesn't quite capture it in a visible way. How about
> > > 
> > >  prio 2 to 7 are mapped directly to PCP 2 to 7, but prio 0 and 1
> > >  are mapped backwards, to PCP 1 and 0, because <...>
> > > 
> > > Something which will draw the eye+brain to 'something is different here'.
> > > The table alone doesn't do that.
> > 
> > I agree. How about this?
> > 
> >  The 802.1Q and 802.1ad protocols include a Priority Code Point (PCP).  
> > By
> >  default, the 802.1p PCP in a transmitted packet is based on the 
> > priority
> >  of packets sent over the interface, which may be altered via 
> > pf.conf(5);
> >  see the prio option for more information.  Alternatively, the 
> > ifconfig(4)
> >  txprio option can set a specific priority for transmitted packets. On
> >  vlan and svlan interfaces priorities 2 to 7 will be mapped directly to
> >  PCP 2 to 7, but priorities 0 and 1 are mapped backwards, to PCP 1 and 
> > 0.
> >  This is because 802.1p defines PCP 1 as lowest priority and PCP 0 as
> >  second lowest priority, which is meant to be used as default (???best
> >  effort???).
> > 
> 
> I think the best way to get someone's attention is to mention the
> conflict first, like in Theo's example. Yours seems wordy, a person
> has to read several sentences before they even realize something
> unusual going on here.
> 
> Chris
> 

hi chris.

it's a fair point. but i suppose the other side is that this way all man
pages would begin with a list of important points. almost like sticking
CAVEATS at page top.

i think the text is written in a logical order, to be honest. if all the
stuff before the "watch out!" text is not needed, then i guess a CAVEATS
might be better. but it reads like it;s all useful.

(but to be fair, i really am not familiar with this stuff)

jmc



Re: explain priority codepoints and their mapping in vlan.4

2021-12-30 Thread Chris Cappuccio
Christopher Zimmermann [chr...@openbsd.org] wrote:
> On Mon, Dec 20, 2021 at 04:41:07PM -0700, Theo de Raadt wrote:
> > You say it twice.  But my eyes still glazed over it, not seeing what was
> > going on the first two times.
> > 
> > Maybe something more like
> > 
> >  prio 0 and 1 are mapped out of order to PCP 1 and 0, but prio 2 to
> >  7 are mapped directly to PCP 2 to 7.
> > 
> > No that still doesn't quite capture it in a visible way. How about
> > 
> >  prio 2 to 7 are mapped directly to PCP 2 to 7, but prio 0 and 1
> >  are mapped backwards, to PCP 1 and 0, because <...>
> > 
> > Something which will draw the eye+brain to 'something is different here'.
> > The table alone doesn't do that.
> 
> I agree. How about this?
> 
>  The 802.1Q and 802.1ad protocols include a Priority Code Point (PCP).  By
>  default, the 802.1p PCP in a transmitted packet is based on the priority
>  of packets sent over the interface, which may be altered via pf.conf(5);
>  see the prio option for more information.  Alternatively, the ifconfig(4)
>  txprio option can set a specific priority for transmitted packets. On
>  vlan and svlan interfaces priorities 2 to 7 will be mapped directly to
>  PCP 2 to 7, but priorities 0 and 1 are mapped backwards, to PCP 1 and 0.
>  This is because 802.1p defines PCP 1 as lowest priority and PCP 0 as
>  second lowest priority, which is meant to be used as default (???best
>  effort???).
> 

I think the best way to get someone's attention is to mention the
conflict first, like in Theo's example. Yours seems wordy, a person
has to read several sentences before they even realize something
unusual going on here.

Chris



Re: explain priority codepoints and their mapping in vlan.4

2021-12-30 Thread Jason McIntyre
On Thu, Dec 30, 2021 at 09:04:53PM +0100, Christopher Zimmermann wrote:
> On Mon, Dec 20, 2021 at 04:41:07PM -0700, Theo de Raadt wrote:
> >You say it twice.  But my eyes still glazed over it, not seeing what 
> >was going on the first two times.
> >
> >Maybe something more like
> >
> >  prio 0 and 1 are mapped out of order to PCP 1 and 0, but prio 2 to
> >  7 are mapped directly to PCP 2 to 7.
> >
> >No that still doesn't quite capture it in a visible way. How about
> >
> >  prio 2 to 7 are mapped directly to PCP 2 to 7, but prio 0 and 1
> >  are mapped backwards, to PCP 1 and 0, because <...>
> >
> >Something which will draw the eye+brain to 'something is different here'.
> >The table alone doesn't do that.
> 
> I agree. How about this?
> 
>   The 802.1Q and 802.1ad protocols include a Priority Code Point (PCP).  
> By
>   default, the 802.1p PCP in a transmitted packet is based on the priority
>   of packets sent over the interface, which may be altered via pf.conf(5);
>   see the prio option for more information.  Alternatively, the 
> ifconfig(4)
>   txprio option can set a specific priority for transmitted packets. On
>   vlan and svlan interfaces priorities 2 to 7 will be mapped directly to
>   PCP 2 to 7, but priorities 0 and 1 are mapped backwards, to PCP 1 and 0.
>   This is because 802.1p defines PCP 1 as lowest priority and PCP 0 as
>   second lowest priority, which is meant to be used as default (???best
>   effort???).
> 

hi.

some feedback, inline.

> 
> 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.44 Oct 2020 12:44:49 -   1.51
> +++ vlan.430 Dec 2021 20:00:38 -
> @@ -83,17 +83,26 @@ 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
> +The 802.1Q and 802.1ad protocols include a Priority Code Point (PCP).
> +By default, the 802.1p PCP in a transmitted packet is based on the
>   priority of packets sent over the interface, which may
>   be altered via
>   .Xr pf.conf 5 ;
>   see the
>   .Cm prio
>   option for more information.
> -Alternatively,
> +Alternatively, the
> +.Xr ifconfig 4
>   .Cm txprio
> -can set a specific priority for transmitted packets.
> +option can set a specific priority for transmitted packets. On

you should start new sentences on new lines

> +.Nm vlan
> +and
> +.Nm svlan
> +interfaces priorities 2 to 7 will be mapped directly to PCP 2 to 7, but
> +priorities 0 and 1 are mapped backwards, to PCP 1 and 0. This is because

ditto

also, consider s/and 0/and 0, respectively/
it is more explicit (which seems to be relevant here)

> +802.1p defines PCP 1 as lowest priority and PCP 0 as second lowest
> +priority, which is meant to be used as default

i'm having trouble with the lack of a/the here. i don;t know the subject
matter well enough to say exactly what it should be, but:

as lowest priority -> as the lowest priority
as second -> as the second
as default -> as the default

(not sure, just asking)

> +.Pq Dq best effort .

i would not mark this up i.e. use ("best effort")

jmc

>   .Pp
>   .Nm vlan
>   and



Re: explain priority codepoints and their mapping in vlan.4

2021-12-30 Thread Christopher Zimmermann

On Mon, Dec 20, 2021 at 04:41:07PM -0700, Theo de Raadt wrote:
You say it twice.  But my eyes still glazed over it, not seeing what 
was going on the first two times.


Maybe something more like

 prio 0 and 1 are mapped out of order to PCP 1 and 0, but prio 2 to
 7 are mapped directly to PCP 2 to 7.

No that still doesn't quite capture it in a visible way. How about

 prio 2 to 7 are mapped directly to PCP 2 to 7, but prio 0 and 1
 are mapped backwards, to PCP 1 and 0, because <...>

Something which will draw the eye+brain to 'something is different here'.
The table alone doesn't do that.


I agree. How about this?

 The 802.1Q and 802.1ad protocols include a Priority Code Point (PCP).  By
 default, the 802.1p PCP in a transmitted packet is based on the priority
 of packets sent over the interface, which may be altered via pf.conf(5);
 see the prio option for more information.  Alternatively, the ifconfig(4)
 txprio option can set a specific priority for transmitted packets. On
 vlan and svlan interfaces priorities 2 to 7 will be mapped directly to
 PCP 2 to 7, but priorities 0 and 1 are mapped backwards, to PCP 1 and 0.
 This is because 802.1p defines PCP 1 as lowest priority and PCP 0 as
 second lowest priority, which is meant to be used as default (“best
 effort”).


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 -   1.51
+++ vlan.4  30 Dec 2021 20:00:38 -
@@ -83,17 +83,26 @@ 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
+The 802.1Q and 802.1ad protocols include a Priority Code Point (PCP).
+By default, the 802.1p PCP in a transmitted packet is based on the
 priority of packets sent over the interface, which may
 be altered via
 .Xr pf.conf 5 ;
 see the
 .Cm prio
 option for more information.
-Alternatively,
+Alternatively, the
+.Xr ifconfig 4
 .Cm txprio
-can set a specific priority for transmitted packets.
+option can set a specific priority for transmitted packets. On
+.Nm vlan
+and
+.Nm svlan
+interfaces priorities 2 to 7 will be mapped directly to PCP 2 to 7, but
+priorities 0 and 1 are mapped backwards, to PCP 1 and 0. This is because
+802.1p defines PCP 1 as lowest priority and PCP 0 as second lowest
+priority, which is meant to be used as default
+.Pq Dq best effort .
 .Pp
 .Nm vlan
 and



Re: explain priority codepoints and their mapping in vlan.4

2021-12-20 Thread Theo de Raadt
Christopher Zimmermann  wrote:

> 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.

Right.

> >> 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.

You say it twice.  But my eyes still glazed over it, not seeing what was
going on the first two times.

Maybe something more like

  prio 0 and 1 are mapped out of order to PCP 1 and 0, but prio 2 to
  7 are mapped directly to PCP 2 to 7.

No that still doesn't quite capture it in a visible way. How about

  prio 2 to 7 are mapped directly to PCP 2 to 7, but prio 0 and 1
  are mapped backwards, to PCP 1 and 0, because <...>

Something which will draw the eye+brain to 'something is different here'.
The table alone doesn't do that.



Re: explain priority codepoints and their mapping in vlan.4

2021-12-20 Thread Christopher Zimmermann

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  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 -   1.51
+++ vlan.4  20 Dec 2021 14:51:31 -
@@ -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



Re: explain priority codepoints and their mapping in vlan.4

2021-12-20 Thread David Gwynne
are you able to find a reference for this in any of the current specs? or in 
documentation from other vendors?

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?

> On 21 Dec 2021, at 00:54, Christopher Zimmermann  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.44 Oct 2020 12:44:49 -   1.51
> +++ vlan.420 Dec 2021 14:51:31 -
> @@ -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
> 



explain priority codepoints and their mapping in vlan.4

2021-12-20 Thread Christopher Zimmermann

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 -   1.51
+++ vlan.4  20 Dec 2021 14:51:31 -
@@ -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