netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
@ 2009-07-21 19:28 Dave Jones
  2009-07-21 19:32 ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Jones @ 2009-07-21 19:28 UTC (permalink / raw)
  To: netdev

This code hasn't been enabled in forever.

Signed-off-by: Dave Jones <davej@redhat.com>
---
 drivers/net/via-velocity.c |   77 ++++++-------------------------------------
 1 files changed, 11 insertions(+), 66 deletions(-)

diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 42365e5..4ebe2ca 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -976,9 +976,6 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
 	dev->netdev_ops = &velocity_netdev_ops;
 	dev->ethtool_ops = &velocity_ethtool_ops;
 
-#ifdef  VELOCITY_ZERO_COPY_SUPPORT
-	dev->features |= NETIF_F_SG;
-#endif
 	dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER |
 		NETIF_F_HW_VLAN_RX;
 
@@ -1849,11 +1846,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_
 
 		pktlen = max_t(unsigned int, skb->len, ETH_ZLEN);
 		for (i = 0; i < tdinfo->nskb_dma; i++) {
-#ifdef VELOCITY_ZERO_COPY_SUPPORT
-			pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);
-#else
 			pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], pktlen, PCI_DMA_TODEVICE);
-#endif
 			tdinfo->skb_dma[i] = 0;
 		}
 	}
@@ -2095,13 +2088,6 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	len = cpu_to_le16(pktlen);
 
-#ifdef VELOCITY_ZERO_COPY_SUPPORT
-	if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) {
-		kfree_skb(skb);
-		return NETDEV_TX_OK;
-	}
-#endif
-
 	spin_lock_irqsave(&vptr->lock, flags);
 
 	index = vptr->tx.curr[qnum];
@@ -2111,59 +2097,18 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
 	td_ptr->tdesc1.TCR = TCR0_TIC;
 	td_ptr->td_buf[0].size &= ~TD_QUEUE;
 
-#ifdef VELOCITY_ZERO_COPY_SUPPORT
-	if (skb_shinfo(skb)->nr_frags > 0) {
-		int nfrags = skb_shinfo(skb)->nr_frags;
-		tdinfo->skb = skb;
-		if (nfrags > 6) {
-			skb_copy_from_linear_data(skb, tdinfo->buf, skb->len);
-			tdinfo->skb_dma[0] = tdinfo->buf_dma;
-			td_ptr->tdesc0.len = len;
-			td_ptr->tx.buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
-			td_ptr->tx.buf[0].pa_high = 0;
-			td_ptr->tx.buf[0].size = len;	/* queue is 0 anyway */
-			tdinfo->nskb_dma = 1;
-		} else {
-			int i = 0;
-			tdinfo->nskb_dma = 0;
-			tdinfo->skb_dma[i] = pci_map_single(vptr->pdev, skb->data,
-						skb_headlen(skb), PCI_DMA_TODEVICE);
-
-			td_ptr->tdesc0.len = len;
-
-			/* FIXME: support 48bit DMA later */
-			td_ptr->tx.buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma);
-			td_ptr->tx.buf[i].pa_high = 0;
-			td_ptr->tx.buf[i].size = cpu_to_le16(skb_headlen(skb));
-
-			for (i = 0; i < nfrags; i++) {
-				skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
-				void *addr = (void *)page_address(frag->page) + frag->page_offset;
-
-				tdinfo->skb_dma[i + 1] = pci_map_single(vptr->pdev, addr, frag->size, PCI_DMA_TODEVICE);
-
-				td_ptr->tx.buf[i + 1].pa_low = cpu_to_le32(tdinfo->skb_dma[i + 1]);
-				td_ptr->tx.buf[i + 1].pa_high = 0;
-				td_ptr->tx.buf[i + 1].size = cpu_to_le16(frag->size);
-			}
-			tdinfo->nskb_dma = i - 1;
-		}
+	/*
+	 *	Map the linear network buffer into PCI space and
+	 *	add it to the transmit ring.
+	 */
+	tdinfo->skb = skb;
+	tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE);
+	td_ptr->tdesc0.len = len;
+	td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
+	td_ptr->td_buf[0].pa_high = 0;
+	td_ptr->td_buf[0].size = len;
+	tdinfo->nskb_dma = 1;
 
