zhhyu7 opened a new pull request, #17842:
URL: https://github.com/apache/nuttx/pull/17842

   ## Summary
   1. Adapt rpmsgdrv.c to netdev_upperhalf;
   2. Add bidirectional data netdev support, both cores have a complete network 
protocol stack, and a network interface card can be created through this module 
on each core to implement inter-core network communication;
   3. It also supports the previous implementation of the cross-core network 
card driver, but the network card driver for the other core requires additional 
implementation;
   4. We have also implemented the rpmsgdrv on the Linux side, which can 
provide network-level interconnection with another core Linux system, and this 
is also the current main usage scenario;
   5. The network cards on both cores will enter the RUNNING state only after 
both have been ifup, and only then can they send and receive packets to and 
from each other.
   
   ## Impact
   Expanded the usage scenarios of rpmsgdrv.
   
   ## Testing
   sim:rpproxy and sim:rpserver with local change:
   rpserver
   ```
   +CONFIG_EXAMPLES_HELLO=y
   +CONFIG_EXAMPLES_HELLO_STACKSIZE=4096
   ```
   rpproxy
   ```
   -# CONFIG_NET_ETHERNET is not set
   +CONFIG_EXAMPLES_HELLO_STACKSIZE=4096
   +CONFIG_NETDEV_IFINDEX=y
   +CONFIG_NETDEV_PHY_IOCTL=y
   +CONFIG_NETUTILS_IPERFTEST_DEVNAME="lo"
   +CONFIG_NET_ICMP_SOCKET=y
   +CONFIG_NET_LOOPBACK=y
   -CONFIG_NET_USRSOCK=y
   -CONFIG_NET_USRSOCK_ICMP=y
   -CONFIG_NET_USRSOCK_RPMSG=y
   -CONFIG_NET_USRSOCK_RPMSG_CPUNAME="server"
   -CONFIG_NET_USRSOCK_TCP=y
   -CONFIG_NET_USRSOCK_UDP=y
   +CONFIG_NET_RPMSG_DRV=y
   +CONFIG_NET_RPMSG_DRV_SERVER=y
   +CONFIG_NET_TCP=y
   +CONFIG_NET_UDP=y
   ```
   test code(create rpmsg network device):
   ```
   #include <nuttx/config.h>
   #include <stdio.h>
   #include <nuttx/net/rpmsgdrv.h>
   
   int main(int argc, FAR char *argv[])
   {
     net_rpmsg_drv_init(argv[1], argv[2], NET_LL_ETHERNET);
     syslog(0, "create rpmsgdrv done cpu[%s] dev[%s]\n", argv[1], argv[2]);
     return 0;
   }
   ```
   test log (both sides are clients):
   ```
   NuttShell (NSH) NuttX-12.12.0
   server> ifconfig
   eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 at RUNNING mtu 576
        inet addr:0.0.0.0 DRaddr:10.0.0.1 Mask:255.255.255.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000003 00000000 00000000 00000000 39c              
        Total Errors: 00000000
   
   lo   Link encap:Local Loopback at RUNNING mtu 1518
        inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000000 00000000 00000000 00000000 0                
        Total Errors: 00000000
   
                IPv4   TCP   UDP  ICMP
   Received     0000  0000  0000  0000
   Dropped      0000  0000  0000  0000
     IPv4        VHL: 0000   Frg: 0000
     Checksum   0000  0000  0000  ----
     TCP         ACK: 0000   SYN: 0000
                 RST: 0000  0000
     Type       0000  ----  ----  0000
   Sent         0003  0000  0003  0000
     Rexmit     ----  0000  ----  ----
   server> 
   server> hello proxy rpmsg-dev
   [   24.750000] [server] create rpmsgdrv done cpu[proxy] dev[rpmsg-dev]
   server> ifconfig
   eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 at RUNNING mtu 576
        inet addr:0.0.0.0 DRaddr:10.0.0.1 Mask:255.255.255.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000003 00000000 00000000 00000000 39c              
        Total Errors: 00000000
   
   lo   Link encap:Local Loopback at RUNNING mtu 1518
        inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000000 00000000 00000000 00000000 0                
        Total Errors: 00000000
   
   rpmsg-dev    Link encap:Ethernet HWaddr c3:0a:f7:12:df:23 at DOWN mtu 576
        inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000000 00000000 00000000 00000000 0                
        Total Errors: 00000000
   
                IPv4   TCP   UDP  ICMP
   Received     0000  0000  0000  0000
   Dropped      0000  0000  0000  0000
     IPv4        VHL: 0000   Frg: 0000
     Checksum   0000  0000  0000  ----
     TCP         ACK: 0000   SYN: 0000
                 RST: 0000  0000
     Type       0000  ----  ----  0000
   Sent         0003  0000  0003  0000
     Rexmit     ----  0000  ----  ----
   server> ifconfig rpmsg-dev 100.0.0.1/24
   server> 
   server> cu
   
   NuttShell (NSH) NuttX-12.12.0
   proxy> 
   proxy> 
   proxy> ifconfig
   lo   Link encap:Local Loopback at RUNNING mtu 1518
        inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
   
   proxy> hello server rpmsg-dev
   proxy> [   80.630000] [proxy] create rpmsgdrv done cpu[server] dev[rpmsg-dev]
   
   proxy> ifconfig
   lo   Link encap:Local Loopback at RUNNING mtu 1518
        inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
   
   rpmsg-dev    Link encap:Ethernet HWaddr 8f:10:0a:80:ab:29 at DOWN mtu 576
        inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
   
   proxy> ifconfig rpmsg-dev 100.0.0.2/24
   proxy> ping -c 3 100.0.0.1
   PING 100.0.0.1 56 bytes of data
   ERROR: sendto failed at seqno 0: 101
   ERROR: sendto failed at seqno 1: 101
   ERROR: sendto failed at seqno 2: 101
   3 packets transmitted, 0 received, 100% packet loss, time 3030 ms
   proxy>
   proxy> ifup rpmsg-dev
   ifup rpmsg-dev...OK
   proxy> 
   proxy> server> 
   server> ifup rpmsg-dev
   ifup rpmsg-dev...OK
   server> 
   server> cu
   
   proxy> 
   proxy> ping -c 3 100.0.0.2
   PING 100.0.0.2 56 bytes of data
   56 bytes from 100.0.0.2: icmp_seq=0 time=0.0 ms
   56 bytes from 100.0.0.2: icmp_seq=1 time=0.0 ms
   56 bytes from 100.0.0.2: icmp_seq=2 time=0.0 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3030 ms
   rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms
   proxy> 
   proxy> ping -c 3 100.0.0.1
   PING 100.0.0.1 56 bytes of data
   56 bytes from 100.0.0.1: icmp_seq=0 time=40.0 ms
   56 bytes from 100.0.0.1: icmp_seq=1 time=30.0 ms
   56 bytes from 100.0.0.1: icmp_seq=2 time=20.0 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3030 ms
   rtt min/avg/max/mdev = 20.000/30.000/40.000/8.164 ms
   proxy> 
   proxy> server> ping -c 3 100.0.0.1
   PING 100.0.0.1 56 bytes of data
   56 bytes from 100.0.0.1: icmp_seq=0 time=0.0 ms
   56 bytes from 100.0.0.1: icmp_seq=1 time=0.0 ms
   56 bytes from 100.0.0.1: icmp_seq=2 time=0.0 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3030 ms
   rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms
   server> ping -c 3 100.0.0.2
   PING 100.0.0.2 56 bytes of data
   56 bytes from 100.0.0.2: icmp_seq=0 time=20.0 ms
   56 bytes from 100.0.0.2: icmp_seq=1 time=10.0 ms
   56 bytes from 100.0.0.2: icmp_seq=2 time=20.0 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3030 ms
   rtt min/avg/max/mdev = 10.000/16.666/20.000/4.716 ms
   server> 
   server> 
   ```
   test log (rpserver is rpmsgdrv client, rpproxy is rpmsg server):
   ```
   NuttShell (NSH) NuttX-12.12.0
   proxy> 
   proxy> ifconfig
   lo   Link encap:Local Loopback at RUNNING mtu 1518
        inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
   
   proxy> 
   proxy> server> hello proxy rpmsg-dev
   [   16.710000] [server] create rpmsgdrv done cpu[proxy] dev[rpmsg-dev]
   server> 
   server> cu
   
   proxy> ifconfig
   lo   Link encap:Local Loopback at RUNNING mtu 1518
        inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
   
   rpmsg-dev    Link encap:Ethernet HWaddr 53:18:62:65:6f:31 at DOWN mtu 576
        inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
   
   proxy> ifconfig rpmsg-dev 100.0.0.2/24
   proxy> ifup rpmsg-dev
   ifup rpmsg-dev...OK
   proxy> 
   proxy> server> ifconfig
   eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 at RUNNING mtu 576
        inet addr:0.0.0.0 DRaddr:10.0.0.1 Mask:255.255.255.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000003 00000000 00000000 00000000 39c              
        Total Errors: 00000000
   
   lo   Link encap:Local Loopback at RUNNING mtu 1518
        inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000000 00000000 00000000 00000000 0                
        Total Errors: 00000000
   
   rpmsg-dev    Link encap:Ethernet HWaddr c7:53:31:f9:e3:6c at RUNNING mtu 576
        inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
   
        RX: Received Fragment Errors   Bytes   
            00000000 00000000 00000000 0               
            IPv4     ARP      Dropped 
            00000000 00000000 00000000
        TX: Queued   Sent     Errors   Timeouts Bytes   
            00000000 00000000 00000000 00000000 0                
        Total Errors: 00000000
   
                IPv4   TCP   UDP  ICMP
   Received     0000  0000  0000  0000
   Dropped      0000  0000  0000  0000
     IPv4        VHL: 0000   Frg: 0000
     Checksum   0000  0000  0000  ----
     TCP         ACK: 0000   SYN: 0000
                 RST: 0000  0000
     Type       0000  ----  ----  0000
   Sent         0003  0000  0003  0000
     Rexmit     ----  0000  ----  ----
   server> ifconfig rpmsg-dev 100.0.0.1/24
   server> ifup rpmsg-dev
   ifup rpmsg-dev...OK
   server> 
   server> ping -c 3 100.0.0.2
   PING 100.0.0.2 56 bytes of data
   56 bytes from 100.0.0.2: icmp_seq=0 time=40.0 ms
   56 bytes from 100.0.0.2: icmp_seq=1 time=10.0 ms
   56 bytes from 100.0.0.2: icmp_seq=2 time=20.0 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3030 ms
   rtt min/avg/max/mdev = 10.000/23.333/40.000/12.472 ms
   server> 
   server> cu
   
   proxy> ping -c 3 100.0.0.1
   PING 100.0.0.1 56 bytes of data
   56 bytes from 100.0.0.1: icmp_seq=0 time=20.0 ms
   56 bytes from 100.0.0.1: icmp_seq=1 time=30.0 ms
   56 bytes from 100.0.0.1: icmp_seq=2 time=20.0 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3030 ms
   rtt min/avg/max/mdev = 20.000/23.333/30.000/4.715 ms
   proxy> 
   proxy> server> 
   server>
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to