From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754723Ab3ETKQX (ORCPT ); Mon, 20 May 2013 06:16:23 -0400 Received: from mga14.intel.com ([143.182.124.37]:4485 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752738Ab3ETKQR (ORCPT ); Mon, 20 May 2013 06:16:17 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,707,1363158000"; d="scan'208";a="305079148" From: Eliezer Tamir Subject: [PATCH v3 net-next 2/4] tcp: add TCP support for low latency receive poll. To: Dave Miller Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Jesse Brandeburg , Don Skidmore , e1000-devel@lists.sourceforge.net, Willem de Bruijn , Andi Kleen , HPA , Eliezer Tamir Date: Mon, 20 May 2013 13:16:12 +0300 Message-ID: <20130520101612.14133.95780.stgit@ladj378.jer.intel.com> In-Reply-To: <20130520101552.14133.45953.stgit@ladj378.jer.intel.com> References: <20130520101552.14133.45953.stgit@ladj378.jer.intel.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org an example of how one could add support for ndo_ll_poll to TCP. Signed-off-by: Alexander Duyck Signed-off-by: Jesse Brandeburg Tested-by: Willem de Bruijn Signed-off-by: Eliezer Tamir --- 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 #include +#include 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 #include #include +#include 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) || From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eliezer Tamir 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 Message-ID: <20130520101612.14133.95780.stgit@ladj378.jer.intel.com> References: <20130520101552.14133.45953.stgit@ladj378.jer.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Willem de Bruijn , e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org, HPA , linux-kernel@vger.kernel.org, Jesse Brandeburg , Andi Kleen , Eliezer Tamir To: Dave Miller Return-path: In-Reply-To: <20130520101552.14133.45953.stgit@ladj378.jer.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: e1000-devel-bounces@lists.sourceforge.net List-Id: netdev.vger.kernel.org an example of how one could add support for ndo_ll_poll to TCP. Signed-off-by: Alexander Duyck Signed-off-by: Jesse Brandeburg Tested-by: Willem de Bruijn Signed-off-by: Eliezer Tamir --- 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 #include +#include 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 #include #include +#include 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® Ethernet, visit http://communities.intel.com/community/wired