From: Kanoj Sarcar <[email protected]>

MLX uses WC to write data payload into HCA buffers. The performance boost
over UC/UC- is significant.

Signed-off-by: Kanoj Sarcar <[email protected]>
[ removed pat_init() and used the new PTE_ flags ]
Signed-off-by: Barret Rhoden <[email protected]>
---
 kern/drivers/net/udrvr/compat.c | 19 +++++++++++++++++++
 kern/drivers/net/udrvr/compat.h | 19 ++-----------------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/kern/drivers/net/udrvr/compat.c b/kern/drivers/net/udrvr/compat.c
index 75b286dd91ed..1d3a015b18a8 100644
--- a/kern/drivers/net/udrvr/compat.c
+++ b/kern/drivers/net/udrvr/compat.c
@@ -17,6 +17,25 @@
 #include <linux/rdma/ib_user_verbs.h>
 #include "uverbs.h"
 
+static unsigned long pgprot_val(int vmprot)
+{
+       unsigned long   prot = PTE_P | PTE_U | PTE_A;
+
+       if (vmprot & PROT_WRITE)
+               prot |= PTE_W | PTE_D;
+       return prot;
+}
+
+unsigned long pgprot_noncached(int vmprot)
+{
+       return pgprot_val(vmprot) | PTE_NOCACHE;
+}
+
+unsigned long pgprot_writecombine(int vmprot)
+{
+       return pgprot_val(vmprot) | PTE_WRITECOMB;
+}
+
 /*
  * Our version knocked off from kern/src/mm.c version + uncaching logic from
  * vmap_pmem_nocache(). This routine is expected to be invoked as part of 
mmap()
diff --git a/kern/drivers/net/udrvr/compat.h b/kern/drivers/net/udrvr/compat.h
index d62897efb69d..796e31017b82 100644
--- a/kern/drivers/net/udrvr/compat.h
+++ b/kern/drivers/net/udrvr/compat.h
@@ -61,23 +61,8 @@ typedef atomic_t                     atomic64_t;
 #define        spin_unlock_bh(E)               spin_unlock(E)
 #define        DEFINE_SPINLOCK(x)              spinlock_t x = 
SPINLOCK_INITIALIZER
 
-/*
- * Linux pgprot_noncached() adds _PAGE_PCD ie bit 4, which is akaros __PTE_PCD.
- * Akaros PTE_NOCACHE also sets bit 3 ie _PAGE_PWT (which is overkill?).
- * Linux pgprot_writecombine() defaults to pgprot_noncached() when PAT is
- * not enabled, otherwise just sets bit 3 ie _PAGE_PWT.
- */
-static unsigned long pgprot_noncached(int vmprot)
-{
-       unsigned long   prot = PTE_P | PTE_U | PTE_A | PTE_NOCACHE;
-
-       if (vmprot & PROT_WRITE)
-               prot |= PTE_W | PTE_D;
-       return prot;
-}
-
-/* TODO: Factor in PAT usage */
-#define        pgprot_writecombine(vmprot)     pgprot_noncached(vmprot)
+extern unsigned long pgprot_noncached(int vmprot);
+extern unsigned long pgprot_writecombine(int vmprot);
 
 #define is_vm_hugetlb_page(vma)        0
 
-- 
2.7.0.rc3.207.g0ac5344

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

Reply via email to