From nobody Tue Aug 29 16:26:05 2023 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RZt8k4YnBz4rxbP for ; Tue, 29 Aug 2023 16:26:14 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RZt8k3pWTz3bbK; Tue, 29 Aug 2023 16:26:14 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693326374; 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: in-reply-to:in-reply-to:references:references; bh=DZHQ+BrG8BKxbwxMTjG2fdPoYtbsbYYAv1hYIk1WvcE=; b=YE58iKl5UaVGMBjNY4duwALm2x//P+eStKALVrPh7pUKBZMZ1A0YqjQCyW3ki7RQ6BUEuK 6zti7BmxWpRjLyRrar8laAm3Va0i0cZWJgMjnfwcsoThQ0iLNEWom5Xsn7Yi/G97Z7MYCq q6Avuo3Atpf/4uzOor3osh96yl5WUqr0E1EPlnecDaKtamDaTj6zggnOJgeilIYnJNso6i s3QzuZ8lCCYtg4Q4FIC2chB92cP/1KPAwSTTLjTp9elYf5LMvzPZ+E600UaCD0sU2amuWT b3FBAu76smZm5ASLjtKAOYXRADuQZ4YeZJbD8EE/NSgrHvZupUFGbgr85JIVkg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693326374; a=rsa-sha256; cv=none; b=BmIKl5fUYxRSdztIbRaqLDKvF25w+Is6Icq00xbQLuAm6QqvutWtPsPN5x6d4qALUmf4JH 455O+wS05Qw9SQ2jDvOpY7f25mVSP3efCdAKU9guXRK4INHv+UoPX3fCxFNrnlvQQYPBXS KnfaBlLaf7B3M/pHRDjuYaAh9E3gQNLNy2BloxHAWTzvA4iUfgEOri3vzwdYviqUfHRewa OoZeNpsx+kC1e1oZyUDVIsapN8IdhT7lOK1X4rStxJNdAJTWw3aJsmcISIbo5VRTL5FFzm Qb0b9l2tZdkUpmIWssglHt7Ak89n4+g45VZB6Yi64Ts0pBk7Lhh5nfCV2Oqddw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693326374; 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: in-reply-to:in-reply-to:references:references; bh=DZHQ+BrG8BKxbwxMTjG2fdPoYtbsbYYAv1hYIk1WvcE=; b=Ml/Z/167863x+APvyEdsslPPFk6iltp/cF9b3oH0hyoJ0dAl1G+x2jCJ1A2U2wPHpi5ZeI uJpUk1cHt9bWMxWfb9JOWnYF9yMTuxCApvcdMk7aeiOT/K/X/py/67NT+drcXlTOTcsbk7 WgEHKjg9L8vOOeMmidi0AR7MwtAYqyPCLTQ3YHIfDqGzi6dYwup1SgCaWs1KbZtcfzqoRX 5aN8dE9tyj1/t2chPgI3TvIjYQzctLMi9dfts4m8OBDEkhoG5mKHAat+ABc5mZyV5qePjd AMsqJEX2HIhKpaGUmkWOgg3kAbbyCcEz7vrZ+qHgIHtJdXCH5LVGANcSU9c7Cg== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4RZt8j3z3yz16C1; Tue, 29 Aug 2023 16:26:13 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_23D9BC82-82BB-4A5E-BAEE-39A65F10568E" List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: About IFNET_PCP_NONE Date: Wed, 30 Aug 2023 00:26:05 +0800 In-Reply-To: Cc: freebsd-net To: Konstantin Belousov References: <20ECDA33-2638-4CFB-8740-5E8BF1F8072B@FreeBSD.org> X-Mailer: Apple Mail (2.3696.120.41.1.4) --Apple-Mail=_23D9BC82-82BB-4A5E-BAEE-39A65F10568E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Aug 29, 2023, at 9:23 AM, Konstantin Belousov = wrote: >=20 > On Mon, Aug 28, 2023 at 10:25:01PM +0800, Zhenlei Huang wrote: >>=20 >>=20 >>> On Aug 28, 2023, at 3:54 PM, Konstantin Belousov = wrote: >>>=20 >>> On Mon, Aug 28, 2023 at 09:51:38AM +0800, Zhenlei Huang wrote: >>>> Hi Konstantin, >>>>=20 >>>>=20 >>>> I was just about going to open a PR for = https://reviews.freebsd.org/D39536 and >>>> realized I might made wrong assumption. >>>>=20 >>>> I thought IFNET_PCP_NONE is something like IEEE8021Q_PCP_BE but I = second why not >>>> use IEEE8021Q_PCP_BE but a new const IFNET_PCP_NONE. >>=20 >> I meant >>=20 >> ``` >> int >> ether_output_frame(struct ifnet *ifp, struct mbuf *m) >> { >> uint8_t pcp; >>=20 >> pcp =3D ifp->if_pcp; >> if (pcp !=3D 0 /* IEEE8021Q_PCP_BE */ && ifp->if_type !=3D = IFT_L2VLAN && >> !ether_set_pcp(&m, ifp, pcp)) >> return (0); >>=20 >> ... > This is wrong. PCP_BE is just one of the priorities, that should = allowed to > be specified in the 802.1q pseudo-vlan header. >=20 >>=20 >> } >> ``` >>=20 >>>>=20 >>>> So despite its naming IFNET_PCP_NONE, is it actually a flag to let = specific interface >>>> completely bypass (disable) PCP processing? >>>>=20 >>>> The const IFNET_PCP_NONE is defined in sys/net/if.h with=20 >>>> ``` >>>> #define IFNET_PCP_NONE 0xff /* PCP disabled */ >>>> ``` >>> I fail to understand your question. >>>=20 >>> IFNET_PCP_NONE is a value that means that no 802.1q prio is inserted = into >>> the packet. Otherwise, non-vlan traffic is tagged with the = priority. >>=20 >> Think about the following case: >>=20 >> 1. Set interface's PCP to IFNET_PCP_NONE, application / firewall = provide per-flow PCP, should >> the traffic be tagged with the priority ? > Yes, it should, but only for packets from the specified flows. Thanks for the clarification ! I updated https://reviews.freebsd.org/D39536 = as per discussion. >=20 >>=20 >>=20 >>>=20 >>> IEEE8021Q_PCP_BE is a name of one of the priorities, it seems from = my >>> code reading. >>=20 >>=20 >> Best regards, >> Zhenlei >>=20 --Apple-Mail=_23D9BC82-82BB-4A5E-BAEE-39A65F10568E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Aug 29, 2023, at 9:23 AM, Konstantin Belousov <kostikbel@gmail.com>= wrote:

