aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/netfront.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-11-28 12:40:57 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-11-28 12:40:57 +0000
commit1c0c172695a42a11ca7206283b4f1d6a486d05ac (patch)
treef4b821a303752bfb60fb9833469e81c7db489235 /extras/mini-os/netfront.c
parent7f4955ee5fc5f9f45e8d201a25b7ac445838b1a2 (diff)
downloadxen-1c0c172695a42a11ca7206283b4f1d6a486d05ac.tar.gz
xen-1c0c172695a42a11ca7206283b4f1d6a486d05ac.tar.bz2
xen-1c0c172695a42a11ca7206283b4f1d6a486d05ac.zip
[Mini-OS] Make gnttab allocation/free safe
Add a semaphore to protect gnttab_list from exhaustion, and disable callbacks during allocation/free. Fix the network frontend accordingly. Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Diffstat (limited to 'extras/mini-os/netfront.c')
-rw-r--r--extras/mini-os/netfront.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c
index fc1e9ab357..4341168652 100644
--- a/extras/mini-os/netfront.c
+++ b/extras/mini-os/netfront.c
@@ -147,6 +147,7 @@ moretodo:
struct net_buffer* buf = &rx_buffers[id];
void* page = buf->page;
+ /* We are sure to have free gnttab entries since they got released above */
buf->gref = req->gref =
gnttab_grant_access(0,virt_to_mfn(page),0);
@@ -436,8 +437,9 @@ void netfront_xmit(unsigned char* data,int len)
down(&tx_sem);
local_irq_save(flags);
-
id = get_id_from_freelist(tx_freelist);
+ local_irq_restore(flags);
+
buf = &tx_buffers[id];
page = buf->page;
@@ -461,7 +463,7 @@ void netfront_xmit(unsigned char* data,int len)
if(notify) notify_remote_via_evtchn(info->evtchn);
+ local_irq_save(flags);
network_tx_buf_gc();
-
local_irq_restore(flags);
}