Will UDP work for FEC Controller on IMX27

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Will UDP work for FEC Controller on IMX27

5,825件の閲覧回数
VSPA
Contributor I

We are trying to test the UDP on the IMX 27 ADS baord with FEC controller. It handgs. But if we use the External Network Controller form Ciruss Logic, it works fine? SO anything we need to configure?

 

We ahve set the MAC address form the Kernel COmmand line option while booting form Redboot & it reflects when we do ifconfig.

 

Kindly let us know, if anybody has faced similar problem & if anybody got solution for it

 

Regards

VSP

PS: TCP is fine

0 件の賞賛
返信
13 返答(返信)

2,633件の閲覧回数
LeonardodeMoura
Contributor I

We faced a similar issue while working with i.MX27 and a distro provided by Freescale. We could ping and do normal TCP/UDP operation, but UDP multicast wouldn't work. We found out that it would work only in promiscuous mode (ifconfig eth0 promisc). So I'd recommend you enable the setting and test again. Looking Linux documentation on multicasts and kernel/driver code, we found out that the FEC driver was bugged: it set a wrong register when enabling multicasts. I won't post the code as I don't know the specifics of your code, but it should lead you into the right direction.

 

Let me know what happens.

 

Best regards,

Leonardo.

Message Edited by Leonardo de Moura Rocha Lima on 2009-07-21 10:10 PM
0 件の賞賛
返信

2,633件の閲覧回数
Yuri
NXP Employee
NXP Employee

The solution with the  promiscuous mode may be not suitable for many cases.

One of customers was able to resolve the issue as following :

 

"In the /drivers/net/fec.c file make the following changes:

      Everywhere it uses the variable fec_hash_table_high change it to fec_grp_hash_table_high

      Everywhere it uses the variable fec_hash_table_low change it to fec_grp_hash_table_low

 

These variables are really references to hardware registers in the MX27 FEC Controller.  The multicast registers have the _grp_ addition to them.   The code was modifying the individual UDP address registers which is not what you want for multicast.    

0 件の賞賛
返信

2,633件の閲覧回数
gokulcg
Contributor I

Hi,

We faced a similar issue while working with QorIQ P2040[cpu: e500mc] and a distro provided by Freescale. We could ping and do normal TCP/UDP operation, but UDP multicast receive wouldn't work.
We found out that it would work only in promiscuous mode (ifconfig eth0 promisc). But I am not using FEC driver or GIANFAR driver .

YuriMuhin_ng

Thanks

Gokul CG
kalkitech

0 件の賞賛
返信

2,633件の閲覧回数
YuriMuhin_ng
Contributor I

Gokul, good day !

I think it would be better to create a SR for my colleagues, working

with QorIQ.

Regards,

Yuri.

0 件の賞賛
返信

2,633件の閲覧回数
gokulcg
Contributor I

In reply to SR ,

There are no known issues with multicast reception in QurIQ SDK 1.5,

and it should not be necessary to set the interface into promiscuous

mode to receive multicasts. Generic suggestions for Linux multicast

setup and diagnostics can be found here:

http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html#MULTICAST

Regarding the driver, FEC driver is not valid for your chip. P2040

is equipped with DPAA, Linux kernel support code for it can be found

under drivers/net/ethernet/freescale/dpa/. The function that specifically

handles multicast address setup is dpa_set_rx_mode() .

0 件の賞賛
返信

2,633件の閲覧回数
daiane_angolini
NXP Employee
NXP Employee

Sory, but I canot make these broadcast tests because of my network.

 

But, it seems to me some kind of mistake, you're sure to be using the right eth!?

0 件の賞賛
返信

2,633件の閲覧回数
daiane_angolini
NXP Employee
NXP Employee

Hi!

 

How are you testing UDP!?

Did you get a  functional system with FEC controller enabled!? Please, let me know what BSP you are using, and if you are running from flash or nfs.

 

I configured my FEC controller with the steps above:

 

** Configure eth0 to get network parameter using DHCP (if you have a DHCP server running in your network):

 

  Target System
Configuration

      Options

          Start Networking

               Network Setup

                   Enable Interface 0

                          Get network
parameters using DHCP

 



**Enable FEC in kernel

 under ./ltib -c choose: Configure Kernel, and then:

 

 Device Drivers
     Network Device Support
         Ethernet (10 or 100Mbit)
              FEC Ethernet Controller

 

