All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eliezer Tamir <eliezer.tamir@linux.intel.com>
To: Dave Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Don Skidmore <donald.c.skidmore@intel.com>,
	e1000-devel@lists.sourceforge.net,
	Willem de Bruijn <willemb@google.com>,
	Andi Kleen <andi@firstfloor.org>, HPA <hpa@zytor.com>,
	Eliezer Tamir <eliezer@tamir.org.il>
Subject: [PATCH v3 net-next 2/4] tcp: add TCP support for low latency receive poll.
Date: Mon, 20 May 2013 13:16:12 +0300	[thread overview]
Message-ID: <20130520101612.14133.95780.stgit@ladj378.jer.intel.com> (raw)
In-Reply-To: <20130520101552.14133.45953.stgit@ladj378.jer.intel.com>

an example of how one could add support for ndo_ll_poll to TCP.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com>
---

 net/ipv4/Kconfig     |   11 +++++++++++
 net/ipv4/tcp.c       |    9 +++++++++
 net/ipv4/tcp_input.c |    4 ++++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index d209f0f..8a3239e 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -421,6 +421,17 @@ config INET_LL_RX_POLL
 
 	  If unsure, say N.
 
+config INET_LL_TCP_POLL
+	bool "Low Latency TCP Receive Poll"
+	depends on INET_LL_RX_POLL
+	default n
+	---help---
+	  TCP support for Low Latency TCP Queue Poll.
+	  (For network cards that support this option.)
+	  Add support to the TCP stack for direct polling of the network card.
+
+	  If unsure, say N.
+
 config INET_DIAG
 	tristate "INET: socket monitoring interface"
 	default y
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index dcb116d..85b8040 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -279,6 +279,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/ioctls.h>
+#include <net/ll_poll.h>
 
 int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT;
 
@@ -1504,6 +1505,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 			if (offset + 1 != skb->len)
 				continue;
 		}
+		sk_mark_ll(sk, skb);
 		if (tcp_hdr(skb)->fin) {
 			sk_eat_skb(sk, skb, false);
 			++seq;
@@ -1551,6 +1553,12 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	struct sk_buff *skb;
 	u32 urg_hole = 0;
 
+#ifdef CONFIG_INET_LL_TCP_POLL
+	if (sk_valid_ll(sk) && skb_queue_empty(&sk->sk_receive_queue)
+	    && (sk->sk_state == TCP_ESTABLISHED))
+		sk_poll_ll(sk, nonblock);
+#endif
+
 	lock_sock(sk);
 
 	err = -ENOTCONN;
@@ -1855,6 +1863,7 @@ do_prequeue:
 					break;
 				}
 			}
+			sk_mark_ll(sk, skb);
 		}
 
 		*seq += used;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index b358e8c..f3f293b 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -74,6 +74,7 @@
 #include <linux/ipsec.h>
 #include <asm/unaligned.h>
 #include <net/netdma.h>
+#include <net/ll_poll.h>
 
 int sysctl_tcp_timestamps __read_mostly = 1;
 int sysctl_tcp_window_scaling __read_mostly = 1;
@@ -4329,6 +4330,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
 				tp->copied_seq += chunk;
 				eaten = (chunk == skb->len);
 				tcp_rcv_space_adjust(sk);
+				sk_mark_ll(sk, skb);
 			}
 			local_bh_disable();
 		}
@@ -4896,6 +4898,7 @@ static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen)
 		tp->ucopy.len -= chunk;
 		tp->copied_seq += chunk;
 		tcp_rcv_space_adjust(sk);
+		sk_mark_ll(sk, skb);
 	}
 
 	local_bh_disable();
@@ -4955,6 +4958,7 @@ static bool tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb,
 		tp->ucopy.len -= chunk;
 		tp->copied_seq += chunk;
 		tcp_rcv_space_adjust(sk);
