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.

Layer 2 Packet sending in Vayu EVM with GLSDK 6.04

Hi,

I am using Vayu evm board with the BSP of GLSDK 6.04.I try sending a Layer 2 packet from the Vayu evm board and I could receive it with the same board.

When I try sending the same packet from another source (eg PC) There is no sign of packet in the Vayu evm. Kindly tell me were should I debug. I tried with few socket options but with the same result.

This happens only with Layer 2 packet.Thanks in advance..

Thanks and Regards,

Sarah Blessie Rajendran

  • Hi Sarah,

    Could you give a little bit more information? What is your setup?

    What command do you use to send a packet? What is the configuration of the ethenret interface on your DRA7xx board?
    Have you by any chance modified the cpsw driver, enabling some kind of filtering ?

    Is this issue present with the latest GLSDK7.0 (a lot of updates and bug fixes were applied since GLSDK6.04)?

    Best Regards,
    Yordan
  • Dear Yordan,

                          Thanks, sorry to be unclear.

    I do a sample code of packing  a ethernet packet. and open a raw socket with multicast as " PACKET_MR_ALLMULTI"

    and started sending the packet from the PC to the vayu board . and could not receive the packet. bothside I do the same.

    socketfd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));

    u8temp_i = ioctl(socketfd, SIOCGIFINDEX, &ifr);

    if (u8temp_i < 0)

    {

    printf("Error getting the interface index%s,%d\n",strerror(errno),errno);

    }

    else

    {

    device.sll_ifindex = ifr.ifr_ifindex;

    /* Use ioctl() to look up interface name and get its MAC address. */

    u8temp_i = ioctl(socketfd,SIOCGIFHWADDR, &ifr);

    if(u8temp_i < 0)

    {

    printf("Error getting MAC address\n");

    }

    else

    {

    /* Copy the appropriate MAC address to cencerned variables */

    for(u8temp_i = 0; u8temp_i < 6; u8temp_i++)

    {

    u8SMAC[u8temp_i] = ifr.ifr_hwaddr.sa_data[u8temp_i];

    }

    }

    }

                  setsockopt( socketfd, SOL_SOCKET,SO_BINDTODEVICE,"eth0",5);

                   mr.mr_ifindex = device.sll_ifindex;

                 //  mr.mr_type = PACKET_MR_ALLMULTI;

                    mr.mr_type = PACKET_MR_MULTICAST;

                         mr.mr_alen = 6;

                   memcpy(mr.mr_address,dest,6);

                   setsockopt( socketfd, SOL_PACKET,PACKET_ADD_MEMBERSHIP, &mr, sizeof(mr));

                   //      if(Sock_opt<0)

                   //              INFO("failed\n");

                   /* Prepare sockaddr_ll for RAW communication */

                   device.sll_family   = AF_PACKET;

                   /* ARP hardware identifier is ethernet */

                   device.sll_protocol = htons(ETH_P_ALL);

                   /* index of the network  */

                   device.sll_ifindex  = device.sll_ifindex;

                   /* we don't use a protocoll above ethernet layer */

                   device.sll_hatype   = ARPHRD_ETHER;

                   /* target is another host */

                   device.sll_pkttype  = PACKET_OTHERHOST;

                   /* address length */

                   device.sll_halen    = ETH_ALEN;

                   bind(socketfd,(struct sockaddr*)&device,sizeof(device));

                   /* Destination MAC */

                   /*

                      for(u8temp_i = 0; u8temp_i < MAC_ADDRESS_SIZE; u8temp_i++)

                      {

                      Net.device.sll_addr[u8temp_i] = Net.u8MMAC[u8temp_i];

                      }

                    */

                   device.sll_addr[0] = 0x01;

                   device.sll_addr[1] = 0x80;

                   device.sll_addr[2] = 0xc2;

                   device.sll_addr[3] = 0x00;

                   device.sll_addr[4] = 0x00;

                   device.sll_addr[5] = 0x0E;

    But I could not receive the packet in the board ,

    Now I have done a different thing I made the PACKET_MR_ALLMULT to PACKET_MR_MULTICAST with the multicast address and now I can receive it ..

    Does the cpsw filter out the PACKET_MR_ALLMULT packets


    I find some code  in cpsw.c

    /*
             * The switch cannot filter multicast traffic unless it is configured
             * in "VLAN Aware" mode.  Unfortunately, VLAN awareness requires a
             * whole bunch of additional logic that this driver does not implement
             * at present.
             */
            if ((flags & IFF_ALLMULTI) && !(ndev->flags & IFF_ALLMULTI))
                    dev_err(&ndev->dev, "multicast traffic cannot be filtered!\n");

    Thanks and Regards,

    Sarah