From: Jiri Benc 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 --- 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 @@ -60,6 +60,10 @@ static const struct e1000_info *igb_info [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) = { { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_FIBER), board_82575 }, @@ -587,7 +591,8 @@ static int igb_request_msix(struct igb_a 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++; @@ -882,6 +887,10 @@ static int igb_request_irq(struct igb_ad 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); @@ -916,7 +925,7 @@ static int igb_request_irq(struct igb_ad } 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; @@ -926,7 +935,8 @@ static int igb_request_irq(struct igb_ad 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)