**In redboot ONLY modify this parameter:

 

  • Default network
    device:
    mxc_fec


 

 

 

My redboot:

 

 

 

RedBoot> fc -l                                                                                                                                                                                      
Run script at boot: true                                                                                                                                                                            
Boot script:                                                                                                                                                                                        
.. load -r -b 0x100000 /tftpboot/imx27_3                                                                                                                                                            
.. exec -b 0x100000 -l 0x200000 -c "noinitrd console=ttymxc0,115200 root=/dev/nfs nfsroot=10.29.244.6:/tftpboot/ltib27_3 init=/linuxrc ip=dhcp"                                 
                                                                                                                                                                                                    
Boot script timeout (1000ms resolution): 1                                                                                                                                                          
Use BOOTP for network configuration: true                                                                                                                                                           
Default server IP address: 10.29.244.6                                                                                                                                                              
Board specifics: 0                                                                                                                                                                                  
Console baud rate: 115200                                                                                                                                                                           
Set eth0 network hardware address [MAC]: false                                                                                                                                                      
Set FEC network hardware address [MAC]: false                                                                                                                                                       
GDB connection port: 9000                                                                                                                                                                           
Force console for special debug messages: false                                                                                                                                                     
Network debug at boot time: false                                                                                                                                                                   
Default network device: mxc_fec

 

 

 

 

 

 I test UDP and TCP throughput using IPERF, you can choose this package under ./ltib -c in package list

Message Edited by Daiane Angolini on 2009-03-30 01:31 PM
Message Edited by Daiane Angolini on 2009-03-30 01:33 PM
0 件の賞賛
返信

2,633件の閲覧回数
daiane_angolini
NXP Employee
NXP Employee

You binary did not worked imediately in my sistem. I have this error:

 

 

mx27#  ./recievermultiarm 10.29.244.6 5555                                                                                                                                                           setsockopt() failed: Invalid argument                                                                                                                                                                mx27# askjdhasd                                                                                                                                                                                      mx27#  ./recievermultiarm 10.29.244.6 5555                                                                                                                                                           setsockopt() failed: Invalid argument                                                                                                                                                                mx27#  ./recievermultiarm 10.29.244.6 555                                                                                                                                                            setsockopt() failed: Invalid argument                                                                                                                                                                mx27#  ./recievermultiarm 10.29.244.6 1234                                                                                                                                                           setsockopt() failed: Invalid argument                                                                                                                                                                mx27#  ./recievermultiarm                                                                                                                                                                            Usage: ./recievermultiarm Multicast_IP Multicast_Port 

 

 

 

 

To insure that your interface is running, test the conectivity with iperf.

 

 TCP TEST:

 

in PC:

 

iperf -s

 

in board

 

iperf -c <HOST_IP>

 

UDP TEST:

 

in PC:

 

iperf -su

 

in board

 

iperf -c <HOST_IP> -u

 

 

 Be sure that the bug is not in your code. 

0 件の賞賛
返信

2,633件の閲覧回数
VSPA
Contributor I

I think You need to first do the follwoing in the Sender & receiver

 

 

route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

 

& We are trying like this ,

 while running sender  on PC give

 

./sender 239.255.255.254 6666

 

& in the Baord for receiving

 

./receivemultiarm 239.255.255.254 6666

 

 

There is no bug in teh code, we have tested this with External controller & it works fine

 

0 件の賞賛
返信

2,633件の閲覧回数
VSPA
Contributor I

Also the interface is up & fine, we can ping & also mount nfs etc....

 

 

0 件の賞賛
返信

2,633件の閲覧回数
daiane_angolini
NXP Employee
NXP Employee

Please, show me your error.

How can I reproduce this here, im my machine?

0 件の賞賛
返信

2,633件の閲覧回数
VSPA
Contributor I

We are trying UDP multicast with follwoing sender & receiver codes. We are unable to receive when we send from any PC

 

Also find binaries atatched, We are trying the Sender on X86 PC & receiver on IMX27 ADS board

We don't get any error as such, it just don't receive the packets

