Re: [PATCH v2 3/4] I/OAT: tcp_dma_copybreak default value dependant onI/OAT version

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dan Williams
Date: Friday, July 18, 2008 - 11:54 am

On Fri, 2008-07-18 at 08:29 -0700, Sosnowski, Maciej wrote:

Let's kill some ifdef's... how about the following instead?

diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 171cad6..1c0dafc 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -1330,6 +1330,8 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev,
 	if (err)
 		goto err_self_test;
 
+	ioat_set_tcp_copy_break(device);
+
 	dma_async_device_register(&device->common);
 
 	return device;
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
index f2c7fed..23e3196 100644
--- a/drivers/dma/ioatdma.h
+++ b/drivers/dma/ioatdma.h
@@ -27,6 +27,7 @@
 #include <linux/dmapool.h>
 #include <linux/cache.h>
 #include <linux/pci_ids.h>
+#include <net/tcp.h>
 
 #define IOAT_DMA_VERSION  "2.04"
 
@@ -121,6 +122,20 @@ struct ioat_desc_sw {
 	struct dma_async_tx_descriptor async_tx;
 };
 
+static inline void ioat_set_tcp_copy_break(struct ioatdma_device *dev)
+{
+	#ifdef CONFIG_NET_DMA
+	switch (dev->version) {
+	case IOAT_VER_1_2:
+		sysctl_tcp_dma_copybreak = 4096;
+		break;
+	case IOAT_VER_2_0:
+		sysctl_tcp_dma_copybreak = 2048;
+		break;
+	}
+	#endif
+}
+
 #if defined(CONFIG_INTEL_IOATDMA) || defined(CONFIG_INTEL_IOATDMA_MODULE)
 struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev,
 				      void __iomem *iobase);
diff --git a/net/core/user_dma.c b/net/core/user_dma.c
index 0ad1cd5..de76050 100644
--- a/net/core/user_dma.c
+++ b/net/core/user_dma.c
@@ -34,6 +34,7 @@
 #define NET_DMA_DEFAULT_COPYBREAK 4096
 
 int sysctl_tcp_dma_copybreak = NET_DMA_DEFAULT_COPYBREAK;
+EXPORT_SYMBOL(sysctl_tcp_dma_copybreak);
 
 /**
  *	dma_skb_copy_datagram_iovec - Copy a datagram to an iovec.


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v2 1/4] I/OAT: Add watchdog/reset functionality to ..., Maciej Sosnowski, (Fri Jul 18, 8:27 am)
[PATCH v2 4/4] I/OAT: I/OAT version 3.0 support, Maciej Sosnowski, (Fri Jul 18, 8:29 am)
Re: [PATCH v2 3/4] I/OAT: tcp_dma_copybreak default value ..., Dan Williams, (Fri Jul 18, 11:54 am)
RE: [PATCH v2 3/4] I/OAT: tcp_dma_copybreak default valued ..., Sosnowski, Maciej, (Mon Jul 21, 9:13 am)