How can I set 802.1Q VLAN priority?

Hi,


for evaluation and testing I need to set the priority on egress frames on a tagged Ethernet interface. On a Linux machine, "setsockopt (sock, SOL_SOCKET, SO_PRIORITY, &sockOpt...)" does the trick – alas, SO_PRIORITY is not available on MacOS.

Ingress frames (from the Linux machine) are tagged correctly, the PCP field shows the correct value in WireShark, so my Ethernet-USB-C dongle seems to be capable.

Is there any other way to set the priority, may be through a system utility? Or via an ioctl call?


Thanks and

Best Regards

Bernd

Replies

As far as I know there’s no supported way to set priority directly. My recommendation is that you look at

SO_NET_SERVICE_TYPE
(see
<sys/socket.h>
) which is an abstract way of setting the traffic class which affects various lower-level parameters.

WWDC 2016 Session 714 Networking for the Modern Internet discusses this issue in detail.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi Quinn,


thanks a lot.

Alas, I cannot see any difference when setting SO_NET_SERVICE_TYPE – the VLAN priority on a vlan0 port stays at 0.


Actually I want to simulate/develop a TSN client on the Mac; it will use TRDP (a UDP/IP based train communication protocol) for controlling e.g. the traction in hard realtime.

I thought I've seen an option to set AVB (the former name of TSN) on the system's network panel - but it disappeared. Is it maybe dependent on the used Ethernet adapter? I'm on a MacBook Pro with USB C / USB 3 Ethernet Dongle attached.

The WWDC 2016 Session 714 reveals exactly what you proposed.


BTW:

I see you're still in business ;-) – you might not remember me, but we met on some WWDCs in the last century/millenium (ISDN modem stuff, Hermstedt, Germany, such old stuff!!!)


Best Regards


Bernd Löhr

Mannheim, Germany

I see you're still in business ;-)

They keep paying me, I keep showing up (-:

but it disappeared. Is it maybe dependent on the used Ethernet adapter?

Quite possibly. In my experience the best way to get Ethernet like a traditional built-in Ethernet is via the Thunderbolt to Gigabit Ethernet Adapter, using a Thunderbolt 3 (USB-C) to Thunderbolt 2 Adapter if you have Thunderbolt 3 ports on your Mac. When I plugged that into my Mac [1] I found that System Preferences > Network > Thunderbolt Ethernet > Advanced > Hardware has a checkbox entitled AVB/EAV Mode. Is that what you’re looking for?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

[1] An Apple MacBook Pro (15-inch, 2016) running 10.13.5.

Yep, that's it! I knew it was there and it was not my age... ;-)

Thanks and keep on going!

Bernd