linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Vagin <avagin@virtuozzo.com>
To: Stefan Baranoff <sbaranoff@gmail.com>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net,v2] tcp: Fix broken repair socket window probe patch
Date: Mon, 16 Jul 2018 10:51:50 -0700	[thread overview]
Message-ID: <20180716175150.GA20960@outlook.office365.com> (raw)
In-Reply-To: <1531668997-1439-1-git-send-email-sbaranoff@gmail.com>

On Sun, Jul 15, 2018 at 11:36:37AM -0400, Stefan Baranoff wrote:
> Correct previous bad attempt at allowing sockets to come out of TCP
> repair without sending window probes. To avoid changing size of
> the repair variable in struct tcp_sock, this lets the decision for
> sending probes or not to be made when coming out of repair by
> introducing two ways to turn it off.
> 
> v2:
> * Remove erroneous comment; defines now make behavior clear
> 
> Fixes: 70b7ff130224 ("tcp: allow user to create repair socket without window probes")
> Signed-off-by: Stefan Baranoff <sbaranoff@gmail.com>

Acked-by: Andrei Vagin <avagin@virtuozzo.com>

> ---
>  include/uapi/linux/tcp.h |  4 ++++
>  net/ipv4/tcp.c           | 13 +++++++------
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
> index 29eb659..e3f6ed8 100644
> --- a/include/uapi/linux/tcp.h
> +++ b/include/uapi/linux/tcp.h
> @@ -127,6 +127,10 @@ enum {
>  
>  #define TCP_CM_INQ		TCP_INQ
>  
> +#define TCP_REPAIR_ON		1
> +#define TCP_REPAIR_OFF		0
> +#define TCP_REPAIR_OFF_NO_WP	-1	/* Turn off without window probes */
> +
>  struct tcp_repair_opt {
>  	__u32	opt_code;
>  	__u32	opt_val;
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 8e5e2ca..ec2186e 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -2823,16 +2823,17 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
>  	case TCP_REPAIR:
>  		if (!tcp_can_repair_sock(sk))
>  			err = -EPERM;
> -		/* 1 for normal repair, 2 for no window probes */
> -		else if (val == 1 || val == 2) {
> -			tp->repair = val;
> +		else if (val == TCP_REPAIR_ON) {
> +			tp->repair = 1;
>  			sk->sk_reuse = SK_FORCE_REUSE;
>  			tp->repair_queue = TCP_NO_QUEUE;
> -		} else if (val == 0) {
> +		} else if (val == TCP_REPAIR_OFF) {
> +			tp->repair = 0;
> +			sk->sk_reuse = SK_NO_REUSE;
> +			tcp_send_window_probe(sk);
> +		} else if (val == TCP_REPAIR_OFF_NO_WP) {
>  			tp->repair = 0;
>  			sk->sk_reuse = SK_NO_REUSE;
> -			if (tp->repair == 1)
> -				tcp_send_window_probe(sk);
>  		} else
>  			err = -EINVAL;
>  
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2018-07-16 17:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-15 15:36 [PATCH net,v2] tcp: Fix broken repair socket window probe patch Stefan Baranoff
2018-07-16 17:51 ` Andrey Vagin [this message]
2018-07-16 21:08 ` David Miller

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=20180716175150.GA20960@outlook.office365.com \
    --to=avagin@virtuozzo.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sbaranoff@gmail.com \
    --cc=xemul@virtuozzo.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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 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).