diff options
| author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-04-16 18:26:30 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:26:30 -0400 |
| commit | d0a9d25cdcd511dd523357bc902979220dc72a2e (patch) | |
| tree | 26b71818fdbb3ee71e0d047398ba92688a17ce95 /drivers/infiniband/hw | |
| parent | 0fabd9fb7bdc935f121e6950a2c4eff971dd4c75 (diff) | |
[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 <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw')
| -rw-r--r-- | drivers/infiniband/hw/mthca/mthca_mr.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c index 6a127a7aca57..ac3265d0bf79 100644 --- a/drivers/infiniband/hw/mthca/mthca_mr.c +++ b/drivers/infiniband/hw/mthca/mthca_mr.c | |||
| @@ -198,20 +198,40 @@ static void mthca_free_mtt(struct mthca_dev *dev, u32 seg, int order, | |||
| 198 | seg + (1 << order) - 1); | 198 | seg + (1 << order) - 1); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | static inline u32 tavor_hw_index_to_key(u32 ind) | ||
| 202 | { | ||
| 203 | return ind; | ||
| 204 | } | ||
| 205 | |||
| 206 | static inline u32 tavor_key_to_hw_index(u32 key) | ||
| 207 | { | ||
| 208 | return key; | ||
| 209 | } | ||
| 210 | |||
| 211 | static inline u32 arbel_hw_index_to_key(u32 ind) | ||
| 212 | { | ||
| 213 | return (ind >> 24) | (ind << 8); | ||
| 214 | } | ||
| 215 | |||
| 216 | static inline u32 arbel_key_to_hw_index(u32 key) | ||
| 217 | { | ||
| 218 | return (key << 24) | (key >> 8); | ||
| 219 | } | ||
| 220 | |||
| 201 | static inline u32 hw_index_to_key(struct mthca_dev *dev, u32 ind) | 221 | static inline u32 hw_index_to_key(struct mthca_dev *dev, u32 ind) |
| 202 | { | 222 | { |
| 203 | if (dev->hca_type == ARBEL_NATIVE) | 223 | if (dev->hca_type == ARBEL_NATIVE) |
| 204 | return (ind >> 24) | (ind << 8); | 224 | return arbel_hw_index_to_key(ind); |
| 205 | else | 225 | else |
| 206 | return ind; | 226 | return tavor_hw_index_to_key(ind); |
| 207 | } | 227 | } |
| 208 | 228 | ||
| 209 | static inline u32 key_to_hw_index(struct mthca_dev *dev, u32 key) | 229 | static inline u32 key_to_hw_index(struct mthca_dev *dev, u32 key) |
| 210 | { | 230 | { |
| 211 | if (dev->hca_type == ARBEL_NATIVE) | 231 | if (dev->hca_type == ARBEL_NATIVE) |
| 212 | return (key << 24) | (key >> 8); | 232 | return arbel_key_to_hw_index(key); |
| 213 | else | 233 | else |
| 214 | return key; | 234 | return tavor_key_to_hw_index(key); |
| 215 | } | 235 | } |
| 216 | 236 | ||
| 217 | int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd, | 237 | int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd, |
