Skip to content
Snippets Groups Projects
Commit 5f1e97d6 authored by Dor Laor's avatar Dor Laor
Browse files

Fix memcached networking issue that was caused by unsecure, parallel device...

Fix memcached networking issue that was caused by unsecure, parallel device invocation. I wasn't aware that the a device lock has to be held on the tx callback. Will look into it deeper tomorrow. The patch solves the issue
parent e2ba7581
No related branches found
No related tags found
No related merge requests found
...@@ -98,16 +98,17 @@ namespace virtio { ...@@ -98,16 +98,17 @@ namespace virtio {
virtio_net_d("%s_start (transmit)", __FUNCTION__); virtio_net_d("%s_start (transmit)", __FUNCTION__);
/* Process packets */ /* Process packets */
vnet->_tx_ring_lock.lock();
IF_DEQUEUE(&ifp->if_snd, m_head); IF_DEQUEUE(&ifp->if_snd, m_head);
while (m_head != NULL) { while (m_head != NULL) {
virtio_net_d("*** processing packet! ***"); virtio_net_d("*** processing packet! ***");
vnet->tx(m_head, false); vnet->tx(m_head, false);
IF_DEQUEUE(&ifp->if_snd, m_head); IF_DEQUEUE(&ifp->if_snd, m_head);
} }
vnet->kick(1); vnet->kick(1);
vnet->_tx_ring_lock.unlock();
} }
static void virtio_if_init(void* xsc) static void virtio_if_init(void* xsc)
......
...@@ -234,6 +234,9 @@ namespace virtio { ...@@ -234,6 +234,9 @@ namespace virtio {
void tx_gc(); void tx_gc();
static hw_driver* probe(hw_device* dev); static hw_driver* probe(hw_device* dev);
// tx ring lock protects this ring for multiple access
mutex _tx_ring_lock;
private: private:
struct virtio_net_req { struct virtio_net_req {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment