tree ead8a3d881a192968fb9ea2be89b1a805df1917c
parent 070c0a5966e991362c02fbde06b83faa93b35a25
author Michael S. Tsirkin <[EMAIL PROTECTED]> Tue Apr 12 08:26:56 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:26:56 2005

[PATCH] IB/mthca: split MR key munging routines

Split Tavor and Arbel/mem-free index<->hw key munging routines, so that FMR
implementation can call correct implementation without testing HCA type (which
it already knows).

Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 mthca_mr.c |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

Index: drivers/infiniband/hw/mthca/mthca_mr.c
===================================================================
--- 
98ac8725b5afaeb8f8c53307b9902eecf74305b7/drivers/infiniband/hw/mthca/mthca_mr.c 
 (mode:100644 sha1:477fb250197b8975b17167a9d3f37ca1989e3a95)
+++ 
ead8a3d881a192968fb9ea2be89b1a805df1917c/drivers/infiniband/hw/mthca/mthca_mr.c 
 (mode:100644 sha1:da392d2080a02134d93db5c99d038a5631317b65)
@@ -198,20 +198,40 @@
                                      seg + (1 << order) - 1);
 }
 
+static inline u32 tavor_hw_index_to_key(u32 ind)
+{
+       return ind;
+}
+
+static inline u32 tavor_key_to_hw_index(u32 key)
+{
+       return key;
+}
+
+static inline u32 arbel_hw_index_to_key(u32 ind)
+{
+       return (ind >> 24) | (ind << 8);
+}
+
+static inline u32 arbel_key_to_hw_index(u32 key)
+{
+       return (key << 24) | (key >> 8);
+}
+
 static inline u32 hw_index_to_key(struct mthca_dev *dev, u32 ind)
 {
        if (dev->hca_type == ARBEL_NATIVE)
-               return (ind >> 24) | (ind << 8);
+               return arbel_hw_index_to_key(ind);
        else
-               return ind;
+               return tavor_hw_index_to_key(ind);
 }
 
 static inline u32 key_to_hw_index(struct mthca_dev *dev, u32 key)
 {
        if (dev->hca_type == ARBEL_NATIVE)
-               return (key << 24) | (key >> 8);
+               return arbel_key_to_hw_index(key);
        else
-               return key;
+               return tavor_key_to_hw_index(key);
 }
 
 int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd,
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to