This commit fixes two observed issues with the vmxnet3 driver:

* Handle both missing SOP and EOP descriptors in the rx loop. ESXi
  drops descriptors under load.
* Always leave at least one Tx descriptor available.  The driver
  appears to hang when it runs out of them.

Signed-off-by: Timmons C. Player <[email protected]>
---
 drivers/vmxnet3.cc | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/vmxnet3.cc b/drivers/vmxnet3.cc
index 926d1b0..0739303 100644
--- a/drivers/vmxnet3.cc
+++ b/drivers/vmxnet3.cc
@@ -537,7 +537,7 @@ int vmxnet3_txqueue::try_xmit_one_locked(void *req)
 
 int vmxnet3_txqueue::try_xmit_one_locked(vmxnet3_req *req)
 {
-    auto count = req->count;
+    auto count = req->count + 1;
     if (_avail < count) {
         gc();
         if (_avail < count)
@@ -830,6 +830,17 @@ void vmxnet3_rxqueue::receive()
             goto next;
         }
 
+        /* Check and handle SOP/EOP state errors */
+        if (rxcd->layout->sop && _m_currpkt_head) {
+            m_freem(_m_currpkt_head);
+            _m_currpkt_head = _m_currpkt_tail = nullptr;
+            stats.rx_drops++;
+        } else if (!rxcd->layout->sop && !_m_currpkt_head) {
+            stats.rx_drops++;
+            discard(rid, idx);
+            goto next;
+        }
+
         if (rxcd->layout->sop) {
             assert(rxd->layout->btype == btype::head);
             assert((idx % 1) == 0);
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to