netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [patch 04/20] ibmveth: Add tx_copybreak
       [not found] ` <20100819072503.937364037@samba.org>
@ 2010-08-19 13:34   ` Brian King
  0 siblings, 0 replies; 2+ messages in thread
From: Brian King @ 2010-08-19 13:34 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: Santiago Leon, netdev

On 08/19/2010 02:25 AM, Anton Blanchard wrote:
> Use the existing bounce buffer if we send a buffer under a certain size.
> This saves the overhead of a TCE map/unmap.
> 
> I can't see any reason for the wmb() in the bounce buffer case, if we need
> a barrier it will be before we call h_send_logical_lan but we have
> nothing in the common case. Remove it.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> 
> Index: powerpc.git/drivers/net/ibmveth.c
> ===================================================================
> --- powerpc.git.orig/drivers/net/ibmveth.c	2010-08-10 18:35:52.293272470 +1000
> +++ powerpc.git/drivers/net/ibmveth.c	2010-08-10 18:35:55.440741255 +1000
> @@ -117,6 +117,11 @@ MODULE_DESCRIPTION("IBM i/pSeries Virtua
>  MODULE_LICENSE("GPL");
>  MODULE_VERSION(ibmveth_driver_version);
> 
> +static unsigned int tx_copybreak __read_mostly = 128;

Where did the 128 come from? I thought I heard the 2k value discussed in
the past.

Thanks,

Brian

-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center



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

* [patch 04/20] ibmveth: Add tx_copybreak
  2010-08-23  0:09 [patch 00/20] ibmveth update Anton Blanchard
@ 2010-08-23  0:09 ` Anton Blanchard
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Blanchard @ 2010-08-23  0:09 UTC (permalink / raw)
  To: brking, santil; +Cc: netdev

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

Use the existing bounce buffer if we send a buffer under a certain size.
This saves the overhead of a TCE map/unmap.

I can't see any reason for the wmb() in the bounce buffer case, if we need
a barrier it will be before we call h_send_logical_lan but we have
nothing in the common case. Remove it.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: net-next-2.6/drivers/net/ibmveth.c
===================================================================
--- net-next-2.6.orig/drivers/net/ibmveth.c	2010-08-23 08:52:28.563877123 +1000
+++ net-next-2.6/drivers/net/ibmveth.c	2010-08-23 08:52:29.173833820 +1000
@@ -117,6 +117,11 @@ MODULE_DESCRIPTION("IBM i/pSeries Virtua
 MODULE_LICENSE("GPL");
 MODULE_VERSION(ibmveth_driver_version);
 
+static unsigned int tx_copybreak __read_mostly = 128;
+module_param(tx_copybreak, uint, 0644);
+MODULE_PARM_DESC(tx_copybreak,
+	"Maximum size of packet that is copied to a new buffer on transmit");
+
 struct ibmveth_stat {
 	char name[ETH_GSTRING_LEN];
 	int offset;
@@ -931,17 +936,24 @@ static netdev_tx_t ibmveth_start_xmit(st
 		buf[1] = 0;
 	}
 
-	data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
-				       skb->len, DMA_TO_DEVICE);
-	if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) {
-		if (!firmware_has_feature(FW_FEATURE_CMO))
-			ibmveth_error_printk("tx: unable to map xmit buffer\n");
+	if (skb->len < tx_copybreak) {
+		used_bounce = 1;
+	} else {
+		data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
+					       skb->len, DMA_TO_DEVICE);
+		if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) {
+			if (!firmware_has_feature(FW_FEATURE_CMO))
+				ibmveth_error_printk("tx: unable to map "
+						     "xmit buffer\n");
+			tx_map_failed++;
+			used_bounce = 1;
+		}
+	}
+
+	if (used_bounce) {
 		skb_copy_from_linear_data(skb, adapter->bounce_buffer,
 					  skb->len);
 		desc.fields.address = adapter->bounce_buffer_dma;
-		tx_map_failed++;
-		used_bounce = 1;
-		wmb();
 	} else
 		desc.fields.address = data_dma_addr;
 



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

end of thread, other threads:[~2010-08-23  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20100819072456.317416634@samba.org>
     [not found] ` <20100819072503.937364037@samba.org>
2010-08-19 13:34   ` [patch 04/20] ibmveth: Add tx_copybreak Brian King
2010-08-23  0:09 [patch 00/20] ibmveth update Anton Blanchard
2010-08-23  0:09 ` [patch 04/20] ibmveth: Add tx_copybreak Anton Blanchard

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