aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorKaren Xie <kxie@chelsio.com>2009-06-15 14:15:16 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-21 11:52:39 -0400
commit9194c6264040d71f851236437a392594b26e5b91 (patch)
treefd7a7bff23923afa5da8363560e924aa7454e52a /drivers/scsi
parent295ab1b54393aec064533fbc5b483844736ccbf0 (diff)
cxgb3i: suppot of different kernel page sizes
The default kernel pages supported are 4K, 8K, 16K, and 64K. Re-calculate entries if PAGE_SIZE is not one of the defaults. Signed-off-by: Karen Xie <kxie@chelsio.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_ddp.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index 8eb2848403f4..344fd53b9954 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -206,6 +206,31 @@ int cxgb3i_ddp_find_page_index(unsigned long pgsz)
206 return DDP_PGIDX_MAX; 206 return DDP_PGIDX_MAX;
207} 207}
208 208
209/**
210 * cxgb3i_ddp_adjust_page_table - adjust page table with PAGE_SIZE
211 * return the ddp page index, if no match is found return DDP_PGIDX_MAX.
212 */
213int cxgb3i_ddp_adjust_page_table(void)
214{
215 int i;
216 unsigned int base_order, order;
217
218 if (PAGE_SIZE < (1UL << ddp_page_shift[0])) {
219 ddp_log_info("PAGE_SIZE 0x%lx too small, min. 0x%lx.\n",
220 PAGE_SIZE, 1UL << ddp_page_shift[0]);
221 return -EINVAL;
222 }
223
224 base_order = get_order(1UL << ddp_page_shift[0]);
225 order = get_order(1 << PAGE_SHIFT);
226 for (i = 0; i < DDP_PGIDX_MAX; i++) {
227 /* first is the kernel page size, then just doubling the size */
228 ddp_page_order[i] = order - base_order + i;
229 ddp_page_shift[i] = PAGE_SHIFT + i;
230 }
231 return 0;
232}
233
209static inline void ddp_gl_unmap(struct pci_dev *pdev, 234static inline void ddp_gl_unmap(struct pci_dev *pdev,
210 struct cxgb3i_gather_list *gl) 235 struct cxgb3i_gather_list *gl)
211{ 236{
@@ -727,6 +752,17 @@ void cxgb3i_ddp_init(struct t3cdev *tdev)
727{ 752{
728 if (page_idx == DDP_PGIDX_MAX) { 753 if (page_idx == DDP_PGIDX_MAX) {
729 page_idx = cxgb3i_ddp_find_page_index(PAGE_SIZE); 754 page_idx = cxgb3i_ddp_find_page_index(PAGE_SIZE);
755
756 if (page_idx == DDP_PGIDX_MAX) {
757 ddp_log_info("system PAGE_SIZE %lu, update hw.\n",
758 PAGE_SIZE);
759 if (cxgb3i_ddp_adjust_page_table() < 0) {
760 ddp_log_info("PAGE_SIZE %lu, ddp disabled.\n",
761 PAGE_SIZE);
762 return;
763 }
764 page_idx = cxgb3i_ddp_find_page_index(PAGE_SIZE);
765 }
730 ddp_log_info("system PAGE_SIZE %lu, ddp idx %u.\n", 766 ddp_log_info("system PAGE_SIZE %lu, ddp idx %u.\n",
731 PAGE_SIZE, page_idx); 767 PAGE_SIZE, page_idx);
732 } 768 }