raiden00pl commented on code in PR #20622:
URL: https://github.com/apache/nuttx/pull/20622#discussion_r4258070350


##########
drivers/net/netdev_upperhalf.c:
##########
@@ -882,7 +883,17 @@ static inline void netdev_upper_queue_work(FAR struct 
net_driver_s *dev)
 
 static int netdev_upper_txavail(FAR struct net_driver_s *dev)
 {
-  netdev_upper_txavail_work(dev->d_private);
+  FAR struct netdev_upperhalf_s *upper = dev->d_private;
+
+  if (upper->lower->rxtype == NETDEV_RX_DIRECT)
+    {
+      netdev_upper_txavail_work(upper);
+    }
+  else
+    {
+      netdev_upper_queue_work(dev);
+    }
+

Review Comment:
   ```suggestion
       if (upper->lower->rxtype == NETDEV_RX_DIRECT)                            
                                                                                
                                                                                
                                    
         {                                                                      
                                                                                
                                                                                
                                    
           netdev_upper_txavail_work(upper);                                    
                                                                                
                                                                                
                                    
         }                                                                      
                                                                                
                                                                                
                                    
       else if (nxrmutex_trylock(&dev->d_lock) >= 0)                            
                                                                                
                                                                                
                                    
         {                                                                      
                                                                                
                                                                                
                                    
           /* Lock free or held by us: transmit now so txq can't overflow.      
                                                                                
                                                                                
                                    
            * Drop the extra reference of the recursive lock.                   
                                                                                
                                                                                
                                    
            */                                                                  
                                                                                
                                                                                
                                    
                                                                                
                                                                                
                                                                                
                                    
           netdev_upper_txavail_work(upper);                                    
                                                                                
                                                                                
                                    
           nxrmutex_unlock(&dev->d_lock);                                       
                                                                                
                                                                                
                                    
         }                                                                      
                                                                                
                                                                                
                                    
       else                                                                     
                                                                                
                                                                                
                                    
         {                                                                      
                                                                                
                                                                                
                                    
           /* Locked by another thread: don't wait (ABBA when forwarding) */    
                                                                                
                                                                                
                                    
                                                                                
                                                                                
                                                                                
                                    
           netdev_upper_queue_work(dev);                                        
                                                                                
                                                                                
                                    
         } 
   ```



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