+		sk_mark_ll(sk, skb);
 
 		if ((tp->ucopy.len == 0) ||
 		    (tcp_flag_word(tcp_hdr(skb)) & TCP_FLAG_PSH) ||


WARNING: multiple messages have this Message-ID (diff)
From: Eliezer Tamir <eliezer.tamir@linux.intel.com>
To: Dave Miller <davem@davemloft.net>
Cc: Willem de Bruijn <willemb@google.com>,
	e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
	HPA <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Andi Kleen <andi@firstfloor.org>,
	Eliezer Tamir <eliezer@tamir.org.il>
Subject: [PATCH v3 net-next 2/4] tcp: add TCP support for low latency receive poll.
Date: Mon, 20 May 2013 13:16:12 +0300	[thread overview]
Message-ID: <20130520101612.14133.95780.stgit@ladj378.jer.intel.com> (raw)
In-Reply-To: <20130520101552.14133.45953.stgit@ladj378.jer.intel.com>

an example of how one could add support for ndo_ll_poll to TCP.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com>
---

 net/ipv4/Kconfig     |   11 +++++++++++
 net/ipv4/tcp.c       |    9 +++++++++
 net/ipv4/tcp_input.c |    4 ++++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index d209f0f..8a3239e 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -421,6 +421,17 @@ config INET_LL_RX_POLL
 
 	  If unsure, say N.
 
+config INET_LL_TCP_POLL
+	bool "Low Latency TCP Receive Poll"
+	depends on INET_LL_RX_POLL
+	default n
+	---help---
+	  TCP support for Low Latency TCP Queue Poll.
+	  (For network cards that support this option.)
+	  Add support to the TCP stack for direct polling of the network card.
+
+	  If unsure, say N.
+
 config INET_DIAG
 	tristate "INET: socket monitoring interface"
 	default y
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index dcb116d..85b8040 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -279,6 +279,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/ioctls.h>
+#include <net/ll_poll.h>
 
 int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT;
 
@@ -1504,6 +1505,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 			if (offset + 1 != skb->len)
 				continue;
 		}
+		sk_mark_ll(sk, skb);
 		if (tcp_hdr(skb)->fin) {
 			sk_eat_skb(sk, skb, false);
 			++seq;
@@ -1551,6 +1553,12 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	struct sk_buff *skb;
 	u32 urg_hole = 0;
 
+#ifdef CONFIG_INET_LL_TCP_POLL
+	if (sk_valid_ll(sk) && skb_queue_empty(&sk->sk_receive_queue)
+	    && (sk->sk_state == TCP_ESTABLISHED))
+		sk_poll_ll(sk, nonblock);
+#endif
+
 	lock_sock(sk);
 
 	err = -ENOTCONN;
@@ -1855,6 +1863,7 @@ do_prequeue:
 					break;
 				}
 			}
+			sk_mark_ll(sk, skb);
 		}
 
 		*seq += used;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index b358e8c..f3f293b 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -74,6 +74,7 @@
 #include <linux/ipsec.h>
 #include <asm/unaligned.h>
 #include <net/netdma.h>
+#include <net/ll_poll.h>
 
 int sysctl_tcp_timestamps __read_mostly = 1;
 int sysctl_tcp_window_scaling __read_mostly = 1;
@@ -4329,6 +4330,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
 				tp->copied_seq += chunk;
 				eaten = (chunk == skb->len);
 				tcp_rcv_space_adjust(sk);
+				sk_mark_ll(sk, skb);
 			}
 			local_bh_disable();
 		}
@@ -4896,6 +4898,7 @@ static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen)
 		tp->ucopy.len -= chunk;
 		tp->copied_seq += chunk;
 		tcp_rcv_space_adjust(sk);
+		sk_mark_ll(sk, skb);
 	}
 
 	local_bh_disable();
@@ -4955,6 +4958,7 @@ static bool tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb,
 		tp->ucopy.len -= chunk;
 		tp->copied_seq += chunk;
 		tcp_rcv_space_adjust(sk);
