qubes-linux-kernel/patches.drivers/tg3-entropy-source.patch
2011-04-19 22:09:59 +02:00

62 lines
1.5 KiB
Diff

From: Brandon Philips <bphilips@suse.de>
Subject: [PATCH] tg3: entropy source
Patch-mainline: never
References: FATE#307517
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
drivers/net/tg3.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -15,7 +15,6 @@
* notice is accompanying it.
*/
-
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/stringify.h>
@@ -67,6 +66,10 @@
#include "tg3.h"
+static int entropy = 0;
+module_param(entropy, int, 0);
+MODULE_PARM_DESC(entropy, "Allow tg3 to populate the /dev/random entropy pool");
+
#define DRV_MODULE_NAME "tg3"
#define TG3_MAJ_NUM 3
#define TG3_MIN_NUM 116
@@ -8590,10 +8593,13 @@ restart_timer:
static int tg3_request_irq(struct tg3 *tp, int irq_num)
{
irq_handler_t fn;
- unsigned long flags;
+ unsigned long flags = 0;
char *name;
struct tg3_napi *tnapi = &tp->napi[irq_num];
+ if (entropy)
+ flags = IRQF_SAMPLE_RANDOM;
+
if (tp->irq_cnt == 1)
name = tp->dev->name;
else {
@@ -8606,12 +8612,11 @@ static int tg3_request_irq(struct tg3 *t
fn = tg3_msi;
if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI)
fn = tg3_msi_1shot;
- flags = IRQF_SAMPLE_RANDOM;
} else {
fn = tg3_interrupt;
if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)
fn = tg3_interrupt_tagged;
- flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM;
+ flags |= IRQF_SHARED;
}
return request_irq(tnapi->irq_vec, fn, flags, name, tnapi);