This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA2EXEVM: Use the Linux sdk to set the vlan prio parameter, it cannot take effect. [Vision sdk 3.06][ (TI-Linux)][kernel 4.4.84+]

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)

{}

  • Hi,

    I am not familiar with CANoe. Can you send a L2 packet over Eth interface and send the capture ?

    Also provide all the commands used and test application used

    Regards

    Vineet

  • Hi Vineet Roy,

    The device sends UDP broadcast data with vlan tag, and directly captures the original Ethernet data through the Ethernet interface on the Canoe device without any filtering. In the 8021q data, only vlanID has data, and prio is always 0.

  • Hi Vineet Roy,

    For example:

    CODE:

    socketfd = socket(AF_INET, SOCK_DGRAM, 0);

    struct ifreq ifr;
    struct sockaddr_in broadcast_addr;
    int option = 1;

    strcpy(ifr->ifr_name, "eth0.6");
    int ret = 0;
    ret = ioctl(socketfd, SIOCGIFBRDADDR, &ifr);

    broadcast_addr.sin_family = AF_INET;
    broadcast_addr.sin_port = htons(40000);
    broadcast_addr.sin_addr.s_addr = ((struct sockaddr_in*)&(ifr.ifr_broadaddr))->sin_addr.s_addr;
    setsockopt(socketfd, SOL_SOCKET, SO_BROADCAST, &option, sizeof(option));


    ioctl(socketfd, SIOCGIFINDEX, &ifr);
    if (setsockopt(socketfd, SOL_SOCKET, SO_BINDTODEVICE, (char *)&ifr, sizeof(ifr)) < 0)
    {

    }
    #endif

    struct vlan_ioctl_args arg;
    short qos = 2;
    arg.cmd = SET_VLAN_EGRESS_PRIORITY_CMD;
    arg.u.skb_priority = 5;
    arg.vlan_qos = qos;
    #arg.u.name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
    memcpy(arg.device1, "eth0.6", strlen("eth0.6"));

    if (ioctl(socketfd, SIOCSIFVLAN, &arg) < 0)
    {
    }

    .
    .
    .
    sendto(){}

  • Hi,

    This is a Linux Ethernet Stack question. You will have to refer to Linux documentation.

    It is not related to TDA2x GMACSW HW.

    Regards,
    Stanley