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

   ## Summary
   Move network interface up operation (ifup) to work queue in RNDIS USB device 
driver to avoid calling netdev_carrier_on API in interrupt context.
   
   This PR addresses a threading context issue in the RNDIS USB device driver 
where network interface initialization was being performed in interrupt context.
   
   ## Impact
   Modified usbclass_setconfig() to schedule ifup operation via work_queue() 
instead of calling it directly;
   Reused existing pollwork work structure since the network card is not yet in 
RUNNING state at this point.
   
   ## Testing
   sim:usbdev
   NuttX test log:
   ```
   NuttShell (NSH)
   nsh> ifconfig
   eth0 Link encap:Ethernet HWaddr 42:73:ca:8b:35:04 at RUNNING mtu 1500
        inet addr:10.0.1.2 DRaddr:10.0.1.1 Mask:255.255.255.0
        inet6 addr: fe80::4073:caff:fe8b:3504/64
        inet6 DRaddr: ::
   
   nsh> conn 0[New Thread 0x7ffff3bff640 (LWP 926963)]
   
   conn_main: Performing architecture-specific initialization
   conn_main: Exiting
   nsh> [New Thread 0x7ffff33fe640 (LWP 926964)]
   [New Thread 0x7ffff2bfd640 (LWP 926965)]
   
   nsh> ifconfig
   eth0 Link encap:Ethernet HWaddr 42:73:ca:8b:35:04 at RUNNING mtu 1500
        inet addr:10.0.1.2 DRaddr:10.0.1.1 Mask:255.255.255.0
        inet6 addr: fe80::4073:caff:fe8b:3504/64
        inet6 DRaddr: ::
   
   eth1 Link encap:Ethernet HWaddr 00:00:00:00:00:00 at RUNNING mtu 1504
        inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
        inet6 addr: ::/0
        inet6 DRaddr: ::
   
   nsh> ifconfig eth1 100.0.0.2/24
   nsh> ping 100.0.0.1
   PING 100.0.0.1 56 bytes of data
   56 bytes from 100.0.0.1: icmp_seq=0 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=1 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=2 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=3 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=4 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=5 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=6 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=7 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=8 time=10.0 ms
   56 bytes from 100.0.0.1: icmp_seq=9 time=10.0 ms
   10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
   rtt min/avg/max/mdev = 10.000/10.000/10.000/0.000 ms
   nsh> 
   ```
   


-- 
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