lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <yyi646l6pmr.wl@toshiba.co.jp>
Date:	Tue, 22 May 2007 20:53:32 +0900
From:	Tsutomu OWA <tsutomu.owa@...hiba.co.jp>
To:	linuxppc-dev@...abs.org, linux-kernel@...r.kernel.org
Cc:	mingo@...e.hu, tglx@...utronix.de
Subject: [PATCH] powerpc 2.6.21-rt6: revert spider_net


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@...hiba.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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