All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Simmons <linuxrocks123@netscape.net>
To: netdev@vger.kernel.org
Subject: [PATCH] Add IRQF_SAMPLE_RANDOM Flag to forcedeth
Date: Sat, 09 Oct 2010 17:45:42 -0600	[thread overview]
Message-ID: <4CB0FEA6.3030206@netscape.net> (raw)

This patch adds the IRQF_SAMPLE_RANDOM flag to the forcedeth driver, 
allowing the interrupt timing for forcedeth to be used for entropy 
generation.  This should help /dev/random generate more secure random 
numbers on machines using this driver.

Signed-off-by: Patrick Simmons <linuxrocks123@netscape.net>

Please CC me with any comments as I am not subscribed to the list.

--- linux/drivers/net/forcedeth.c.orig    2010-10-09 17:12:08.400000015 
-0600
+++ linux/drivers/net/forcedeth.c    2010-10-09 17:14:44.880000015 -0600
@@ -3819,7 +3819,7 @@ static int nv_request_irq(struct net_dev
                  /* Request irq for rx handling */
                  sprintf(np->name_rx, "%s-rx", dev->name);
                  if 
(request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector,
-                        nv_nic_irq_rx, IRQF_SHARED, np->name_rx, dev) 
!= 0) {
+                        nv_nic_irq_rx, IRQF_SHARED | 
IRQF_SAMPLE_RANDOM, np->name_rx, dev) != 0) {
                      printk(KERN_INFO "forcedeth: request_irq failed 
for rx %d\n", ret);
                      pci_disable_msix(np->pci_dev);
                      np->msi_flags &= ~NV_MSI_X_ENABLED;
@@ -3828,7 +3828,7 @@ static int nv_request_irq(struct net_dev
                  /* Request irq for tx handling */
                  sprintf(np->name_tx, "%s-tx", dev->name);
                  if 
(request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector,
-                        nv_nic_irq_tx, IRQF_SHARED, np->name_tx, dev) 
!= 0) {
+                        nv_nic_irq_tx, IRQF_SHARED | 
IRQF_SAMPLE_RANDOM, np->name_tx, dev) != 0) {
                      printk(KERN_INFO "forcedeth: request_irq failed 
for tx %d\n", ret);
                      pci_disable_msix(np->pci_dev);
                      np->msi_flags &= ~NV_MSI_X_ENABLED;
@@ -3837,7 +3837,7 @@ static int nv_request_irq(struct net_dev
                  /* Request irq for link and timer handling */
                  sprintf(np->name_other, "%s-other", dev->name);
                  if 
(request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector,
-                        nv_nic_irq_other, IRQF_SHARED, np->name_other, 
dev) != 0) {
+                        nv_nic_irq_other, IRQF_SHARED | 
IRQF_SAMPLE_RANDOM, np->name_other, dev) != 0) {
                      printk(KERN_INFO "forcedeth: request_irq failed 
for link %d\n", ret);
                      pci_disable_msix(np->pci_dev);
                      np->msi_flags &= ~NV_MSI_X_ENABLED;
@@ -3851,7 +3851,7 @@ static int nv_request_irq(struct net_dev
                  set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, 
NVREG_IRQ_OTHER);
              } else {
                  /* Request irq for all interrupts */
-                if 
(request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, handler, 
IRQF_SHARED, dev->name, dev) != 0) {
+                if 
(request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, handler, 
IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev) != 0) {
                      printk(KERN_INFO "forcedeth: request_irq failed 
%d\n", ret);
                      pci_disable_msix(np->pci_dev);
                      np->msi_flags &= ~NV_MSI_X_ENABLED;
@@ -3868,7 +3868,7 @@ static int nv_request_irq(struct net_dev
          if ((ret = pci_enable_msi(np->pci_dev)) == 0) {
              np->msi_flags |= NV_MSI_ENABLED;
              dev->irq = np->pci_dev->irq;
-            if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, 
dev->name, dev) != 0) {
+            if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED | 
IRQF_SAMPLE_RANDOM, dev->name, dev) != 0) {
                  printk(KERN_INFO "forcedeth: request_irq failed %d\n", 
ret);
                  pci_disable_msi(np->pci_dev);
                  np->msi_flags &= ~NV_MSI_ENABLED;
@@ -3884,7 +3884,7 @@ static int nv_request_irq(struct net_dev
          }
      }
      if (ret != 0) {
-        if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, 
dev->name, dev) != 0)
+        if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED | 
IRQF_SAMPLE_RANDOM, dev->name, dev) != 0)
              goto out_err;

      }


             reply	other threads:[~2010-10-09 23:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09 23:45 Patrick Simmons [this message]
2010-10-10  1:09 ` [PATCH] Add IRQF_SAMPLE_RANDOM Flag to forcedeth Ben Hutchings
2010-10-10  3:15   ` David Miller
2010-10-10  3:23     ` Patrick Simmons
2010-10-10  8:57       ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CB0FEA6.3030206@netscape.net \
    --to=linuxrocks123@netscape.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.