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.

Linux/J6EVM5777: Problem with IPv6 over USB NCM interface

Part Number: J6EVM5777

Tool/software: Linux

Hi,

(This question is observed while trying to implement CarPlay over TI J6 (Android OS; 6AM.1.3))

I have the USB gadget configured to use USB Bulk In/Out and NCM control and data interfaces.

When TI J6 is connected to the iPhone as USB device and 'usb0' network interface is setup.

They exchange ICMPv6 Neighbor Solicitation and Neighbor Advertisement and the iPhone tries to send a TCP packet to the TI J6.

This fails and also all the multiple TCP retransmissions that follow.

Running 'ip -6 neigh' on TI J6 does return the IPv6 address of the iPhone but display as STALE.

> root@jacinto6evm:/data/local/tmp # ip -6 neigh
> fe80::14c0:1650:d9d6:701 dev usb0 lladdr 52:f0:b7:98:dd:5f STALE

I cannot ping the address.

> root@jacinto6evm:/data/local/tmp # ping6 fe80::14c0:1650:d9d6:71%usb0
> connect: Network is unreachable

I cleared the 'ip6tables' before the connection to make sure no rules are affecting the packets.

> root@jacinto6evm:/data/local/tmp # ip6tables -S
> -P INPUT ACCEPT
> -P FORWARD ACCEPT
> -P OUTPUT ACCEPT

Wireshark PCAP file can be downloaded from the following link if needed:
drive.google.com/.../view

I also tried connecting with a Ubuntu host and I see similar results.



Now if I configure 'usb0' with IPv4 address, then I can communicate fine between the TI J6 and the Ubuntu host using IPv4.

CarPlay does seem to work using the IPv4 address as a fallback. (But we must have it work over IPv6)

Please provide some advice on how this issue can be resolved.

Thanks,

