mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tsutomu OWA <tsutomu.owa@toshiba.co.jp>
To: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, tglx@linutronix.de
Subject: [PATCH] powerpc 2.6.21-rt6: revert spider_net
Date: Tue, 22 May 2007 20:53:32 +0900	[thread overview]
Message-ID: <yyi646l6pmr.wl@toshiba.co.jp> (raw)


Hi Ingo and Thomas,

Please apply.

To revert spider_net.c to original one as it turns out that the patch 
I sent was unnecessary.  It was my mistake.

Compile, boot and netperf tested on celleb.

thanks for your time!

Signed-off-by: Tsutomu OWA <tsutomu.owa@toshiba.co.jp>
-- owa

--- linux-2.6.21-rt3/drivers/net/spider_net.c	2007-05-21 15:19:42.000000000 +0900
+++ rt/drivers/net/spider_net.c	2007-04-26 12:08:32.000000000 +0900
@@ -688,6 +688,7 @@ spider_net_prepare_tx_descr(struct spide
 	struct spider_net_descr *descr;
 	struct spider_net_hw_descr *hwdescr;
 	dma_addr_t buf;
+	unsigned long flags;
 
 	buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
 	if (pci_dma_mapping_error(buf)) {
@@ -698,8 +699,10 @@ spider_net_prepare_tx_descr(struct spide
 		return -ENOMEM;
 	}
 
+	spin_lock_irqsave(&chain->lock, flags);
 	descr = card->tx_chain.head;
 	if (descr->next == chain->tail->prev) {
+		spin_unlock_irqrestore(&chain->lock, flags);
 		pci_unmap_single(card->pdev, buf, skb->len, PCI_DMA_TODEVICE);
 		return -ENOMEM;
 	}
@@ -714,6 +717,7 @@ spider_net_prepare_tx_descr(struct spide
 
 	hwdescr->dmac_cmd_status =
 			SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS;
+	spin_unlock_irqrestore(&chain->lock, flags);
 
 	if (skb->protocol == htons(ETH_P_IP) && skb->ip_summed == CHECKSUM_PARTIAL)
 		switch (skb->nh.iph->protocol) {
@@ -738,6 +742,7 @@ spider_net_set_low_watermark(struct spid
 {
 	struct spider_net_descr *descr = card->tx_chain.tail;
 	struct spider_net_hw_descr *hwdescr;
+	unsigned long flags;
 	int status;
 	int cnt=0;
 	int i;
@@ -763,6 +768,7 @@ spider_net_set_low_watermark(struct spid
 		descr = descr->next;
 
 	/* Set the new watermark, clear the old watermark */
+	spin_lock_irqsave(&card->tx_chain.lock, flags);
 	descr->hwdescr->dmac_cmd_status |= SPIDER_NET_DESCR_TXDESFLG;
 	if (card->low_watermark && card->low_watermark != descr) {
 		hwdescr = card->low_watermark->hwdescr;
@@ -770,7 +776,7 @@ spider_net_set_low_watermark(struct spid
 		     hwdescr->dmac_cmd_status & ~SPIDER_NET_DESCR_TXDESFLG;
 	}
 	card->low_watermark = descr;
-
+	spin_unlock_irqrestore(&card->tx_chain.lock, flags);
 	return cnt;
 }
 
@@ -778,7 +784,6 @@ spider_net_set_low_watermark(struct spid
  * spider_net_release_tx_chain - processes sent tx descriptors
  * @card: adapter structure
  * @brutal: if set, don't care about whether descriptor seems to be in use
- * @locked: if set, tx_chain locked is held by caller.
  *
  * returns 0 if the tx ring is empty, otherwise 1.
  *
@@ -788,7 +793,7 @@ spider_net_set_low_watermark(struct spid
  * scheduled again (if we were scheduled) and will not loose initiative.
  */
 static int
-spider_net_release_tx_chain(struct spider_net_card *card, int brutal, int locked)
+spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
 {
 	struct spider_net_descr_chain *chain = &card->tx_chain;
 	struct spider_net_descr *descr;
@@ -799,11 +804,9 @@ spider_net_release_tx_chain(struct spide
 	int status;
 
 	while (1) {
-		if (!locked)
-			spin_lock_irqsave(&chain->lock, flags);
+		spin_lock_irqsave(&chain->lock, flags);
 		if (chain->tail == chain->head) {
-			if (!locked)
-				spin_unlock_irqrestore(&chain->lock, flags);
+			spin_unlock_irqrestore(&chain->lock, flags);
 			return 0;
 		}
 		descr = chain->tail;
@@ -818,8 +821,7 @@ spider_net_release_tx_chain(struct spide
 
 		case SPIDER_NET_DESCR_CARDOWNED:
 			if (!brutal) {
-				if (!locked)
-					spin_unlock_irqrestore(&chain->lock, flags);
+				spin_unlock_irqrestore(&chain->lock, flags);
 				return 1;
 			}
 
@@ -840,8 +842,7 @@ spider_net_release_tx_chain(struct spide
 		default:
 			card->netdev_stats.tx_dropped++;
 			if (!brutal) {
-				if (!locked)
-					spin_unlock_irqrestore(&chain->lock, flags);
+				spin_unlock_irqrestore(&chain->lock, flags);
 				return 1;
 			}
 		}
@@ -851,9 +852,7 @@ spider_net_release_tx_chain(struct spide
 		skb = descr->skb;
 		descr->skb = NULL;
 		buf_addr = hwdescr->buf_addr;
-
-		if (!locked)
-			spin_unlock_irqrestore(&chain->lock, flags);
+		spin_unlock_irqrestore(&chain->lock, flags);
 
 		/* unmap the skb */
 		if (skb) {
@@ -917,28 +916,18 @@ spider_net_xmit(struct sk_buff *skb, str
 {
 	int cnt;
 	struct spider_net_card *card = netdev_priv(netdev);
-	unsigned long flags;
-
-	if (!spin_trylock_irqsave(&card->tx_chain.lock, flags))
-		return NETDEV_TX_BUSY;
-		//? collision ? return NETDEV_TX_LOCKED;
 
-	spider_net_release_tx_chain(card, 0, 1);
+	spider_net_release_tx_chain(card, 0);
 
 	if (spider_net_prepare_tx_descr(card, skb) != 0) {
-		spin_unlock_irqrestore(&card->tx_chain.lock, flags);
 		card->netdev_stats.tx_dropped++;
 		netif_stop_queue(netdev);
 		return NETDEV_TX_BUSY;
 	}
 
 	cnt = spider_net_set_low_watermark(card);
-
-	spin_unlock_irqrestore(&card->tx_chain.lock, flags);
-
 	if (cnt < 5)
 		spider_net_kick_tx_dma(card);
-
 	return NETDEV_TX_OK;
 }
 
@@ -954,20 +943,11 @@ spider_net_xmit(struct sk_buff *skb, str
 static void
 spider_net_cleanup_tx_ring(struct spider_net_card *card)
 {
-	unsigned long flags;
-
-	if (!spin_trylock_irqsave(&card->tx_chain.lock, flags))
-		return;
-
-	if ((spider_net_release_tx_chain(card, 0, 1) != 0) &&
+	if ((spider_net_release_tx_chain(card, 0) != 0) &&
 	    (card->netdev->flags & IFF_UP)) {
-		spin_unlock_irqrestore(&card->tx_chain.lock, flags);
 		spider_net_kick_tx_dma(card);
 		netif_wake_queue(card->netdev);
-	} else
-		spin_unlock_irqrestore(&card->tx_chain.lock, flags);
-
-
+	}
 }
 
 /**
@@ -2112,7 +2092,7 @@ spider_net_stop(struct net_device *netde
 	spider_net_disable_rxdmac(card);
 
 	/* release chains */
-	spider_net_release_tx_chain(card, 1, 0);
+	spider_net_release_tx_chain(card, 1);
 	spider_net_free_rx_chain_contents(card);
 
 	spider_net_free_chain(card, &card->tx_chain);

             reply	other threads:[~2007-05-22 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22 11:53 Tsutomu OWA [this message]
2007-05-22 18:46 ` Linas Vepstas
2007-05-22 18:52   ` Thomas Gleixner

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=yyi646l6pmr.wl@toshiba.co.jp \
    --to=tsutomu.owa@toshiba.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®