On Mon, Aug 28, 2023 at 10:25:01PM +0800, Zhenlei Huang = wrote:


On Aug = 28, 2023, at 3:54 PM, Konstantin Belousov <kostikbel@gmail.com>= wrote:

On Mon, Aug 28, 2023 at 09:51:38AM = +0800, Zhenlei Huang wrote:
Hi Konstantin,


I = was just about going to open a PR for https://reviews.freebsd.org/D39536 and
realized I might made wrong assumption.

I thought IFNET_PCP_NONE is something like IEEE8021Q_PCP_BE = but I second why not
use IEEE8021Q_PCP_BE but a new const = IFNET_PCP_NONE.

I = meant

```
int
ether_output_frame(struct ifnet *ifp, struct mbuf *m)
{
   uint8_t pcp;

   pcp =3D ifp->if_pcp;
   if (pcp !=3D 0 /* IEEE8021Q_PCP_BE */ = && ifp->if_type !=3D IFT_L2VLAN &&
=        !ether_set_pcp(&m, ifp, = pcp))
       return = (0);

...
This is = wrong.  PCP_BE is just one of the priorities, that should allowed = to
be specified in the 802.1q pseudo-vlan header.


}
```


So despite its naming IFNET_PCP_NONE, is it actually a flag = to let specific interface
completely bypass (disable) PCP = processing?

The const IFNET_PCP_NONE is = defined in sys/net/if.h with
```
#define = IFNET_PCP_NONE 0xff   /* PCP disabled */
```
I fail to understand your question.

IFNET_PCP_NONE is a value that means that no = 802.1q prio is inserted into
the packet.  Otherwise, = non-vlan traffic is tagged with the priority.

Think about the following = case:

1. Set interface's PCP to = IFNET_PCP_NONE, application / firewall provide per-flow PCP, should
the traffic be tagged with the priority ?
Yes, it should, but only for packets from the = specified flows.

Thanks for the clarification !

I updated https://reviews.freebsd.org/D39536 as per = discussion.





IEEE8021Q_PCP_BE is a name of one of the = priorities, it seems from my
code reading.


Best regards,
Zhenlei



= --Apple-Mail=_23D9BC82-82BB-4A5E-BAEE-39A65F10568E--