Alan

  • Hi Alan,

    I have forwarded your question to CarPlay experts.

    Regards,
    Yordan
  • Alan

    We have not verified with iPhone. But verified NCM with ubuntu host running iperf client/server.

    Can you check iperf is working for you with IPV6.

    Run iperf performance test between ubuntu host and EVM. 

    1) @EVM, run iperf as server

    #ifconfig usb0 up

    #ifconfig usb0

    #iperf -s -u -V -b

    2)  @Ubunut Host  run iperf as client application

    #iperf -V -c fe80::7c11:59ff:fec9:b37e%usb0 -u -b 300m"

    The "fe80::7c11:59ff:fec9:b37e" is IPV6 address taken from usb0 interface of taget. Issue command ifconfig usb0 at EVM and copy the IPV6 physical address.

    Note: This example shows UDP data performance.

    Regards

    Ravi

  • Hi Ravi B,

    Here are the logs for running iperf.

    1) @EVM

    root@jacinto6evm:/data/local/tmp # ifconfig
    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:5485 errors:0 dropped:0 overruns:0 frame:0
    TX packets:5485 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1
    RX bytes:1544309 TX bytes:1544309

    usb0 Link encap:Ethernet HWaddr 2A:A1:6D:C4:17:A5
    inet6 addr: fe80::28a1:6dff:fec4:17a5/64 Scope: Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:3211311 errors:0 dropped:0 overruns:0 frame:0
    TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:2527058778 TX bytes:2340

    root@jacinto6evm:/data/local/tmp # data/com.magicandroidapps.iperf/bin/iperf -s -u -V -b
    /data/data/com.magicandroidapps.iperf/bin/iperf: option requires an argument -- b
    ------------------------------------------------------------
    Server listening on UDP port 5001
    Receiving 1470 byte datagrams
    UDP buffer size: 160 KByte (default)
    ------------------------------------------------------------
    connect UDP failed: Network is unreachable

    2) @Ubuntu Host

    foobar@nothing:~$ iperf -V -c fe80::28a1:6dff:fec4:17a5%usb0 -u -b 300m
    ------------------------------------------------------------
    Client connecting to fe80::28a1:6dff:fec4:17a5%usb0, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size: 208 KByte (default)
    ------------------------------------------------------------
    [ 3] local fe80::9c3f:fcff:fe7e:c719 port 41410 connected with fe80::28a1:6dff:fec4:17a5 port 5001
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0-10.0 sec 348 MBytes 292 Mbits/sec
    [ 3] Sent 248309 datagrams
    [ 3] WARNING: did not receive ack of last datagram after 10 tries.

    Thanks,

    Alan

  • Couple of observations.

    1. TX packets shown in the ifconfig info on the Ubuntu host and RX packets on the EVM count goes up noticeably after running the above UDP test.

    2. Nothing happens with TCP testing.

    1) @EVM
    root@jacinto6evm:/data/local/tmp # ./iperf -s -V
    ------------------------------------------------------------
    Server listening on TCP port 5001
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------

    2) @Ubuntu Host
    foobar@nothing:~$ iperf -V -c fe80::609c:72ff:feed:2338%usb0
  • Alan

    Can you disable the all interfaces (ethx) in Ubuntu Host. Before you run iperf server/client from PC host.

    I assume ping between host and EVM works well.

    Regards

    Ravi

  • Hi

    I tried with the eth0 disabled (ifconfig eth0 down) on the Ubuntu Host.
    It did not have any effect.

    As I noted, when the Ubuntu Host runs iperf as client
    I do see the TX packets on the Ubuntu Host and RX packets on the EVM does increase in the ifconfig usb0 information.
    So it does seem like something is getting sent and received but not picked up by the iperf server on the EVM.

    @Ubuntu Host
    > usb0 Link encap:Ethernet HWaddr fa:2e:de:27:71:31
    > inet6 addr: fe80::f82e:deff:fe27:7131/64 Scope:Link
    > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    > RX packets:8 errors:0 dropped:0 overruns:0 frame:0
    > TX packets:1971023 errors:0 dropped:0 overruns:0 carrier:0
    > collisions:0 txqueuelen:1000
    > RX bytes:560 (560.0 B) TX bytes:1578687434 (1.5 GB)

    @EVM
    > usb0 Link encap:Ethernet HWaddr 8A:36:08:F0:76:96
    > inet6 addr: fe80::8836:8ff:fef0:7696/64 Scope: Link
    > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    > RX packets:1971221 errors:0 dropped:0 overruns:0 frame:0
    > TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
    > collisions:0 txqueuelen:1000
    > RX bytes:1551139826 TX bytes:1776


    I cannot ping either way however.
    @EVM
    > root@jacinto6evm:/data/local/tmp # ping6 fe80::f82e:deff:fe27:7131%usb0
    > connect: Network is unreachable

    @Ubuntu Host
    > foobar@nothing:~$ ping6 fe80::8836:8ff:fef0:7696%usb0
    > PING fe80::8836:8ff:fef0:7696%usb0(fe80::8836:8ff:fef0:7696) 56 data bytes
    > ping: sendmsg: Cannot assign requested address
    > ping: sendmsg: Cannot assign requested address
    > ping: sendmsg: Cannot assign requested address
    > ^C
    > --- fe80::8836:8ff:fef0:7696%usb0 ping statistics ---
    > 178 packets transmitted, 0 received, 100% packet loss, time 177659ms

    When I run `ip -6 neigh`,
    both EVM and Ubuntu Host shows the other IP address as REACHABLE when running iperf but still cannot ping.
    They soon change to STALE after the iperf client finishes runnning.

    @Ubuntu Host
    > foobar@nothing:~$ ip -6 neigh
    > fe80::8836:8ff:fef0:7696 dev usb0 lladdr 8a:36:08:f0:76:96 STALE --> REACHABLE when running iperf

    @EVM
    > root@jacinto6evm:/data/local/tmp # ip -6 neigh
    > fe80::f82e:deff:fe27:7131 dev usb0 lladdr fa:2e:de:27:71:31 STALE

    Thanks,
    Alan
  • Hi ,

    I tried pining the EVM from the Ubuntu Host and tried running tcpdump on the EVM.

    @Ubuntu Host
    > foobar@nothing:~$ ping6 fe80::8836:8ff:fef0:7696%usb0
    > PING fe80::8836:8ff:fef0:7696%usb0(fe80::8836:8ff:fef0:7696) 56 data bytes
    > ping: sendmsg: Cannot assign requested address
    > ping: sendmsg: Cannot assign requested address
    > ^C
    > --- fe80::8836:8ff:fef0:7696%usb0 ping statistics ---
    > 288 packets transmitted, 0 received, 100% packet loss, time 288334ms


    Although the ping command does not show a successful ping,
    I could see that the echo request has reached the EVM using TCPDUMP.

    @EVM
    > root@jacinto6evm:/data/local/tmp # tcpdump
    > [ 4414.404520] device usb0 entered promiscuous mode
    > tcpdump: WARNING: usb0: no IPv4 address assigned
    > tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    > listening on usb0, link-type EN10MB (Ethernet), capture size 65535 bytes
    > -6:-46:-26.5794 IP6 fe80::f82e:deff:fe27:7131 > fe80::8836:8ff:fef0:7696: ICMP6, echo request, seq 11, length 64
    > -6:-46:-25.5870 IP6 fe80::f82e:deff:fe27:7131 > fe80::8836:8ff:fef0:7696: ICMP6, echo request, seq 12, length 64
    > -6:-46:-24.5956 IP6 fe80::f82e:deff:fe27:7131 > fe80::8836:8ff:fef0:7696: ICMP6, echo request, seq 13, length 64
    > -6:-46:-23.6027 IP6 fe80::f82e:deff:fe27:7131 > fe80::8836:8ff:fef0:7696: ICMP6, echo request, seq 14, length 64
    > -6:-46:-22.6112 IP6 fe80::f82e:deff:fe27:7131 > fe80::8836:8ff:fef0:7696: ICMP6, echo request, seq 15, length 64
    > ...

    FYI. I have removed all entries from the ip6tables on the EVM and just have the default policy.

    > root@jacinto6evm:/data/local/tmp # ip6tables -L
    > Chain INPUT (policy ACCEPT)
    > target prot opt source destination
    >
    > Chain FORWARD (policy ACCEPT)
    > target prot opt source destination
    >
    > Chain OUTPUT (policy ACCEPT)
    > target prot opt source destination


    Thanks,
    Alan
  • Pining from the EVM to the Ubuntu Host does not work at all.
    It fails immediately.
    > root@jacinto6evm:/data/local/tmp # ping6 fe80::f82e:deff:fe27:7131%usb0
    > connect: Network is unreachable
  • Alan

    After booting kernel and inserting g_ncm gadget.
    I tried below it works, can you check (dont assing any IP address).

    1). From EVM bring up the interface
    # ifconfig usb0 up
    oot@dra7xx-evm:~# ifconfig usb0
    usb0 Link encap:Ethernet HWaddr A2:66:3C:42:2D:1E
    inet6 addr: fe80::a066:3cff:fe42:2d1e%3068449560/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:18 errors:0 dropped:0 overruns:0 frame:0
    TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:4091 (3.9 KiB) TX bytes:2276

    2). From EVM run iperf udp server
    # iperf –s –u –V -b3

    3) From Ubuntu Host run iperf udp Client.
    Disconnect all interface (both ethx and usbx) in Ubuntu Host PC before running the iperf client .
    Copy the inet6 address (fe80::a066:3cff:fe42:2d1e)from EVM and issue the iperf client from Host PC.

    $ iperf -V -c fe80::a066:3cff:fe42:2d1e%usb0 -u -b 300m
    ------------------------------------------------------------
    Client connecting to fe80::a066:3cff:fe42:2d1e%usb0, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size: 208 KByte (default)
    ------------------------------------------------------------
    [ 3] local fe80::c824:d2ff:fe67:3d58 port 46233 connected with fe80::a066:3cff:fe42:2d1e port 5001
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0-10.0 sec 61.9 MBytes 51.9 Mbits/sec
    [ 3] Sent 44129 datagrams
    [ 3] Server Report:
    [ 3] 0.0-10.0 sec 61.4 MBytes 51.5 Mbits/sec 0.752 ms 330/44128 (0.75%)
    [ 3] 0.0-10.0 sec 19 datagrams received out-of-order

    The iperf result shows there is 272Mbps with 0.48% data loss

    Regards
    Ravi
  • Hi  

    Are you testing on AM6.1.3 Android OS?

    This is not working for me.

    I'll give bit more detail on what I've done.

    I am using a custom built kernel which just has minor changes from the AM6.1.3. to make it work for CarPlay.

    You were in most of the related discussions in the forum which got me this far so you should be somewhat familiar with what I was trying.

    Here are the things I've done but

    1) Build the kernel with USB Gadget NCM support added

    2) Made minor changes to the Generic serial driver (drivers/usb/gadget/function/f_serial.c)

    Changed Interface String: Generic Serial --> iAP Interface

    Changed Interface Subclass: 0x00 --> 0xF0

    3) Manually applied patch to enable VBUS in USB gadget

    Refereced patch from processors.wiki.ti.com/index.php

    4) After EVM boot up, reconfigure the existing USB gadget for CarPlay using the USB 2.0 port

    setprop sys.usb.config none
    rm /config/usb_gadget/g1/configs/b.1/f1
    rm /config/usb_gadget/g1/configs/b.1/f2

    mkdir /config/usb_gadget/g1/functions/gser.gs0
    ln -s /config/usb_gadget/g1/functions/gser.gs0 /config/usb_gadget/g1/configs/b.1/f1
    mkdir /config/usb_gadget/g1/functions/ncm.gs1
    ln -s /config/usb_gadget/g1/functions/ncm.gs1 /config/usb_gadget/g1/configs/b.1/f2
    echo "0xC0" > /config/usb_gadget/g1/configs/b.1/bmAttributes
    echo "0" > /config/usb_gadget/g1/configs/b.1/MaxPower
    echo "Default Configuration" > /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration
    echo "488d0000.usb" > /config/usb_gadget/g1/UDC

    5) Rest of the steps are same as how you described.

    @EVM 

    ifconfig eth0 down

    ifconfig usb0 up

    ./iperf -s -u -V -b3

    @Ubuntu host

    ifconfig eth0 down

    iperf -V -c fe80::c86f:feff:fef7:f3d0%usb0 -u -b 300m

    IPv4 does work over the same interface when I assign IPv4 address to usb0.

    Here is also how the USB configuration of the EVM looks from the Ubuntu Host in case you need it.

    gist.github.com/.../51f91d0b80162666e8640d8c68a9f477

    Thanks,

    Alan

  • Leftout a step.
    I also run the following command to configure the USB mode for the USB 2.0 port.
    > echo 'device' > /d/488d0000.usb/mode
  • Hi ,

    Any suggestions?

    Thanks,

    Alan

  • Alan

    I have verified on Linux, not verified on Android.

    Let me check with android team and let you know.

    Regards

    Ravi

  • Hi Alan,

    Have you tried regular IPV6 traffic on this setup? with Ethernet instead of NCM.

    Regards,
    Vishal

  • Hi ,

    I haven't tested over plain ethernet.

    Will try and let you know once I get a crossover cable.

    Thanks,

    Alan

  • HI ,

    I tested with a cross over ethernet cable and it does NOT work.
    I flashed TI J6 with the TI released 6AM1.3 binaries without any custom changes and this does not work either.

    Summarzing again. I try ping or iperf from Ubuntu Host to the board.
    Although the RX packet count of ifconfig on the TI J6 increases no response is receved from the Ubuntu host when doing ping or iperf.
    It appears as though the packets do not reach the upper layer.
    Doing the opposite (TI J6 -> Ubuntu Host) fails right away and no data can be sent from TI J6.
    Ping and iperf using IPv4 does work over the same connection.

    Thanks,
    Alan
  • Hi Alan,

    IPV4 also doesn't work?
  • > Ping and iperf using IPv4 does work over the same connection.

    As I've written, It works. Having problem only with IPv6.

    Thanks,
    Alan
  • Sorry Alan, missed reading that.

    Let me compare Android kernel config with Linux kernel config to see if any Kernel config is missing in Android. Unfortunately I don't have a IPV6 setup to test it out.
  • Hi Alan,

    The big difference I see between Linux defconfig and Android defconfig w.r.t IPV6 is IPV6 Netfilter configuration.
    It is enabled in Android defconfig but not in Linux. Could you try testing by disabling below configuration?

    CONFIG_IP6_NF_IPTABLES
    CONFIG_NF_REJECT_IPV6
    CONFIG_NF_CONNTRACK_IPV6

    Regards,
    Vishal
  • Hi ,

    Disabling following config causes a build error.

    CONFIG_IP6_NF_IPTABLES=n

    > net/built-in.o:xt_qtaguid.c:function qtaguid_mt: error: undefined reference to 'xt_socket_lookup_slow_v6'
    Makefile:947: recipe for target 'vmlinux' failed

    I tried with the below configs but the problem still exists.

    CONFIG_NF_CONNTRACK_IPV6=n
    CONFIG_NF_REJECT_IPV6=n
    CONFIG_IP6_NF_FILTER=n

    Any other suggestions?

    Thanks,

    Alan

  • Hi Alan,

    Thanks for the update.

    In that case I need to check the networking related patches coming from Android Kernel and get back.
    (Based on Ravi's comment on IPv6 working on Linux only Kernel)

    Regards,
    Vishal

  • Okay. Will wait for your update.

    Thanks,
    Alan
  • Hi Alan,

    I just tried the default 6AM.1.3 release binaries and I am able to ping between EVM and Linux PC with IPv6 address
    (Using Ethernet interface)

    root@jacinto6evm:/ # ifconfig
    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:8 errors:0 dropped:0 overruns:0 frame:0
    TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1
    RX bytes:712 TX bytes:712

    eth1 Link encap:Ethernet HWaddr FC:0F:4B:B0:0D:89
    inet addr:128.247.77.116 Bcast:128.247.77.255 Mask:255.255.254.0
    inet6 addr: fe80::fe0f:4bff:feb0:d89/64 Scope: Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:188 errors:0 dropped:0 overruns:0 frame:0
    TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:34207 TX bytes:3858

    root@jacinto6evm:/ # ping6 fe80::7a2b:cbff:feb7:5407%eth1
    PING fe80::7a2b:cbff:feb7:5407%eth1(fe80::7a2b:cbff:feb7:5407) 56 data bytes
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=1 ttl=64 time=0.592 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=2 ttl=64 time=0.325 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=3 ttl=64 time=0.282 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=4 ttl=64 time=0.508 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=5 ttl=64 time=0.492 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=6 ttl=64 time=0.374 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=7 ttl=64 time=0.281 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=8 ttl=64 time=0.468 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=9 ttl=64 time=0.395 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=10 ttl=64 time=0.438 ms
    64 bytes from fe80::7a2b:cbff:feb7:5407: icmp_seq=11 ttl=64 time=0.408 ms
    ^C
    --- fe80::7a2b:cbff:feb7:5407%eth1 ping statistics ---
    11 packets transmitted, 11 received, 0% packet loss, time 9994ms
    rtt min/avg/max/mdev = 0.281/0.414/0.592/0.096 ms


    Regards,
    Vishal

  • Hi Alan,

    Even though Ethernet interface + IPv6 works on EVM, as you mentioned I am not able to achieve the same over NCM interface.

    On the Linux PC side the EVM address shows up as REACHABLE

    ~/ANDROID/kernel/p-k44$ ip -6 neigh
    fe80::c0fb:b2ff:fe4a:62e7 dev usb0 lladdr c2:fb:b2:4a:62:e7 REACHABLE


    On the EVM Side, the PC address is marked as STALE

    root@jacinto6evm:/ # ip -6 neigh
    fe80::d823:9bff:feb8:82d9 dev usb0 lladdr da:23:9b:b8:82:d9 STALE


    Regards,
    Vishal

  • Hi ,

    Thank you for testing it out.

    How did you connect the EVM and the PC?

    I was using a crossover cable to directly connect the two.

    Also what are the next steps?

    Best regards,

    Alan

  • Hi Alan,

    I did not connect the Ethernet directly between PC and EVM.
    I connected the EVM to same network where PC is.


    Regards,
    Vishal
  • The DHCP server of network took care of assigning IP, etc..
  • Hi Alan,

    I am not able to ping IPV6 on Ethernet with local address. Working for me only with active network (PC connected to network and EVM also connected to same network)

    Not sure if some Android framework is preventing this.

    Regards,
    Vishal

  • Hi ,

    Will you be able to provide a fix for this problem?

    It is not urgent but we do need the IPv6 working properly over USB NCM.

    Thanks,

    Alan

  • Hi Alan,

    The issue doesn't seem to be related to USB NCM. The ping is not working even with local IPv6 Ethernet.
    The IPV6 ping works when the connection is through a network.

    I don't have any resolution yet.

    Regards,
    Vishal

  • Hi

    Any estimates on how long this may take?

    Thanks,
    Alan
  • Hi Alan,

    The behavior could be related to how Android handles IPV6 communication. The behavior is not related to USB.
    As the same behavior can be seen with local PC connection via Ethernet.

    IPV6 communication works fine when they are connected via network, dhcp, etc..

    At this point I don't have an estimate on when we can look at this. Will update you when we have an update.


    Regards,
    Vishal