diff options
author | Roland Dreier <rolandd@cisco.com> | 2006-12-15 17:01:49 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-12-15 17:01:49 -0500 |
commit | bf628dc22a09ed2022abb32c76011ae5f99ad6b0 (patch) | |
tree | c29aff97085d9426dffe1e648e09d4aca0ead024 /drivers | |
parent | c59a3da1342ff456e5123361739bc331446cda21 (diff) |
IB/srp: Fix FMR mapping for 32-bit kernels and addresses above 4G
struct srp_device.fmr_page_mask was unsigned long, which means that
the top part of addresses above 4G was being chopped off on 32-bit
architectures. Of course nothing good happens when data from SRP
targets is DMAed to the wrong place.
Fix this by changing fmr_page_mask to u64, to match the addresses
actually used by IB devices.
Thanks to Brian Cain <Brian.Cain@ge.com> and David McMillen
<davem@systemfabricworks.com> for help diagnosing the bug and testing
the fix.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index e9b6a6f07dd7..cdecbf5911c8 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -1898,7 +1898,7 @@ static void srp_add_one(struct ib_device *device) | |||
1898 | */ | 1898 | */ |
1899 | srp_dev->fmr_page_shift = max(9, ffs(dev_attr->page_size_cap) - 1); | 1899 | srp_dev->fmr_page_shift = max(9, ffs(dev_attr->page_size_cap) - 1); |
1900 | srp_dev->fmr_page_size = 1 << srp_dev->fmr_page_shift; | 1900 | srp_dev->fmr_page_size = 1 << srp_dev->fmr_page_shift; |
1901 | srp_dev->fmr_page_mask = ~((unsigned long) srp_dev->fmr_page_size - 1); | 1901 | srp_dev->fmr_page_mask = ~((u64) srp_dev->fmr_page_size - 1); |
1902 | 1902 | ||
1903 | INIT_LIST_HEAD(&srp_dev->dev_list); | 1903 | INIT_LIST_HEAD(&srp_dev->dev_list); |
1904 | 1904 | ||
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 868a540ef7cd..c21772317b86 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -87,7 +87,7 @@ struct srp_device { | |||
87 | struct ib_fmr_pool *fmr_pool; | 87 | struct ib_fmr_pool *fmr_pool; |
88 | int fmr_page_shift; | 88 | int fmr_page_shift; |
89 | int fmr_page_size; | 89 | int fmr_page_size; |
90 | unsigned long fmr_page_mask; | 90 | u64 fmr_page_mask; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | struct srp_host { | 93 | struct srp_host { |