diff options
author | Ishai Rabinovitz <ishai@mellanox.co.il> | 2006-03-02 01:33:11 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-03-20 13:08:19 -0500 |
commit | 8d3ef29d6be1e750512e0a9dbea6225290b81d0a (patch) | |
tree | 9384d9275d5122574665db18b5196f9c9a96d7ac /drivers/infiniband/hw/mthca/mthca_memfree.h | |
parent | 67e7377661db4e341ed5e9a0358d11a55e532aa8 (diff) |
IB/mthca: Use an enum for HCA page size
Use a named enum for the HCA's internal page size, rather than having
magic values of 4096 and shifts by 12 all over the code. Also, fix
one minor bug in EQ handling: only one HCA page is mapped to the HCA
during initialization, but a full kernel page is unmapped during
cleanup. This might cause problems when PAGE_SIZE != 4096.
Signed-off-by: Ishai Rabinovitz <ishai@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_memfree.h')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_memfree.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.h b/drivers/infiniband/hw/mthca/mthca_memfree.h index 36f1141a08aa..6d42947e1dc4 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.h +++ b/drivers/infiniband/hw/mthca/mthca_memfree.h | |||
@@ -45,6 +45,12 @@ | |||
45 | ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \ | 45 | ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \ |
46 | (sizeof (struct scatterlist))) | 46 | (sizeof (struct scatterlist))) |
47 | 47 | ||
48 | enum { | ||
49 | MTHCA_ICM_PAGE_SHIFT = 12, | ||
50 | MTHCA_ICM_PAGE_SIZE = 1 << MTHCA_ICM_PAGE_SHIFT, | ||
51 | MTHCA_DB_REC_PER_PAGE = MTHCA_ICM_PAGE_SIZE / 8 | ||
52 | }; | ||
53 | |||
48 | struct mthca_icm_chunk { | 54 | struct mthca_icm_chunk { |
49 | struct list_head list; | 55 | struct list_head list; |
50 | int npages; | 56 | int npages; |
@@ -131,10 +137,6 @@ static inline unsigned long mthca_icm_size(struct mthca_icm_iter *iter) | |||
131 | return sg_dma_len(&iter->chunk->mem[iter->page_idx]); | 137 | return sg_dma_len(&iter->chunk->mem[iter->page_idx]); |
132 | } | 138 | } |
133 | 139 | ||
134 | enum { | ||
135 | MTHCA_DB_REC_PER_PAGE = 4096 / 8 | ||
136 | }; | ||
137 | |||
138 | struct mthca_db_page { | 140 | struct mthca_db_page { |
139 | DECLARE_BITMAP(used, MTHCA_DB_REC_PER_PAGE); | 141 | DECLARE_BITMAP(used, MTHCA_DB_REC_PER_PAGE); |
140 | __be64 *db_rec; | 142 | __be64 *db_rec; |