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.

Bind a socket to a specific NIMU device

Other Parts Discussed in Thread: SYSBIOS

Hi,

I read section A.16 of spru524h "Virtual LAN (VLAN) Support",  There is an example of how to create a VLAn device with a spcific ID, and how to map user priority to vlan priorities through a socket. I don't understand how the brand new created VLAN device is coupled with the socket in the example.

In my use case I would like to have different TCP sockets having different VID. How can I do that?

Since I use the CPSW (working drivers ported from Linux) I tried with this:

AddNetifEntryFn(CPSW_NETIF_INIT (as in ethernetip adapter example from sdk)

//waiting for NDK to boot...

vlan_dev_index = VLANAddDevice (src_index /*cpsw index*/, vlan_id, def_priority, prio_mapping);

sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

dwOptval = vlan_dev_index; //in return from VLANAddDevice

dwError = setsockopt (sockfd , SOL_SOCKET, SO_IFDEVICE, (char*) &dwOptval, sizeof (dwOptval));

 

But the socket configuration fails with -22 (invalid argument). Indeed it fails in SockSet at:

 case SO_IFDEVICE:
        {
            HANDLE h;

            /* Only DGRAM sockets can use the IFDEVICE option */
            if( !(ps->StateFlags & SS_ADDR) || size != sizeof(uint) )
                return( EINVAL );

This means I cannot use VLANs with TCP sockets?

Tools' versions:

1) Sysbios 6.35.4.50

2) NDK 2.22.3.20

3) CCS 6

Thank you!

Luca