+		sk_mark_ll(sk, skb);
 
 		if ((tp->ucopy.len == 0) ||
 		    (tcp_flag_word(tcp_hdr(skb)) & TCP_FLAG_PSH) ||


------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

  parent reply	other threads:[~2013-05-20 10:16 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 10:15 [PATCH v3 net-next 0/4] net: low latency Ethernet device polling Eliezer Tamir
2013-05-20 10:15 ` Eliezer Tamir
2013-05-20 10:16 ` [PATCH v3 net-next 1/4] net: implement support for low latency socket polling Eliezer Tamir
2013-05-20 10:16   ` Eliezer Tamir
2013-05-20 15:29   ` Eric Dumazet
2013-05-20 19:40     ` David Miller
2013-05-21  7:28     ` Eliezer Tamir
2013-05-21 13:28       ` Eric Dumazet
2013-05-21 17:02         ` Pekka Riikonen
2013-05-21 17:48           ` Eric Dumazet
2013-05-21 17:51             ` Eric Dumazet
2013-05-21 17:51               ` Eric Dumazet
2013-05-21 19:25               ` Eliezer Tamir
2013-05-21 19:25                 ` Eliezer Tamir
2013-05-21 19:29                 ` Eric Dumazet
2013-05-21 19:29                   ` Eric Dumazet
2013-05-21 18:49           ` David Miller
2013-05-21 19:31             ` Pekka Riikonen
2013-05-21 19:31               ` Pekka Riikonen
2013-05-20 10:16 ` Eliezer Tamir [this message]
2013-05-20 10:16   ` [PATCH v3 net-next 2/4] tcp: add TCP support for low latency receive poll Eliezer Tamir
2013-05-20 13:49   ` Eric Dumazet
2013-05-20 14:59     ` Eliezer Tamir
2013-05-20 14:59       ` Eliezer Tamir
2013-05-20 10:16 ` [PATCH v3 net-next 3/4] ixgbe: Add support for ndo_ll_poll Eliezer Tamir
2013-05-20 10:16   ` Eliezer Tamir
2013-05-20 20:20   ` Or Gerlitz
2013-05-20 20:20     ` Or Gerlitz
2013-05-20 20:33     ` Andi Kleen
2013-05-20 20:42       ` Or Gerlitz
2013-05-20 21:01         ` Andi Kleen
2013-05-21  6:23           ` Or Gerlitz
2013-05-21  6:23             ` Or Gerlitz
2013-05-21  6:54     ` Eliezer Tamir
2013-05-21  6:54       ` Eliezer Tamir
2013-05-21  7:06       ` Eilon Greenstein
2013-05-21  7:06         ` Eilon Greenstein
2013-05-21  7:14         ` David Miller
2013-05-21  8:24           ` Or Gerlitz
2013-05-21  8:24             ` Or Gerlitz
2013-05-21  8:31             ` Eliezer Tamir
2013-05-21  8:31               ` Eliezer Tamir
2013-05-21  8:39             ` David Miller
2013-05-21  8:42               ` Eliezer Tamir
2013-05-21  8:42                 ` Eliezer Tamir
2013-05-21  8:43               ` Or Gerlitz
2013-05-21  8:43                 ` Or Gerlitz
2013-05-21 10:27                 ` Eliezer Tamir
2013-05-21 10:41                   ` Or Gerlitz
2013-05-21  8:21         ` Or Gerlitz
2013-05-21  8:21           ` Or Gerlitz
2013-05-21  8:28           ` Eilon Greenstein
2013-05-21  8:28             ` Eilon Greenstein
2013-05-21 14:19       ` Willem de Bruijn
2013-05-21 14:19         ` Willem de Bruijn
2013-05-20 10:16 ` [PATCH v3 net-next 4/4] ixgbe: add extra stats " Eliezer Tamir
2013-05-20 10:16   ` Eliezer Tamir
2013-05-21 12:06 ` [PATCH v3 net-next 0/4] net: low latency Ethernet device polling Alex Rosenbaum
2013-05-21 12:29   ` Eliezer Tamir
2013-05-21 13:15     ` Alex Rosenbaum
2013-05-21 13:15       ` Alex Rosenbaum
2013-05-21 13:31       ` Eric Dumazet
2013-05-23 11:06       ` Eliezer Tamir
2013-05-23 11:45         ` Alex Rosenbaum
2013-05-21 14:30     ` Willem de Bruijn
2013-05-21 14:30       ` Willem de Bruijn
2013-05-21 18:15     ` Ben Hutchings
2013-05-21 18:15       ` Ben Hutchings
2013-05-22  9:35       ` Eliezer Tamir

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=20130520101612.14133.95780.stgit@ladj378.jer.intel.com \
    --to=eliezer.tamir@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=davem@davemloft.net \
    --cc=donald.c.skidmore@intel.com \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=eliezer@tamir.org.il \
    --cc=hpa@zytor.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.