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

   ## Summary
   
   c177a4107dd ("drivers/net: replace the TX quota with the -EBUSY              
                         
   contract") removed the netpkt quota.  virtio-net relied on it in two         
                         
   places, and the commit did not adapt the driver:
                                                      
     - virtio_net_rxfill() loops bufnum times and runs on every receive.        
                         
       The RX quota bounded it.  Without the quota it fills the whole RX
       ring, which drains the shared IOB pool, and the ARP, ICMP and TCP        
                         
       allocations that follow fail.          
     - virtio_net_send() reported a full TX ring with -ENOMEM.  The upper       
                         
       half treats everything but -EBUSY as permanent, so it dropped the        
                         
       packet instead of offering it again.                                     
                         
                                                                                
                                                                                
                                               
   This restores both:                                                          
                         
                                                                                
                         
     - priv->rxnum counts the buffers the RX virtqueue holds, and rxfill        
                         
       refills only up to bufnum of them.  virtio_net_ifdown() drains the       
                         
       virtqueue, so it clears the count.
     - A full TX ring reclaims the completed buffers and retries once; if       
                         
       it is still full, it arms the TX done callback and returns -EBUSY.       
                         
   
   The RX cap and the -EBUSY report follow an existing fix in Xiaomi's          
                                                                                
                                               
   tree (dengwenqi); the ifdown reset is new.
   
   ## Impact
   
   Fixes a regression on master: on rv-virt with virtio-net the node's          
                         
   first ping to the host gets no reply (100% loss), and IP forwarding          
                         
   between two virtio-net interfaces fails the same way.  Reported against      
                         
   c177a4107dd.                                       
   
   Without the ifdown reset the count would survive an interface down/up
   cycle, bufnum - rxnum would stay <= 0, and the interface would never
   receive again.
   
   Only drivers/virtio/virtio-net.c changes.  No API, Kconfig or defconfig
   change, so no other driver or board is affected.
   
   ## Testing
   
   Built clean with CONFIG_DRIVERS_VIRTIO_NET=y; checkpatch passes on the
   changed file.
   
   NOT TESTED AT RUNTIME.  The change is from code review only.
   


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