2010-07-07 11:12:45 +00:00
|
|
|
From: Jiri Benc <jbenc@suse.cz>
|
|
|
|
Subject: Enable igb as entropy source (disabled by default)
|
|
|
|
References: FATE#307517
|
|
|
|
Patch-mainline: never
|
|
|
|
|
|
|
|
Current disk-less systems have no entropy source whatsoever. Therefore, the
|
|
|
|
network drivers tg3, bnx2, e1000, e1000e, igb and ixgbe should be enabled to
|
|
|
|
feed entropy to the kernel via the IRQF_SAMPLE_RANDOM flag when loaded. This
|
|
|
|
option shall not be enabled by default but implemented via a module option to
|
|
|
|
be activated by the administrator.
|
|
|
|
|
|
|
|
Signed-off-by: Brandon Philips <bphilips@suse.de>
|
|
|
|
|
|
|
|
---
|
|
|
|
drivers/net/igb/igb_main.c | 16 +++++++++++++---
|
|
|
|
1 file changed, 13 insertions(+), 3 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/net/igb/igb_main.c
|
|
|
|
+++ b/drivers/net/igb/igb_main.c
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -61,6 +61,10 @@ static const struct e1000_info *igb_info
|
2010-07-07 11:12:45 +00:00
|
|
|
[board_82575] = &e1000_82575_info,
|
|
|
|
};
|
|
|
|
|
|
|
|
+static int entropy = 0;
|
|
|
|
+module_param(entropy, int, 0);
|
|
|
|
+MODULE_PARM_DESC(entropy, "Allow igb to populate the /dev/random entropy pool");
|
|
|
|
+
|
|
|
|
static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = {
|
2011-04-19 20:09:59 +00:00
|
|
|
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_COPPER), board_82575 },
|
|
|
|
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_FIBER), board_82575 },
|
|
|
|
@@ -897,7 +901,8 @@ static int igb_request_msix(struct igb_a
|
2010-07-07 11:12:45 +00:00
|
|
|
int i, err = 0, vector = 0;
|
|
|
|
|
|
|
|
err = request_irq(adapter->msix_entries[vector].vector,
|
|
|
|
- igb_msix_other, 0, netdev->name, adapter);
|
|
|
|
+ igb_msix_other, entropy ? IRQF_SAMPLE_RANDOM : 0,
|
|
|
|
+ netdev->name, adapter);
|
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
vector++;
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -1194,6 +1199,10 @@ static int igb_request_irq(struct igb_ad
|
2010-07-07 11:12:45 +00:00
|
|
|
struct net_device *netdev = adapter->netdev;
|
|
|
|
struct pci_dev *pdev = adapter->pdev;
|
|
|
|
int err = 0;
|
|
|
|
+ int irq_flags = 0;
|
|
|
|
+
|
|
|
|
+ if (entropy)
|
|
|
|
+ irq_flags = IRQF_SAMPLE_RANDOM;
|
|
|
|
|
|
|
|
if (adapter->msix_entries) {
|
|
|
|
err = igb_request_msix(adapter);
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -1228,7 +1237,7 @@ static int igb_request_irq(struct igb_ad
|
2010-07-07 11:12:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (adapter->flags & IGB_FLAG_HAS_MSI) {
|
|
|
|
- err = request_irq(adapter->pdev->irq, igb_intr_msi, 0,
|
|
|
|
+ err = request_irq(adapter->pdev->irq, igb_intr_msi, irq_flags,
|
|
|
|
netdev->name, adapter);
|
|
|
|
if (!err)
|
|
|
|
goto request_done;
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -1238,7 +1247,8 @@ static int igb_request_irq(struct igb_ad
|
2010-07-07 11:12:45 +00:00
|
|
|
adapter->flags &= ~IGB_FLAG_HAS_MSI;
|
|
|
|
}
|
|
|
|
|
|
|
|
- err = request_irq(adapter->pdev->irq, igb_intr, IRQF_SHARED,
|
|
|
|
+ irq_flags |= IRQF_SHARED;
|
|
|
|
+ err = request_irq(adapter->pdev->irq, igb_intr, irq_flags,
|
|
|
|
netdev->name, adapter);
|
|
|
|
|
|
|
|
if (err)
|