Part Number: TDA2EXEVM
First:
ip link add link eth0 name eth0.6 type vlan id 6
ifconfig eth0.6 198.19.24.96 netmask 255.255.0.0 broadcast 198.19.255.255 up
For the prio field of the vlan protocol, I use the following method:
1.vconfig set_egress_map command
2. IOCTL function SIOCSIFVLAN
3. Use setsockopt to configure SO_PRIORITY
The above 3 methods prompt vlan prio to prompt success, but using CANoe to receive udp broadcast data, it is found that PRIO is always 0.
code:
1.
vconfig set_egress_map eth0.6 6 6
2.
struct vlan_ioctl_args arg;
arg.cmd = SET_VLAN_EGRESS_PRIORITY_CMD;
arg.u.skb_priority = prio;
memcpy(arg.device1, "eth0.6", strlen("eth0.6"));
if (ioctl(socketfd, SIOCSIFVLAN, &arg) < 0) {
printf("[%s][%d] set SIOCSIFVLAN err\n");
}
3.
int prio = 6;
if (setsockopt(socketfd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)) < 0)
{}