netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ayaz Abdulla <aabdulla@nvidia.com>
To: Jeff Garzik <jgarzik@pobox.com>,
	Manfred Spraul <manfred@colorfullife.com>,
	Andrew Morton <akpm@osdl.org>,
	netdev@vger.kernel.org
Subject: [PATCH 3/12] forcedeth: tx locking
Date: Tue, 09 Jan 2007 13:30:10 -0500	[thread overview]
Message-ID: <45A3DF32.3090909@nvidia.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 138 bytes --]

This patch reduces the amount of code within the lock to only the 
critical sections.

Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>


[-- Attachment #2: patch-tx-locking --]
[-- Type: text/plain, Size: 1254 bytes --]

--- orig/drivers/net/forcedeth.c	2007-01-07 22:30:08.000000000 -0500
+++ new/drivers/net/forcedeth.c	2007-01-07 22:30:02.000000000 -0500
@@ -1569,12 +1569,11 @@
 			   ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
 	}
 
-	spin_lock_irq(&np->lock);
-
 	empty_slots = nv_get_empty_tx_slots(np);
 	if ((empty_slots - np->tx_limit_stop) <= entries) {
-		spin_unlock_irq(&np->lock);
+		spin_lock_irq(&np->lock);
 		netif_stop_queue(dev);
+		spin_unlock_irq(&np->lock);
 		return NETDEV_TX_BUSY;
 	}
 
@@ -1669,6 +1668,8 @@
 		tx_flags_vlan = NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb);
 	}
 
+	spin_lock_irq(&np->lock);
+
 	/* set tx flags */
 	if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
 		start_tx.orig->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra);
@@ -1679,6 +1680,7 @@
 		np->put_tx.ex = put_tx.ex;
 	}
 
+	spin_unlock_irq(&np->lock);
 
 	dprintk(KERN_DEBUG "%s: nv_start_xmit: entries %d queued for transmission. tx_flags_extra: %x\n",
 		dev->name, entries, tx_flags_extra);
@@ -1693,7 +1695,6 @@
 	}
 
 	dev->trans_start = jiffies;
-	spin_unlock_irq(&np->lock);
 	writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
 	pci_push(get_hwbase(dev));
 	return NETDEV_TX_OK;

                 reply	other threads:[~2007-01-09 21:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=45A3DF32.3090909@nvidia.com \
    --to=aabdulla@nvidia.com \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=manfred@colorfullife.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).