Index: sys/net/if_vlan_var.h =================================================================== RCS file: /cvs/src/sys/net/if_vlan_var.h,v retrieving revision 1.37 diff -u -p -r1.37 if_vlan_var.h --- sys/net/if_vlan_var.h 24 Jan 2017 10:08:30 -0000 1.37 +++ sys/net/if_vlan_var.h 16 Nov 2018 01:37:21 -0000 @@ -63,9 +63,9 @@ struct ifvlan { struct arpcom ifv_ac; /* make this an interface */ unsigned int ifv_ifp0; /* parent interface of this vlan */ struct ifv_linkmib { + int ifvm_prio; /* prio to apply on packet leaving if */ u_int16_t ifvm_proto; /* encapsulation ethertype */ u_int16_t ifvm_tag; /* tag to apply on packets leaving if */ - u_int16_t ifvm_prio; /* prio to apply on packet leaving if */ u_int16_t ifvm_type; /* non-standard ethertype or 0x8100 */ } ifv_mib; LIST_HEAD(__vlan_mchead, vlan_mc_entry) vlan_mc_listhead; Index: sys/net/if_vlan.c =================================================================== RCS file: /cvs/src/sys/net/if_vlan.c,v retrieving revision 1.178 diff -u -p -r1.178 if_vlan.c --- sys/net/if_vlan.c 11 Jul 2018 14:20:18 -0000 1.178 +++ sys/net/if_vlan.c 16 Nov 2018 01:37:21 -0000 @@ -173,6 +173,7 @@ vlan_clone_create(struct if_clone *ifc, ifv->ifv_type = ETHERTYPE_VLAN; refcnt_init(&ifv->ifv_refcnt); + ifv->ifv_prio = IF_HDRPRIO_PACKET; ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST; ifp->if_xflags = IFXF_CLONED|IFXF_MPSAFE; @@ -245,6 +246,7 @@ vlan_start(struct ifqueue *ifq) struct ifvlan *ifv; struct ifnet *ifp0; struct mbuf *m; + int txprio; uint8_t prio; ifv = ifp->if_softc; @@ -255,14 +257,16 @@ vlan_start(struct ifqueue *ifq) goto leave; } + txprio = ifv->ifv_prio; + while ((m = ifq_dequeue(ifq)) != NULL) { #if NBPFILTER > 0 if (ifp->if_bpf) bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* NBPFILTER > 0 */ - prio = ISSET(ifp->if_flags, IFF_LINK0) ? - ifp->if_llprio : m->m_pkthdr.pf.prio; + prio = (txprio == IF_HDRPRIO_PACKET) ? + m->m_pkthdr.pf.prio : txprio; /* IEEE 802.1p has prio 0 and 1 swapped */ if (prio <= 1) @@ -712,6 +716,21 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCGETVLAN: error = vlan_get_compat(ifp, ifr); + break; + + case SIOCSTXHPRIO: + if (ifr->ifr_hdrprio == IF_HDRPRIO_PACKET) + ; + else if (ifr->ifr_hdrprio > IF_HDRPRIO_MAX || + ifr->ifr_hdrprio < IF_HDRPRIO_MIN) { + error = EINVAL; + break; + } + + ifv->ifv_prio = ifr->ifr_hdrprio; + break; + case SIOCGTXHPRIO: + ifr->ifr_hdrprio = ifv->ifv_prio; break; default: Index: share/man/man4/vlan.4 =================================================================== RCS file: /cvs/src/share/man/man4/vlan.4,v retrieving revision 1.49 diff -u -p -r1.49 vlan.4 --- share/man/man4/vlan.4 7 Apr 2018 13:34:39 -0000 1.49 +++ share/man/man4/vlan.4 16 Nov 2018 01:37:22 -0000 @@ -84,18 +84,16 @@ identifiers, and decapsulated for recept interfaces. .Pp The 802.1Q and 802.1ad protocols include a priority field. -By default, the priority of a transmitted packet is based on the +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 .Xr pf.conf 5 ; see the .Cm prio option for more information. -Alternatively, the -.Cm link0 -flag may be set to use the interface's -.Cm llprio -value for transmitted packets. +Alternatively, +.Cm txprio +can set a specific priority for transmitted packets. .Pp .Nm vlan and @@ -183,8 +181,7 @@ Remove a custom MAC address from an 802. Force the use of priority 1 for transmitted packets, regardless of the packet priority: .Bd -literal -offset indent -# ifconfig vlan0 llprio 1 -# ifconfig vlan0 link0 +# ifconfig vlan0 txprio 1 .Ed .Sh SEE ALSO .Xr inet 4 , Index: sbin/ifconfig/ifconfig.8 =================================================================== RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v retrieving revision 1.322 diff -u -p -r1.322 ifconfig.8 --- sbin/ifconfig/ifconfig.8 16 Nov 2018 01:10:51 -0000 1.322 +++ sbin/ifconfig/ifconfig.8 16 Nov 2018 01:37:22 -0000 @@ -1831,6 +1831,7 @@ device will try to establish a data conn .Ar vlan-interface .Op Oo Fl Oc Ns Cm parent Ar parent-interface .Op Oo Fl Oc Ns Cm vnetid Ar vlan-tag +.Op Cm txprio Ar prio .Ek .nr nS 0 .Pp @@ -1871,6 +1872,12 @@ Valid tag values are from 1 to 4094 incl Clear the tag value. Packets on a VLAN interface without a tag set will use a value of 0 in their headers. +.It Cm txprio Ar prio +Set the value used for the priority field in the 802.1Q or 802.1ad +headers. +Values may be from 0 to 7, or +.Ar packet +to use the priority of packets transmitted on the interface. .El .Sh EXAMPLES Assign the