Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: hpilo: increase number of max supported channels

Increase number of supported channels from 8 to 24.
Make the number of channels configurable via module parameter max_ccb.

Signed-off-by: Mark Rusk <mark.rusk@hp.com>
Signed-off-by: Tony Camuso <tony.camuso@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Camuso, Tony and committed by
Greg Kroah-Hartman
98dcd59d f6a4e494

+24 -13
+21 -12
drivers/misc/hpilo.c
··· 30 30 31 31 static struct class *ilo_class; 32 32 static unsigned int ilo_major; 33 + static unsigned int max_ccb = MIN_CCB; 33 34 static char ilo_hwdev[MAX_ILO_DEV]; 34 35 35 36 static inline int get_entry_id(int entry) ··· 425 424 * Mapped memory is zeroed on ilo reset, so set a per ccb flag 426 425 * to indicate that this ccb needs to be closed and reopened. 427 426 */ 428 - for (slot = 0; slot < MAX_CCB; slot++) { 427 + for (slot = 0; slot < max_ccb; slot++) { 429 428 if (!hw->ccb_alloc[slot]) 430 429 continue; 431 430 set_channel_reset(&hw->ccb_alloc[slot]->driver_ccb); ··· 536 535 struct ilo_hwinfo *hw; 537 536 unsigned long flags; 538 537 539 - slot = iminor(ip) % MAX_CCB; 538 + slot = iminor(ip) % max_ccb; 540 539 hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev); 541 540 542 541 spin_lock(&hw->open_lock); ··· 567 566 struct ilo_hwinfo *hw; 568 567 unsigned long flags; 569 568 570 - slot = iminor(ip) % MAX_CCB; 569 + slot = iminor(ip) % max_ccb; 571 570 hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev); 572 571 573 572 /* new ccb allocation */ ··· 664 663 ilo_set_reset(hw); 665 664 } 666 665 667 - for (i = 0; i < MAX_CCB; i++) { 666 + for (i = 0; i < max_ccb; i++) { 668 667 if (!hw->ccb_alloc[i]) 669 668 continue; 670 669 if (pending & (1 << i)) ··· 698 697 } 699 698 700 699 /* map the adapter shared memory region */ 701 - hw->ram_vaddr = pci_iomap(pdev, 2, MAX_CCB * ILOHW_CCB_SZ); 700 + hw->ram_vaddr = pci_iomap(pdev, 2, max_ccb * ILOHW_CCB_SZ); 702 701 if (hw->ram_vaddr == NULL) { 703 702 dev_err(&pdev->dev, "Error mapping shared mem\n"); 704 703 goto mmio_free; 705 704 } 706 705 707 706 /* map the doorbell aperture */ 708 - hw->db_vaddr = pci_iomap(pdev, 3, MAX_CCB * ONE_DB_SIZE); 707 + hw->db_vaddr = pci_iomap(pdev, 3, max_ccb * ONE_DB_SIZE); 709 708 if (hw->db_vaddr == NULL) { 710 709 dev_err(&pdev->dev, "Error mapping doorbell\n"); 711 710 goto ram_free; ··· 728 727 clear_device(ilo_hw); 729 728 730 729 minor = MINOR(ilo_hw->cdev.dev); 731 - for (i = minor; i < minor + MAX_CCB; i++) 730 + for (i = minor; i < minor + max_ccb; i++) 732 731 device_destroy(ilo_class, MKDEV(ilo_major, i)); 733 732 734 733 cdev_del(&ilo_hw->cdev); ··· 738 737 pci_release_regions(pdev); 739 738 pci_disable_device(pdev); 740 739 kfree(ilo_hw); 741 - ilo_hwdev[(minor / MAX_CCB)] = 0; 740 + ilo_hwdev[(minor / max_ccb)] = 0; 742 741 } 743 742 744 743 static int __devinit ilo_probe(struct pci_dev *pdev, ··· 746 745 { 747 746 int devnum, minor, start, error; 748 747 struct ilo_hwinfo *ilo_hw; 748 + 749 + if (max_ccb > MAX_CCB) 750 + max_ccb = MAX_CCB; 751 + else if (max_ccb < MIN_CCB) 752 + max_ccb = MIN_CCB; 749 753 750 754 /* find a free range for device files */ 751 755 for (devnum = 0; devnum < MAX_ILO_DEV; devnum++) { ··· 801 795 802 796 cdev_init(&ilo_hw->cdev, &ilo_fops); 803 797 ilo_hw->cdev.owner = THIS_MODULE; 804 - start = devnum * MAX_CCB; 805 - error = cdev_add(&ilo_hw->cdev, MKDEV(ilo_major, start), MAX_CCB); 798 + start = devnum * max_ccb; 799 + error = cdev_add(&ilo_hw->cdev, MKDEV(ilo_major, start), max_ccb); 806 800 if (error) { 807 801 dev_err(&pdev->dev, "Could not add cdev\n"); 808 802 goto remove_isr; 809 803 } 810 804 811 - for (minor = 0 ; minor < MAX_CCB; minor++) { 805 + for (minor = 0 ; minor < max_ccb; minor++) { 812 806 struct device *dev; 813 807 dev = device_create(ilo_class, &pdev->dev, 814 808 MKDEV(ilo_major, minor), NULL, ··· 885 879 class_destroy(ilo_class); 886 880 } 887 881 888 - MODULE_VERSION("1.2"); 882 + MODULE_VERSION("1.3"); 889 883 MODULE_ALIAS(ILO_NAME); 890 884 MODULE_DESCRIPTION(ILO_NAME); 891 885 MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>"); 892 886 MODULE_LICENSE("GPL v2"); 887 + 888 + module_param(max_ccb, uint, 0444); 889 + MODULE_PARM_DESC(max_ccb, "Maximum number of HP iLO channels to attach (8)"); 893 890 894 891 module_init(ilo_init); 895 892 module_exit(ilo_exit);
+3 -1
drivers/misc/hpilo.h
··· 14 14 #define ILO_NAME "hpilo" 15 15 16 16 /* max number of open channel control blocks per device, hw limited to 32 */ 17 - #define MAX_CCB 8 17 + #define MAX_CCB 24 18 + /* min number of open channel control blocks per device, hw limited to 32 */ 19 + #define MIN_CCB 8 18 20 /* max number of supported devices */ 19 21 #define MAX_ILO_DEV 1 20 22 /* max number of files */