-	} else
-#endif
-	{
-		/*
-		 *	Map the linear network buffer into PCI space and
-		 *	add it to the transmit ring.
-		 */
-		tdinfo->skb = skb;
-		tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE);
-		td_ptr->tdesc0.len = len;
-		td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
-		td_ptr->td_buf[0].pa_high = 0;
-		td_ptr->td_buf[0].size = len;
-		tdinfo->nskb_dma = 1;
-	}
 	td_ptr->tdesc1.cmd = TCPLS_NORMAL + (tdinfo->nskb_dma + 1) * 16;
 
 	if (vptr->vlgrp && vlan_tx_tag_present(skb)) {

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
  2009-07-21 19:28 [1/4 v2] Remove unused zero-copy code from velocity NIC driver Dave Jones
@ 2009-07-21 19:32 ` David Miller
  2009-07-21 19:32   ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-07-21 19:32 UTC (permalink / raw)
  To: davej; +Cc: netdev

From: Dave Jones <davej@redhat.com>
Date: Tue Jul 21 15:15:49 2009 -0400

> This code hasn't been enabled in forever.
> 
> Signed-off-by: Dave Jones <davej@redhat.com>

David it still doesn't apply....

Try to apply this using GIT to net-next-2.6, it won't go.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
  2009-07-21 19:32 ` David Miller
@ 2009-07-21 19:32   ` David Miller
  2009-07-21 19:33     ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-07-21 19:32 UTC (permalink / raw)
  To: davej; +Cc: netdev

From: David Miller <davem@davemloft.net>
Date: Tue, 21 Jul 2009 12:32:02 -0700 (PDT)

> From: Dave Jones <davej@redhat.com>
> Date: Tue Jul 21 15:15:49 2009 -0400
> 
>> This code hasn't been enabled in forever.
>> 
>> Signed-off-by: Dave Jones <davej@redhat.com>
> 
> David it still doesn't apply....
> 
> Try to apply this using GIT to net-next-2.6, it won't go.

Sorry, PEBKAC....

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
  2009-07-21 19:32   ` David Miller
@ 2009-07-21 19:33     ` David Miller
  2009-07-21 19:44       ` Dave Jones
  2009-07-23 22:58       ` David Miller
  0 siblings, 2 replies; 8+ messages in thread
From: David Miller @ 2009-07-21 19:33 UTC (permalink / raw)
  To: davej; +Cc: netdev

From: David Miller <davem@davemloft.net>
Date: Tue, 21 Jul 2009 12:32:27 -0700 (PDT)

> From: David Miller <davem@davemloft.net>
> Date: Tue, 21 Jul 2009 12:32:02 -0700 (PDT)
> 
>> From: Dave Jones <davej@redhat.com>
>> Date: Tue Jul 21 15:15:49 2009 -0400
>> 
>>> This code hasn't been enabled in forever.
>>> 
>>> Signed-off-by: Dave Jones <davej@redhat.com>
>> 
>> David it still doesn't apply....
>> 
>> Try to apply this using GIT to net-next-2.6, it won't go.
> 
> Sorry, PEBKAC....

Ok, all applied to net-next-2.6, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
  2009-07-21 19:33     ` David Miller
@ 2009-07-21 19:44       ` Dave Jones
  2009-07-23 22:58       ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Dave Jones @ 2009-07-21 19:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Tue, Jul 21, 2009 at 12:33:22PM -0700, David Miller wrote:

 > >> David it still doesn't apply....
 > >> 
 > >> Try to apply this using GIT to net-next-2.6, it won't go.
 > > 
 > > Sorry, PEBKAC....
 > 
 > Ok, all applied to net-next-2.6, thanks.

Phew, I was hella confused for a moment ;-)

thanks !

	Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
  2009-07-21 19:33     ` David Miller
  2009-07-21 19:44       ` Dave Jones
@ 2009-07-23 22:58       ` David Miller
  2009-07-24  0:44         ` Dave Jones
  1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2009-07-23 22:58 UTC (permalink / raw)
  To: davej; +Cc: netdev

From: David Miller <davem@davemloft.net>
Date: Tue, 21 Jul 2009 12:33:22 -0700 (PDT)

> Ok, all applied to net-next-2.6, thanks.

Ok, now we have a stinking pile of poo situation when one tries to
compile the velocity driver without CONFIG_PM defined.

First we hit:

drivers/net/via-velocity.c: In function ‘velocity_init_module’:
drivers/net/via-velocity.c:3303: error: implicit declaration of function ‘velocity_register_notifier’
drivers/net/via-velocity.c:3306: error: implicit declaration of function ‘velocity_unregister_notifier’

Because the whole CONFIG_PM + CONFIG_INET ifdeffery around these functions
was missed up.  Simple enough to fix, but then we get:

drivers/net/via-velocity.c:2957: warning: ‘velocity_suspend’ defined but not used
drivers/net/via-velocity.c:3026: warning: ‘velocity_resume’ defined but not used

Fine, let's ifdef protect these two functions with CONFIG_PM:

drivers/net/via-velocity.c:2853: warning: ‘velocity_set_wol’ defined but not used
drivers/net/via-velocity.c:2939: warning: ‘velocity_save_context’ defined but not used
drivers/net/via-velocity.c:3001: warning: ‘velocity_restore_context’ defined but not used

And at this point I really give up Dave.  This whole thing to move
functions around to avoid forward decls has created a worse problem
than it solved.

Unless you can fix this, like, immediately.  I want to revert.

This is keeping me from pulling more work into my net-next-2.6
tree.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
  2009-07-23 22:58       ` David Miller
@ 2009-07-24  0:44         ` Dave Jones
  2009-07-24  2:02           ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Jones @ 2009-07-24  0:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Thu, Jul 23, 2009 at 03:58:55PM -0700, David Miller wrote:
 > From: David Miller <davem@davemloft.net>
 > Date: Tue, 21 Jul 2009 12:33:22 -0700 (PDT)
 > 
 > > Ok, all applied to net-next-2.6, thanks.
 > 
 > Ok, now we have a stinking pile of poo situation when one tries to
 > compile the velocity driver without CONFIG_PM defined.
 > 
 > First we hit:
 > 
 > drivers/net/via-velocity.c: In function ‘velocity_init_module’:
 > drivers/net/via-velocity.c:3303: error: implicit declaration of function ‘velocity_register_notifier’
 > drivers/net/via-velocity.c:3306: error: implicit declaration of function ‘velocity_unregister_notifier’
 > 
 > Because the whole CONFIG_PM + CONFIG_INET ifdeffery around these functions
 > was missed up.  Simple enough to fix, but then we get:
 > 
 > drivers/net/via-velocity.c:2957: warning: ‘velocity_suspend’ defined but not used
 > drivers/net/via-velocity.c:3026: warning: ‘velocity_resume’ defined but not used
 > 
 > Fine, let's ifdef protect these two functions with CONFIG_PM:
 > 
 > drivers/net/via-velocity.c:2853: warning: ‘velocity_set_wol’ defined but not used
 > drivers/net/via-velocity.c:2939: warning: ‘velocity_save_context’ defined but not used
 > drivers/net/via-velocity.c:3001: warning: ‘velocity_restore_context’ defined but not used
 > 
 > And at this point I really give up Dave.  This whole thing to move
 > functions around to avoid forward decls has created a worse problem
 > than it solved.
 > 
 > Unless you can fix this, like, immediately.  I want to revert.
 > 
 > This is keeping me from pulling more work into my net-next-2.6
 > tree.

apologies.. This should fix it..

	Dave

-- 

Previous changes broke compilation with CONFIG_PM disabled.
This widens the ifdefs to cover the functions that only get called
within the suspend/resume routines.

Signed-off-by: Dave Jones <davej@redhat.com>

diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index b4bd1d3..47be41a 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2805,6 +2805,7 @@ err_free_dev:
 }
 
 
+#ifdef CONFIG_PM
 /**
  *	wol_calc_crc		-	WOL CRC
  *	@pattern: data pattern
@@ -2952,7 +2953,6 @@ static void velocity_save_context(struct velocity_info *vptr, struct velocity_co
 
 }
 
-
 static int velocity_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
@@ -3056,7 +3056,7 @@ static int velocity_resume(struct pci_dev *pdev)
 
 	return 0;
 }
-
+#endif
 
 /*
  *	Definition for our device driver. The PCI layer interface
@@ -3239,7 +3239,6 @@ static const struct ethtool_ops velocity_ethtool_ops = {
 };
 
 #ifdef CONFIG_PM
-
 #ifdef CONFIG_INET
 static int velocity_netdev_event(struct notifier_block *nb, unsigned long notification, void *ptr)
 {
@@ -3263,6 +3262,7 @@ static int velocity_netdev_event(struct notifier_block *nb, unsigned long notifi
 	return NOTIFY_DONE;
 }
 #endif	/* CONFIG_INET */
+#endif	/* CONFIG_PM */
 
 #if defined(CONFIG_PM) && defined(CONFIG_INET)
 static struct notifier_block velocity_inetaddr_notifier = {
@@ -3286,8 +3286,6 @@ static void velocity_unregister_notifier(void)
 
 #endif	/* defined(CONFIG_PM) && defined(CONFIG_INET) */
 
-#endif	/* CONFIG_PM */
-
 /**
  *	velocity_init_module	-	load time function
  *

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [1/4 v2] Remove unused zero-copy code from velocity NIC driver.
  2009-07-24  0:44         ` Dave Jones
@ 2009-07-24  2:02           ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2009-07-24  2:02 UTC (permalink / raw)
  To: davej; +Cc: netdev

From: Dave Jones <davej@redhat.com>
Date: Thu, 23 Jul 2009 20:44:49 -0400

> Previous changes broke compilation with CONFIG_PM disabled.
> This widens the ifdefs to cover the functions that only get called
> within the suspend/resume routines.
> 
> Signed-off-by: Dave Jones <davej@redhat.com>

Applied, thanks Dave.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-07-24  2:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-21 19:28 [1/4 v2] Remove unused zero-copy code from velocity NIC driver Dave Jones
2009-07-21 19:32 ` David Miller
2009-07-21 19:32   ` David Miller
2009-07-21 19:33     ` David Miller
2009-07-21 19:44       ` Dave Jones
2009-07-23 22:58       ` David Miller
2009-07-24  0:44         ` Dave Jones
2009-07-24  2:02           ` David Miller

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).