diff options
Diffstat (limited to 'drivers/net/ehea/ehea_qmr.c')
-rw-r--r-- | drivers/net/ehea/ehea_qmr.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c index c82e24596074..329a25248d75 100644 --- a/drivers/net/ehea/ehea_qmr.c +++ b/drivers/net/ehea/ehea_qmr.c | |||
@@ -563,8 +563,7 @@ int ehea_destroy_qp(struct ehea_qp *qp) | |||
563 | int ehea_create_busmap( void ) | 563 | int ehea_create_busmap( void ) |
564 | { | 564 | { |
565 | u64 vaddr = EHEA_BUSMAP_START; | 565 | u64 vaddr = EHEA_BUSMAP_START; |
566 | unsigned long abs_max_pfn = 0; | 566 | unsigned long high_section_index = 0; |
567 | unsigned long sec_max_pfn; | ||
568 | int i; | 567 | int i; |
569 | 568 | ||
570 | /* | 569 | /* |
@@ -574,14 +573,10 @@ int ehea_create_busmap( void ) | |||
574 | ehea_bmap.valid_sections = 0; | 573 | ehea_bmap.valid_sections = 0; |
575 | 574 | ||
576 | for (i = 0; i < NR_MEM_SECTIONS; i++) | 575 | for (i = 0; i < NR_MEM_SECTIONS; i++) |
577 | if (valid_section_nr(i)) { | 576 | if (valid_section_nr(i)) |
578 | sec_max_pfn = section_nr_to_pfn(i); | 577 | high_section_index = i; |
579 | if (sec_max_pfn > abs_max_pfn) | ||
580 | abs_max_pfn = sec_max_pfn; | ||
581 | ehea_bmap.valid_sections++; | ||
582 | } | ||
583 | 578 | ||
584 | ehea_bmap.entries = abs_max_pfn / EHEA_PAGES_PER_SECTION + 1; | 579 | ehea_bmap.entries = high_section_index + 1; |
585 | ehea_bmap.vaddr = vmalloc(ehea_bmap.entries * sizeof(*ehea_bmap.vaddr)); | 580 | ehea_bmap.vaddr = vmalloc(ehea_bmap.entries * sizeof(*ehea_bmap.vaddr)); |
586 | 581 | ||
587 | if (!ehea_bmap.vaddr) | 582 | if (!ehea_bmap.vaddr) |
@@ -593,6 +588,7 @@ int ehea_create_busmap( void ) | |||
593 | if (pfn_valid(pfn)) { | 588 | if (pfn_valid(pfn)) { |
594 | ehea_bmap.vaddr[i] = vaddr; | 589 | ehea_bmap.vaddr[i] = vaddr; |
595 | vaddr += EHEA_SECTSIZE; | 590 | vaddr += EHEA_SECTSIZE; |
591 | ehea_bmap.valid_sections++; | ||
596 | } else | 592 | } else |
597 | ehea_bmap.vaddr[i] = 0; | 593 | ehea_bmap.vaddr[i] = 0; |
598 | } | 594 | } |
@@ -637,7 +633,7 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) | |||
637 | 633 | ||
638 | mr_len = ehea_bmap.valid_sections * EHEA_SECTSIZE; | 634 | mr_len = ehea_bmap.valid_sections * EHEA_SECTSIZE; |
639 | 635 | ||
640 | pt = kzalloc(EHEA_MAX_RPAGE * sizeof(u64), GFP_KERNEL); | 636 | pt = kzalloc(PAGE_SIZE, GFP_KERNEL); |
641 | if (!pt) { | 637 | if (!pt) { |
642 | ehea_error("no mem"); | 638 | ehea_error("no mem"); |
643 | ret = -ENOMEM; | 639 | ret = -ENOMEM; |
@@ -660,8 +656,8 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) | |||
660 | void *sectbase = __va(i << SECTION_SIZE_BITS); | 656 | void *sectbase = __va(i << SECTION_SIZE_BITS); |
661 | unsigned long k = 0; | 657 | unsigned long k = 0; |
662 | 658 | ||
663 | for (j = 0; j < (PAGES_PER_SECTION / EHEA_MAX_RPAGE); | 659 | for (j = 0; j < (EHEA_PAGES_PER_SECTION / |
664 | j++) { | 660 | EHEA_MAX_RPAGE); j++) { |
665 | 661 | ||
666 | for (m = 0; m < EHEA_MAX_RPAGE; m++) { | 662 | for (m = 0; m < EHEA_MAX_RPAGE; m++) { |
667 | pg = sectbase + ((k++) * EHEA_PAGESIZE); | 663 | pg = sectbase + ((k++) * EHEA_PAGESIZE); |