public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba•org>
To: brking@linux•vnet.ibm.com, santil@linux•vnet.ibm.com
Cc: netdev@vger•kernel.org
Subject: [patch 04/20] ibmveth: Add tx_copybreak
Date: Mon, 23 Aug 2010 10:09:34 +1000	[thread overview]
Message-ID: <20100823001238.661834862@samba.org> (raw)
In-Reply-To: 20100823000930.546065833@samba.org

[-- 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;
 



  parent reply	other threads:[~2010-08-23  0:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23  0:09 [patch 00/20] ibmveth update Anton Blanchard
2010-08-23  0:09 ` [patch 01/20] ibmveth: Remove integer divide caused by modulus Anton Blanchard
2010-08-23  0:09 ` [patch 02/20] ibmveth: batch rx buffer replacement Anton Blanchard
2010-08-23  0:09 ` [patch 03/20] ibmveth: Remove LLTX Anton Blanchard
2010-08-23  0:09 ` Anton Blanchard [this message]
2010-08-23  0:09 ` [patch 05/20] ibmveth: Add rx_copybreak Anton Blanchard
2010-08-23  0:09 ` [patch 06/20] ibmveth: Use lighter weight read memory barrier in ibmveth_poll Anton Blanchard
2010-08-23  0:09 ` [patch 07/20] ibmveth: Add scatter-gather support Anton Blanchard
2010-08-23  0:09 ` [patch 08/20] ibmveth: Dont overallocate buffers Anton Blanchard
2010-08-23 20:49   ` Robert Jennings
2010-08-25 13:44     ` Brian King
2010-08-23  0:09 ` [patch 09/20] ibmveth: Add optional flush of rx buffer Anton Blanchard
2010-08-23  0:09 ` [patch 10/20] ibmveth: remove procfs code Anton Blanchard
2010-08-23  0:09 ` [patch 11/20] ibmveth: Convert to netdev_alloc_skb Anton Blanchard
2010-08-23  0:09 ` [patch 12/20] ibmveth: Remove redundant function prototypes Anton Blanchard
2010-08-23  0:09 ` [patch 13/20] ibmveth: Convert driver specific debug to netdev_dbg Anton Blanchard
2010-08-23  0:09 ` [patch 14/20] ibmveth: Convert driver specific error functions to netdev_err Anton Blanchard
2010-08-23  0:09 ` [patch 15/20] ibmveth: Some formatting fixes Anton Blanchard
2010-08-23  0:09 ` [patch 16/20] ibmveth: Coding style fixes Anton Blanchard
2010-08-23  0:09 ` [patch 17/20] ibmveth: Return -EINVAL on all ->probe errors Anton Blanchard
2010-08-23  0:09 ` [patch 18/20] ibmveth: Convert driver specific assert to BUG_ON Anton Blanchard
2010-08-23  0:09 ` [patch 19/20] ibmveth: Remove some unnecessary include files Anton Blanchard
2010-08-23  0:09 ` [patch 20/20] ibmveth: Update module information and version Anton Blanchard
2010-08-23  1:57 ` [patch 00/20] ibmveth update David Miller
2010-08-23  2:07   ` Anton Blanchard
2010-08-23  2:15     ` David Miller
     [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

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=20100823001238.661834862@samba.org \
    --to=anton@samba$(echo .)org \
    --cc=brking@linux$(echo .)vnet.ibm.com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=santil@linux$(echo .)vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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