linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 183/198] IB/mthca: split MR key munging routines
@ 2005-04-12 10:33 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2005-04-12 10:33 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, akpm, mst, roland


From: Michael S. Tsirkin <mst@mellanox.co.il>

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 <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/infiniband/hw/mthca/mthca_mr.c |   28 +++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff -puN drivers/infiniband/hw/mthca/mthca_mr.c~ib-mthca-split-mr-key-munging-routines drivers/infiniband/hw/mthca/mthca_mr.c
--- 25/drivers/infiniband/hw/mthca/mthca_mr.c~ib-mthca-split-mr-key-munging-routines	2005-04-12 03:21:46.923003520 -0700
+++ 25-akpm/drivers/infiniband/hw/mthca/mthca_mr.c	2005-04-12 03:21:46.927002912 -0700
@@ -198,20 +198,40 @@ static void mthca_free_mtt(struct mthca_
 				      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,
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-12 10:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-12 10:33 [patch 183/198] IB/mthca: split MR key munging routines akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).