aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/grant_table.h
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-03-01 13:45:53 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-03-01 13:45:53 +0000
commit0ba49c38df9776a78f7f7666afb78e754157d69e (patch)
tree7d34cc8df67773bbe14c06590d3c36f01fd3e2f1 /xen/include/xen/grant_table.h
parent5fca0f03a3feecdfb2618c62d6ef5ab547d83e5a (diff)
downloadxen-0ba49c38df9776a78f7f7666afb78e754157d69e.tar.gz
xen-0ba49c38df9776a78f7f7666afb78e754157d69e.tar.bz2
xen-0ba49c38df9776a78f7f7666afb78e754157d69e.zip
acm: Fix the traversal of the event channel buckets and use the active
grant table entries instead of the shared ones. I had to move some functions from grant_table.c into grant_table.h to make them usable by the ACM module. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Diffstat (limited to 'xen/include/xen/grant_table.h')
-rw-r--r--xen/include/xen/grant_table.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 54ea021683..5ae9149bc1 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -120,4 +120,26 @@ static inline unsigned int nr_grant_entries(struct grant_table *gt)
return (nr_grant_frames(gt) << PAGE_SHIFT) / sizeof(grant_entry_t);
}
+static inline unsigned int
+num_act_frames_from_sha_frames(const unsigned int num)
+{
+ /* How many frames are needed for the active grant table,
+ * given the size of the shared grant table?
+ *
+ * act_per_page = PAGE_SIZE / sizeof(active_grant_entry_t);
+ * sha_per_page = PAGE_SIZE / sizeof(grant_entry_t);
+ * num_sha_entries = num * sha_per_page;
+ * num_act_frames = (num_sha_entries + (act_per_page-1)) / act_per_page;
+ */
+ return ((num * (PAGE_SIZE / sizeof(grant_entry_t))) +
+ ((PAGE_SIZE / sizeof(struct active_grant_entry))-1))
+ / (PAGE_SIZE / sizeof(struct active_grant_entry));
+}
+
+static inline unsigned int
+nr_active_grant_frames(struct grant_table *gt)
+{
+ return num_act_frames_from_sha_frames(nr_grant_frames(gt));
+}
+
#endif /* __XEN_GRANT_TABLE_H__ */