******************************Receiver************************************#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #define MAX_LEN  1024int main(int argc, char *argv[]){ int sock; int flag_on = 1; struct sockaddr_in multicast_addr; char message_received[MAX_LEN+1]; int msgrecv_len; struct ip_mreq mc_req; char* multicast_ip; unsigned short multicast_port; struct sockaddr_in from_addr; unsigned int from_len;         if (argc != 3) {  fprintf(stderr, "Usage: %s Multicast_IP Multicast_Port\n", argv[0]);  exit(1); } multicast_ip = argv[1];      /* arg 1: multicast ip address */ multicast_port = atoi(argv[2]);    /* arg 2: multicast port number */ if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {  perror("socket() failed");  exit(1); } /* set reuse port to on to allow multiple binds per host */ if ((setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flag_on, sizeof(flag_on))) < 0) {  perror("setsockopt() failed");  exit(1); } /* construct a multicast address structure */ memset(&multicast_addr, 0, sizeof(multicast_addr)); multicast_addr.sin_family      = AF_INET; multicast_addr.sin_addr.s_addr = htonl(INADDR_ANY); multicast_addr.sin_port        = htons(multicast_port); /* bind to multicast address to socket */ if ((bind(sock, (struct sockaddr *) &multicast_addr, sizeof(multicast_addr))) < 0) {  perror("bind() failed");  exit(1); } /* construct an IGMP join request structure */ mc_req.imr_multiaddr.s_addr = inet_addr(multicast_ip); mc_req.imr_interface.s_addr = htonl(INADDR_ANY); /* send an ADD MEMBERSHIP message via setsockopt */ if ((setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void*) &mc_req, sizeof(mc_req))) < 0) {  perror("setsockopt() failed");  exit(1); } while(1) {  memset(message_received, 0, sizeof(message_received));  from_len = sizeof(from_addr);  memset(&from_addr, 0, from_len);  /* block waiting to receive a packet */  if ((msgrecv_len = recvfrom(sock, message_received, MAX_LEN, 0, (struct sockaddr*)&from_addr, &from_len)) < 0)  {   perror("recvfrom() failed");   break;  }  printf("Received %d bytes from %s: ", msgrecv_len,  inet_ntoa(from_addr.sin_addr));  printf("%s", message_received); } /* send a DROP MEMBERSHIP message via setsockopt */ if ((setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void*) &mc_req, sizeof(mc_req))) < 0) {  perror("setsockopt() failed");  exit(1); } close(sock);}***************************Receiver END*************************************************************Sender***********************#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #define MAX_LEN  1024 int main(int argc, char *argv[]){ int sock; char message_to_send[MAX_LEN]; unsigned int send_len; char* multicast_ip; unsigned short multicast_port; unsigned char multicast_ttl=1; struct sockaddr_in multicast_addr; if (argc != 3) {  fprintf(stderr, "Usage: %s Multicast_IP Multicast_Port\n", argv[0]);  exit(1); } multicast_ip = argv[1];       /* arg 1: multicast IP address */ multicast_port     = atoi(argv[2]); /* arg 2: multicast port number */ /* create a socket */ if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {  perror("Socket creation failed");  exit(1); } /* set the TTL (time to live/hop count) for(i=0;i<5;i++){} the send */ if ((setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, (void*) &multicast_ttl, sizeof(multicast_ttl))) < 0) {  perror("setsockopt() failed");  exit(1); }  memset(&multicast_addr, 0, sizeof(multicast_addr)); multicast_addr.sin_family      = AF_INET; multicast_addr.sin_addr.s_addr = inet_addr(multicast_ip); multicast_addr.sin_port        = htons(multicast_port); printf("Type the message below (Press Enter to send, ctrl-C to quit):\n"); memset(message_to_send, 0, sizeof(message_to_send)); while(fgets(message_to_send, MAX_LEN, stdin)) {  send_len = strlen(message_to_send);  if ((sendto(sock, message_to_send, send_len, 0,  (struct sockaddr *) &multicast_addr,  sizeof(multicast_addr))) != send_len)  {   perror("Error include<> number of bytes");   exit(1);  }  memset(message_to_send, 0, sizeof(message_to_send)); } close(sock);   exit(0);}*************************************Receiver END

 

 

Please note that this code works fine when we enable the external controller on the IMX27 ADS board.

 

 

0 件の賞賛
返信

2,633件の閲覧回数
VSPA
Contributor I

Yes , we enabled the FEC controller in the Kernel Config. We are using ltib-imx27ads-20071219.

We could get TCP working fine, but not the UDP with Multicast.

We have set the FEC mac while running the Kernel from the Redboot.

 

0 件の賞賛
返信