4 Replies
      Latest reply on Jul 19, 2018 5:05 AM by Retmarut
      Retmarut Level 1 Level 1 (0 points)



        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


        • Re: How can I set 802.1Q VLAN priority?
          eskimo Apple Staff Apple Staff (13,905 points)

          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"

            • Re: How can I set 802.1Q VLAN priority?
              Retmarut Level 1 Level 1 (0 points)

              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.



              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