Wednesday, December 23, 2015

Ethernet driver for mcc/rpmsg status

mccethernet is loading on Ubuntu 15.10.:

ifconfig
eth0      Link encap:Ethernet  HWaddr 00:21:70:5a:c0:7d  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:722 errors:0 dropped:0 overruns:0 frame:0
          TX packets:722 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:88472 (88.4 KB)  TX bytes:88472 (88.4 KB)

mcc0      Link encap:Ethernet  HWaddr 00:00:00:00:00:01  
          UP BROADCAST RUNNING MULTICAST  MTU:1024  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:c0:a8:c3:56:15  
          inet addr:192.168.9.6  Bcast:192.168.9.255  Mask:255.255.255.0
          inet6 addr: fe80::2c0:a8ff:fec3:5615/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8630 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7939 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4416731 (4.4 MB)  TX bytes:1681525 (1.6 MB)

Background on driver development for mccethernet, mccmulti, and mcctty:

I start by creating a basic driver that can be loaded by my desktop PC, which is running 15.10 Ubuntu.  This way I can load/debug/ etc faster then recompiling the kernel or loading the Udoo Neo.  Also, the Ubuntu is using 4.x and neo is using a 3.4.x and there are some API differences that have to be accounted for in the mccethernet.c 

For example: in 3.4.x alloc_netdev only needs 3 arguments where alloc_netdev in 4.x needs 4 arguments. 
Linux kernel has some macros to help you out:
    
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)        
mccethernet_dev = alloc_netdev(sizeof(struct mcc_ethernet_device), "mcc0", mcc_setup);
#else
mccethernet_dev = alloc_netdev(sizeof(struct mcc_ethernet_device), "mcc0", NET_NAME_UNKNOWN, mcc_setup);

#endif 

mccmulti driver was a little harder to since it is using MCC api calls; the first pass was to stub MCC calls.


For the mccethernet it is using basic file operations on m4mcc1 on the mccmulti user interface.  Code can be found here.


No comments:

Post a Comment