zhhyu7 commented on PR #21931:
URL: https://github.com/apache/nuttx/pull/21931#issuecomment-7096176475

   > @zhhyu7 @xiaoxiang781216 @GUIDINGLI
   > 
   > This change causes an RX regression on non-VLAN traffic, and #22039 does 
not restore the previous behaviour.
   > 
   > Before this PR netdev_upper_rxpoll_work() held netdev_lock() around the 
whole receive loop. Now (after #22039) the lock is taken and released once per 
frame:
   > 
   > ```
   >     netdev_lock(dev);
   >     netpkt_put(dev, pkt, NETPKT_RX);
   >     netdev_upper_input(dev);
   >     netdev_unlock(dev);
   > ```
   > 
   > so the RX work competes for the lock with the TX path on every frame and 
falls behind the device.
   > 
   > Observed on qemu-intel64 (SMP):
   > 
   > * e1000, TCP from NuttX to the host (iperf): about 25 Mbit/s, was about
   >   1000 Mbit/s.
   > * kvaser_pci (SJA1000) SocketCAN: with three concurrent ISO-TP transfers 
the
   >   controller RX FIFO overruns, a consecutive frame is lost and read() on 
the
   >   ISO-TP socket fails with EILSEQ.
   > 
   > With the lock held around the whole loop again, and released only around 
the VLAN dispatch, both are back to normal:
   > 
   > ```
   > netdev_lock(dev);
   > while ((pkt = lower->ops->receive(lower)) != NULL)
   >   {
   >     ...
   >     netpkt_put(dev, pkt, NETPKT_RX);
   >     netdev_upper_input(dev);
   >   }
   > 
   > netdev_unlock(dev);
   > ```
   
   @raiden00pl This modification is mainly to prevent the lock of the physical 
network adapter from affecting the real-time performance of the high-priority 
vlan network adapter, so we must not hold the lock before receive. I tested it 
in the internal build (also netdev_lock before netpkt_put), and the non-vlan 
network adapter rx of qemu can reach 850M; for real Intel machines, it can run 
at full 1G (e1000) and 2.5G (igc). Let's wait until all my subsequent patches 
are merged, then verify the performance again?


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