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

be2net: Use Kconfig flag to support for enabling/disabling adapters

Add flags to enable/disable supported chips in be2net.

With disable support are removed coresponding PCI IDs and
also codepaths with [BE2|BE3|BEx|lancer|skyhawk]_chip checks.

Disable chip will reduce module size by:
BE2 ~2kb
BE3 ~3kb
Lancer ~10kb
Skyhawk ~9kb

When enable skyhawk only it will reduce module size by ~20kb

New help style in Kconfig

Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: Petr Oros <poros@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Petr Oros and committed by
David S. Miller
98471b5b eb95f52f

+63 -3
+38 -2
drivers/net/ethernet/emulex/benet/Kconfig
··· 1 1 config BE2NET 2 2 tristate "ServerEngines' 10Gbps NIC - BladeEngine" 3 3 depends on PCI 4 - ---help--- 4 + help 5 5 This driver implements the NIC functionality for ServerEngines' 6 6 10Gbps network adapter - BladeEngine. 7 7 ··· 10 10 depends on BE2NET && HWMON 11 11 depends on !(BE2NET=y && HWMON=m) 12 12 default y 13 - ---help--- 13 + help 14 14 Say Y here if you want to expose thermal sensor data on 15 15 be2net network adapter. 16 + 17 + config BE2NET_BE2 18 + bool "Support for BE2 chipsets" 19 + depends on BE2NET 20 + default y 21 + help 22 + Say Y here if you want to use devices based on BE2 23 + chipsets. (e.g. OneConnect OCe10xxx) 24 + 25 + config BE2NET_BE3 26 + bool "Support for BE3 chipsets" 27 + depends on BE2NET 28 + default y 29 + help 30 + Say Y here if you want to use devices based on BE3 31 + chipsets. (e.g. OneConnect OCe11xxx) 32 + 33 + config BE2NET_LANCER 34 + bool "Support for Lancer chipsets" 35 + depends on BE2NET 36 + default y 37 + help 38 + Say Y here if you want to use devices based on Lancer 39 + chipsets. (e.g LightPulse LPe12xxx) 40 + 41 + config BE2NET_SKYHAWK 42 + bool "Support for Skyhawk chipsets" 43 + depends on BE2NET 44 + default y 45 + help 46 + Say Y here if you want to use devices based on Skyhawk 47 + chipsets. (e.g. OneConnect OCe14xxx) 48 + 49 + comment "WARNING: be2net is useless without any enabled chip" 50 + depends on BE2NET_BE2=n && BE2NET_BE3=n && BE2NET_LANCER=n && \ 51 + BE2NET_SKYHAWK=n && BE2NET
+16
drivers/net/ethernet/emulex/benet/be.h
··· 752 752 /* Is BE in QNQ multi-channel mode */ 753 753 #define be_is_qnq_mode(adapter) (adapter->function_mode & QNQ_MODE) 754 754 755 + #ifdef CONFIG_BE2NET_LANCER 755 756 #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ 756 757 adapter->pdev->device == OC_DEVICE_ID4) 758 + #else 759 + #define lancer_chip(adapter) (0) 760 + #endif /* CONFIG_BE2NET_LANCER */ 757 761 762 + #ifdef CONFIG_BE2NET_SKYHAWK 758 763 #define skyhawk_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID5 || \ 759 764 adapter->pdev->device == OC_DEVICE_ID6) 765 + #else 766 + #define skyhawk_chip(adapter) (0) 767 + #endif /* CONFIG_BE2NET_SKYHAWK */ 760 768 769 + #ifdef CONFIG_BE2NET_BE3 761 770 #define BE3_chip(adapter) (adapter->pdev->device == BE_DEVICE_ID2 || \ 762 771 adapter->pdev->device == OC_DEVICE_ID2) 772 + #else 773 + #define BE3_chip(adapter) (0) 774 + #endif /* CONFIG_BE2NET_BE3 */ 763 775 776 + #ifdef CONFIG_BE2NET_BE2 764 777 #define BE2_chip(adapter) (adapter->pdev->device == BE_DEVICE_ID1 || \ 765 778 adapter->pdev->device == OC_DEVICE_ID1) 779 + #else 780 + #define BE2_chip(adapter) (0) 781 + #endif /* CONFIG_BE2NET_BE2 */ 766 782 767 783 #define BEx_chip(adapter) (BE3_chip(adapter) || BE2_chip(adapter)) 768 784
+9 -1
drivers/net/ethernet/emulex/benet/be_main.c
··· 47 47 static struct workqueue_struct *be_err_recovery_workq; 48 48 49 49 static const struct pci_device_id be_dev_ids[] = { 50 + #ifdef CONFIG_BE2NET_BE2 50 51 { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) }, 51 - { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID2) }, 52 52 { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID1) }, 53 + #endif /* CONFIG_BE2NET_BE2 */ 54 + #ifdef CONFIG_BE2NET_BE3 55 + { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID2) }, 53 56 { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID2) }, 57 + #endif /* CONFIG_BE2NET_BE3 */ 58 + #ifdef CONFIG_BE2NET_LANCER 54 59 { PCI_DEVICE(EMULEX_VENDOR_ID, OC_DEVICE_ID3)}, 55 60 { PCI_DEVICE(EMULEX_VENDOR_ID, OC_DEVICE_ID4)}, 61 + #endif /* CONFIG_BE2NET_LANCER */ 62 + #ifdef CONFIG_BE2NET_SKYHAWK 56 63 { PCI_DEVICE(EMULEX_VENDOR_ID, OC_DEVICE_ID5)}, 57 64 { PCI_DEVICE(EMULEX_VENDOR_ID, OC_DEVICE_ID6)}, 65 + #endif /* CONFIG_BE2NET_SKYHAWK */ 58 66 { 0 } 59 67 }; 60 68 MODULE_DEVICE_TABLE(pci, be_dev_ids);