Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2569

kernel-2.6.18-238.el5.src.rpm

From: Ivan Vecera <ivecera@redhat.com>
Date: Fri, 19 Dec 2008 12:22:40 +0100
Subject: [net] e1000, bnx2: enable entropy generation
Message-id: 1229685760-23831-1-git-send-email-ivecera@redhat.com
O-Subject: [RHEL5 PATCH] enable entropy generation from e1000 and bnx2 network cards
Bugzilla: 439898
RH-Acked-by: Andy Gospodarek <gospo@redhat.com>
RH-Acked-by: Neil Horman <nhorman@redhat.com>

BZs:
#439898 - enable entropy generation from e1000 and bnx2 network cards

Description:
This BZ requests an insertion of the IRQF_SAMPLE_RANDOM flag into request_irq.
I know this is a little bit problematic and unacceptable by upstream. But
e1000 in RHEL-5 supported this functionality before update and from a certain
point of view it's a regression.
The insertion the flag into bnx2 is unacceptable by upstream I know but on
second thought I think and Andy also this could be a case where we can deviate
from upstream.

Upstream status:
N/A

Signed-off-by: Ivan Vecera <ivecera@redhat.com>

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 87e7e77..d9b19d7 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -76,6 +76,12 @@ static int disable_msi = 0;
 module_param(disable_msi, int, 0);
 MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
 
+static int enable_entropy = 0;
+
+module_param(enable_entropy, int, 0);
+MODULE_PARM_DESC(enable_entropy,
+		 "Allow bnx2 to populate the /dev/random entropy pool");
+
 typedef enum {
 	BCM5706 = 0,
 	NC370T,
@@ -5783,6 +5789,9 @@ bnx2_request_irq(struct bnx2 *bp)
 	else
 		flags = IRQF_SHARED;
 
+	if (enable_entropy)
+		flags |= IRQF_SAMPLE_RANDOM;
+
 	for (i = 0; i < bp->irq_nvecs; i++) {
 		irq = &bp->irq_tbl[i];
 		rc = request_irq(irq->vector, irq->handler, flags, irq->name,
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 6663908..25c7202 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -274,7 +274,7 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
 {
 	struct net_device *netdev = adapter->netdev;
 	void (*handler) = &e1000_intr;
-	int irq_flags = IRQF_SHARED;
+	int irq_flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM;
 	int err;
 
 	if (adapter->hw.mac_type >= e1000_82571) {